ScummVM API documentation
Graphics::Views::Events Class Referenceabstract

#include <events.h>

Inheritance diagram for Graphics::Views::Events:
Graphics::Views::UIElement Ultima::Shared::Events Ultima::Ultima1::Ultima1Engine Ultima::Ultima2::Ultima2Engine Ultima::Ultima3::Ultima3Engine

Public Member Functions

 Events (const Common::String &engineName, uint frameRate=20)
 
uint getFrameRate () const
 
void runGame ()
 
bool pumpEvents ()
 
int getRandomNumber (int minNumber, int maxNumber)
 
int getRandomNumber (int maxNumber)
 
void replaceView (UIElement *ui, bool replaceAllViews=false) override
 
void replaceView (const Common::String &name, bool replaceAllViews=false) override
 
void addView (UIElement *ui) override
 
void addView (const Common::String &name) override
 
void clearViews ()
 
void popView ()
 
UIElement * focusedView () const
 
UIElement * priorView () const
 
UIElement * baseView () const
 
bool isPresent (const Common::String &name) const
 
Graphics::Screen * getScreen () const
 
void drawElements () override
 
void draw () override
 
bool tick () override
 
void close () override
 
void updateScreen ()
 
virtual Graphics::Font * createFont () const
 
- Public Member Functions inherited from Graphics::Views::UIElement
 UIElement (const Common::String &name, UIElement *uiParent)
 
 UIElement (const Common::String &name)
 
bool needsRedraw () const
 
void redraw ()
 
virtual void close ()
 
virtual void replaceView (UIElement *ui, bool replaceAllViews=false)
 
virtual void replaceView (const Common::String &name, bool replaceAllViews=false)
 
virtual void addView (UIElement *ui)
 
virtual void addView (const Common::String &name)
 
void addView ()
 
void open ()
 
int getRandomNumber (int minNumber, int maxNumber)
 
int getRandomNumber (int maxNumber)
 
virtual void setBounds (const Common::Rect &r)
 
Common::Rect getBounds () const
 
const Common::String & getName () const
 
GfxSurface getSurface (bool innerBounds=false) const
 
virtual void draw ()
 
virtual bool tick ()
 
virtual UIElement * findView (const Common::String &name)
 
bool send (const MouseMoveMessage &msg)
 
bool send (const Common::String &viewName, const FocusMessage &msg)
 
bool send (const FocusMessage &msg)
 
bool send (const Common::String &viewName, const UnfocusMessage &msg)
 
bool send (const UnfocusMessage &msg)
 
bool send (const Common::String &viewName, const MouseEnterMessage &msg)
 
bool send (const MouseEnterMessage &msg)
 
bool send (const Common::String &viewName, const MouseLeaveMessage &msg)
 
bool send (const MouseLeaveMessage &msg)
 
bool send (const Common::String &viewName, const KeypressMessage &msg)
 
bool send (const KeypressMessage &msg)
 
bool send (const Common::String &viewName, const MouseDownMessage &msg)
 
bool send (const MouseDownMessage &msg)
 
bool send (const Common::String &viewName, const MouseUpMessage &msg)
 
bool send (const MouseUpMessage &msg)
 
bool send (const Common::String &viewName, const ActionMessage &msg)
 
bool send (const ActionMessage &msg)
 
bool send (const Common::String &viewName, const GameMessage &msg)
 
bool send (const GameMessage &msg)
 
bool send (const Common::String &viewName, const ValueMessage &msg)
 
bool send (const ValueMessage &msg)
 
template<class T >
bool send (const T &msg)
 
template<class T >
bool send (const Common::String &viewName, const T &msg)
 

Protected Member Functions

virtual bool shouldQuit () const =0
 
bool msgAction (const ActionMessage &e) override
 
bool msgFocus (const FocusMessage &e) override
 
bool msgUnfocus (const UnfocusMessage &e) override
 
bool msgMouseEnter (const MouseEnterMessage &e) override
 
bool msgMouseLeave (const MouseLeaveMessage &e) override
 
bool msgKeypress (const KeypressMessage &e) override
 
bool msgMouseDown (const MouseDownMessage &e) override
 
bool msgMouseUp (const MouseUpMessage &e) override
 
bool msgMouseMove (const MouseMoveMessage &e) override
 
bool msgCustom (const Message &msg) override
 
- Protected Member Functions inherited from Graphics::Views::UIElement
void delaySeconds (uint seconds)
 
void delayFrames (uint frames)
 
bool isDelayActive () const
 
void cancelDelay ()
 
virtual void timeout ()
 
virtual bool msgMouseMove (const MouseMoveMessage &msg)
 
void stopTextToSpeech ()
 
virtual bool msgFocus (const FocusMessage &e)
 
virtual bool msgUnfocus (const UnfocusMessage &e)
 
virtual bool msgMouseEnter (const MouseEnterMessage &e)
 
virtual bool msgMouseLeave (const MouseLeaveMessage &e)
 
virtual bool msgKeypress (const KeypressMessage &e)
 
virtual bool msgMouseDown (const MouseDownMessage &e)
 
virtual bool msgMouseUp (const MouseUpMessage &e)
 
virtual bool msgAction (const ActionMessage &e)
 
virtual bool msgGame (const GameMessage &e)
 
virtual bool msgValue (const ValueMessage &e)
 
virtual bool msgCustom (const Message &msg)
 

Additional Inherited Members

- Protected Attributes inherited from Graphics::Views::UIElement
UIElement * _parent
 
Common::Array< UIElement * > _children
 
Common::Rect _innerBounds
 
Bounds _bounds
 
bool _needsRedraw = true
 
Common::String _name
 
Common::String _previousSaid
 

Detailed Description

Main events and view manager. This is kept separate from the engine class because the engine may add a lot of globals and bring in other classes. So to save on compilation time, classes that only need to access basic view management methods like addView or replaceView only need to include events.h rather than the whole engine.

Constructor & Destructor Documentation

◆ Events()

Graphics::Views::Events::Events ( const Common::String &  engineName,
uint  frameRate = 20 
)

Constructor, with the number of frames per second

Member Function Documentation

◆ shouldQuit()

virtual bool Graphics::Views::Events::shouldQuit ( ) const
protectedpure virtual

Returns true if the game should quit

Implemented in Ultima::Ultima1::Ultima1Engine, Ultima::Ultima2::Ultima2Engine, and Ultima::Ultima3::Ultima3Engine.

◆ msgAction()

bool Graphics::Views::Events::msgAction ( const ActionMessage &  e)
inlineoverrideprotectedvirtual

Reimplemented from Graphics::Views::UIElement.

◆ msgFocus()

bool Graphics::Views::Events::msgFocus ( const FocusMessage &  e)
inlineoverrideprotectedvirtual

Reimplemented from Graphics::Views::UIElement.

◆ msgUnfocus()

bool Graphics::Views::Events::msgUnfocus ( const UnfocusMessage &  e)
inlineoverrideprotectedvirtual

Reimplemented from Graphics::Views::UIElement.

◆ msgMouseEnter()

bool Graphics::Views::Events::msgMouseEnter ( const MouseEnterMessage &  e)
inlineoverrideprotectedvirtual

Reimplemented from Graphics::Views::UIElement.

◆ msgMouseLeave()

bool Graphics::Views::Events::msgMouseLeave ( const MouseLeaveMessage &  e)
inlineoverrideprotectedvirtual

Reimplemented from Graphics::Views::UIElement.

◆ msgKeypress()

bool Graphics::Views::Events::msgKeypress ( const KeypressMessage &  e)
inlineoverrideprotectedvirtual

Reimplemented from Graphics::Views::UIElement.

◆ msgMouseDown()

bool Graphics::Views::Events::msgMouseDown ( const MouseDownMessage &  e)
inlineoverrideprotectedvirtual

Reimplemented from Graphics::Views::UIElement.

◆ msgMouseUp()

bool Graphics::Views::Events::msgMouseUp ( const MouseUpMessage &  e)
inlineoverrideprotectedvirtual

Reimplemented from Graphics::Views::UIElement.

◆ msgMouseMove()

bool Graphics::Views::Events::msgMouseMove ( const MouseMoveMessage &  msg)
inlineoverrideprotectedvirtual

Handles events

Reimplemented from Graphics::Views::UIElement.

◆ msgCustom()

bool Graphics::Views::Events::msgCustom ( const Message &  msg)
inlineoverrideprotectedvirtual

Fallback for custom messages, to route them to the currently focused view

Reimplemented from Graphics::Views::UIElement.

◆ getFrameRate()

uint Graphics::Views::Events::getFrameRate ( ) const
inline

Returns the frame rate

◆ runGame()

void Graphics::Views::Events::runGame ( )

Main game loop

◆ pumpEvents()

bool Graphics::Views::Events::pumpEvents ( )

Processes pending events and any due frame, for nested game loops. Returns false if the game is quitting

◆ getRandomNumber()

int Graphics::Views::Events::getRandomNumber ( int  minNumber,
int  maxNumber 
)

Returns a random number

◆ replaceView() [1/2]

void Graphics::Views::Events::replaceView ( UIElement *  ui,
bool  replaceAllViews = false 
)
overridevirtual

Sets the focus to a new view

Reimplemented from Graphics::Views::UIElement.

◆ replaceView() [2/2]

void Graphics::Views::Events::replaceView ( const Common::String &  name,
bool  replaceAllViews = false 
)
overridevirtual

Reimplemented from Graphics::Views::UIElement.

◆ addView() [1/2]

void Graphics::Views::Events::addView ( UIElement *  ui)
overridevirtual

Adds a focused view to the view stack without replacing current one

Reimplemented from Graphics::Views::UIElement.

◆ addView() [2/2]

void Graphics::Views::Events::addView ( const Common::String &  name)
overridevirtual

Reimplemented from Graphics::Views::UIElement.

◆ clearViews()

void Graphics::Views::Events::clearViews ( )

Clears the view list

◆ popView()

void Graphics::Views::Events::popView ( )

Pops a view from the view stack

◆ focusedView()

UIElement * Graphics::Views::Events::focusedView ( ) const
inline

Returns the currently focused view, if any

◆ priorView()

UIElement * Graphics::Views::Events::priorView ( ) const
inline

Returns the view prior to the current view, if any

◆ baseView()

UIElement * Graphics::Views::Events::baseView ( ) const
inline

Returns the earliest view on the view stack, if any

◆ isPresent()

bool Graphics::Views::Events::isPresent ( const Common::String &  name) const

Returns true if a view of a given name is present at all in the visible view stack

◆ getScreen()

Graphics::Screen * Graphics::Views::Events::getScreen ( void  ) const
inline

Returns the underlying screen

◆ drawElements()

void Graphics::Views::Events::drawElements ( )
overridevirtual

Draws the focused view

Reimplemented from Graphics::Views::UIElement.

◆ draw()

void Graphics::Views::Events::draw ( )
inlineoverridevirtual

Events manager doesn't have any intrinsic drawing

Reimplemented from Graphics::Views::UIElement.

◆ tick()

bool Graphics::Views::Events::tick ( )
inlineoverridevirtual

Called once every game frame

Reimplemented from Graphics::Views::UIElement.

◆ close()

void Graphics::Views::Events::close ( )
inlineoverridevirtual

Calling the close method for g_events closes the active view

Reimplemented from Graphics::Views::UIElement.

◆ updateScreen()

void Graphics::Views::Events::updateScreen ( )

Updates the underlying screen

◆ createFont()

virtual Graphics::Font * Graphics::Views::Events::createFont ( ) const
virtual

Returns a font object that GfxSurface instances can use

Reimplemented in Ultima::Ultima1::Ultima1Engine, Ultima::Ultima2::Ultima2Engine, and Ultima::Ultima3::Ultima3Engine.


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