49 lines
893 B
C
49 lines
893 B
C
#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;
|
|
}; |