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{breakout.cpp} Namespace Reference

Classes

struct  Ball
struct  Block
struct  Box
class  BreakoutWindow

Functions

bool check_collision (const Ball &ball, const Box &object)
float clampf (float value, float low, float high)

Variables

constexpr float BALL_MODEL_SCALE = 0.05f
constexpr float BALL_RADIUS = 0.25f
constexpr float BALL_ROLL_DEGREES_PER_UNIT = 360.0f / (2.0f * PI * BALL_RADIUS)
constexpr float BALL_SPEED = 4.0f
constexpr int BLOCK_COLUMNS = 11
constexpr int BLOCK_ROWS = 5
constexpr float DEFAULT_ZOOM = 0.8f
constexpr float GAME_BOTTOM = -3.75f
constexpr float GAME_LEFT = -5.0f
constexpr float GAME_RIGHT = 5.0f
constexpr float GAME_TOP = 3.75f
constexpr Sint16 GAMEPAD_DEAD_ZONE = 8000
constexpr int MAX_MISSES = 3
constexpr float MAX_ZOOM = 1.6f
constexpr float MIN_ZOOM = 0.45f
constexpr float MODEL_SCALE = 1.0f
constexpr float PADDLE_SPEED = 5.0f
constexpr float PI = 3.14159265358979323846f
constexpr float ROTATION_SPEED = 50.0f
constexpr float ZOOM_SPEED = 0.8f

Function Documentation

◆ check_collision()

bool anonymous_namespace{breakout.cpp}::check_collision ( const Ball & ball,
const Box & object )
nodiscard

Definition at line 79 of file breakout.cpp.

79 {
80 const glm::vec3 half_extents(object.size.x * 0.5f, object.size.y * 0.5f, 0.0f);
81 const glm::vec3 difference = ball.box.position - object.position;
82 const glm::vec3 clamped = glm::clamp(difference, -half_extents, half_extents);
83 const glm::vec3 closest = object.position + clamped;
84 return glm::length(closest - ball.box.position) < ball.radius;
85 }

◆ clampf()

float anonymous_namespace{breakout.cpp}::clampf ( float value,
float low,
float high )
nodiscard

Definition at line 75 of file breakout.cpp.

75 {
76 return std::max(low, std::min(value, high));
77 }

Variable Documentation

◆ BALL_MODEL_SCALE

float anonymous_namespace{breakout.cpp}::BALL_MODEL_SCALE = 0.05f
constexpr

Definition at line 40 of file breakout.cpp.

◆ BALL_RADIUS

float anonymous_namespace{breakout.cpp}::BALL_RADIUS = 0.25f
constexpr

Definition at line 38 of file breakout.cpp.

◆ BALL_ROLL_DEGREES_PER_UNIT

float anonymous_namespace{breakout.cpp}::BALL_ROLL_DEGREES_PER_UNIT = 360.0f / (2.0f * PI * BALL_RADIUS)
constexpr

Definition at line 42 of file breakout.cpp.

◆ BALL_SPEED

float anonymous_namespace{breakout.cpp}::BALL_SPEED = 4.0f
constexpr

Definition at line 37 of file breakout.cpp.

◆ BLOCK_COLUMNS

int anonymous_namespace{breakout.cpp}::BLOCK_COLUMNS = 11
constexpr

Definition at line 51 of file breakout.cpp.

◆ BLOCK_ROWS

int anonymous_namespace{breakout.cpp}::BLOCK_ROWS = 5
constexpr

Definition at line 50 of file breakout.cpp.

◆ DEFAULT_ZOOM

float anonymous_namespace{breakout.cpp}::DEFAULT_ZOOM = 0.8f
constexpr

Definition at line 44 of file breakout.cpp.

◆ GAME_BOTTOM

float anonymous_namespace{breakout.cpp}::GAME_BOTTOM = -3.75f
constexpr

Definition at line 35 of file breakout.cpp.

◆ GAME_LEFT

float anonymous_namespace{breakout.cpp}::GAME_LEFT = -5.0f
constexpr

Definition at line 32 of file breakout.cpp.

◆ GAME_RIGHT

float anonymous_namespace{breakout.cpp}::GAME_RIGHT = 5.0f
constexpr

Definition at line 33 of file breakout.cpp.

◆ GAME_TOP

float anonymous_namespace{breakout.cpp}::GAME_TOP = 3.75f
constexpr

Definition at line 34 of file breakout.cpp.

◆ GAMEPAD_DEAD_ZONE

Sint16 anonymous_namespace{breakout.cpp}::GAMEPAD_DEAD_ZONE = 8000
constexpr

Definition at line 48 of file breakout.cpp.

◆ MAX_MISSES

int anonymous_namespace{breakout.cpp}::MAX_MISSES = 3
constexpr

Definition at line 49 of file breakout.cpp.

◆ MAX_ZOOM

float anonymous_namespace{breakout.cpp}::MAX_ZOOM = 1.6f
constexpr

Definition at line 46 of file breakout.cpp.

◆ MIN_ZOOM

float anonymous_namespace{breakout.cpp}::MIN_ZOOM = 0.45f
constexpr

Definition at line 45 of file breakout.cpp.

◆ MODEL_SCALE

float anonymous_namespace{breakout.cpp}::MODEL_SCALE = 1.0f
constexpr

Definition at line 39 of file breakout.cpp.

◆ PADDLE_SPEED

float anonymous_namespace{breakout.cpp}::PADDLE_SPEED = 5.0f
constexpr

Definition at line 36 of file breakout.cpp.

◆ PI

float anonymous_namespace{breakout.cpp}::PI = 3.14159265358979323846f
constexpr

Definition at line 41 of file breakout.cpp.

◆ ROTATION_SPEED

float anonymous_namespace{breakout.cpp}::ROTATION_SPEED = 50.0f
constexpr

Definition at line 43 of file breakout.cpp.

◆ ZOOM_SPEED

float anonymous_namespace{breakout.cpp}::ZOOM_SPEED = 0.8f
constexpr

Definition at line 47 of file breakout.cpp.