Nameless Engine
Loading...
Searching...
No Matches
ne::EditorGameInstance Class Reference

#include <EditorGameInstance.h>

Inheritance diagram for ne::EditorGameInstance:
ne::GameInstance

Classes

struct  EditorGcPointers
 

Public Member Functions

 EditorGameInstance (Window *pWindow, GameManager *pGameManager, InputManager *pInputManager)
 
sgc::GcPtr< EditorCameraNodegetEditorCamera () const
 
- Public Member Functions inherited from ne::GameInstance
 GameInstance (Window *pGameWindow, GameManager *pGameManager, InputManager *pInputManager)
 
 GameInstance (const GameInstance &)=delete
 
GameInstanceoperator= (const GameInstance &)=delete
 
void addDeferredTask (const std::function< void()> &task) const
 
void addTaskToThreadPool (const std::function< void()> &task) const
 
void createWorld (const std::function< void(const std::optional< Error > &)> &onCreated, size_t iWorldSize=Globals::getDefaultWorldSize())
 
void loadNodeTreeAsWorld (const std::function< void(const std::optional< Error > &)> &onLoaded, const std::filesystem::path &pathToNodeTree, size_t iWorldSize=Globals::getDefaultWorldSize())
 
void queueGarbageCollection (bool bForce, const std::optional< std::function< void()> > &onFinished={})
 
void setGarbageCollectorRunInterval (long long iGcRunIntervalInSec)
 
void executeShaderManagerSelfValidation () const
 
sgc::GcPtr< NodegetWorldRootNode () const
 
float getWorldTimeInSeconds () const
 
size_t getWorldSize () const
 
size_t getTotalSpawnedNodeCount ()
 
size_t getCalledEveryFrameNodeCount ()
 
WindowgetWindow () const
 
CameraManagergetCameraManager () const
 
InputManagergetInputManager () const
 
long long getGarbageCollectorRunIntervalInSec ()
 

Static Public Member Functions

static const char * getEditorWindowTitle ()
 
- Static Public Member Functions inherited from ne::GameInstance
static float getTotalApplicationTimeInSec ()
 

Protected Member Functions

virtual void onGameStarted () override
 
virtual void onBeforeNewFrame (float timeSincePrevCallInSec) override
 
- Protected Member Functions inherited from ne::GameInstance
TimercreateTimer (const std::string &sTimerName)
 
void stopAndDisableCreatedTimers ()
 
virtual void onGameStarted ()
 
virtual void onBeforeNewFrame (float timeSincePrevCallInSec)
 
virtual void onKeyboardInput (KeyboardKey key, KeyboardModifiers modifiers, bool bIsPressedDown)
 
virtual void onMouseInput (MouseButton button, KeyboardModifiers modifiers, bool bIsPressedDown)
 
virtual void onMouseMove (double xOffset, double yOffset)
 
virtual void onMouseScrollMove (int iOffset)
 
virtual void onWindowFocusChanged (bool bIsFocused)
 
virtual void onFramebufferSizeChanged (int iWidth, int iHeight)
 
virtual void onWindowClose ()
 
std::pair< std::recursive_mutex, std::unordered_map< unsigned int, std::function< void(KeyboardModifiers, bool)> > > * getActionEventBindings ()
 
std::pair< std::recursive_mutex, std::unordered_map< unsigned int, std::function< void(KeyboardModifiers, float)> > > * getAxisEventBindings ()
 

Private Member Functions

void spawnEditorNodesForNewWorld ()
 

Private Attributes

EditorGcPointers gcPointers
 

Static Private Attributes

static constexpr auto pEditorWindowTitle = "Nameless Editor"
 

Detailed Description

Defines editor game.

Remarks
This node expects to be a child of the world's root node so that parent rotations will not affect the camera.

Constructor & Destructor Documentation

◆ EditorGameInstance()

ne::EditorGameInstance::EditorGameInstance ( Window pWindow,
GameManager pGameManager,
InputManager pInputManager 
)

Constructor.

Remarks
There is no need to save window/input manager pointers in derived classes as the base class already saves these pointers and provides getWindow and getInputManager functions.
Parameters
pWindowWindow that owns this game instance.
pGameManagerGameManager that owns this game instance.
pInputManagerInput manager of the owner Game object.

Member Function Documentation

◆ getEditorCamera()

sgc::GcPtr< EditorCameraNode > ne::EditorGameInstance::getEditorCamera ( ) const

Returns camera that's used for editor's viewport.

Returns
Camera node.

◆ getEditorWindowTitle()

const char * ne::EditorGameInstance::getEditorWindowTitle ( )
static

Returns title of the editor's window.

Returns
Window title.

◆ onBeforeNewFrame()

void ne::EditorGameInstance::onBeforeNewFrame ( float  timeSincePrevCallInSec)
overrideprotectedvirtual

Called before a new frame is rendered.

Remarks
Called before nodes that should be called every frame.
Parameters
timeSincePrevCallInSecTime in seconds that has passed since the last call to this function.

Reimplemented from ne::GameInstance.

◆ onGameStarted()

void ne::EditorGameInstance::onGameStarted ( )
overrideprotectedvirtual

Called after GameInstance's constructor is finished and created GameInstance object was saved in GameManager (that owns GameInstance).

At this point you can create and interact with the game world and etc.

Reimplemented from ne::GameInstance.

◆ spawnEditorNodesForNewWorld()

void ne::EditorGameInstance::spawnEditorNodesForNewWorld ( )
private

Called after a new world was created to create editor-specific nodes such as camera and etc.

Member Data Documentation

◆ gcPointers

EditorGcPointers ne::EditorGameInstance::gcPointers
private

All GC pointer that the editor holds.

◆ pEditorWindowTitle

constexpr auto ne::EditorGameInstance::pEditorWindowTitle = "Nameless Editor"
staticconstexprprivate

Title of the editor's window.


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