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 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 ()
GOSU_DEPRECATED const Audio & audio () const
GOSU_DEPRECATED 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 27 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

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

GOSU_DEPRECATED 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 65 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 67 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 55 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 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 61 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 52 of file Window.hpp.

double Gosu::Window::updateInterval (  )  const


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