2 #ifndef GRAMODS_GRAPHICS_WINDOW
3 #define GRAMODS_GRAPHICS_WINDOW
6 #include <gmCore/io_float.hh>
7 #include <gmCore/io_int.hh>
8 #include <gmCore/io_size.hh>
10 #include <gmGraphics/ViewBase.hh>
14 BEGIN_NAMESPACE_GMGRAPHICS;
32 key_event(
bool up,
int key) : up(up), key(key) {}
43 void renderFullPipeline(ViewSettings settings)
override;
50 void traverse(Visitor *visitor)
override;
59 void addView(std::shared_ptr<View> view) {
61 views.push_back(view);
120 virtual void setTitle(std::string t) { title = t; }
128 background_color = c;
141 virtual bool handleEvent(
event *);
148 void addEventHandler(std::function<
bool(
const event*)> fun,
void *tag);
153 void removeEventHandler(
void *tag);
182 std::vector<std::shared_ptr<View>> views;
184 bool fullscreen =
false;
186 std::string title =
"untitled gramods window";
188 gmCore::int2 position = { (std::numeric_limits<int>::max)(),
189 (std::numeric_limits<int>::max)() };
192 std::unordered_map<
void*, std::function<bool(
const event*)>> event_handlers;
195 END_NAMESPACE_GMGRAPHICS;
The common base for nodes taking renderers for dispatching rendering jobs.
Definition: ViewBase.hh:23
The base of graphics Window implementations.
Definition: Window.hh:21
virtual void swap()=0
Posts a swap buffers command to the underlying windowing system, to show the newly rendered material.
virtual void setTitle(std::string t)
Sets the title of the windows.
Definition: Window.hh:120
virtual void setSize(gmCore::size2 s)
Sets the size of the drawable canvas of this window, in pixels.
Definition: Window.hh:98
virtual void close()=0
Asks the Window to close itself.
virtual void setDisplay(size_t N)
Set on which display the window should be shown.
Definition: Window.hh:89
virtual void processEvents()=0
Triggers the windows to process its incoming events.
virtual void setBackgroundColor(gmCore::float4 c)
Set the background color of the window.
Definition: Window.hh:127
virtual gmCore::size2 getSize()
Returns the size of the drawable canvas of this window, in pixels.
Definition: Window.hh:112
virtual bool isOpen()
Returns true as long as the window is open.
Definition: Window.hh:160
virtual void setFullscreen(bool on)
Activates or deactivates fullscreen mode.
Definition: Window.hh:82
void addView(std::shared_ptr< View > view)
Adds a view to the window.
Definition: Window.hh:59
virtual void setPosition(gmCore::int2 p)
Sets the position of the window.
Definition: Window.hh:105
virtual void makeGLContextCurrent()=0
Asks the Window to make its GL context current.
std::array< int, 2 > int2
Array of 2 int.
Definition: io_int.hh:9
std::array< float, 4 > float4
Array of 4 float.
Definition: io_float.hh:18
std::array< size_t, 2 > size2
Array of 2 size_t.
Definition: io_size.hh:9
Standard exception for invalid arguments in a call to a function or object.
Definition: InvalidArgument.hh:15