combine with desktop project

Signed-off-by: Peter Siegmund <developer@mars3142.org>
This commit is contained in:
2025-04-10 23:20:19 +02:00
parent b6fb4eb65c
commit b3bf03999b
72 changed files with 65538 additions and 132 deletions

View File

@@ -0,0 +1,44 @@
#pragma once
#include "SDL3_ttf/SDL_ttf.h"
#include "Window.h"
class Matrix;
class AppContext {
public:
explicit AppContext(const Window *window) : m_window(window) {
m_font_default = TTF_OpenFont(
"assets/haxrcorp-4089.otf", 21);
m_font_text = TTF_OpenFont(
"assets/Helvetica-Bold.otf", 21);
}
~AppContext() {
TTF_CloseFont(m_font_default);
TTF_CloseFont(m_font_text);
}
[[nodiscard]] auto window() const -> SDL_Window *;
[[nodiscard]] auto renderer() const -> SDL_Renderer *;
[[nodiscard]] auto surface() const -> SDL_Surface *;
void setMatrix(Matrix *matrix);
[[nodiscard]] auto matrix() const -> Matrix *;
[[nodiscard]] auto matrix_window() const -> SDL_Window *;
[[nodiscard]] auto matrix_renderer() const -> SDL_Renderer *;
void matrix_render() const;
TTF_Font *m_font_default = nullptr;
private:
const Window *m_window;
Matrix *m_matrix = nullptr;
TTF_Font *m_font_text = nullptr;
};