zenilib: Zeni::Window Class Reference

zenilib 0.5.3.0

- Main Page
- Modules
- Namespaces
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Friends | List of all members
Zeni::Window Class Reference
Zenilib

The Window Management Singleton. More...

`#include <Window.h>`

Inherits Zeni::Singleton< Window >.

## Public Types

enum | Mouse_State { MOUSE_NORMAL, MOUSE_GRABBED = 1, MOUSE_HIDDEN = 2, MOUSE_GRABBED_AND_HIDDEN = 3, MOUSE_RELATIVE = 7 }

## Public Member Functions

void | alert_window_resized (const Point2i &resolution)
| Tell Window that it has been resized. More...
Mouse_State | get_mouse_state () const
| Find out if the mouse cursor is grabbed/hidden/relative. More...
const std::vector< Point2i > & | get_resolutions () const
| Get available full screen resolutions. More...
const String & | get_taskmsg () const
| Get the taskbar message. More...
const String & | get_title () const
| Get the window title. More...
void | set_mouse_state (const Mouse_State &mouse_state)
Public Member Functions inherited from Zeni::Singleton< Window >
void | fax_post_reinit (Event::Handler *const &handler)
void | fax_pre_uninit (Event::Handler *const &handler)
void | give_post_reinit (Event::Handler *const &handler)
void | give_pre_uninit (Event::Handler *const &handler)
void | lend_post_reinit (Event::Handler *const &handler)
void | lend_pre_uninit (Event::Handler *const &handler)

## Static Public Member Functions

static const int & | get_height ()
| Get the height of the window. More...
static const bool & | get_opengl_flag ()
static const Point2i & | get_size ()
static const int & | get_width ()
| Get the size of the window. More...
static const bool & | is_enabled ()
| Determine whether the use of rendering is desired. More...
static const bool & | is_frame_visible ()
| Determine whether the frame is visible (windowed only) More...
static const bool & | is_full_screen ()
| Determine whether the window is windowed or full screen. More...
static const bool & | is_resizable ()
| Determine whether the frame is resizable (windowed only) More...
static void | preinit_from_xml (const XML_Element_c &video)
| Set rendering options from an XML data structure. More...
static void | preinit_full_screen (const bool &full_screen=false)
| Set the rendering window to be full screen at launch. More...
static void | preinit_resizable (const bool &resizable_=true)
| Allow the frame to be dynamically resized when in windows mode. More...
static void | preinit_resolution (const Point2i &resolution=Point2i(800, 600))
| Set the rendering window to have a given resolution. More...
static void | preinit_show_frame (const bool &show_frame_=true)
| Show a frame around the rendering window when in windowed mode. More...
static void | set_enabled (const bool &enabled)
| Enable/Disable the use of rendering; This will not close the rendering window once it is open. More...
static void | set_failsafe_defaults ()
| Set failsafe default options. More...
static bool | set_icon (const String &filename)
| Set the window icon. More...
static void | set_opengl_flag (const bool &on=true)
static void | set_taskmsg (const String &taskmsg)
| Set the taskbar message. More...
static void | set_title (const String &title)
| Set the window title. More...
static void | set_tt (const String &title, const String &taskmsg)
| Set the window title and taskbar message. More...
Static Public Member Functions inherited from Zeni::Singleton< Window >
static void | completely_destroy ()
static void | destroy ()
static Window & | get ()
static bool | is_initialized ()
static void | remove_post_reinit (Event::Handler *const &handler)
static void | remove_pre_uninit (Event::Handler *const &handler)

## Protected Member Functions

| Window ()
| ~Window ()
SDL_Surface * | get_display_surface ()
Protected Member Functions inherited from Zeni::Singleton< Window >
| Singleton ()
virtual | ~Singleton ()

## Friends

class | Singleton< Window >

## Detailed Description

The Window Management Singleton.

Author
  bazald

Contact: bazal.nosp@m.d@ze.nosp@m.nipex.nosp@m..com

Definition at line 53 of file Window.h.

## Member Enumeration Documentation

enum Zeni::Window::Mouse_State

Enumerator
MOUSE_NORMAL |
MOUSE_GRABBED |
MOUSE_HIDDEN |
MOUSE_GRABBED_AND_HIDDEN |
MOUSE_RELATIVE |

Definition at line 98 of file Window.h.

## Constructor & Destructor Documentation

Zeni::Window::Window | ( |  | ) |

protected

Definition at line 122 of file Window.cpp.

References Zeni::Core::assert_no_error(), SDL_PixelFormat::BitsPerPixel, EGL_BLUE_SIZE, EGL_DEFAULT_DISPLAY, EGL_FALSE, EGL_GREEN_SIZE, EGL_HEIGHT, EGL_NATIVE_VISUAL_ID, EGL_NO_CONTEXT, EGL_NO_DISPLAY, EGL_NO_SURFACE, EGL_NONE, EGL_RED_SIZE, EGL_SURFACE_TYPE, EGL_WIDTH, EGL_WINDOW_BIT, eglChooseConfig(), eglCreateContext(), eglCreateWindowSurface(), eglDestroyContext(), eglDestroySurface(), eglGetConfigAttrib(), eglGetDisplay(), eglInitialize(), eglMakeCurrent(), eglQuerySurface(), eglTerminate(), Zeni::get_Core(), Zeni::Video::get_vertical_sync(), SDL_DisplayMode::h, SDL_Rect::h, i, SDL_SysWMinfo::info, Zeni::Singleton< TYPE >::lend_post_reinit(), Zeni::Singleton< TYPE >::lend_pre_uninit(), memset, MINIMUM_SCREEN_HEIGHT, MINIMUM_SCREEN_WIDTH, NULL, Zeni::Core::print_error(), Zeni::Singleton< Core >::remove_post_reinit(), SDL_CreateWindow(), SDL_GetDisplayBounds(), SDL_GetDisplayMode(), SDL_GetNumDisplayModes(), SDL_GetWindowWMInfo(), SDL_GL_SetAttribute(), SDL_INIT_VIDEO, SDL_InitSubSystem(), SDL_ShowWindow(), SDL_VERSION, SDL_WINDOW_BORDERLESS, SDL_WINDOW_FULLSCREEN, SDL_WINDOW_OPENGL, SDL_WINDOW_RESIZABLE, SDL_WINDOWPOS_CENTERED, Zeni::Core::set_screen_saver(), SDL_SysWMinfo::version, SDL_DisplayMode::w, SDL_Rect::w, Zeni::window_mode_lt(), Zeni::Point2i::x, Zeni::Point2i::y, and ZENI_LOGW().

Zeni::Window::~Window | ( |  | ) |

protected

Definition at line 354 of file Window.cpp.

References Zeni::Core::assert_no_error(), EGL_NO_CONTEXT, EGL_NO_DISPLAY, EGL_NO_SURFACE, eglDestroyContext(), eglDestroySurface(), eglMakeCurrent(), eglTerminate(), Zeni::get_Core(), Zeni::Core::print_error(), Zeni::Singleton< Core >::remove_pre_uninit(), SDL_DestroyWindow(), SDL_FreeSurface(), SDL_INIT_VIDEO, SDL_QuitSubSystem(), and Zeni::Core::set_screen_saver().

## Member Function Documentation

void Zeni::Window::alert_window_resized | ( | const Point2i & | resolution | ) |

Tell Window that it has been resized.

Definition at line 498 of file Window.cpp.

References Zeni::Core::assert_no_error(), Zeni::Image::color_space(), Zeni::Image::get_data(), SDL_Surface::h, Zeni::Image::height(), NULL, Zeni::Image::RGBA, SDL_CreateRGBSurfaceFrom(), SDL_FreeSurface(), SDL_SetWindowIcon(), SDL_SetWindowTitle(), SDL_ShowWindow(), set_icon(), set_tt(), SDL_Surface::w, Zeni::Image::width(), Zeni::Point2i::x, and Zeni::Point2i::y.

Referenced by Zeni::Video::change_resolution().

SDL_Surface * Zeni::Window::get_display_surface | ( |  | ) |

inlineprotected

Definition at line 75 of file Window.hxx.

const int & Zeni::Window::get_height | ( |  | ) |

inlinestatic

Get the height of the window.

Definition at line 37 of file Window.hxx.

References Zeni::Point2i::y.

Referenced by android_main(), Zeni::Video::change_resolution(), Zeni::Game::run(), and Zeni::Video::save().

Window::Mouse_State Zeni::Window::get_mouse_state | ( |  | ) | const

Find out if the mouse cursor is grabbed/hidden/relative.

Definition at line 465 of file Window.cpp.

References Zeni::get_Window(), MOUSE_GRABBED, MOUSE_GRABBED_AND_HIDDEN, MOUSE_HIDDEN, MOUSE_NORMAL, MOUSE_RELATIVE, SDL_ENABLE, SDL_GetRelativeMouseMode(), SDL_GetWindowGrab(), SDL_QUERY, SDL_ShowCursor(), and SDL_TRUE.

Referenced by Zeni::Gamestate_Base::on_active(), and Zeni::Widget_Gamestate::on_push().

const bool & Zeni::Window::get_opengl_flag | ( |  | ) |

static

Definition at line 429 of file Window.cpp.

const std::vector< Point2i > & Zeni::Window::get_resolutions | ( |  | ) | const

inline

Get available full screen resolutions.

Definition at line 66 of file Window.hxx.

const Point2i & Zeni::Window::get_size | ( |  | ) |

inlinestatic

Definition at line 29 of file Window.hxx.

Referenced by Zeni::Video_DX9::create_Texture(), Zeni::Video_GL_Shader::get_render_target_size(), Zeni::Video_GL_Fixed::get_render_target_size(), and Zeni::Video_DX9::get_render_target_size().

const String & Zeni::Window::get_taskmsg | ( |  | ) | const

inline

Get the taskbar message.

Definition at line 84 of file Window.hxx.

const String & Zeni::Window::get_title | ( |  | ) | const

inline

Get the window title.

Definition at line 80 of file Window.hxx.

const int & Zeni::Window::get_width | ( |  | ) |

inlinestatic

Get the size of the window.

Get the width of the window

Definition at line 33 of file Window.hxx.

References Zeni::Point2i::x.

Referenced by android_main(), Zeni::Video::change_resolution(), Zeni::Game::run(), and Zeni::Video::save().

const bool & Zeni::Window::is_enabled | ( |  | ) |

inlinestatic

Determine whether the use of rendering is desired.

Definition at line 25 of file Window.hxx.

Referenced by engine_draw_frame(), and main2().

const bool & Zeni::Window::is_frame_visible | ( |  | ) |

inlinestatic

Determine whether the frame is visible (windowed only)

Definition at line 58 of file Window.hxx.

const bool & Zeni::Window::is_full_screen | ( |  | ) |

inlinestatic

Determine whether the window is windowed or full screen.

Definition at line 54 of file Window.hxx.

Referenced by Zeni::Video::save().

const bool & Zeni::Window::is_resizable | ( |  | ) |

inlinestatic

Determine whether the frame is resizable (windowed only)

Definition at line 62 of file Window.hxx.

void Zeni::Window::preinit_from_xml | ( | const XML_Element_c & | video | ) |

static

Set rendering options from an XML data structure.

Definition at line 417 of file Window.cpp.

References preinit_full_screen(), and preinit_resolution().

Referenced by Zeni::Video::preinit_from_file().

void Zeni::Window::preinit_full_screen | ( | const bool & | full_screen = `false` | ) |

static

Set the rendering window to be full screen at launch.

Definition at line 405 of file Window.cpp.

Referenced by load_config(), and preinit_from_xml().

void Zeni::Window::preinit_resizable | ( | const bool & | resizable_ = `true` | ) |

static

Allow the frame to be dynamically resized when in windows mode.

Definition at line 413 of file Window.cpp.

void Zeni::Window::preinit_resolution | ( | const Point2i & | resolution = `Point2i(800, 600)` | ) |

static

Set the rendering window to have a given resolution.

Definition at line 401 of file Window.cpp.

Referenced by load_config(), and preinit_from_xml().

void Zeni::Window::preinit_show_frame | ( | const bool & | show_frame_ = `true` | ) |

static

Show a frame around the rendering window when in windowed mode.

Definition at line 409 of file Window.cpp.

Referenced by load_config().

void Zeni::Window::set_enabled | ( | const bool & | enabled | ) |

static

Enable/Disable the use of rendering; This will not close the rendering window once it is open.

Definition at line 396 of file Window.cpp.

Referenced by engine_handle_cmd(), engine_term_display(), and load_config().

void Zeni::Window::set_failsafe_defaults | ( |  | ) |

static

Set failsafe default options.

Definition at line 423 of file Window.cpp.

References FAILSAFE_SCREEN_HEIGHT, FAILSAFE_SCREEN_WIDTH, Zeni::Point2i::x, and Zeni::Point2i::y.

Referenced by Zeni::Video::set_failsafe_defaults().

bool Zeni::Window::set_icon | ( | const String & | filename | ) |

static

Set the window icon.

Definition at line 459 of file Window.cpp.

References sort_controllers::filename, Zeni::Singleton< Window >::is_initialized(), and set_icon().

Referenced by alert_window_resized(), and set_icon().

void Zeni::Window::set_mouse_state | ( | const Mouse_State & | mouse_state | ) |

Definition at line 478 of file Window.cpp.

References Zeni::get_Window(), MOUSE_GRABBED, MOUSE_HIDDEN, MOUSE_RELATIVE, SDL_DISABLE, SDL_ENABLE, SDL_FALSE, SDL_SetRelativeMouseMode(), SDL_SetWindowGrab(), SDL_ShowCursor(), and SDL_TRUE.

Referenced by Zeni::Gamestate_Base::on_active(), Zeni::Widget_Gamestate::on_pop(), Zeni::Widget_Gamestate::on_push(), and Zeni::Title_State< PLAY_STATE, INSTRUCTIONS_STATE >::on_uncover().

void Zeni::Window::set_opengl_flag | ( | const bool & | on = `true` | ) |

static

Definition at line 433 of file Window.cpp.

void Zeni::Window::set_taskmsg | ( | const String & | taskmsg | ) |

static

Set the taskbar message.

Definition at line 452 of file Window.cpp.

References Zeni::Singleton< Window >::is_initialized(), and set_tt().

void Zeni::Window::set_title | ( | const String & | title | ) |

static

Set the window title.

Definition at line 445 of file Window.cpp.

References Zeni::Singleton< Window >::is_initialized(), and set_tt().

Referenced by Zeni::Configurator_Video::Configurator_Video(), and Zeni::Configurator_Video::~Configurator_Video().

void Zeni::Window::set_tt | ( | const String & | title,
|  | const String & | taskmsg
| ) |  |

static

Set the window title and taskbar message.

Definition at line 437 of file Window.cpp.

References Zeni::Singleton< Window >::is_initialized(), and set_tt().

Referenced by alert_window_resized(), set_taskmsg(), set_title(), and set_tt().

## Friends And Related Function Documentation

friend class Singleton< Window >

friend

Definition at line 54 of file Window.h.

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

- zenilib/jni/external/zenilib/zeni_graphics/Zeni/Window.h
- zenilib/jni/external/zenilib/zeni_graphics/Window.cpp
- zenilib/jni/external/zenilib/zeni_graphics/Zeni/Window.hxx