outsourced application handling

This commit is contained in:
Lauchmelder 2021-12-13 00:25:13 +01:00
parent 5762d02b48
commit 71fdb2c053
10 changed files with 251 additions and 141 deletions

37
lib/Window.hpp Normal file
View file

@ -0,0 +1,37 @@
#pragma once
#include <string>
#include <chrono>
struct SDL_Renderer;
struct SDL_Window;
class Window
{
public:
void Launch();
protected:
Window(int width, int height, const std::string& title);
Window(const Window& other);
Window& operator=(const Window& other);
~Window();
virtual void OnUpdate(double dt) {}
virtual void OnRender(SDL_Renderer* renderer) {}
private:
void HandleEvents();
void Update();
void Render();
protected:
SDL_Window* window;
private:
SDL_Renderer* renderer;
bool shouldClose = false;
std::chrono::steady_clock::time_point startOfLastFrame;
};