|
Flint Engine
Modular C++20 2D game engine powered by SDL3
|
SDL3 window implementation that also exposes the SDL GPU context. More...
#include <flint/window/sdl-window.h>
Inheritance diagram for Flint::SdlWindow:
Collaboration diagram for Flint::SdlWindow:Public Member Functions | |
| SdlWindow (const ApplicationConfig &config, GRAPHICS_BACKEND backend) | |
| Create and show an SDL window. | |
| void | display () override |
| Present the current frame to the screen. | |
| bool | isOpen () const override |
| Return true if the window is open and the application should keep running. | |
| void | setMouseCursor (CursorType type) override |
| Set the mouse cursor shape. | |
| void | pollEvents (const std::function< void(const AppEvent &)> &handler) override |
Poll all pending OS events and dispatch them to handler. | |
| void | setTitle (const std::string &name) override |
| Set the window title. | |
| void | close () override |
| Signal that the window should close at the end of the current frame. | |
| Flint::Vec2i | getSize () const override |
| Return the current window size in pixels. | |
| Flint::Vec2f | getMousePosition () const override |
| Return the current mouse cursor position in window-space pixels. | |
| Flint::Vec2f | mapPixelToCoords (Flint::Vec2f pixel) const override |
| Pass-through pixel-to-coord mapping (no scaling applied). | |
| void | addGlobalEventListener (std::function< void(const AppEvent &)> callback) override |
| Register a global event listener that receives every polled event. | |
| bool | hasFocus () const override |
| Return true if the window currently has input focus. | |
| void * | getNativeHandle () const override |
| Return the platform-native window handle (e.g. HWND, SDL_Window*). | |
| void | setGPUDevice (SDL_GPUDevice *device) override |
| Store the SDL GPU device created by the renderer (IGPUContext). | |
| SDL_GPUDevice * | getGPUDevice () override |
| Return the SDL GPU device (IGPUContext). | |
| SDL_GPUCommandBuffer * | getCommandBuffer () override |
| Return the current frame's command buffer (IGPUContext). | |
| SDL_GPURenderPass * | getRenderPass () override |
| Return the current frame's render pass (IGPUContext). | |
| bool | isFullscreen () const override |
| Return true if the window is in fullscreen mode. | |
| void | setFullscreen (bool fullscreen) override |
| Enter or exit fullscreen mode. | |
Public Member Functions inherited from Flint::IWindow | |
Public Member Functions inherited from Flint::IGPUContext | |
SDL3 window implementation that also exposes the SDL GPU context.
Implements both IWindow (for event polling and presentation) and IGPUContext (for GPU device, command buffer, and render pass access). The Application and GPURenderer obtain GPU handles through this class without depending on any other platform type.
Definition at line 23 of file sdl-window.h.
|
explicit |
Create and show an SDL window.
| config | Application configuration |
|
overridevirtual |
Register a global event listener that receives every polled event.
Multiple listeners can be registered; they are called in registration order.
| callback | Listener invoked for each AppEvent. |
Implements Flint::IWindow.
|
inlineoverridevirtual |
Signal that the window should close at the end of the current frame.
Implements Flint::IWindow.
Definition at line 44 of file sdl-window.h.
|
overridevirtual |
Present the current frame to the screen.
Implements Flint::IWindow.
|
inlineoverridevirtual |
Return the current frame's command buffer (IGPUContext).
Implements Flint::IGPUContext.
Definition at line 86 of file sdl-window.h.
|
inlineoverridevirtual |
Return the SDL GPU device (IGPUContext).
Implements Flint::IGPUContext.
Definition at line 81 of file sdl-window.h.
|
inlineoverridevirtual |
Return the current mouse cursor position in window-space pixels.
Implements Flint::IWindow.
Definition at line 56 of file sdl-window.h.
|
inlineoverridevirtual |
Return the platform-native window handle (e.g. HWND, SDL_Window*).
Cast to the appropriate platform type when needed.
Implements Flint::IWindow.
Definition at line 71 of file sdl-window.h.
|
inlineoverridevirtual |
Return the current frame's render pass (IGPUContext).
Implements Flint::IGPUContext.
Definition at line 91 of file sdl-window.h.
|
inlineoverridevirtual |
Return the current window size in pixels.
Implements Flint::IWindow.
Definition at line 49 of file sdl-window.h.
|
overridevirtual |
Return true if the window currently has input focus.
Implements Flint::IWindow.
|
inlineoverridevirtual |
Return true if the window is in fullscreen mode.
Implements Flint::IWindow.
Definition at line 96 of file sdl-window.h.
|
overridevirtual |
Return true if the window is open and the application should keep running.
Implements Flint::IWindow.
|
inlineoverridevirtual |
Pass-through pixel-to-coord mapping (no scaling applied).
Implements Flint::IWindow.
Definition at line 63 of file sdl-window.h.
|
overridevirtual |
Poll all pending OS events and dispatch them to handler.
| handler | Callback invoked once for each pending AppEvent. |
Implements Flint::IWindow.
|
inlineoverridevirtual |
Enter or exit fullscreen mode.
| fullscreen | true to enter SDL_WINDOW_FULLSCREEN mode. |
Implements Flint::IWindow.
Definition at line 106 of file sdl-window.h.
|
inlineoverridevirtual |
Store the SDL GPU device created by the renderer (IGPUContext).
Implements Flint::IGPUContext.
Definition at line 76 of file sdl-window.h.
|
overridevirtual |
|
inlineoverridevirtual |