Änderung von Capter1 auf SDL3

This commit is contained in:
2025-11-02 16:26:43 +01:00
parent f4f9560fa9
commit 2aa3720d12
11 changed files with 59 additions and 38 deletions

49
Capter1/Game.h.old Normal file
View File

@@ -0,0 +1,49 @@
#pragma once
//#include "SDL2/SDL.h"
#include "SDL3/SDL.h"
#include "SDL3/SDL_main.h"
// Vector2 struct just stores x/y coordinates
// (for now)
struct Vector2
{
float x;
float y;
};
// Game class
class Game
{
public:
Game();
// Initialize the game
bool Initialize();
// Runs the game loop until the game is over
void RunLoop();
// Shutdown the game
void Shutdown();
private:
// Helper functions for the game loop
void ProcessInput();
void UpdateGame();
void GenerateOutput();
// Window created by SDL
SDL_Window* mWindow;
// Renderer for 2D drawing
SDL_Renderer* mRenderer;
// Number of ticks since start of game
Uint32 mTicksCount;
// Game should continue to run
bool mIsRunning;
// Pong specific
// Direction of paddle
int mPaddleDir;
// Position of paddle
Vector2 mPaddlePos;
// Position of ball
Vector2 mBallPos;
// Velocity of ball
Vector2 mBallVel;
};