move into firmware subfolder

Signed-off-by: Peter Siegmund <developer@mars3142.org>
This commit is contained in:
2025-08-20 10:27:03 +02:00
parent d316bb9f2c
commit 5a08c2e09d
117 changed files with 0 additions and 0 deletions

View File

@@ -0,0 +1,54 @@
#include "model/AppContext.h"
#include "Matrix.h"
auto AppContext::MainWindow() const -> SDL_Window *
{
return m_window->window();
}
auto AppContext::MainRenderer() const -> SDL_Renderer *
{
return m_window->renderer();
}
auto AppContext::MainSurface() const -> SDL_Surface *
{
return SDL_GetWindowSurface(m_window->window());
}
void AppContext::SetMatrix(Matrix *matrix)
{
m_matrix = matrix;
}
auto AppContext::LedMatrix() const -> Matrix *
{
return m_matrix;
}
auto AppContext::LedMatrixId() const -> SDL_WindowID
{
if (m_matrix)
{
return m_matrix->windowId();
}
return 0;
}
auto AppContext::LedMatrixRenderer() const -> SDL_Renderer *
{
if (m_matrix && m_matrix->renderer())
{
return m_matrix->renderer();
}
return nullptr;
}
void AppContext::Render() const
{
if (m_matrix && m_matrix->renderer())
{
m_matrix->Render();
}
}

View File

@@ -0,0 +1,45 @@
#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("haxrcorp-4089.otf", 21);
m_font_text = TTF_OpenFont("Helvetica-Bold.otf", 21);
}
~AppContext()
{
TTF_CloseFont(m_font_default);
TTF_CloseFont(m_font_text);
}
[[nodiscard]] auto MainWindow() const -> SDL_Window *;
[[nodiscard]] auto MainRenderer() const -> SDL_Renderer *;
[[nodiscard]] auto MainSurface() const -> SDL_Surface *;
void SetMatrix(Matrix *matrix);
[[nodiscard]] auto LedMatrix() const -> Matrix *;
[[nodiscard]] auto LedMatrixId() const -> SDL_WindowID;
[[nodiscard]] auto LedMatrixRenderer() const -> SDL_Renderer *;
void Render() const;
TTF_Font *m_font_default = nullptr;
private:
const Window *m_window;
Matrix *m_matrix = nullptr;
TTF_Font *m_font_text = nullptr;
};

View File

@@ -0,0 +1,11 @@
#include "model/Window.h"
auto Window::window() const -> SDL_Window *
{
return m_window;
}
auto Window::renderer() const -> SDL_Renderer *
{
return SDL_GetRenderer(m_window);
}

View File

@@ -0,0 +1,18 @@
#pragma once
#include "SDL3/SDL.h"
class Window
{
public:
explicit Window(SDL_Window *window) : m_window(window)
{
}
[[nodiscard]] auto window() const -> SDL_Window *;
[[nodiscard]] auto renderer() const -> SDL_Renderer *;
private:
SDL_Window *m_window = nullptr;
};