![]() |
Olympe Engine 2.0
2D Game Engine with ECS Architecture
|
Abstract interface for canvas editors with unified pan/zoom/grid management. More...
#include <ICanvasEditor.h>
Inheritance diagram for Olympe::ICanvasEditor:Public Member Functions | |
| virtual | ~ICanvasEditor ()=default |
| virtual void | BeginRender ()=0 |
| Begin rendering cycle for this canvas. | |
| virtual void | EndRender ()=0 |
| End rendering cycle for this canvas. | |
| virtual ImVec2 | ScreenToCanvas (const ImVec2 &screenPos) const =0 |
| Transform screen space coordinates to canvas space. | |
| virtual ImVec2 | CanvasToScreen (const ImVec2 &canvasPos) const =0 |
| Transform canvas space coordinates to screen space. | |
| virtual ImVec2 | EditorToGrid (const ImVec2 &editorPos) const =0 |
| Transform editor space to grid space. | |
| virtual ImVec2 | GridToEditor (const ImVec2 &gridPos) const =0 |
| Transform grid space to editor space. | |
| virtual ImVec2 | GetPan () const =0 |
| Get current pan offset. | |
| virtual void | SetPan (const ImVec2 &offset)=0 |
| Set pan offset directly. | |
| virtual void | PanBy (const ImVec2 &delta)=0 |
| Pan by delta amount. | |
| virtual void | ResetPan ()=0 |
| Reset pan to origin (0, 0) | |
| virtual float | GetZoom () const =0 |
| Get current zoom level. | |
| virtual void | SetZoom (float scale, const ImVec2 *zoomCenter=nullptr)=0 |
| Set zoom level directly. | |
| virtual void | ZoomBy (float factor, const ImVec2 *zoomCenter=nullptr)=0 |
| Zoom by multiplier. | |
| virtual ImVec2 | GetZoomLimits () const =0 |
| Get zoom limits (min, max) | |
| virtual void | ResetZoom ()=0 |
| Reset zoom to 1.0x. | |
| virtual void | ResetView ()=0 |
| Reset both pan and zoom to defaults. | |
| virtual CanvasGridRenderer::GridConfig | GetGridConfig () const =0 |
| Get current grid configuration. | |
| virtual void | RenderGrid (CanvasGridRenderer::GridStylePreset preset)=0 |
| Render grid using current configuration. | |
| virtual void | SetGridVisible (bool enabled)=0 |
| Enable/disable grid rendering. | |
| virtual bool | IsGridVisible () const =0 |
| Check if grid is visible. | |
| virtual ImVec2 | GetCanvasScreenPos () const =0 |
| Get canvas position on screen. | |
| virtual ImVec2 | GetCanvasSize () const =0 |
| Get canvas size in screen space. | |
| virtual void | SetCanvasScreenPos (const ImVec2 &screenPos)=0 |
| Set canvas screen position (call each frame to update) | |
| virtual void | SetCanvasSize (const ImVec2 &size)=0 |
| Set canvas size (call each frame to update) | |
| virtual void | GetCanvasVisibleBounds (ImVec2 &outMin, ImVec2 &outMax) const =0 |
| Get canvas visible area as AABB in canvas space. | |
| virtual bool | IsPointInCanvas (const ImVec2 &screenPos) const =0 |
| Check if point in screen space is within canvas bounds. | |
| virtual bool | IsCanvasHovered () const =0 |
| Check if canvas is being hovered by mouse. | |
| virtual const char * | GetCanvasName () const =0 |
| Get the name/identifier of this canvas. | |
| virtual void | RenderMinimap ()=0 |
| Render minimap overlay. | |
| virtual void | SetMinimapVisible (bool enabled)=0 |
| Enable/disable minimap rendering. | |
| virtual bool | IsMinimapVisible () const =0 |
| Check if minimap is visible. | |
| virtual void | SetMinimapSize (float scale)=0 |
| Set minimap size scale. | |
| virtual float | GetMinimapSize () const =0 |
| Get minimap size scale. | |
| virtual void | SetMinimapPosition (int position)=0 |
| Set minimap position. | |
| virtual int | GetMinimapPosition () const =0 |
| Get minimap position. | |
| virtual void | UpdateMinimapNodes (const std::vector< std::tuple< int, float, float, float, float > > &nodes, float graphMinX, float graphMaxX, float graphMinY, float graphMaxY)=0 |
| Update minimap with current graph node data. | |
| virtual void | UpdateMinimapViewport (float viewMinX, float viewMaxX, float viewMinY, float viewMaxY, float graphMinX, float graphMaxX, float graphMinY, float graphMaxY)=0 |
| Update minimap with current viewport bounds. | |
Abstract interface for canvas editors with unified pan/zoom/grid management.
Implementations:
Key contract:
Definition at line 47 of file ICanvasEditor.h.
|
virtualdefault |
Begin rendering cycle for this canvas.
Must be called at the start of each frame's canvas rendering
Implementations:
Implemented in Olympe::CustomCanvasEditor, and Olympe::ImNodesCanvasEditor.
Transform canvas space coordinates to screen space.
| canvasPos | Coordinates in canvas space (logical coordinates) |
Inverse of ScreenToCanvas: screen = canvasPos * zoom + pan + canvasOrigin
Implemented in Olympe::CustomCanvasEditor, and Olympe::ImNodesCanvasEditor.
Referenced by Olympe::PrefabCanvas::CanvasToScreen().
Here is the caller graph for this function:Transform editor space to grid space.
| editorPos | Coordinates in editor space |
Grid space removes the pan offset, allowing positions to be stored pan-independently. Useful for serialization.
For imnodes: grid space = SetNodeGridSpacePos (pan-independent storage) For custom: grid space = editorPos - pan offset
Implemented in Olympe::CustomCanvasEditor, and Olympe::ImNodesCanvasEditor.
End rendering cycle for this canvas.
Must be called at the end of each frame's canvas rendering
Implementations:
Implemented in Olympe::CustomCanvasEditor, and Olympe::ImNodesCanvasEditor.
Get the name/identifier of this canvas.
Implemented in Olympe::CustomCanvasEditor, and Olympe::ImNodesCanvasEditor.
Get canvas position on screen.
Implemented in Olympe::CustomCanvasEditor, and Olympe::ImNodesCanvasEditor.
Get canvas size in screen space.
Implemented in Olympe::CustomCanvasEditor, and Olympe::ImNodesCanvasEditor.
|
pure virtual |
Get canvas visible area as AABB in canvas space.
Useful for culling: which nodes are visible on screen?
Implemented in Olympe::CustomCanvasEditor, and Olympe::ImNodesCanvasEditor.
|
pure virtual |
Get current grid configuration.
Implemented in Olympe::CustomCanvasEditor, and Olympe::ImNodesCanvasEditor.
Get minimap position.
Implemented in Olympe::CustomCanvasEditor, and Olympe::ImNodesCanvasEditor.
Get minimap size scale.
Implemented in Olympe::CustomCanvasEditor, and Olympe::ImNodesCanvasEditor.
Get current pan offset.
Implemented in Olympe::CustomCanvasEditor, and Olympe::ImNodesCanvasEditor.
Referenced by Olympe::PrefabCanvas::AcceptComponentDropAtScreenPos(), Olympe::PrefabCanvas::GetCanvasOffset(), Olympe::PrefabCanvas::HandlePanStart(), Olympe::PrefabCanvas::RenderConnections(), Olympe::PrefabCanvas::RenderDebugInfo(), Olympe::PrefabCanvas::RenderGrid(), and Olympe::PrefabCanvas::RenderNodes().
Here is the caller graph for this function:Get current zoom level.
Implemented in Olympe::CustomCanvasEditor, and Olympe::ImNodesCanvasEditor.
Referenced by Olympe::PrefabCanvas::AcceptComponentDropAtScreenPos(), Olympe::PrefabCanvas::GetCanvasZoom(), Olympe::PrefabCanvas::RenderConnectionPreview(), Olympe::PrefabCanvas::RenderConnections(), Olympe::PrefabCanvas::RenderDebugInfo(), Olympe::PrefabCanvas::RenderGrid(), Olympe::PrefabCanvas::RenderNodes(), Olympe::PrefabCanvas::SetCanvasZoom(), and Olympe::PrefabCanvas::ZoomCanvas().
Here is the caller graph for this function:Get zoom limits (min, max)
Implemented in Olympe::CustomCanvasEditor, and Olympe::ImNodesCanvasEditor.
Referenced by Olympe::PrefabCanvas::SetCanvasZoom().
Here is the caller graph for this function:Transform grid space to editor space.
| gridPos | Coordinates in grid space |
Inverse of EditorToGrid, adds back the pan offset.
Implemented in Olympe::CustomCanvasEditor, and Olympe::ImNodesCanvasEditor.
Check if canvas is being hovered by mouse.
Implemented in Olympe::CustomCanvasEditor, and Olympe::ImNodesCanvasEditor.
Check if grid is visible.
Implemented in Olympe::CustomCanvasEditor, and Olympe::ImNodesCanvasEditor.
Check if minimap is visible.
Implemented in Olympe::CustomCanvasEditor, and Olympe::ImNodesCanvasEditor.
Check if point in screen space is within canvas bounds.
| screenPos | Position in screen space |
Implemented in Olympe::CustomCanvasEditor, and Olympe::ImNodesCanvasEditor.
Pan by delta amount.
| delta | Relative pan movement |
Implemented in Olympe::CustomCanvasEditor, and Olympe::ImNodesCanvasEditor.
Referenced by Olympe::PrefabCanvas::PanCanvas().
Here is the caller graph for this function:
|
pure virtual |
Render grid using current configuration.
| preset | Style preset to use |
Delegates to CanvasGridRenderer::RenderGrid()
Implemented in Olympe::CustomCanvasEditor, and Olympe::ImNodesCanvasEditor.
Render minimap overlay.
Renders minimap showing current viewport relative to full graph
Implementations:
Note: Must be called BEFORE EndRender() for imnodes
Implemented in Olympe::CustomCanvasEditor, and Olympe::ImNodesCanvasEditor.
Referenced by Olympe::PrefabCanvas::Render().
Here is the caller graph for this function:Reset pan to origin (0, 0)
Implemented in Olympe::CustomCanvasEditor, and Olympe::ImNodesCanvasEditor.
Reset both pan and zoom to defaults.
Implemented in Olympe::CustomCanvasEditor, and Olympe::ImNodesCanvasEditor.
Referenced by Olympe::PrefabCanvas::ResetView().
Here is the caller graph for this function:Reset zoom to 1.0x.
Implemented in Olympe::CustomCanvasEditor, and Olympe::ImNodesCanvasEditor.
Transform screen space coordinates to canvas space.
| screenPos | Coordinates in screen space (pixels from top-left of window) |
Canvas space = screen space transformed by:
Formula: canvas = (screen - canvasOrigin - pan) / zoom
Implemented in Olympe::CustomCanvasEditor, and Olympe::ImNodesCanvasEditor.
Referenced by Olympe::PrefabCanvas::Render(), and Olympe::PrefabCanvas::ScreenToCanvas().
Here is the caller graph for this function:Set canvas screen position (call each frame to update)
| screenPos | Top-left corner position in screen space |
Required for minimap coordinate calculations each frame
Implemented in Olympe::CustomCanvasEditor, and Olympe::ImNodesCanvasEditor.
Referenced by Olympe::PrefabCanvas::Render().
Here is the caller graph for this function:Set canvas size (call each frame to update)
| size | Width and height in screen space |
Required for minimap rendering calculations each frame
Implemented in Olympe::CustomCanvasEditor, and Olympe::ImNodesCanvasEditor.
Referenced by Olympe::PrefabCanvas::Render().
Here is the caller graph for this function:Enable/disable grid rendering.
| enabled | True to show grid, false to hide |
Implemented in Olympe::CustomCanvasEditor, and Olympe::ImNodesCanvasEditor.
Set minimap position.
| position | Position enum value (TopLeft, TopRight, BottomLeft, BottomRight) |
Implemented in Olympe::CustomCanvasEditor, and Olympe::ImNodesCanvasEditor.
Set minimap size scale.
| scale | Size multiplier (0.1f = 10%, 0.3f = 30% of canvas) |
Implemented in Olympe::CustomCanvasEditor, and Olympe::ImNodesCanvasEditor.
Enable/disable minimap rendering.
| enabled | True to show minimap, false to hide |
Implemented in Olympe::CustomCanvasEditor, and Olympe::ImNodesCanvasEditor.
Set pan offset directly.
| offset | New pan offset |
Used for programmatic pan (keyboard shortcut, reset view, etc.)
Implemented in Olympe::CustomCanvasEditor, and Olympe::ImNodesCanvasEditor.
Referenced by Olympe::PrefabCanvas::HandlePan(), and Olympe::PrefabCanvas::SetCanvasOffset().
Here is the caller graph for this function:
|
pure virtual |
Set zoom level directly.
| scale | New zoom scale |
| zoomCenter | Optional center point for zoom (in screen space) |
If zoomCenter provided, zoom maintains visual position of that point
Implemented in Olympe::CustomCanvasEditor, and Olympe::ImNodesCanvasEditor.
Referenced by Olympe::PrefabCanvas::SetCanvasZoom(), and Olympe::PrefabCanvas::ZoomCanvas().
Here is the caller graph for this function:
|
pure virtual |
Update minimap with current graph node data.
| nodes | Vector of (nodeId, posX, posY, width, height) tuples representing graph nodes |
| graphMinX | Graph bounds left edge |
| graphMaxX | Graph bounds right edge |
| graphMinY | Graph bounds top edge |
| graphMaxY | Graph bounds bottom edge |
Required for custom minimap rendering (CustomCanvasEditor) ImNodes minimap ignores this (uses internal ImNodes node positions)
Implemented in Olympe::CustomCanvasEditor, and Olympe::ImNodesCanvasEditor.
Referenced by Olympe::PrefabCanvas::Render().
Here is the caller graph for this function:
|
pure virtual |
Update minimap with current viewport bounds.
| viewMinX | Visible area left edge |
| viewMaxX | Visible area right edge |
| viewMinY | Visible area top edge |
| viewMaxY | Visible area bottom edge |
| graphMinX | Graph bounds left edge |
| graphMaxX | Graph bounds right edge |
| graphMinY | Graph bounds top edge |
| graphMaxY | Graph bounds bottom edge |
Required for custom minimap rendering (CustomCanvasEditor) Normalizes viewport bounds relative to graph bounds for minimap display
Implemented in Olympe::CustomCanvasEditor, and Olympe::ImNodesCanvasEditor.
Referenced by Olympe::PrefabCanvas::Render().
Here is the caller graph for this function:
|
pure virtual |
Zoom by multiplier.
| factor | Zoom multiplier (1.1 = 10% zoom in, 0.9 = 10% zoom out) |
| zoomCenter | Optional center point for zoom |
Implemented in Olympe::CustomCanvasEditor, and Olympe::ImNodesCanvasEditor.