Public Types | Public Member Functions | Static Public Member Functions | Private Attributes | Static Private Attributes | List of all members
nom::Window Class Reference
Inheritance diagram for nom::Window:
[legend]
Collaboration diagram for nom::Window:
[legend]

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_
 

Detailed Description

Definition at line 53 of file Window.hpp.

Member Function Documentation

SDL_RENDERER::RawPtr nom::Window::context ( void  )
static

Get the active rendering context

Returns
SDL_Renderer* Structure containing the active rendering context

Definition at line 491 of file Window.cpp.

Here is the caller graph for this function:

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

Todo:
Rename to initialize

Definition at line 57 of file Window.cpp.

Here is the call graph for this function:

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.

Todo:
Test me

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.

Returns
A nom::Coords object filled with the display bounds.
Todo:
Test me

Definition at line 188 of file Window.cpp.

Here is the call graph for this function:

void nom::Window::draw ( SDL_SURFACE::RawPtr  video_buffer,
const Coords &  bounds 
) const

Render SDL1 video surfaces

Todo:
Test me!

Definition at line 280 of file Window.cpp.

Here is the call graph for this function:

void nom::Window::enable_screensaver ( void  )

Allow the screen to be blanked by a screen saver.

Todo:
Test me
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.

Here is the call graph for this function:

VideoModeList nom::Window::getVideoModes ( void  ) const

Obtain a list of supported video modes

Returns a sorted vector of VideoMode objects, from greatest to least.

Todo:
Test out 8-bit, 16-bit, 24-bit video surfaces

Definition at line 207 of file Window.cpp.

void nom::Window::hide_window ( void  )

Hide this window

Todo:
Test me

Definition at line 438 of file Window.cpp.

Here is the call graph for this function:

void nom::Window::maximize_window ( void  )

Maximize this window.

Todo:
Test me

Definition at line 413 of file Window.cpp.

Here is the call graph for this function:

void nom::Window::minimize_window ( void  )

Minimize this window.

Todo:
Test me

Definition at line 418 of file Window.cpp.

Here is the call graph for this function:

void nom::Window::raise_window ( void  )

Raise this window.

Todo:
Test me

Definition at line 423 of file Window.cpp.

Here is the call graph for this function:

void nom::Window::restore_window ( void  )

Restore this window.

Todo:
Test me

Definition at line 428 of file Window.cpp.

Here is the call graph for this function:

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.

Here is the call graph for this function:

bool nom::Window::screen_saver ( void  )

Get the status of the OS screensaver.

Returns
TRUE if enabled; FALSE if disabled.
Todo:
Test me

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.

Here is the call graph for this function:

Here is the caller graph for this function:

void nom::Window::set_context ( Window::RawPtr  window)
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.

Here is the call graph for this function:

Here is the caller graph for this function:

void nom::Window::set_maximum_window_size ( int  max_width,
int  max_height 
)

Set the maximum size of the window's client area.

Parameters
max_widthMaximum width of window in pixels
max_heightMaximum height of window in pixels
Todo:
Test me

Definition at line 453 of file Window.cpp.

Here is the call graph for this function:

void nom::Window::set_minimum_window_size ( int  min_width,
int  min_height 
)

Set the minimum size of the window's client area.

Parameters
min_widthMinimum width of window in pixels
min_heightMinimum height of window in pixels
Todo:
Test me

Definition at line 448 of file Window.cpp.

Here is the call graph for this function:

void nom::Window::set_window_grab ( bool  grab)

Set the window input grab mode.

Parameters
grabTRUE to grab input; FALSE to release input
Todo:
Test me

Definition at line 443 of file Window.cpp.

Here is the call graph for this function:

void nom::Window::show_window ( void  )

Show this window

Todo:
Test me

Definition at line 433 of file Window.cpp.

Here is the call graph for this function:

Point2i nom::Window::size ( void  ) const

Get this window's size in pixels

Returns
Point2i object containing the width (x) and height (y)

Definition at line 135 of file Window.cpp.

Here is the call graph for this function:

bool nom::Window::toggle_fullscreen ( void  )

Set this window fullscreen if it is windowed, and windowed if it is fullscreen.

Todo:
Implement SDL_WINDOW_FULLSCREEN support – this will lead us to also looking further into the SDL_(Get/Set)WindowDisplayMode functions. We can probably get away with extending nom::VideoMode with SDL_DisplayMode* somehow; these two have the same end-goals in mind.

Definition at line 327 of file Window.cpp.

Here is the call graph for this function:

int nom::Window::window_display_id ( void  ) const

Obtain this window's display index

Returns
This window's display index

Definition at line 398 of file Window.cpp.

Here is the caller graph for this function:

uint32 nom::Window::window_flags ( void  ) const

Get display surface bits per pixel

Todo:
rename method to something more along lines of Canvas equiv.

Definition at line 161 of file Window.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

uint32 nom::Window::window_id ( void  ) const

Obtain this window's unique identifier

Returns
This window's unique identifier

Definition at line 388 of file Window.cpp.

SDL_Window * nom::Window::window_id ( uint32  id)
static

Obtain a pointer to a SDL_Window struct by ID.

Parameters
idUnique identifier used for the lookup
Returns
SDL_Window pointer if exists; NULL if no Window exists

Definition at line 393 of file Window.cpp.


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