The sample application framework builds upon the Base Application Framework and extends it with game-specific code and also code that is common for the samples: e.g. initialization/deinitialization for Coherent GT.
You should have read the Base Application Framework page before continuing.
The sample framework contains:
The sample framework uses glm for cross-platform mathematical operations. You can check the manual at the official site
The FPS camera provides means for moving around a 3D world and getting back view and projection matrices needed for rendering. It can be located in the Coherent/Samples/UI/C++/Common/Camera.cpp
file.
The important methods for movement are Camera::AddMoveFlags
and Camera::AddMouseDelta
, which should be called whenever a key or mouse event occurs. Then, each frame the Camera::Update
method is called, which updates the matrices and resets flags and deltas. Check Sample 03 - Input in 3D for basic usage.
The game object stores geometry and transformation for the object and can be tested for intersection with a ray. It can be located in the Coherent/Samples/UI/C++/Common/GameObject.cpp
file.
The base application is located in the Coherent/Samples/Application/Application.h
file. It has a PlatformWindow and an IRenderer. The base application has virtual methods for all of the events that the PlatformWindow
exposes. Those methods are bound to the events of the PlatformWindow
and can be overridden to customize behavior.
The user should derive the ApplicationBase
class and override the event handler functions, such as ApplicationBase::OnMouseEvent
, ApplicationBase::OnKeyEvent
, ApplicationBase::OnIdle
, ApplicationBase::OnResize
. The derived application should be created either globally, or in the main loop and then its Run
method should be called. The overridden event handlers will then be called until the window is closed. For more information about the base application, please check out BaseApplication
Check one of the samples for example usage of the sample framework.