29#ifndef NOMLIB_GRAPHICS_RENDER_WINDOW_HPP
30#define NOMLIB_GRAPHICS_RENDER_WINDOW_HPP
37#include "nomlib/config.hpp"
38#include "nomlib/math/Rect.hpp"
39#include "nomlib/math/Color4.hpp"
40#include "nomlib/math/Point2.hpp"
41#include "nomlib/graphics/DisplayMode.hpp"
42#include "nomlib/graphics/Renderer.hpp"
43#include "nomlib/graphics/Image.hpp"
44#include "nomlib/system/SDL_helpers.hpp"
45#include "nomlib/core/clock.hpp"
46#include "nomlib/system/File.hpp"
53 void operator()(
void* ptr);
60 typedef SelfType* RawPtr;
62 static const Point2i DEFAULT_WINDOW_POS;
63 static const Point2i WINDOW_POS_CENTERED;
64 static const uint32 DEFAULT_WINDOW_FLAGS = 0;
89 bool create(
const std::string& window_title,
const Size2i& res,
92 uint32 renderer_flags = DEFAULT_RENDERER_FLAGS );
106 bool create(
const std::string& window_title,
const Point2i& pos,
107 int display_index,
const Size2i& res, uint32 window_flags,
109 uint32 renderer_flags = DEFAULT_RENDERER_FLAGS );
112 RenderWindow::RawPtr
get (
void );
115 SDL_WINDOW::RawPtr
window (
void )
const;
137 uint32 window_flags (
void )
const;
139 uint32 pixel_format (
void )
const;
170 void set_size ( int32 width, int32 height );
200 const std::string window_title (
void )
const;
202 void set_window_title (
const std::string& title );
377 static SDL_Renderer* context_;
379 SDL_WINDOW::UniquePtr window_;
404RenderWindow* render_interface();
405void set_render_interface(RenderWindow& win);
void restore_window(void)
void enable_screensaver(void)
int window_display_id_
The unique identifier given to the display.
bool create(const std::string &window_title, const Size2i &res, uint32 window_flags, int rendering_driver=DEFAULT_RENDERING_DRIVER, uint32 renderer_flags=DEFAULT_RENDERER_FLAGS)
Initialize a native platform window and renderer.
const IntRect display_bounds(void) const
static std::string display_name(int display_id)
Get the display name associated with a window.
const uint8 bits_per_pixel(void) const
Obtain the BPP (bits per pixel) of this window.
static int num_video_displays()
Get the number of available video displays.
bool enabled_
State of the window (visible or not).
Point2i position() const
Get the window's current position.
int window_display_id() const
Get the display index associated with this window.
void minimize_window(void)
void disable_screensaver(void)
static void set_context(RenderWindow::RawPtr window)
Set a new nom::RenderWindow as the active rendering context; we must always have a context active at ...
bool save_png_file(const std::string &filename) const
Output a screen-shot of the window as a PNG file.
void set_window_grab(bool grab)
bool save_screenshot(const std::string &filename) const
bool create(const std::string &window_title, const Point2i &pos, int display_index, const Size2i &res, uint32 window_flags, int rendering_driver=DEFAULT_RENDERING_DRIVER, uint32 renderer_flags=DEFAULT_RENDERER_FLAGS)
Initialize a native platform window and renderer.
bool toggle_fullscreen(uint32 flags)
SDL_SURFACE::RawPtr window_surface(void) const
Obtain a SDL_Surface pointer from this Window.
RenderWindow::RawPtr get(void)
Obtain a pointer to this Window object.
SDL_WINDOW::RawPtr window(void) const
Returns a raw pointer to the SDL_Window struct in use for this object.
void maximize_window(void)
uint32 window_id(void) const
~RenderWindow(void)
Destructor; the current rendering context for the object is freed at this time.
static SDL_WINDOW::RawPtr window_id(uint32 id)
bool set_window_icon(const std::string &filename)
Set an icon for this window.
bool fullscreen_
Toggle window & full-screen states.
void set_position(const Point2i &window_pos)
Set the window's position.
SDL_Window * mouse_focus(void) const
Get the window which currently has mouse focus.
void set_fullscreen(bool state)
Set new fullscreen state.
void set_minimum_window_size(int min_width, int min_height)
int refresh_rate() const
Get a video mode's refresh rate for the display of the window.
bool toggle_fullscreen(void)
Set this window full screen if it is windowed, and windowed if it is full screen.
RenderWindow(void)
Default constructor; initialize an object to sane, but invalid defaults.
bool window_valid(void) const
Is this object initialized – not nullptr?
void set_maximum_window_size(int max_width, int max_height)
bool valid(void) const
Get validity of the window and rendering context.
RenderWindow(const SelfType ©)=delete
Copy constructor.
SelfType & operator=(const SelfType &other)=delete
Copy assignment operator.
bool display_modes(DisplayModeList &modes) const
Get the display mode capabilities of the window.
uint32 window_id_
The unique identifier as recognized internally by SDL.
static SDL_Renderer * context(void)
Obtain the active rendering context.
Size2i size(void) const
Get this window's size dimensions.
bool fullscreen(void) const
Getter for fullscreen_ state variable.
std::string display_name() const
Get the display name associated with this window.
static const int DEFAULT_RENDERING_DRIVER
The index of the default rendering driver to use.
Renderer(void)
Default constructor; initializes instance to sane defaults.
Custom deleter for void* return of Renderer::pixels().