smk::View Class Reference

#include <View.hpp>

Description

Represent the area in the game to be drawn on the screen. To preserve the screen ratio, the view ratio must be the same.

Examples
rounded_rectangle.cpp.

Definition at line 14 of file View.hpp.

Public Member Functions

void SetCenter (float x, float y)
 Set the center position of the in-game view. param x The center of the view along the horizontal axis. param y The center of the view along the vertical axis. More...
 
void SetCenter (const glm::vec2 &center)
 Set the center position of the in-game view. param center The center of the view. More...
 
void SetSize (float width, float height)
 Set the size of the in-game view. param width The size of the view along the horizontal axis. param height The size of the view along the vertical axis. More...
 
void SetSize (const glm::vec2 &size)
 Set the size of the in-game view. param center The size of the view. More...
 
float Left () const
 
float Right () const
 < More...
 
float Top () const
 < More...
 
float Bottom () const
 < More...
 

Public Attributes

float x_ = 0.f
 < More...
 
float y_ = 0.f
 
float width_ = 0.f
 
float height_ = 0.f
 

Member Function Documentation

◆ Bottom()

float smk::View::Bottom ( ) const
inline

<

Definition at line 24 of file View.hpp.

24{ return y_ + height_ / 2; }; /// <

◆ Left()

float smk::View::Left ( ) const
inline

Definition at line 21 of file View.hpp.

21{ return x_ - width_ / 2; }; /// <
float x_
<
Definition: View.hpp:27

◆ Right()

float smk::View::Right ( ) const
inline

<

Definition at line 22 of file View.hpp.

22{ return x_ + width_ / 2; }; /// <

◆ SetCenter() [1/2]

void smk::View::SetCenter ( const glm::vec2 &  center)

Set the center position of the in-game view. param center The center of the view.

Definition at line 19 of file View.cpp.

19 {
20 SetCenter(center.x, center.y);
21}
void SetCenter(float x, float y)
Set the center position of the in-game view. param x The center of the view along the horizontal axis...
Definition: View.cpp:12

◆ SetCenter() [2/2]

void smk::View::SetCenter ( float  x,
float  y 
)

Set the center position of the in-game view. param x The center of the view along the horizontal axis. param y The center of the view along the vertical axis.

Examples
rounded_rectangle.cpp.

Definition at line 12 of file View.cpp.

12 {
13 x_ = x;
14 y_ = y;
15}

◆ SetSize() [1/2]

void smk::View::SetSize ( const glm::vec2 &  size)

Set the size of the in-game view. param center The size of the view.

Definition at line 33 of file View.cpp.

33 {
34 SetSize(size.x, size.y);
35}
void SetSize(float width, float height)
Set the size of the in-game view. param width The size of the view along the horizontal axis....
Definition: View.cpp:26

◆ SetSize() [2/2]

void smk::View::SetSize ( float  width,
float  height 
)

Set the size of the in-game view. param width The size of the view along the horizontal axis. param height The size of the view along the vertical axis.

Examples
rounded_rectangle.cpp.

Definition at line 26 of file View.cpp.

26 {
27 width_ = width;
28 height_ = height;
29}

◆ Top()

float smk::View::Top ( ) const
inline

<

Definition at line 23 of file View.hpp.

23{ return y_ - height_ / 2; }; /// <

Member Data Documentation

◆ height_

float smk::View::height_ = 0.f

Definition at line 30 of file View.hpp.

◆ width_

float smk::View::width_ = 0.f

Definition at line 29 of file View.hpp.

◆ x_

float smk::View::x_ = 0.f

<

Definition at line 27 of file View.hpp.

◆ y_

float smk::View::y_ = 0.f

Definition at line 28 of file View.hpp.


The documentation for this class was generated from the following files: