Divide Framework 0.1
A free and open-source 3D Framework under heavy development
Loading...
Searching...
No Matches
Divide::Kernel Class Referencefinal

The kernel is the main system that connects all of our various systems: windows, gfx, sfx, input, physics, timing, etc. More...

#include <Kernel.h>

+ Inheritance diagram for Divide::Kernel:

Public Member Functions

 Kernel (I32 argc, char **argv, Application &parentApp)
 
 ~Kernel () override
 
void onLoop ()
 Our main application rendering loop: Call input requests, physics calculations, pre-rendering, rendering,post-rendering etc.
 
void idle (bool fast, U64 deltaTimeUSGame, U64 deltaTimeUSApp)
 
bool onKeyDown (const Input::KeyEvent &key) override
 Key pressed.
 
bool onKeyUp (const Input::KeyEvent &key) override
 Key released.
 
bool joystickAxisMoved (const Input::JoystickEvent &arg) override
 Joystick axis change.
 
bool joystickPovMoved (const Input::JoystickEvent &arg) override
 Joystick direction change.
 
bool joystickButtonPressed (const Input::JoystickEvent &arg) override
 Joystick button pressed.
 
bool joystickButtonReleased (const Input::JoystickEvent &arg) override
 Joystick button released.
 
bool joystickBallMoved (const Input::JoystickEvent &arg) override
 
bool joystickAddRemove (const Input::JoystickEvent &arg) override
 
bool joystickRemap (const Input::JoystickEvent &arg) override
 
bool mouseMoved (const Input::MouseMoveEvent &arg) override
 Mouse moved.
 
bool mouseButtonPressed (const Input::MouseButtonEvent &arg) override
 Mouse button pressed.
 
bool mouseButtonReleased (const Input::MouseButtonEvent &arg) override
 Mouse button released.
 
bool onTextEvent (const Input::TextEvent &arg) override
 Generated by text events (e.g. for SDL: SDL_TEXTEDITING and SDL_TEXTINPUT)
 
 PROPERTY_RW (LoopTimingData, timingData)
 
 PROPERTY_RW (bool, keepAlive, true)
 
 PROPERTY_R (std::unique_ptr< ProjectManager >, projectManager)
 
 PROPERTY_R (std::unique_ptr< RenderPassManager >, renderPassManager)
 
 PROPERTY_R (FrameListenerManager, frameListenerMgr)
 
 PROPERTY_R (PlatformContext, platformContext)
 
FORCE_INLINE FrameListenerManagerframeListenerMgr () noexcept
 
FORCE_INLINE PlatformContextplatformContext () noexcept
 
- Public Member Functions inherited from Divide::Input::InputAggregatorInterface
virtual ~InputAggregatorInterface ()=default
 
virtual bool onKeyDown (const KeyEvent &arg)=0
 Keyboard: return true if input was consumed.
 
virtual bool onKeyUp (const KeyEvent &arg)=0
 
virtual bool mouseMoved (const MouseMoveEvent &arg)=0
 Mouse: return true if input was consumed.
 
virtual bool mouseButtonPressed (const MouseButtonEvent &arg)=0
 
virtual bool mouseButtonReleased (const MouseButtonEvent &arg)=0
 
virtual bool joystickButtonPressed (const JoystickEvent &arg)=0
 Joystick or Gamepad: return true if input was consumed.
 
virtual bool joystickButtonReleased (const JoystickEvent &arg)=0
 
virtual bool joystickAxisMoved (const JoystickEvent &arg)=0
 
virtual bool joystickPovMoved (const JoystickEvent &arg)=0
 
virtual bool joystickBallMoved (const JoystickEvent &arg)=0
 
virtual bool joystickAddRemove (const JoystickEvent &arg)=0
 
virtual bool joystickRemap (const JoystickEvent &arg)=0
 
virtual bool onTextEvent (const TextEvent &arg)=0
 

Static Public Member Functions

static size_t TotalThreadCount (TaskPoolType type) noexcept
 

Private Types

enum class  InputConsumerType : U8 { Editor , GUI , Scene , COUNT }
 

Private Member Functions

ErrorCode initialize (const string &entryPoint)
 
void warmup ()
 
void shutdown ()
 
void startSplashScreen ()
 
void stopSplashScreen ()
 
bool mainLoopScene (FrameEvent &evt)
 
bool presentToScreen (FrameEvent &evt)
 
void onWindowSizeChange (const SizeChangeParams &params)
 
void onResolutionChange (const SizeChangeParams &params)
 
void remapAbsolutePosition (Input::MouseEvent &eventInOut) const noexcept
 
- Private Member Functions inherited from Divide::NonCopyable
 NonCopyable (const NonCopyable &)=delete
 
NonCopyableoperator= (const NonCopyable &)=delete
 
 NonCopyable (NonCopyable &&)=default
 
NonCopyableoperator= (NonCopyable &&)=default
 
 NonCopyable ()=default
 
 ~NonCopyable ()=default
 

Private Attributes

std::array< InputAggregatorInterface *, to_base(InputConsumerType::COUNT)> _inputConsumers {}
 
vector< Rect< I32 > > _targetViewports {}
 
Time::ProfileTimer_appLoopTimerMain
 
Time::ProfileTimer_appLoopTimerInternal
 
Time::ProfileTimer_frameTimer
 
Time::ProfileTimer_appIdleTimer
 
Time::ProfileTimer_appScenePass
 
Time::ProfileTimer_sceneUpdateTimer
 
Time::ProfileTimer_sceneUpdateLoopTimer
 
Time::ProfileTimer_cameraMgrTimer
 
Time::ProfileTimer_flushToScreenTimer
 
Time::ProfileTimer_preRenderTimer
 
Time::ProfileTimer_postRenderTimer
 
vector< Time::ProfileTimer * > _renderTimer {}
 
std::atomic_bool _splashScreenUpdating {}
 
std::unique_ptr< GUISplash_splashScreen
 
I32 _argc
 
char ** _argv
 
Rect< I32_prevViewport = { -1, -1, -1, -1 }
 
U8 _prevPlayerCount = 0u
 

Friends

class Attorney::KernelApplication
 
class Attorney::KernelWindowManager
 
class Attorney::KernelDebugInterface
 

Detailed Description

The kernel is the main system that connects all of our various systems: windows, gfx, sfx, input, physics, timing, etc.

Definition at line 79 of file Kernel.h.

Member Enumeration Documentation

◆ InputConsumerType

enum class Divide::Kernel::InputConsumerType : U8
strongprivate
Enumerator
Editor 
GUI 
Scene 
COUNT 

Definition at line 148 of file Kernel.h.

Constructor & Destructor Documentation

◆ Kernel()

Divide::Kernel::Kernel ( I32  argc,
char **  argv,
Application parentApp 
)

Definition at line 72 of file Kernel.cpp.

◆ ~Kernel()

Divide::Kernel::~Kernel ( )
override

Definition at line 107 of file Kernel.cpp.

Member Function Documentation

◆ frameListenerMgr()

FORCE_INLINE FrameListenerManager & Divide::Kernel::frameListenerMgr ( )
inlinenoexcept

Definition at line 128 of file Kernel.h.

◆ idle()

void Divide::Kernel::idle ( bool  fast,
U64  deltaTimeUSGame,
U64  deltaTimeUSApp 
)

Called after a swap-buffer call and before a clear-buffer call. In a GPU-bound application, the CPU will wait on the GPU to finish processing the frame so this should keep it busy (old-GLUT heritage)

Definition at line 154 of file Kernel.cpp.

◆ initialize()

ErrorCode Divide::Kernel::initialize ( const string entryPoint)
private

Definition at line 662 of file Kernel.cpp.

◆ joystickAddRemove()

bool Divide::Kernel::joystickAddRemove ( const Input::JoystickEvent arg)
overridevirtual

Implements Divide::Input::InputAggregatorInterface.

Definition at line 1156 of file Kernel.cpp.

◆ joystickAxisMoved()

bool Divide::Kernel::joystickAxisMoved ( const Input::JoystickEvent arg)
overridevirtual

Joystick axis change.

Implements Divide::Input::InputAggregatorInterface.

Definition at line 1106 of file Kernel.cpp.

◆ joystickBallMoved()

bool Divide::Kernel::joystickBallMoved ( const Input::JoystickEvent arg)
overridevirtual

Implements Divide::Input::InputAggregatorInterface.

Definition at line 1146 of file Kernel.cpp.

◆ joystickButtonPressed()

bool Divide::Kernel::joystickButtonPressed ( const Input::JoystickEvent arg)
overridevirtual

Joystick button pressed.

Implements Divide::Input::InputAggregatorInterface.

Definition at line 1126 of file Kernel.cpp.

◆ joystickButtonReleased()

bool Divide::Kernel::joystickButtonReleased ( const Input::JoystickEvent arg)
overridevirtual

Joystick button released.

Implements Divide::Input::InputAggregatorInterface.

Definition at line 1136 of file Kernel.cpp.

◆ joystickPovMoved()

bool Divide::Kernel::joystickPovMoved ( const Input::JoystickEvent arg)
overridevirtual

Joystick direction change.

Implements Divide::Input::InputAggregatorInterface.

Definition at line 1116 of file Kernel.cpp.

◆ joystickRemap()

bool Divide::Kernel::joystickRemap ( const Input::JoystickEvent arg)
overridevirtual

Implements Divide::Input::InputAggregatorInterface.

Definition at line 1166 of file Kernel.cpp.

◆ mainLoopScene()

bool Divide::Kernel::mainLoopScene ( FrameEvent evt)
private

Definition at line 344 of file Kernel.cpp.

◆ mouseButtonPressed()

bool Divide::Kernel::mouseButtonPressed ( const Input::MouseButtonEvent arg)
overridevirtual

Mouse button pressed.

Implements Divide::Input::InputAggregatorInterface.

Definition at line 1042 of file Kernel.cpp.

◆ mouseButtonReleased()

bool Divide::Kernel::mouseButtonReleased ( const Input::MouseButtonEvent arg)
overridevirtual

Mouse button released.

Implements Divide::Input::InputAggregatorInterface.

Definition at line 1064 of file Kernel.cpp.

◆ mouseMoved()

bool Divide::Kernel::mouseMoved ( const Input::MouseMoveEvent arg)
overridevirtual

Mouse moved.

Implements Divide::Input::InputAggregatorInterface.

Definition at line 1019 of file Kernel.cpp.

◆ onKeyDown()

bool Divide::Kernel::onKeyDown ( const Input::KeyEvent key)
overridevirtual

Key pressed.

Implements Divide::Input::InputAggregatorInterface.

Definition at line 1086 of file Kernel.cpp.

◆ onKeyUp()

bool Divide::Kernel::onKeyUp ( const Input::KeyEvent key)
overridevirtual

Key released.

Implements Divide::Input::InputAggregatorInterface.

Definition at line 1096 of file Kernel.cpp.

◆ onLoop()

void Divide::Kernel::onLoop ( )

Our main application rendering loop: Call input requests, physics calculations, pre-rendering, rendering,post-rendering etc.

Definition at line 181 of file Kernel.cpp.

◆ onResolutionChange()

void Divide::Kernel::onResolutionChange ( const SizeChangeParams params)
private

Definition at line 977 of file Kernel.cpp.

◆ onTextEvent()

bool Divide::Kernel::onTextEvent ( const Input::TextEvent arg)
overridevirtual

Generated by text events (e.g. for SDL: SDL_TEXTEDITING and SDL_TEXTINPUT)

Implements Divide::Input::InputAggregatorInterface.

Definition at line 1176 of file Kernel.cpp.

◆ onWindowSizeChange()

void Divide::Kernel::onWindowSizeChange ( const SizeChangeParams params)
private

Definition at line 969 of file Kernel.cpp.

◆ platformContext()

FORCE_INLINE PlatformContext & Divide::Kernel::platformContext ( )
inlinenoexcept

Definition at line 129 of file Kernel.h.

◆ presentToScreen()

bool Divide::Kernel::presentToScreen ( FrameEvent evt)
private

Definition at line 572 of file Kernel.cpp.

◆ PROPERTY_R() [1/4]

Divide::Kernel::PROPERTY_R ( FrameListenerManager  ,
frameListenerMgr   
)

◆ PROPERTY_R() [2/4]

Divide::Kernel::PROPERTY_R ( PlatformContext  ,
platformContext   
)

◆ PROPERTY_R() [3/4]

Divide::Kernel::PROPERTY_R ( std::unique_ptr< ProjectManager ,
projectManager   
)

◆ PROPERTY_R() [4/4]

Divide::Kernel::PROPERTY_R ( std::unique_ptr< RenderPassManager ,
renderPassManager   
)

◆ PROPERTY_RW() [1/2]

Divide::Kernel::PROPERTY_RW ( bool  ,
keepAlive  ,
true   
)

◆ PROPERTY_RW() [2/2]

Divide::Kernel::PROPERTY_RW ( LoopTimingData  ,
timingData   
)

◆ remapAbsolutePosition()

void Divide::Kernel::remapAbsolutePosition ( Input::MouseEvent eventInOut) const
privatenoexcept

Definition at line 992 of file Kernel.cpp.

◆ shutdown()

void Divide::Kernel::shutdown ( )
private

Definition at line 934 of file Kernel.cpp.

◆ startSplashScreen()

void Divide::Kernel::startSplashScreen ( )
private

Definition at line 112 of file Kernel.cpp.

◆ stopSplashScreen()

void Divide::Kernel::stopSplashScreen ( )
private

Definition at line 134 of file Kernel.cpp.

◆ TotalThreadCount()

size_t Divide::Kernel::TotalThreadCount ( TaskPoolType  type)
staticnoexcept

Definition at line 51 of file Kernel.cpp.

◆ warmup()

void Divide::Kernel::warmup ( )
private

Definition at line 642 of file Kernel.cpp.

Friends And Related Function Documentation

◆ Attorney::KernelApplication

friend class Attorney::KernelApplication
friend

Definition at line 82 of file Kernel.h.

◆ Attorney::KernelDebugInterface

friend class Attorney::KernelDebugInterface
friend

Definition at line 84 of file Kernel.h.

◆ Attorney::KernelWindowManager

friend class Attorney::KernelWindowManager
friend

Definition at line 83 of file Kernel.h.

Member Data Documentation

◆ _appIdleTimer

Time::ProfileTimer& Divide::Kernel::_appIdleTimer
private

Definition at line 162 of file Kernel.h.

◆ _appLoopTimerInternal

Time::ProfileTimer& Divide::Kernel::_appLoopTimerInternal
private

Definition at line 160 of file Kernel.h.

◆ _appLoopTimerMain

Time::ProfileTimer& Divide::Kernel::_appLoopTimerMain
private

Definition at line 159 of file Kernel.h.

◆ _appScenePass

Time::ProfileTimer& Divide::Kernel::_appScenePass
private

Definition at line 163 of file Kernel.h.

◆ _argc

I32 Divide::Kernel::_argc
private

Definition at line 176 of file Kernel.h.

◆ _argv

char** Divide::Kernel::_argv
private

Definition at line 177 of file Kernel.h.

◆ _cameraMgrTimer

Time::ProfileTimer& Divide::Kernel::_cameraMgrTimer
private

Definition at line 166 of file Kernel.h.

◆ _flushToScreenTimer

Time::ProfileTimer& Divide::Kernel::_flushToScreenTimer
private

Definition at line 167 of file Kernel.h.

◆ _frameTimer

Time::ProfileTimer& Divide::Kernel::_frameTimer
private

Definition at line 161 of file Kernel.h.

◆ _inputConsumers

std::array<InputAggregatorInterface*, to_base(InputConsumerType::COUNT)> Divide::Kernel::_inputConsumers {}
private

Definition at line 155 of file Kernel.h.

◆ _postRenderTimer

Time::ProfileTimer& Divide::Kernel::_postRenderTimer
private

Definition at line 169 of file Kernel.h.

◆ _preRenderTimer

Time::ProfileTimer& Divide::Kernel::_preRenderTimer
private

Definition at line 168 of file Kernel.h.

◆ _prevPlayerCount

U8 Divide::Kernel::_prevPlayerCount = 0u
private

Definition at line 180 of file Kernel.h.

◆ _prevViewport

Rect<I32> Divide::Kernel::_prevViewport = { -1, -1, -1, -1 }
private

Definition at line 179 of file Kernel.h.

◆ _renderTimer

vector<Time::ProfileTimer*> Divide::Kernel::_renderTimer {}
private

Definition at line 170 of file Kernel.h.

◆ _sceneUpdateLoopTimer

Time::ProfileTimer& Divide::Kernel::_sceneUpdateLoopTimer
private

Definition at line 165 of file Kernel.h.

◆ _sceneUpdateTimer

Time::ProfileTimer& Divide::Kernel::_sceneUpdateTimer
private

Definition at line 164 of file Kernel.h.

◆ _splashScreen

std::unique_ptr<GUISplash> Divide::Kernel::_splashScreen
private

Definition at line 173 of file Kernel.h.

◆ _splashScreenUpdating

std::atomic_bool Divide::Kernel::_splashScreenUpdating {}
private

Definition at line 172 of file Kernel.h.

◆ _targetViewports

vector<Rect<I32> > Divide::Kernel::_targetViewports {}
private

Definition at line 157 of file Kernel.h.


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