Potato Engine
Toggle main menu visibility
Loading...
Searching...
No Matches
GameplayHelper.cpp
Go to the documentation of this file.
1
2
3
#include "
Game/Actors/Camera.hpp
"
4
#include "
Util/Vector2.hpp
"
5
6
#include "
GameplayHelper.hpp
"
7
8
Vector2
GameplayHelper::VecToScreenVec
(
const
Vector2
& worldPos) {
9
Vector2
vec =
Vector2
(worldPos.
x
, worldPos.
y
).
Swizzled
();
10
vec.
x
= 23.f - vec.
x
;
11
return
vec;
12
}
13
14
bool
GameplayHelper::IsPositionInCameraFrame
(
const
Vector2
& pos,
Camera
* camera) {
15
16
return
pos.
x
- camera->
GetPosition
().
x
>= 0.f && pos.
x
- camera->
GetPosition
().
x
< camera->
GetSize
().
x
;
17
18
19
20
}
Camera.hpp
GameplayHelper.hpp
Vector2.hpp
Actor::GetSize
Vector2 GetSize() const
Gets size.
Definition
Actor.cpp:52
Actor::GetPosition
Vector2 GetPosition() const
Gets position.
Definition
Actor.cpp:38
Camera
Camera wrapper for rendering.
Definition
Camera.hpp:13
GameplayHelper::VecToScreenVec
static Vector2 VecToScreenVec(const Vector2 &worldPos)
Converts world position to screen position.
Definition
GameplayHelper.cpp:8
GameplayHelper::IsPositionInCameraFrame
static bool IsPositionInCameraFrame(const Vector2 &pos, Camera *camera)
Checks if a position is visible in the view of a camera object.
Definition
GameplayHelper.cpp:14
Vector2
Standard 2-dimensional vector.
Definition
Vector2.hpp:11
Vector2::x
float x
X Component.
Definition
Vector2.hpp:13
Vector2::y
float y
Y Component.
Definition
Vector2.hpp:15
Vector2::Swizzled
Vector2 Swizzled() const
Definition
Vector2.hpp:60
Util
GameplayHelper.cpp
Generated by
1.17.0