Files
2025-08-10 11:49:07 +02:00

50 lines
850 B
C++

#pragma once
#include <string>
#include <SDL3/SDL_keycode.h>
#include <SDL3/SDL_video.h>
#include <td/common/StateMachine.h>
#include <td/misc/Signal.h>
namespace td {
class Display : public StateMachine<Display, void, float> {
private:
SDL_Window* m_Window;
SDL_GLContext m_GLContext;
int m_LastWidth, m_LastHeight;
float m_AspectRatio;
bool m_ShouldClose;
public:
utils::Signal<float> OnAspectRatioChange;
utils::Signal<SDL_Keycode> OnKeyDown;
Display(int a_Width, int a_Height, const std::string& a_Title);
~Display();
void PollEvents();
void Update(float a_Delta) override;
void Close();
bool IsCloseRequested() {
return m_ShouldClose;
}
float GetAspectRatio() {
return m_AspectRatio;
}
int GetWindowWidth() {
return m_LastWidth;
}
int GetWindowHeight() {
return m_LastHeight;
}
};
} // namespace td