|
| void | addComponent (Core &component) |
| | Register a Core object with the application's component manager.
|
| | ApplicationBase (const sf::VideoMode &videoMode, const std::string &title, sf::RenderWindow &window=WindowManager::getWindow()) |
| | Construct with an explicit video mode and window title.
|
| | ApplicationBase (unsigned int screenWidth, unsigned int screenHeight, unsigned int bitDepth, const std::string &title) |
| | Construct from pixel dimensions and bit depth.
|
| void | clear () |
| | Remove all registered objects.
|
| const std::vector< Core * > & | getComponents () const |
| | Return a read-only view of all currently registered objects.
|
| virtual void | onInit () |
| | Called once after construction, before the first frame.
|
| virtual void | onReady () |
| | Called once after onInit(), when all components are registered.
|
| void | onUpdate (std::function< void()> callback) |
| | Register a no-argument callback invoked every frame.
|
| void | onUpdate (std::function< void(const std::optional< sf::Event > &)> callback) |
| | Register a callback invoked every frame, receiving the SFML event.
|
| void | onWindowFocusGained (std::function< void()> callback) |
| | Register a no-argument callback invoked when the application window gains OS focus.
|
| void | onWindowFocusGained (std::function< void(const std::optional< sf::Event > &)> callback) |
| | Register a callback invoked when the application window gains OS focus, receiving the raw SFML event.
|
| void | onWindowFocusLost (std::function< void()> callback) |
| | Register a no-argument callback invoked when the application window loses OS focus.
|
| void | onWindowFocusLost (std::function< void(const std::optional< sf::Event > &)> callback) |
| | Register a callback invoked when the application window loses OS focus, receiving the raw SFML event.
|
| void | onWindowResized (std::function< void()> callback) |
| | Register a no-argument callback invoked when the application window is resized.
|
| void | onWindowResized (std::function< void(const std::optional< sf::Event > &)> callback) |
| | Register a callback invoked when the application window is resized, receiving the raw SFML event.
|
| virtual void | process (const std::string &key, const std::optional< sf::Event > &event) |
| | Invoke all callbacks registered for key.
|
| template<typename ENUM_TYPE> |
| void | process (ENUM_TYPE eventName, const std::optional< sf::Event > &event) |
| | Invoke all callbacks registered for eventName.
|
| bool | removeComponent (Core &component) |
| | Unregister a T object by reference.
|
| void | reset () |
| | Full application reset — clears events, messages, and components.
|
| void | run () |
| | Enter the main loop and run until the window is closed.
|
|
| static void | clearEvents () |
| | Clear all event subscriptions across the entire application.
|
| static void | clearPending () |
| | Discard all pending operations without executing them.
|
| template<typename EnumType> |
| static auto | get (EnumType key) -> std::enable_if_t< !is_asset_enum< TManifest, EnumType >::value, decltype(ConfigManager< TManifest >::get(key))> |
| | Retrieve a config value by enum key → ConfigManager.
|
| template<typename EnumType> |
| static auto | get (EnumType key) -> std::enable_if_t< is_asset_enum< TManifest, EnumType >::value, const_ref_t< decltype(AssetsManager< TManifest >::get(key))> > |
| | Retrieve an asset by enum key → AssetsManager.
|
| static bool | isBusy () |
| | Return true if the manager is currently iterating.
|
| static void | processPending () |
| | Flush all pending operations immediately.
|
| template<typename EnumType> |
| static std::enable_if_t< is_sounds_enum< TManifest, EnumType >::value > | unload (EnumType key) |
| template<typename EnumType> |
| static std::enable_if_t< is_fonts_enum< TManifest, EnumType >::value > | unload (EnumType key) |
| template<typename EnumType> |
| static std::enable_if_t< is_images_enum< TManifest, EnumType >::value > | unload (EnumType key) |
template<typename TManifest>
class ml::ApplicationWith< TManifest >
Entry point for Malena applications with a manifest.
Extends Application with manifest support — injects Resources::get() and all manifest enum aliases into scope automatically. Use when your application has global resources (icon, main font, app-wide config).
{
public:
static constexpr const char* name = "My App";
static constexpr const char* version = "1.0.0";
enum class Images { Icon };
enum class Fonts { Main };
enum class Text { WindowTitle };
enum class Ints { TargetFPS };
private:
inline static const auto _ = [](){
set(Images::Icon,
"assets/icon.png");
set(Fonts::Main,
"assets/main.ttf");
set(Text::WindowTitle, std::string(
"My App"));
set(Ints::TargetFPS, 60);
return 0;
}();
};
class MyApp : public ml::ApplicationWith<MyManifest>
{
public:
MyApp() : ml::ApplicationWith<MyManifest>(
1280, 720, 32,
{
}
};
ml::ManifestResources< TManifest > Resources
Unified resource accessor — Resources::get(Images::Icon).
virtual void onInit()
Called once after construction, before the first frame.
virtual void onReady()
Called once after onInit(), when all components are registered.
Base class for all Malena manifests.
static void set(EnumType key, const char *filepath)
Register an asset file path.
static auto get(EnumType key) -> std::enable_if_t< is_asset_enum< TManifest, EnumType >::value, const_ref_t< decltype(AssetsManager< TManifest >::get(key))> >
Retrieve an asset by enum key → AssetsManager.
- Template Parameters
-
- See also
- Application, ApplicationBase, Resources
Definition at line 179 of file Application.h.
template<typename TManifest>
template<typename EnumType>
| auto ml::ManifestResources< TManifest >::get |
( |
EnumType | key | ) |
-> std::enable_if_t< is_asset_enum< TManifest, EnumType >::value, const_ref_t< decltype(AssetsManager< TManifest >::get(key))> > |
|
inlinestaticinherited |
Retrieve an asset by enum key → AssetsManager.
Return type is explicitly const T& — taking & gives const T* with no ambiguity, suitable for SFML functions that take const sf::Texture* etc.
Definition at line 111 of file ManifestResources.h.
| virtual void ml::Lifecycle::onInit |
( |
| ) |
|
|
inlinevirtualinherited |
Called once after construction, before the first frame.
Override to perform initial setup — configure component properties, load resources, and register objects with the framework. At this point no other sibling components are guaranteed to be fully registered.
Definition at line 82 of file Lifecycle.h.
| virtual void ml::Lifecycle::onReady |
( |
| ) |
|
|
inlinevirtualinherited |
Called once after onInit(), when all components are registered.
Override to wire logic that depends on other components already existing — event callbacks, cross-component bindings, or derived initial state.
Definition at line 90 of file Lifecycle.h.