Flint Engine
Modular C++20 2D game engine powered by SDL3
Loading...
Searching...
No Matches
Flint::IWindow Class Referenceabstract

Abstract interface for a platform window. More...

#include <flint/window/IWindow.h>

+ Inheritance diagram for Flint::IWindow:
+ Collaboration diagram for Flint::IWindow:

Public Member Functions

virtual void display ()=0
 Present the current frame to the screen.
 
virtual void setMouseCursor (CursorType type)=0
 Set the mouse cursor shape.
 
virtual bool isOpen () const =0
 Return true if the window is open and the application should keep running.
 
virtual void pollEvents (const std::function< void(const AppEvent &)> &handler)=0
 Poll all pending OS events and dispatch them to handler.
 
virtual void setTitle (const std::string &name)=0
 Set the window title bar text.
 
virtual void close ()=0
 Request that the window close.
 
virtual Vec2f getMousePosition () const =0
 Return the current mouse cursor position in window-space pixels.
 
virtual Vec2f mapPixelToCoords (Vec2f pixel) const =0
 Return the current mouse cursor position in window-space pixels.
 
virtual Vec2i getSize () const =0
 Return the current window size in pixels.
 
virtual void addGlobalEventListener (std::function< void(const AppEvent &)> callback)=0
 Register a global event listener that receives every polled event.
 
virtual bool hasFocus () const =0
 Return true if the window currently has input focus.
 
virtual void * getNativeHandle () const =0
 Return the platform-native window handle (e.g. HWND, SDL_Window*).
 
virtual bool isFullscreen () const =0
 Return true if the window is currently in fullscreen mode.
 
virtual void setFullscreen (bool fullscreen)=0
 Enter or exit fullscreen mode.
 

Detailed Description

Abstract interface for a platform window.

Provides event polling, display/present, mouse queries, and window manipulation. The concrete implementation (SdlWindow) also implements IGPUContext so the renderer can obtain GPU handles through this interface.

Definition at line 27 of file IWindow.h.

Member Function Documentation

◆ addGlobalEventListener()

virtual void Flint::IWindow::addGlobalEventListener ( std::function< void(const AppEvent &)> callback)
pure virtual

Register a global event listener that receives every polled event.

Multiple listeners can be registered; they are called in registration order.

Parameters
callbackListener invoked for each AppEvent.

Implemented in Flint::SdlWindow.

◆ close()

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

Request that the window close.

isOpen() will return false after this call.

Implemented in Flint::SdlWindow.

◆ display()

virtual void Flint::IWindow::display ( )
pure virtual

Present the current frame to the screen.

Implemented in Flint::SdlWindow.

◆ getMousePosition()

virtual Vec2f Flint::IWindow::getMousePosition ( ) const
pure virtual

Return the current mouse cursor position in window-space pixels.

Implemented in Flint::SdlWindow.

◆ getNativeHandle()

virtual void * Flint::IWindow::getNativeHandle ( ) const
pure virtual

Return the platform-native window handle (e.g. HWND, SDL_Window*).

Cast to the appropriate platform type when needed.

Returns
Opaque native handle as void*.

Implemented in Flint::SdlWindow.

◆ getSize()

virtual Vec2i Flint::IWindow::getSize ( ) const
pure virtual

Return the current window size in pixels.

Implemented in Flint::SdlWindow.

◆ hasFocus()

virtual bool Flint::IWindow::hasFocus ( ) const
pure virtual

Return true if the window currently has input focus.

Implemented in Flint::SdlWindow.

◆ isFullscreen()

virtual bool Flint::IWindow::isFullscreen ( ) const
pure virtual

Return true if the window is currently in fullscreen mode.

Implemented in Flint::SdlWindow.

◆ isOpen()

virtual bool Flint::IWindow::isOpen ( ) const
pure virtual

Return true if the window is open and the application should keep running.

Implemented in Flint::SdlWindow.

◆ mapPixelToCoords()

virtual Vec2f Flint::IWindow::mapPixelToCoords ( Vec2f pixel) const
pure virtual

Return the current mouse cursor position in window-space pixels.

Implemented in Flint::SdlWindow.

◆ pollEvents()

virtual void Flint::IWindow::pollEvents ( const std::function< void(const AppEvent &)> & handler)
pure virtual

Poll all pending OS events and dispatch them to handler.

Parameters
handlerCallback invoked once for each pending AppEvent.

Implemented in Flint::SdlWindow.

◆ setFullscreen()

virtual void Flint::IWindow::setFullscreen ( bool fullscreen)
pure virtual

Enter or exit fullscreen mode.

Parameters
fullscreentrue to enter fullscreen, false to restore windowed mode.

Implemented in Flint::SdlWindow.

◆ setMouseCursor()

virtual void Flint::IWindow::setMouseCursor ( CursorType type)
pure virtual

Set the mouse cursor shape.

Parameters
typeDesired cursor shape.

Implemented in Flint::SdlWindow.

◆ setTitle()

virtual void Flint::IWindow::setTitle ( const std::string & name)
pure virtual

Set the window title bar text.

Parameters
nameNew title string.

Implemented in Flint::SdlWindow.


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