Files
dae16-VerhulstBram-GameProject/Engine/BaseGame.h
Bram Verhulst e75b80eea8 Add more ores
Add weighted random distribution
2024-04-22 22:34:39 +02:00

64 lines
1.4 KiB
C++

#pragma once
#include "structs.h"
#include "SDL.h"
// https://BaseGameprogrammingpatterns.com/subclass-sandbox.html
class BaseGame
{
public:
explicit BaseGame(const Window& window);
BaseGame(const BaseGame& other) = delete;
BaseGame& operator=(const BaseGame& other) = delete;
BaseGame(BaseGame&& other) = delete;
BaseGame& operator=(BaseGame&& other) = delete;
virtual ~BaseGame();
void Run();
virtual void Update(float elapsedSec) {
}
virtual void Draw() const {
}
// Event handling
virtual void ProcessKeyDownEvent(const SDL_KeyboardEvent& e) {
}
virtual void ProcessKeyUpEvent(const SDL_KeyboardEvent& e) {
}
virtual void ProcessMouseMotionEvent(const SDL_MouseMotionEvent& e) {
}
virtual void ProcessMouseDownEvent(const SDL_MouseButtonEvent& e) {
}
virtual void ProcessMouseUpEvent(const SDL_MouseButtonEvent& e) {
}
virtual void ProcessMouseWheelEvent(const SDL_MouseWheelEvent& e) {
}
virtual void ProcessImGui() {
}
const Rectf& GetViewPort() const {
return m_Viewport;
}
private:
// DATA MEMBERS
// The window properties
const Window m_Window;
const Rectf m_Viewport;
// The window we render to
SDL_Window* m_pWindow;
// OpenGL context
SDL_GLContext m_pContext;
// Init info
bool m_Initialized;
// Prevent timing jumps when debugging
const float m_MaxElapsedSeconds;
// FUNCTIONS
void InitializeGameEngine();
void CleanupGameEngine();
};