igraphic 0.2.0
Contrats graphiques chargeables : IGraphic2Module / IGraphic3Module
Loading...
Searching...
No Matches
graphic::IWindow Interface Referenceabstract

Window lifecycle. No drawing here : every window, 2D-capable or not, has to open, close and pump its events. See IWindow2 for 2D drawing, IWindow3 for 3D. More...

#include <IWindow.hpp>

Inheritance diagram for graphic::IWindow:

Public Member Functions

virtual ~IWindow ()=default
 Destroy the IWindow object.
 
virtual bool isOpen ()=0
 notice if the window is open
 
virtual void close ()=0
 close the window
 
virtual Vector2f getPosition ()=0
 Where the window sits on the desktop, in pixels, origin top-left of the primary screen.
 
virtual void setPosition (Vector2f position)=0
 Move the window on the desktop.
 
virtual Vector2f getSize ()=0
 The drawable area, in pixels - NOT the desktop size. A hit-test built on IMouse::getPosition() compares against this one.
 
virtual void setSize (Vector2f size)=0
 Resize the drawable area.
 
virtual void setFrameLimit (int32_t limit)=0
 Set the Frame Limit object.
 
virtual void setMouseVisibility (bool visible)=0
 Show or hide the system cursor over THIS window.
 
virtual int32_t getDelta ()=0
 Get the Delta object.
 
virtual bool pollEvent ()=0
 Drains the whole native queue for this frame and refreshes device state. This is the frame's event pump.
 
virtual void eventClose ()=0
 notice the window that a close was requested
 

Detailed Description

Window lifecycle. No drawing here : every window, 2D-capable or not, has to open, close and pump its events. See IWindow2 for 2D drawing, IWindow3 for 3D.

Native input (keyboard/mouse/pad) is created from the module, handing it the window : createKeyboard(window). The window is what pumps the events they depend on.

Constructor & Destructor Documentation

◆ ~IWindow()

virtual graphic::IWindow::~IWindow ( )
virtualdefault

Destroy the IWindow object.

Member Function Documentation

◆ close()

virtual void graphic::IWindow::close ( )
pure virtual

close the window

◆ eventClose()

virtual void graphic::IWindow::eventClose ( )
pure virtual

notice the window that a close was requested

◆ getDelta()

virtual int32_t graphic::IWindow::getDelta ( )
pure virtual

Get the Delta object.

Returns
__int32_t

◆ getPosition()

virtual Vector2f graphic::IWindow::getPosition ( )
pure virtual

Where the window sits on the desktop, in pixels, origin top-left of the primary screen.

Returns
Vector2f

◆ getSize()

virtual Vector2f graphic::IWindow::getSize ( )
pure virtual

The drawable area, in pixels - NOT the desktop size. A hit-test built on IMouse::getPosition() compares against this one.

Returns
Vector2f

◆ isOpen()

virtual bool graphic::IWindow::isOpen ( )
pure virtual

notice if the window is open

Returns
bool

◆ pollEvent()

virtual bool graphic::IWindow::pollEvent ( )
pure virtual

Drains the whole native queue for this frame and refreshes device state. This is the frame's event pump.

ONE call per frame. ALWAYS written as a condition :

if (window->pollEvent()) {
window->eventClose();
if (kb->isKeyPressed(KEY_SPACE)) jump(); // fronts here
}

Calling it again in the same frame finds the native queue empty, adds nothing, and answers the same thing : two readers sharing a window cannot steal each other's events. An arcade drawing a menu and a game running inside it both read the keyboard, and neither has to know about the other.

What was drained is dropped by endDraw(), the frame boundary.

ONLY THE FRONTS go inside the condition - isKeyPressed and isKeyReleased, which are false anyway when nothing happened. isKeyDown, isKeyUp and whichKeyDown() are states : they stay true across frames with no event at all, so they are read outside. See IKeyboard for the detail.

Returns
true if anything happened this frame. A vendor with no queue (raylib) cannot know and answers true always, which is harmless as long as the rule above is held.

◆ setFrameLimit()

virtual void graphic::IWindow::setFrameLimit ( int32_t  limit)
pure virtual

Set the Frame Limit object.

Parameters
limit

◆ setMouseVisibility()

virtual void graphic::IWindow::setMouseVisibility ( bool  visible)
pure virtual

Show or hide the system cursor over THIS window.

For any game that draws its own pointer - a crosshair, a selection ring - where the native arrow sitting on top of it is just a second, wrong cursor.

Scoped to the window, not to the desktop : leaving it puts the arrow back, and closing the window can never strand the user without a pointer. Vendors whose cursor is process-wide (raylib) restore it on close for the same reason.

Hiding does NOT capture the mouse : IMouse::getPosition() keeps answering, and the pointer still leaves the window normally.

Parameters
visible

◆ setPosition()

virtual void graphic::IWindow::setPosition ( Vector2f  position)
pure virtual

Move the window on the desktop.

Parameters
position

◆ setSize()

virtual void graphic::IWindow::setSize ( Vector2f  size)
pure virtual

Resize the drawable area.

Parameters
size

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