ScummVM API documentation
Ultima::Ultima0::Events Class Referenceabstract

#include <events.h>

Inheritance diagram for Ultima::Ultima0::Events:
Ultima::Ultima0::UIElement Ultima::Ultima0::Ultima0Engine

Public Member Functions

void runGame ()
 
void replaceView (UIElement *ui, bool replaceAllViews=false)
 
void replaceView (const Common::String &name, bool replaceAllViews=false)
 
void addView (UIElement *ui)
 
void addView (const Common::String &name)
 
void clearViews ()
 
void popView ()
 
void redrawViews ()
 
UIElementfocusedView () const
 
UIElementpriorView () const
 
bool isPresent (const Common::String &name) const
 
bool isInCombat () const
 
Graphics::ScreengetScreen () const
 
void drawElements ()
 
void addKeypress (const Common::KeyCode kc)
 
void draw () override
 
bool tick () override
 
void close () override
 
- Public Member Functions inherited from Ultima::Ultima0::UIElement
 UIElement (const Common::String &name, UIElement *uiParent)
 
 UIElement (const Common::String &name)
 
bool needsRedraw () const
 
void redraw ()
 
void focus ()
 
bool isFocused () const
 
Common::String getName () const
 
void replaceView (UIElement *ui, bool replaceAllViews=false)
 
void replaceView (const Common::String &name, bool replaceAllViews=false)
 
void addView (UIElement *ui)
 
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
 
Gfx::GfxSurface getSurface () const
 
virtual void clearSurface ()
 
virtual UIElementfindView (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)
 

Protected Member Functions

void processEvent (Common::Event &ev)
 
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
 
- Protected Member Functions inherited from Ultima::Ultima0::UIElement
void delaySeconds (uint seconds)
 
void delayFrames (uint frames)
 
bool isDelayActive () const
 
void cancelDelay ()
 
virtual void timeout ()
 
virtual bool msgGame (const GameMessage &e)
 
virtual bool msgValue (const ValueMessage &e)
 

Additional Inherited Members

- Protected Attributes inherited from Ultima::Ultima0::UIElement
UIElement_parent
 
Common::Array< UIElement * > _children
 
Common::Rect _innerBounds
 
Bounds _bounds
 
bool _needsRedraw = true
 
Common::String _name
 

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.

Member Function Documentation

◆ processEvent()

void Ultima::Ultima0::Events::processEvent ( Common::Event ev)
protected

Process an event

◆ shouldQuit()

virtual bool Ultima::Ultima0::Events::shouldQuit ( ) const
protectedpure virtual

Returns true if the game should quit

Implemented in Ultima::Ultima0::Ultima0Engine.

◆ msgMouseMove()

bool Ultima::Ultima0::Events::msgMouseMove ( const MouseMoveMessage msg)
inlineoverrideprotectedvirtual

Handles events

Reimplemented from Ultima::Ultima0::UIElement.

◆ runGame()

void Ultima::Ultima0::Events::runGame ( )

Main game loop

◆ replaceView()

void Ultima::Ultima0::Events::replaceView ( UIElement ui,
bool  replaceAllViews = false 
)

Sets the focus to a new view

◆ addView()

void Ultima::Ultima0::Events::addView ( UIElement ui)

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

◆ clearViews()

void Ultima::Ultima0::Events::clearViews ( )

Clears the view list

◆ popView()

void Ultima::Ultima0::Events::popView ( )

Pops a view from the view stack

◆ redrawViews()

void Ultima::Ultima0::Events::redrawViews ( )

Redraws the views in order. This is used in rare cases where a view draws outside it's defined area, and needs to restore whether the background was before

◆ focusedView()

UIElement* Ultima::Ultima0::Events::focusedView ( ) const
inline

Returns the currently focused view, if any

◆ priorView()

UIElement* Ultima::Ultima0::Events::priorView ( ) const
inline

Returns the view prior to the current view, if any

◆ isPresent()

bool Ultima::Ultima0::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

◆ isInCombat()

bool Ultima::Ultima0::Events::isInCombat ( ) const
inline

Returns true if combat is active

◆ getScreen()

Graphics::Screen* Ultima::Ultima0::Events::getScreen ( void  ) const
inline

Returns the underlying screen

◆ drawElements()

void Ultima::Ultima0::Events::drawElements ( )
inline

Draws the focused view

◆ addKeypress()

void Ultima::Ultima0::Events::addKeypress ( const Common::KeyCode  kc)

Add a keypress to the event queue

◆ draw()

void Ultima::Ultima0::Events::draw ( )
inlineoverridevirtual

Events manager doesn't have any intrinsic drawing

Reimplemented from Ultima::Ultima0::UIElement.

◆ tick()

bool Ultima::Ultima0::Events::tick ( )
inlineoverridevirtual

Called once every game frame

Reimplemented from Ultima::Ultima0::UIElement.

◆ close()

void Ultima::Ultima0::Events::close ( )
inlineoverridevirtual

Calling the close method for g_events closes the active view

Reimplemented from Ultima::Ultima0::UIElement.


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