module charge.game.app

Source file for App base classes.

Code Map

//! Source file for App base classes.
module charge.game.app;


class App
{
public:
	this(opts: core.Options) { }
	this(core: core.Core) { }
	//! Called by the core when it is shutting down.
	fn close() { }
	//! Simple function that dispatches to the charge core.
	fn loop() i32 { }
	//! Called every time actions should be updated, timepoint given is when
	//! next frame is to be displayed.
	fn updateActions(timepoint: i64);
	//! Called every logic step.
	fn logic();
	//! Called every frame.
	fn render(t: gfx.Target, viewInfo: gfx.ViewInfo);
	//! Idle is a bit missleading name, this function is always called after a
	//! frame is completed. Time is the difference between when the next logic
	//! step should happen and the current time, so it can be a negative value
	//! if we are behind (often happens when rendering takes to long to
	//! complete).
	fn idle(time: i64);


protected:
	mCore: core.Core;
	mInput: ctl.Input;
	mFrameTime: gfx.TimeTracker;
	mRenderTime: sys.TimeTracker;
	mLogicTime: sys.TimeTracker;
	mBuildTime: sys.TimeTracker;
	mIdleTime: sys.TimeTracker;
}