MXVK Vulkan Framework 0.24.0
C++20 Vulkan rendering framework for practical 2D and 3D application development with SDL3.
Loading...
Searching...
No Matches
anonymous_namespace{pong.cpp}::Paddle Class Reference

Public Member Functions

glm::mat4 modelMatrix () const
 Paddle (const glm::vec3 &pos, const glm::vec3 &sz)
void startRotation (float speed)
void update (float deltaTime)

Public Attributes

bool isRotating = false
glm::vec3 position
float rotationAngle = 0.0f
float rotationSpeed = 0.0f
glm::vec3 size

Detailed Description

Definition at line 80 of file pong.cpp.

Constructor & Destructor Documentation

◆ Paddle()

anonymous_namespace{pong.cpp}::Paddle::Paddle ( const glm::vec3 & pos,
const glm::vec3 & sz )
inline

Definition at line 88 of file pong.cpp.

Member Function Documentation

◆ modelMatrix()

glm::mat4 anonymous_namespace{pong.cpp}::Paddle::modelMatrix ( ) const
inlinenodiscard

Definition at line 109 of file pong.cpp.

109 {
110 glm::mat4 model(1.0f);
111 model = glm::translate(model, position);
112 model = glm::rotate(model, glm::radians(rotationAngle), glm::vec3(0.0f, 1.0f, 0.0f));
113 model = glm::scale(model, size);
114 return model;
115 }

◆ startRotation()

void anonymous_namespace{pong.cpp}::Paddle::startRotation ( float speed)
inline

Definition at line 102 of file pong.cpp.

102 {
103 if (!isRotating) {
104 rotationSpeed = speed;
105 isRotating = true;
106 }
107 }

◆ update()

void anonymous_namespace{pong.cpp}::Paddle::update ( float deltaTime)
inline

Definition at line 91 of file pong.cpp.

91 {
92 if (!isRotating) {
93 return;
94 }
95 rotationAngle += rotationSpeed * deltaTime;
96 if (rotationAngle >= 360.0f) {
97 rotationAngle = 0.0f;
98 isRotating = false;
99 }
100 }

Member Data Documentation

◆ isRotating

bool anonymous_namespace{pong.cpp}::Paddle::isRotating = false

Definition at line 86 of file pong.cpp.

◆ position

glm::vec3 anonymous_namespace{pong.cpp}::Paddle::position

Definition at line 82 of file pong.cpp.

◆ rotationAngle

float anonymous_namespace{pong.cpp}::Paddle::rotationAngle = 0.0f

Definition at line 84 of file pong.cpp.

◆ rotationSpeed

float anonymous_namespace{pong.cpp}::Paddle::rotationSpeed = 0.0f

Definition at line 85 of file pong.cpp.

◆ size

glm::vec3 anonymous_namespace{pong.cpp}::Paddle::size

Definition at line 83 of file pong.cpp.


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