DEKI/ENGINE docs
Deki 0.19.0
Modular C++ 2D engine for embedded displays and desktop
Loading...
Searching...
No Matches
DekiEditor::EditorWindow Class Referenceabstract

Base class for standalone editor windows. More...

#include <C:/Users/kirby/Documents/Github/deki/deki-editor/deki-editor/include/deki-editor/EditorWindow.h>

Public Member Functions

virtual ~EditorWindow ()=default
virtual const char * GetTitle ()=0
 The window title.
virtual const char * GetMenuPath ()
 Where the window sits in the Tools menu (e.g.
virtual const char * GetShortcut ()
 A keyboard shortcut (e.g. "Ctrl+Shift+S"), or nullptr.
virtual void OnOpen ()
 Called when the window is first opened.
virtual void OnClose ()
virtual void OnGUI ()=0
 Draws the window each frame, with ImGui directly.
virtual void OnUpdate (float deltaTime)
 Called each frame for work other than drawing. deltaTime is in seconds.
virtual bool CanOpenFile (const char *extension)
 Whether this window opens files with this extension (e.g. ".png", ".anim").
virtual bool CanOpenAssetType (const char *assetType)
 Whether this window opens .asset files whose JSON "type" is assetType (e.g.
virtual void OpenFile (const char *filePath, const char *cachePath)
 Opens a file, given the full paths of the file and of its cached version.
virtual bool SaveSession (std::string &)
 Saves the window's state as JSON. Return false to save nothing.
virtual void RestoreSession (const std::string &)
 Restores state from SaveSession's JSON, after the DLLs reloaded.
bool IsOpen () const
void SetOpen (bool open)

Protected Attributes

bool m_IsOpen = false

Detailed Description

Base class for standalone editor windows.

Use EditorApplication::Get() for project info.

Usage: class SpritesheetEditorWindow : public EditorWindow { public: const char* GetTitle() override { return "Spritesheet Editor"; } const char* GetMenuPath() override { return "2D/Spritesheet Editor"; }

void OnOpen() override { auto& app = EditorApplication::Get(); m_ProjectPath = app.GetProjectPath(); }

void OnGUI() override { ImGui::Begin(GetTitle(), &m_IsOpen); // ... draw UI ImGui::End(); } };

REGISTER_EDITOR_WINDOW(SpritesheetEditorWindow, "Spritesheet Editor", "2D/Spritesheet Editor")

Constructor & Destructor Documentation

◆ ~EditorWindow()

virtual DekiEditor::EditorWindow::~EditorWindow ( )
virtualdefault

Member Function Documentation

◆ GetTitle()

virtual const char * DekiEditor::EditorWindow::GetTitle ( )
pure virtual

The window title.

◆ GetMenuPath()

virtual const char * DekiEditor::EditorWindow::GetMenuPath ( )
inlinevirtual

Where the window sits in the Tools menu (e.g.

"2D/Spritesheet Editor"), or nullptr.

◆ GetShortcut()

virtual const char * DekiEditor::EditorWindow::GetShortcut ( )
inlinevirtual

A keyboard shortcut (e.g. "Ctrl+Shift+S"), or nullptr.

◆ OnOpen()

virtual void DekiEditor::EditorWindow::OnOpen ( )
inlinevirtual

Called when the window is first opened.

EditorApplication::Get() gives the project paths: void OnOpen() override { auto& app = EditorApplication::Get(); m_ProjectPath = app.GetProjectPath(); m_AssetsPath = app.GetAssetsPath(); }

◆ OnClose()

virtual void DekiEditor::EditorWindow::OnClose ( )
inlinevirtual

◆ OnGUI()

virtual void DekiEditor::EditorWindow::OnGUI ( )
pure virtual

Draws the window each frame, with ImGui directly.

Call ImGui::Begin() with &m_IsOpen.

◆ OnUpdate()

virtual void DekiEditor::EditorWindow::OnUpdate ( float deltaTime)
inlinevirtual

Called each frame for work other than drawing. deltaTime is in seconds.

◆ CanOpenFile()

virtual bool DekiEditor::EditorWindow::CanOpenFile ( const char * extension)
inlinevirtual

Whether this window opens files with this extension (e.g. ".png", ".anim").

◆ CanOpenAssetType()

virtual bool DekiEditor::EditorWindow::CanOpenAssetType ( const char * assetType)
inlinevirtual

Whether this window opens .asset files whose JSON "type" is assetType (e.g.

"iconexport").

◆ OpenFile()

virtual void DekiEditor::EditorWindow::OpenFile ( const char * filePath,
const char * cachePath )
inlinevirtual

Opens a file, given the full paths of the file and of its cached version.

◆ SaveSession()

virtual bool DekiEditor::EditorWindow::SaveSession ( std::string & )
inlinevirtual

Saves the window's state as JSON. Return false to save nothing.

◆ RestoreSession()

virtual void DekiEditor::EditorWindow::RestoreSession ( const std::string & )
inlinevirtual

Restores state from SaveSession's JSON, after the DLLs reloaded.

◆ IsOpen()

bool DekiEditor::EditorWindow::IsOpen ( ) const
inline

◆ SetOpen()

void DekiEditor::EditorWindow::SetOpen ( bool open)
inline

Member Data Documentation

◆ m_IsOpen

bool DekiEditor::EditorWindow::m_IsOpen = false
protected

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