- nom
- Window
Public Types | |
| typedef Window * | RawPtr |
Public Member Functions | |
| bool | create (const std::string &window_title, int32 width, int32 height, uint32 window_flags, uint32 context_flags=SDL_RENDERER_ACCELERATED) |
| Window::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. | |
| SDL_SURFACE::RawPtr | window_surface (void) const |
| Obtain a SDL_Surface pointer from this Window. | |
| bool | window_valid (void) const |
| Is this object initialized – not nullptr? | |
| Point2i | position (void) const |
| Obtain this Window's position. | |
| Point2i | size (void) const |
| uint32 | window_flags (void) const |
| uint32 | pixel_format (void) const |
| Obtain a pointer to this object's pixels. | |
| const Coords | display_bounds (void) const |
| VideoModeList | getVideoModes (void) const |
| void | set_position (int32 x, int32 y) |
| void | draw (SDL_SURFACE::RawPtr video_buffer, const Coords &bounds) const |
| bool | flip (void) const |
| bool | fullscreen (void) const |
| Getter for fullscreen_ state variable. | |
| void | set_fullscreen (bool state) |
| Set new fullscreen state. | |
| bool | toggle_fullscreen (void) |
| const std::string | window_title (void) const |
| void | set_window_title (const std::string &title) |
| bool | set_window_icon (const std::string &filename) |
| Set an icon for this window. | |
| uint32 | window_id (void) const |
| int | window_display_id (void) const |
| void | enable_screensaver (void) |
| void | disable_screensaver (void) |
| bool | screen_saver (void) |
| void | maximize_window (void) |
| void | minimize_window (void) |
| void | raise_window (void) |
| void | restore_window (void) |
| void | show_window (void) |
| void | hide_window (void) |
| void | set_window_grab (bool grab) |
| void | set_minimum_window_size (int min_width, int min_height) |
| void | set_maximum_window_size (int max_width, int max_height) |
| bool | save_screenshot (const std::string &filename) const |
| void | set_active (void) |
Public Member Functions inherited from nom::Renderer | |
| Renderer (void) | |
| Default constructor; initializes instance to sane defaults. | |
| virtual | ~Renderer (void) |
| Lazy destructor with nothing to do. | |
| bool | initialize (SDL_WINDOW::RawPtr window, int32 rendering_driver=-1, uint32 context_flags=SDL_RENDERER_ACCELERATED) |
| SDL_RENDERER::RawPtr | renderer (void) const |
| Get a raw pointer to the SDL_Renderer in use. | |
| bool | renderer_valid (void) const |
| Is this object initialized? Valid when NOT nullptr. | |
| const Point2i | logical_resolution (void) const |
| const Coords | viewport (void) const |
| const Point2i | scale_factor (void) const |
| Obtain the current scale factor. | |
| const SDL_BlendMode | blend_mode (void) const |
| Obtain the blending mode used for drawing. | |
| const Point2i | size (void) const |
| const Coords | bounds (void) const |
| void | update (void) const |
| Update the renderer surface on the attached window. | |
| bool | update (SDL_TEXTURE::RawPtr input_texture) |
| bool | clear (void) const |
| bool | fill (const Color &color=Color::Blue) |
| bool | set_logical_resolution (int width, int height) |
| bool | set_viewport (const Coords &rect) |
| bool | set_color (const Color &color) |
| bool | set_blend_mode (const SDL_BlendMode mode) |
| bool | set_bounds (const Coords &clip_bounds) |
| void * | pixels (void) const |
Static Public Member Functions | |
| static SDL_WINDOW::RawPtr | window_id (uint32 id) |
| static SDL_RENDERER::RawPtr | context (void) |
| static void | set_context (Window::RawPtr window) |
Private Attributes | |
| SDL_WINDOW::UniquePtr | window_ |
| uint32 | window_id_ |
| Cache the unique window identifier we get from SDL upon initialization. | |
| int | window_display_id_ |
| Cache the display identifier we get from SDL upon initialization. | |
| bool | enabled_ |
| State of the window (visible or not) | |
| bool | fullscreen_ |
| Toggle window & full-screen states. | |
Static Private Attributes | |
| static SDL_RENDERER::RawPtr | context_ = nullptr |
Additional Inherited Members | |
Protected Attributes inherited from nom::Renderer | |
| SDL_RENDERER::UniquePtr | renderer_ |
Definition at line 53 of file Window.hpp.
|
static |
Get the active rendering context
Definition at line 491 of file Window.cpp.
| bool nom::Window::create | ( | const std::string & | window_title, |
| int32 | width, | ||
| int32 | height, | ||
| uint32 | window_flags, | ||
| uint32 | context_flags = SDL_RENDERER_ACCELERATED |
||
| ) |
Initialize a SDL window and renderer
Definition at line 57 of file Window.cpp.
| void nom::Window::disable_screensaver | ( | void | ) |
Prevent the screen from being blanked by a screen saver.
It is automatically re-enabled by SDL upon exit.
Definition at line 403 of file Window.cpp.
| const Coords nom::Window::display_bounds | ( | void | ) | const |
Get the desktop area represented by a display monitor
The primary desktop display is located at 0, 0.
Definition at line 188 of file Window.cpp.
| void nom::Window::draw | ( | SDL_SURFACE::RawPtr | video_buffer, |
| const Coords & | bounds | ||
| ) | const |
Render SDL1 video surfaces
Definition at line 280 of file Window.cpp.
| void nom::Window::enable_screensaver | ( | void | ) |
Allow the screen to be blanked by a screen saver.
| bool nom::Window::flip | ( | void | ) | const |
Update the surface of the screen inside the window
(For use only with SDL Surfaces API)
Equivalent to SDL 1.2 API SDL_Flip()
Definition at line 305 of file Window.cpp.
| VideoModeList nom::Window::getVideoModes | ( | void | ) | const |
Obtain a list of supported video modes
Returns a sorted vector of VideoMode objects, from greatest to least.
Definition at line 207 of file Window.cpp.
| void nom::Window::hide_window | ( | void | ) |
Hide this window
Definition at line 438 of file Window.cpp.
| void nom::Window::maximize_window | ( | void | ) |
Maximize this window.
Definition at line 413 of file Window.cpp.
| void nom::Window::minimize_window | ( | void | ) |
Minimize this window.
Definition at line 418 of file Window.cpp.
| void nom::Window::raise_window | ( | void | ) |
Raise this window.
Definition at line 423 of file Window.cpp.
| void nom::Window::restore_window | ( | void | ) |
Restore this window.
Definition at line 428 of file Window.cpp.
| bool nom::Window::save_screenshot | ( | const std::string & | filename | ) | const |
Save a screenshot of the window as an uncompressed RGB Windows Bitmap (BMP) file.
Pixels pitch calculation
Definition at line 458 of file Window.cpp.
| bool nom::Window::screen_saver | ( | void | ) |
Get the status of the OS screensaver.
Definition at line 408 of file Window.cpp.
| void nom::Window::set_active | ( | void | ) |
Set the current Window as the active rendering context; this must be called before doing any drawing (this includes creation of textures) when using multiple rendering windows.
Definition at line 486 of file Window.cpp.
|
static |
Set a new nom::Window as the active rendering context; we must always have at least one context active at any given time, even for generating SDL_Textures.
This is a low-level, internal function call, to be used within this library elsewhere.
Definition at line 496 of file Window.cpp.
| void nom::Window::set_maximum_window_size | ( | int | max_width, |
| int | max_height | ||
| ) |
Set the maximum size of the window's client area.
| max_width | Maximum width of window in pixels |
| max_height | Maximum height of window in pixels |
Definition at line 453 of file Window.cpp.
| void nom::Window::set_minimum_window_size | ( | int | min_width, |
| int | min_height | ||
| ) |
Set the minimum size of the window's client area.
| min_width | Minimum width of window in pixels |
| min_height | Minimum height of window in pixels |
Definition at line 448 of file Window.cpp.
| void nom::Window::set_window_grab | ( | bool | grab | ) |
Set the window input grab mode.
| grab | TRUE to grab input; FALSE to release input |
Definition at line 443 of file Window.cpp.
| void nom::Window::show_window | ( | void | ) |
Show this window
Definition at line 433 of file Window.cpp.
| Point2i nom::Window::size | ( | void | ) | const |
Get this window's size in pixels
Definition at line 135 of file Window.cpp.
| bool nom::Window::toggle_fullscreen | ( | void | ) |
Set this window fullscreen if it is windowed, and windowed if it is fullscreen.
Definition at line 327 of file Window.cpp.
| int nom::Window::window_display_id | ( | void | ) | const |
Obtain this window's display index
Definition at line 398 of file Window.cpp.
| uint32 nom::Window::window_flags | ( | void | ) | const |
Get display surface bits per pixel
Definition at line 161 of file Window.cpp.
| uint32 nom::Window::window_id | ( | void | ) | const |
Obtain this window's unique identifier
Definition at line 388 of file Window.cpp.
|
static |
Obtain a pointer to a SDL_Window struct by ID.
| id | Unique identifier used for the lookup |
Definition at line 393 of file Window.cpp.