struct Bvr::App

Main instance of Beaver.

Main instance of the application that constrols all resources and systems Use App::Default or App::Raw to create configured or unconfigured insrances of the application It is possible to access it as App::Get

Functions

Bvr::App::App(App &&app) noexcept

Bvr::App::~App()

void Bvr::App::RunOnce()

Runs the application schedule and its sub apps once.

void Bvr::App::Run()

Runs the application while App::ShouldRun is true.

App & Bvr::App::RunStartupSchedule()

Runs once the startup schedule.

App & Bvr::App::AddSubApp(App &&app)

Adds a sub application to the application that runs Independently from the main application.

T * Bvr::App::GetResource()

Gets the resource of type T that was added to the application.

Finds the instance of the resource and return it if it is present, nullptr otherwise

Returns: pointer to the resource

App & Bvr::App::InsertResource(U &&resource)

Inserts the resource of type T into an app instance.

Inserts previously constructed instance of the resource without claiming its ownership Does nothing if resource of type T already exists

Returns: instance of an app into which the resource was inserted

App & Bvr::App::CreateResource(Args &&… args)

Constructs the resource of type T with specified arguments in an app instance.

Does nothing if resource of type T already exists

Returns: instance of an app into which the resource was inserted

App & Bvr::App::RemoveResource()

Remove the resource from the application.

Does nothing if resource wasn’t created

Returns: instance of an app into which the resource was inserted

App & Bvr::App::AddSystem(const char *stageName, T &&fn)

Adds system to a specified stage.

Internally constructs Bvr::SystemDesc

Parameters:

Name Description
stageName Name of the stage into which system is added
fn System to execute or Bvr::SystemDesc

Returns: instance of an app into which the system was inserted

App & Bvr::App::AddStartupSystem(T &&fn)

Adds a system into the startup schedule.

Internally constructs Bvr::SystemDesc

Parameters:

Name Description
fn System to execute or Bvr::SystemDesc

Returns: instance of an app into which the system was inserted

App & Bvr::App::AddStage(const char *name, EStageFlags eFlags=EStageFlags::SingleThreaded)

Adds a stage to the app schedule.

Parameters:

Name Description
name Name of the stage to add

App & Bvr::App::AddStageBefore(const char *name, const char *before, EStageFlags eFlags=EStageFlags::SingleThreaded)

Adds a stage to the app schedule before specified stage.

Parameters:

Name Description
name Name of the stage to add
before Name of the stage before which stage is inserted

App & Bvr::App::AddStageAfter(const char *name, const char *after, EStageFlags eFlags=EStageFlags::SingleThreaded)

Adds a stage to the app schedule before specified stage.

Parameters:

Name Description
name Name of the stage to add
after Name of the stage after which stage is inserted

constexpr App & Bvr::App::AddPlugin(Plug &&plug={})

Adds a plugin to the application No ownership of the plugin is taken!

Parameters:

Name Description
plug Plugin to add

App & Bvr::App::RegisterEvent()

Sets up all of the resources and systems needed for event dispatching.

App & Bvr::App::AddAsset()

Sets up all of the resources and systems needed for asset management.

Such as:

App & Bvr::App::AddComponent()

Sets up component type T description needed for runtime ecs.

App & Bvr::App::AddLoader()

Registers a loader of type T.

Optionally possible to provide a loaded resource type Either as a template argument or by providing AssetT typedef inside of the loader class AssetT defaults to std::nullptr_t

App & Bvr::App::AddState(const char *stage=DefaultStages::FIRST)

Sets up state at state DefaultStages::FIRST.

Parameters:

Name Description
stage stage to which the state will be added (by default FIRST)

App & Bvr::App::Get()

Static instance of the main application.

void Bvr::App::Set(App *app)

Allows setting custom instance of the application.

Usually should be used if library is statically linked against the dll

App Bvr::App::Default()

Constructs default application.

App Bvr::App::Raw()

Constructs empty application(not really safe to use)

Bvr::App::App() noexcept

Bvr::App::App(const App &)=delete

static constexpr BvrUtil::Hash Bvr::App::ResourceHash()

Variables

std::vector Bvr::App::subApps

bool Bvr::App::ShouldRun

Controls weather the app runs.

App * Bvr::App::s_Instance

std::unordered_map<uint64, std::unique_ptr > Bvr::App::m_resources

std::vector Bvr::App::m_resourceReleaseOrder

CSchedule* Bvr::App::m_pSchedule