DEKI/ENGINE docs
manual api reference
Deki 0.40.1
Modular C++ engine with a visual editor, for 2D and 3D
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 bool CanOpenAssetType (const char *assetType)
 Whether this window opens .asset files whose JSON "type" is assetType (e.g.
virtual bool CanOpenFile (const char *extension)
 Whether this window opens files with this extension (e.g. ".png", ".anim").
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 const char * GetTitle ()=0
 The window title.
bool IsOpen () const
virtual void OnClose ()
virtual void OnGUI ()=0
 Draws the window each frame, with ImGui directly.
virtual void OnOpen ()
 Called when the window is first opened.
virtual void OnUpdate (float deltaTime)
 Called each frame for work other than drawing. deltaTime is in seconds.
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 void RestoreSession (const std::string &)
 Restores state from SaveSession's JSON, after the DLLs reloaded.
virtual bool SaveSession (std::string &)
 Saves the window's state as JSON. Return false to save nothing.
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 "Sprite Slicer"; } const char* GetMenuPath() override { return "2D/Sprite Slicer"; }

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, "Sprite Slicer", "2D/Sprite Slicer")

Constructor & Destructor Documentation

◆ ~EditorWindow()

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

Member Function Documentation

◆ CanOpenAssetType()

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

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

"iconexport").

◆ CanOpenFile()

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

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

◆ GetMenuPath()

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

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

"2D/Sprite Slicer"), or nullptr.

◆ GetShortcut()

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

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

◆ GetTitle()

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

The window title.

◆ IsOpen()

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

◆ 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.

◆ 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(); }

◆ OnUpdate()

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

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

◆ 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.

◆ RestoreSession()

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

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

◆ SaveSession()

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

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

◆ 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: