29#ifndef NOMLIB_GRAPHICS_RENDER_WINDOW_HPP
30#define NOMLIB_GRAPHICS_RENDER_WINDOW_HPP
38#include "nomlib/config.hpp"
39#include "nomlib/math/Rect.hpp"
40#include "nomlib/math/Color4.hpp"
41#include "nomlib/math/Point2.hpp"
42#include "nomlib/graphics/DisplayMode.hpp"
43#include "nomlib/graphics/Renderer.hpp"
44#include "nomlib/graphics/Image.hpp"
45#include "nomlib/system/SDL_helpers.hpp"
46#include "nomlib/core/clock.hpp"
47#include "nomlib/system/File.hpp"
54 void operator()(
void* ptr);
61 typedef SelfType* RawPtr;
63 static const Point2i DEFAULT_WINDOW_POS;
64 static const Point2i WINDOW_POS_CENTERED;
65 static const uint32 DEFAULT_WINDOW_FLAGS = 0;
87 SelfType& operator =(
const SelfType& other ) =
delete;
90 bool create(
const std::string& window_title,
const Size2i& res,
93 uint32 renderer_flags = DEFAULT_RENDERER_FLAGS );
107 bool create(
const std::string& window_title,
const Point2i& pos,
108 int display_index,
const Size2i& res, uint32 window_flags,
110 uint32 renderer_flags = DEFAULT_RENDERER_FLAGS );
113 RenderWindow::RawPtr
get (
void );
116 SDL_WINDOW::RawPtr
window (
void )
const;
138 uint32 window_flags (
void )
const;
140 uint32 pixel_format (
void )
const;
171 void set_size ( int32 width, int32 height );
201 const std::string window_title (
void )
const;
203 void set_window_title (
const std::string& title );
225 NOM_EXPORT
static SDL_WINDOW::RawPtr
window_id( uint32
id );
364 NOM_EXPORT
static SDL_Renderer*
context(
void );
378 NOM_NO_EXPORT
static SDL_Renderer* context_;
380 SDL_WINDOW::UniquePtr window_;
405NOM_EXPORT RenderWindow* render_interface();
406NOM_EXPORT
void 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
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)
static NOM_EXPORT std::string display_name(int display_id)
Get the display name associated with a window.
void disable_screensaver(void)
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
static NOM_EXPORT int num_video_displays()
Get the number of available video displays.
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 NOM_EXPORT SDL_WINDOW::RawPtr window_id(uint32 id)
static NOM_EXPORT SDL_Renderer * context(void)
Obtain the active rendering context.
uint8 bits_per_pixel(void) const
Obtain the BPP (bits per pixel) of this window.
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?
static NOM_NO_EXPORT void set_context(RenderWindow::RawPtr window)
Set a new nom::RenderWindow as the active rendering context; we must always have a context active at ...
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.
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.
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.
Renderer(void)
Default constructor; initializes instance to sane defaults.
static NOM_EXPORT const int DEFAULT_RENDERING_DRIVER
The index of the default rendering driver to use.
Custom deleter for void* return of Renderer::pixels().