Blowbox 2017
A 3D Game Engine by Riko Ophorst using DirectX 12
Public Member Functions | Static Public Attributes | Protected Member Functions | Private Attributes | List of all members
blowbox::BlowboxCore Class Reference

#include <blowbox_core.h>

Public Member Functions

 BlowboxCore ()
 
 BlowboxCore (BlowboxConfig *config)
 
 BlowboxCore (const BlowboxCore &that)=delete
 
 ~BlowboxCore ()
 
void Run ()
 
void Shutdown ()
 
bool IsBlowboxAlive ()
 
void SetRunProcedure (const Function< void > &run_procedure)
 
void SetUpdateProcedure (const Function< void > &update_procedure)
 
void SetPostUpdateProcedure (const Function< void > &post_update_procedure)
 
void SetRenderProcedure (const Function< void > &render_procedure)
 
void SetPostRenderProcedure (const Function< void > &post_render_procedure)
 
void SetShutdownProcedure (const Function< void > &shutdown_procedure)
 

Static Public Attributes

static bool alive = false
 

Protected Member Functions

void StartupGetter ()
 
void StartupWin32 ()
 
void StartupRenderer ()
 
void StartupScene ()
 
void StartupDebug ()
 
void ShutdownGetter ()
 
void ShutdownWin32 ()
 
void ShutdownRenderer ()
 
void ShutdownScene ()
 
void ShutdownDebug ()
 
void Update ()
 
void Render ()
 

Private Attributes

BlowboxConfigconfig_
 
bool shutdown_requested_
 
Function< void > user_procedure_run_
 
Function< void > user_procedure_update_
 
Function< void > user_procedure_post_update_
 
Function< void > user_procedure_render_
 
Function< void > user_procedure_post_render_
 
Function< void > user_procedure_shutdown_
 
Getgetter_
 
SharedPtr< GLFWManagerwin32_glfw_manager_
 
SharedPtr< Windowwin32_main_window_
 
SharedPtr< Timewin32_time_
 
SharedPtr< Devicerender_device_
 
SharedPtr< SwapChainrender_swap_chain_
 
SharedPtr< CommandManagerrender_command_manager_
 
SharedPtr< CommandContextManagerrender_command_context_manager_
 
SharedPtr< DescriptorHeaprender_rtv_heap_
 
SharedPtr< DescriptorHeaprender_dsv_heap_
 
SharedPtr< DescriptorHeaprender_cbv_srv_uav_heap_
 
SharedPtr< ForwardRendererrender_forward_renderer_
 
SharedPtr< DeferredRendererrender_deferred_renderer_
 
SharedPtr< ImGuiManagerrender_imgui_manager_
 
SharedPtr< SceneManagerscene_manager_
 
SharedPtr< DebugMenudebug_menu_
 
SharedPtr< Consoleconsole_
 
SharedPtr< PerformanceProfilerperformance_profiler_
 
SharedPtr< MemoryProfilermemory_profiler_
 
SharedPtr< FrameStatsframe_stats_
 
SharedPtr< MemoryStatsmemory_stats_
 

Detailed Description

The core of Blowbox.

This is the main class that the user has to create upon startup. It sets up everything for you. All necessary subsystems are initialized and setup. You can start executing Blowbox by calling BlowboxCore::Run(). Before doing so, you have the option to set a few user procedures that happen at different times during the execution of the application. These are provided via functions such as BlowboxCore::SetUpdateProcedure(). BlowboxCore can only be created through the BlowboxCore::BlowboxCore(BlowboxConfig* config) constructor, because a config is mandatory.

Constructor & Destructor Documentation

blowbox::BlowboxCore::BlowboxCore ( )

This is a dummy constructor and doesn't do anything except that it enables this class to have a default constructor.

Remarks
This constructor is not valid and only exists so that the BlowboxCore has a default constructor.
blowbox::BlowboxCore::BlowboxCore ( BlowboxConfig config)

Constructs the actual BlowboxCore.

Parameters
[in]configThe configuration you wish to use for the BlowboxCore instance
Remarks
The subsystems aren't initialized yet, they are merely constructed. They only get initialized when you call BlowboxCore::Run().
blowbox::BlowboxCore::BlowboxCore ( const BlowboxCore that)
delete

The copy destructor is unavailable. A BlowboxCore isn't copyable.

blowbox::BlowboxCore::~BlowboxCore ( )

Destroys the BlowboxCore.

Member Function Documentation

bool blowbox::BlowboxCore::IsBlowboxAlive ( )

Figures out whether the BlowboxCore should shutdown based on the state of the engine (window, input, etc)

void blowbox::BlowboxCore::Render ( )
protected

Performs the render step in the game loop.

This function triggers the rendering of the game to the main Window instance. User procedures are also called by this function.

void blowbox::BlowboxCore::Run ( )

Kicks off the gameloop.

This starts the actual gameloop. All subsystems will be properly initialized and retrievable through the Get class from this point on. This function is blocking until the game is exited. You can manually trigger an exit by calling BlowboxCore::Shutdown() from one of the user procedures. First, all subsystems are initialized. Second, the game loop is entered. Each frame the game gets updated and rendered. After the game loop is done, subsystems automatically get shutdown. Once BlowboxCore::Run() returns, you are free to delete the BlowboxCore instance from the heap.

void blowbox::BlowboxCore::SetPostRenderProcedure ( const Function< void > &  post_render_procedure)

Sets the PostRender user procedure.

The PostRender procedure is invoked every frame after the entire scene is rendered. It allows you to enter some miscellaneous code after the game gets rendered, essentially.

Parameters
[in]post_render_procedureThe function that should be called each frame when the PostRender step happens in the game loop
void blowbox::BlowboxCore::SetPostUpdateProcedure ( const Function< void > &  post_update_procedure)

Set the PostUpdate user procedure.

The PostUpdate procedure is invoked every frame after the entire scene is updated. It allows you to enter some miscellaneous code after the game gets updated, essentially.

Parameters
[in]post_update_procedureThe function that should be called each frame when the PostUpdate step happens in the game loop
void blowbox::BlowboxCore::SetRenderProcedure ( const Function< void > &  render_procedure)

Sets the Render user procedure.

The Render procedure is invoked every frame before the entire scene is rendered. It allows you to enter some miscellaneous code before the game gets rendered, essentially.

Parameters
[in]render_procedureThe function that should be called each frame when the Render step happens in the game loop
void blowbox::BlowboxCore::SetRunProcedure ( const Function< void > &  run_procedure)

Sets the Run user procedure.

The Run procedure is invoked immediately after all subsystems have been initialized (after calling BlowboxCore::Run()). It allows you to enter some miscellaneous code before the actual game loop starts.

Parameters
[in]run_procedureThe function that should be called when the Run step happens in the game loop
void blowbox::BlowboxCore::SetShutdownProcedure ( const Function< void > &  shutdown_procedure)

Sets the Shutdown user procedure.

The Shutdown procedure is invoked right after the final frame has been executed by the game loop, but before all subsystems get shutdown. It allows you to enter some miscellaneous code after the game gets shutdown.

Parameters
[in]shutdown_procedureThe function that should be called when the Shutdown step happens in the game loop
void blowbox::BlowboxCore::SetUpdateProcedure ( const Function< void > &  update_procedure)

Sets the Update user procedure.

The Update procedure is invoked every frame before the entire scene is updated. It allows you to enter some miscellaneous code before the game gets updated, essentially.

Parameters
[in]update_procedureThe function that should be called each frame when the Update step happens in the game loop
void blowbox::BlowboxCore::Shutdown ( )

Request BlowboxCore to shutdown.

This function requests BlowboxCore to shutdown. BlowboxCore will finish the current frame and then continue to shutdown all the different subsystems.

Remarks
Should only be called from one of the customizable user procedures.
void blowbox::BlowboxCore::ShutdownDebug ( )
protected

Shuts down the debug subsystems.

void blowbox::BlowboxCore::ShutdownGetter ( )
protected

Shuts down the Getter system.

void blowbox::BlowboxCore::ShutdownRenderer ( )
protected

Shuts down the Renderer subsystems.

void blowbox::BlowboxCore::ShutdownScene ( )
protected

Shuts down the Scene subsystems.

void blowbox::BlowboxCore::ShutdownWin32 ( )
protected

Shuts down the Win32 subsystems.

void blowbox::BlowboxCore::StartupDebug ( )
protected

Starts up the debug subsystems.

void blowbox::BlowboxCore::StartupGetter ( )
protected

Starts up the Getter system.

void blowbox::BlowboxCore::StartupRenderer ( )
protected

Starts up the Renderer subsystems.

void blowbox::BlowboxCore::StartupScene ( )
protected

Starts up the Scene subsystems.

void blowbox::BlowboxCore::StartupWin32 ( )
protected

Starts up the Win32 subsystems.

void blowbox::BlowboxCore::Update ( )
protected

Performs the update step in the game loop.

This function updates all subsystems in the engine in the correct order. User procedures are also called by this function.

Member Data Documentation

bool blowbox::BlowboxCore::alive = false
static

Static variable to determine whether the BlowboxCore is alive.

BlowboxConfig* blowbox::BlowboxCore::config_
private

The configuration of blowbox.

SharedPtr<Console> blowbox::BlowboxCore::console_
private

The Console instance.

SharedPtr<DebugMenu> blowbox::BlowboxCore::debug_menu_
private

The DebugMenu instance.

SharedPtr<FrameStats> blowbox::BlowboxCore::frame_stats_
private

The FrameStats instance.

Get* blowbox::BlowboxCore::getter_
private

The Get instance that is used in the entire engine.

SharedPtr<MemoryProfiler> blowbox::BlowboxCore::memory_profiler_
private

The MemoryProfiler instance.

SharedPtr<MemoryStats> blowbox::BlowboxCore::memory_stats_
private

The MemoryStats instance.

SharedPtr<PerformanceProfiler> blowbox::BlowboxCore::performance_profiler_
private

The PerformanceProfiler instance.

SharedPtr<DescriptorHeap> blowbox::BlowboxCore::render_cbv_srv_uav_heap_
private

DescriptorHeap for cbv/srv/uavs.

SharedPtr<CommandContextManager> blowbox::BlowboxCore::render_command_context_manager_
private

The CommandContextManager instance.

SharedPtr<CommandManager> blowbox::BlowboxCore::render_command_manager_
private

The CommandManager instance.

SharedPtr<DeferredRenderer> blowbox::BlowboxCore::render_deferred_renderer_
private

The DeferredRenderer instance.

SharedPtr<Device> blowbox::BlowboxCore::render_device_
private

The Device used by the renderers.

SharedPtr<DescriptorHeap> blowbox::BlowboxCore::render_dsv_heap_
private

DescriptorHeap for depth stencil views.

SharedPtr<ForwardRenderer> blowbox::BlowboxCore::render_forward_renderer_
private

The ForwardRenderer instance.

SharedPtr<ImGuiManager> blowbox::BlowboxCore::render_imgui_manager_
private

The ImGuiManager instance.

SharedPtr<DescriptorHeap> blowbox::BlowboxCore::render_rtv_heap_
private

DescriptorHeap for render target views.

SharedPtr<SwapChain> blowbox::BlowboxCore::render_swap_chain_
private

The SwapChain used by the renderers.

SharedPtr<SceneManager> blowbox::BlowboxCore::scene_manager_
private

The SceneManager instance.

bool blowbox::BlowboxCore::shutdown_requested_
private

Tracks whether the engine should still be alive.

Function<void> blowbox::BlowboxCore::user_procedure_post_render_
private

The procedure that is defined by the user for the PostRender step.

Function<void> blowbox::BlowboxCore::user_procedure_post_update_
private

The procedure that is defined by the user for the PostUpdate step.

Function<void> blowbox::BlowboxCore::user_procedure_render_
private

The procedure that is defined by the user for the Render step.

Function<void> blowbox::BlowboxCore::user_procedure_run_
private

The procedure that is defined by the user for the Run step.

Function<void> blowbox::BlowboxCore::user_procedure_shutdown_
private

The procedure that is defined by the user for the Shutdown step.

Function<void> blowbox::BlowboxCore::user_procedure_update_
private

The procedure that is defined by the user for the Update step.

SharedPtr<GLFWManager> blowbox::BlowboxCore::win32_glfw_manager_
private

The GLFWManager instance is stored here.

SharedPtr<Window> blowbox::BlowboxCore::win32_main_window_
private

The main Window instance.

SharedPtr<Time> blowbox::BlowboxCore::win32_time_
private

The Time instance.


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