Simulant  21.12-349
A portable game engine for Windows, OSX, Linux, Dreamcast, and PSP
Public Member Functions | Protected Member Functions | Friends | List of all members
smlt::Application Class Referenceabstract
Inheritance diagram for smlt::Application:
smlt::test::TestApp

Public Member Functions

 Application (const AppConfig &config)
 
int32_t run ()
 
int32_t run (int argc, char *argv[])
 
bool initialized () const
 
ProcessID process_id () const
 
smlt::thread::ThreadID thread_id () const
 
int64_t ram_usage_in_bytes () const
 
uint32_t stage_node_pool_capacity () const
 
uint32_t stage_node_pool_capacity_in_bytes () const
 
bool run_frame ()
 
void run_update (float dt)
 
void run_fixed_updates ()
 
void request_frame_time (float ms)
 
void start_coroutine (std::function< void()> func)
 
void update_coroutines ()
 
void stop_all_coroutines ()
 
void stop_running ()
 
bool is_shutting_down () const
 
void shutdown ()
 
LoaderPtr loader_for (const Path &filename, LoaderHint hint=LOADER_HINT_NONE)
 
LoaderPtr loader_for (const std::string &loader_name, const Path &filename)
 
LoaderTypePtr loader_type (const std::string &loader_name) const
 
void register_loader (LoaderTypePtr loader_type)
 
bool activate_language (const std::string &language_code)
 
std::string active_language () const
 
unicode translated_text (const unicode &source_text)
 
 S_DEFINE_PROPERTY (window, &Application::window_)
 
 S_DEFINE_PROPERTY (data, &Application::data_carrier_)
 
 S_DEFINE_PROPERTY (scenes, &Application::scene_manager_)
 
 S_DEFINE_PROPERTY (args, &Application::args_)
 
 S_DEFINE_PROPERTY (config, &Application::config_)
 
 S_DEFINE_PROPERTY (stage_node_pool, &Application::node_pool_)
 
 S_DEFINE_PROPERTY (shared_assets, &Application::asset_manager_)
 
 S_DEFINE_PROPERTY (time_keeper, &Application::time_keeper_)
 
 S_DEFINE_PROPERTY (stats, &Application::stats_)
 
 S_DEFINE_PROPERTY (vfs, &Application::vfs_)
 
 S_DEFINE_PROPERTY (sound_driver, &Application::sound_driver_)
 

Protected Member Functions

bool _call_init ()
 

Friends

class Window
 
void cr_run_main (std::function< void()> func)
 
Applicationget_app ()
 

Member Function Documentation

◆ activate_language()

bool smlt::Application::activate_language ( const std::string &  language_code)

Activates a new language for UI widgets. This will search asset paths for an .arb file for the language using fallback logic (e.g. en-gb -> en). Codes are ISO 639-1 and should be lower-case. This function will return false if the .po file cannot be found or loaded.

◆ active_language()

std::string smlt::Application::active_language ( ) const
inline

Returns the currently active language

◆ is_shutting_down()

bool smlt::Application::is_shutting_down ( ) const

Returns true if the application is shutting down

◆ process_id()

ProcessID smlt::Application::process_id ( ) const

Returns the process ID for the application, or -1 if it's unavailable or unsupported

◆ ram_usage_in_bytes()

int64_t smlt::Application::ram_usage_in_bytes ( ) const

Returns an approximation of the ram usage of the current process. Returns -1 if an error occurs or not supported on the platform

◆ request_frame_time()

void smlt::Application::request_frame_time ( float  ms)

Request the target frame time - frames will delay to match it if the framerate would otherwise be too high

◆ run_fixed_updates()

void smlt::Application::run_fixed_updates ( )

Runs fixed_updates, you likely don't want to call this directly

◆ run_frame()

bool smlt::Application::run_frame ( )

Runs a single frame of the application. You likely don't want to call this!

◆ run_update()

void smlt::Application::run_update ( float  dt)

Runs the update and late_update methods on the active scene. You likely don't want to call this directly.

◆ stage_node_pool_capacity()

uint32_t smlt::Application::stage_node_pool_capacity ( ) const

Capacity of the global stagenode pool. This is a memory buffer where all stage nodes (across all stages) are stored/released

◆ stop_running()

void smlt::Application::stop_running ( )

Stops the entire application

◆ thread_id()

thread::ThreadID smlt::Application::thread_id ( ) const

Returns the thread ID of the main process

◆ translated_text()

unicode smlt::Application::translated_text ( const unicode source_text)
inline

Returns the localised text for the active language. This will return source_text if no translation exists or the active language is the same as the default language in the AppConfig. This method is wrapped by the _T() helper macro and you should prefer to use that so that your translated strings can be detected by automated scanning.


The documentation for this class was generated from the following files: