![]() |
Simulant
21.12-553
A portable game engine for Windows, OSX, Linux, Dreamcast, and PSP
|
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) |
bool | activate_language_from_arb_data (const uint8_t *data, std::size_t byte_size) |
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) |
Application * | get_app () |
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.
bool smlt::Application::activate_language_from_arb_data | ( | const uint8_t * | data, |
std::size_t | byte_size | ||
) |
Activates a language from an ARB file that's already been loaded from disk. The language code is read from the ARB itself and no locale directories are searched.
|
inline |
Returns the currently active language
bool smlt::Application::is_shutting_down | ( | ) | const |
Returns true if the application is shutting down
ProcessID smlt::Application::process_id | ( | ) | const |
Returns the process ID for the application, or -1 if it's unavailable or unsupported
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
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
void smlt::Application::run_fixed_updates | ( | ) |
Runs fixed_updates, you likely don't want to call this directly
bool smlt::Application::run_frame | ( | ) |
Runs a single frame of the application. You likely don't want to call this!
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.
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
void smlt::Application::stop_running | ( | ) |
Stops the entire application
thread::ThreadID smlt::Application::thread_id | ( | ) | const |
Returns the thread ID of the main process
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.