Gosu::Window Class Reference

Convenient all-in-one class that serves as the foundation of a standard Gosu application. More...

List of all members.

Public Member Functions

 Window (unsigned width, unsigned height, bool fullscreen, double updateInterval=16.666666)
 Constructs a Window.
virtual ~Window ()
std::wstring caption () const
void setCaption (const std::wstring &caption)
double updateInterval () const
void show ()
 Enters a modal loop where the Window is visible on screen and receives calls to draw, update etc.
void close ()
 Closes the window if it is currently shown.
virtual void update ()
 Called every updateInterval milliseconds while the window is being shown.
virtual void draw ()
 Called after every update and when the OS wants the window to repaint itself.
virtual bool needsRedraw () const
 Gives the game a chance to say no to being redrawn.
virtual bool needsCursor () const
 If this function returns true, the system arrow cursor is drawn while over the window.
virtual void loseFocus ()
 This function is called when the window loses focus on some platforms.
virtual void releaseMemory ()
 This function is called when the operating system's memory is low.
virtual void buttonDown (Gosu::Button)
 Called before update when the user pressed a button while the window had the focus.
virtual void buttonUp (Gosu::Button)
 Same as buttonDown. Called then the user released a button.
const Graphicsgraphics () const
Graphicsgraphics ()
const Inputinput () const
Inputinput ()
const Audio & audio () const
Audio & audio ()


Detailed Description

Convenient all-in-one class that serves as the foundation of a standard Gosu application.

Manages initialization of all of Gosu's core components and provides timing functionality. Note that you should really only use on instance of this class at the same time. This may or may not change later.

Definition at line 29 of file Window.hpp.


Constructor & Destructor Documentation

Gosu::Window::Window ( unsigned  width,
unsigned  height,
bool  fullscreen,
double  updateInterval = 16.666666 
)

Constructs a Window.

Parameters:
updateInterval Interval in milliseconds between two calls to the update member function.

virtual Gosu::Window::~Window (  )  [virtual]


Member Function Documentation

Audio& Gosu::Window::audio (  ) 

const Audio& Gosu::Window::audio (  )  const

virtual void Gosu::Window::buttonDown ( Gosu::Button   )  [virtual]

Called before update when the user pressed a button while the window had the focus.

Definition at line 80 of file Window.hpp.

virtual void Gosu::Window::buttonUp ( Gosu::Button   )  [virtual]

Same as buttonDown. Called then the user released a button.

Definition at line 82 of file Window.hpp.

std::wstring Gosu::Window::caption (  )  const

void Gosu::Window::close (  ) 

Closes the window if it is currently shown.

virtual void Gosu::Window::draw (  )  [virtual]

Called after every update and when the OS wants the window to repaint itself.

Your application's rendering code goes here.

Definition at line 57 of file Window.hpp.

Graphics& Gosu::Window::graphics (  ) 

const Graphics& Gosu::Window::graphics (  )  const

Input& Gosu::Window::input (  ) 

const Input& Gosu::Window::input (  )  const

virtual void Gosu::Window::loseFocus (  )  [virtual]

This function is called when the window loses focus on some platforms.

Most importantly, it is called on the iPhone or iPad when the user locks the screen.

Definition at line 72 of file Window.hpp.

virtual bool Gosu::Window::needsCursor (  )  const [virtual]

If this function returns true, the system arrow cursor is drawn while over the window.

Definition at line 67 of file Window.hpp.

virtual bool Gosu::Window::needsRedraw (  )  const [virtual]

Gives the game a chance to say no to being redrawn.

This is not a definitive answer. The operating system can still cause redraws for one reason or another. By default, the window is redrawn all the time.

Definition at line 63 of file Window.hpp.

virtual void Gosu::Window::releaseMemory (  )  [virtual]

This function is called when the operating system's memory is low.

So far, it is only called in iOS applications.

Definition at line 76 of file Window.hpp.

void Gosu::Window::setCaption ( const std::wstring &  caption  ) 

void Gosu::Window::show (  ) 

Enters a modal loop where the Window is visible on screen and receives calls to draw, update etc.

virtual void Gosu::Window::update (  )  [virtual]

Called every updateInterval milliseconds while the window is being shown.

Your application's main game logic goes here.

Definition at line 54 of file Window.hpp.

double Gosu::Window::updateInterval (  )  const


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