Loading...
Searching...
No Matches
Application.h
Go to the documentation of this file.
1// Copyright (c) 2025 Dave R. Smith.
2// Malena Framework — Licensed under PolyForm Noncommercial 1.0.0; commercial use requires a paid license. See LICENSE.
3
4//
5// Application.h
6//
7
8#ifndef MALENA_APPLICATION_H
9#define MALENA_APPLICATION_H
10
11#pragma once
12
20#include <cstdint>
21#include <string>
22#include <type_traits>
23
24namespace ml
25{
26 // ── ApplicationBase — internal base shared by Application and ApplicationWith ──
27
37 {
38 public:
51 const std::string& title,
54 std::uint32_t windowStyle = sf::Style::Default);
55
65 ApplicationBase(unsigned int screenWidth,
66 unsigned int screenHeight,
67 unsigned int bitDepth,
68 const std::string& title,
69 std::uint32_t windowStyle = sf::Style::Default);
70
71
75 void addComponent(Core& component);
76
80 static void clearEvents();
81
95 void reset();
96
98 };
99
100 // ── Application — no manifest ─────────────────────────────────────────────
101
136 {
137 public:
139
140 };
141
142 // ── ApplicationWith — with manifest ───────────────────────────────────────
143
197 template<typename TManifest, typename... Traits>
199 public ml::ManifestResources<TManifest>,
200 public GatherStates<TManifest>::type,
201 public Traits...
202 {
203 public:
206
208
209 using GatherStates<TManifest>::type::setState;
210 using GatherStates<TManifest>::type::getState;
211 using GatherStates<TManifest>::type::isState;
212 using GatherStates<TManifest>::type::onStateEnter;
213 using GatherStates<TManifest>::type::onStateExit;
214 using GatherStates<TManifest>::type::syncState;
215 };
216
217} // namespace ml
218
219#endif // MALENA_APPLICATION_H
Architecture
Architectural style hint passed at construction.
Definition AppManager.h:117
@ MVC
Model-View-Controller.
Definition AppManager.h:118
AppManager(const sf::VideoMode &videoMode, const std::string &title, sf::RenderWindow &window=WindowManager::getWindow(), Architecture architecture=MVC, std::uint32_t windowStyle=sf::Style::Default)
Construct an AppManager and create the SFML window.
void addComponent(Core &component)
Register a Core object with the application's component manager.
static void clearEvents()
Clear all event subscriptions across the entire application.
void reset()
Full application reset — clears events, messages, and components.
ApplicationBase(unsigned int screenWidth, unsigned int screenHeight, unsigned int bitDepth, const std::string &title, std::uint32_t windowStyle=sf::Style::Default)
Construct from pixel dimensions and bit depth.
ApplicationBase(const sf::VideoMode &videoMode, const std::string &title, sf::RenderWindow &window=WindowManager::getWindow(), AppManager::Architecture architecture=AppManager::MVC, std::uint32_t windowStyle=sf::Style::Default)
Construct with an explicit video mode and window title.
Primary entry point for Malena applications without a manifest.
ApplicationBase(const sf::VideoMode &videoMode, const std::string &title, sf::RenderWindow &window=WindowManager::getWindow(), AppManager::Architecture architecture=AppManager::MVC, std::uint32_t windowStyle=sf::Style::Default)
Construct with an explicit video mode and window title.
Entry point for Malena applications with a manifest.
ml::ManifestResources< TManifest > Resources
Unified resource accessor — Resources::get(Images::Icon).
ApplicationBase(const sf::VideoMode &videoMode, const std::string &title, sf::RenderWindow &window=WindowManager::getWindow(), AppManager::Architecture architecture=AppManager::MVC, std::uint32_t windowStyle=sf::Style::Default)
Construct with an explicit video mode and window title.
Virtual base class for all Malena framework objects.
Definition Core.h:97
Trait that adds per-frame update and window lifecycle callbacks to any Core object.
Definition Updatable.h:61
sf::RenderWindow & getWindow()
Return the framework's shared sf::RenderWindow.
#define MALENA_API
Definition Component.h:22
Collects all State enums from a component manifest and its traits.
Unified manifest resource and config accessor.