ScummVM
Glk::Events Class Reference

Events manager. More...

#include <events.h>

Collaboration diagram for Glk::Events:

Classes

struct  Surface
 

Public Member Functions

 Events ()
 Constructor. More...
 
 ~Events ()
 Destructor. More...
 
void getEvent (event_t *event, bool polled)
 Get any pending event. More...
 
void store (EvType type, Window *win, uint val1=0, uint val2=0)
 Store an event for retrieval. More...
 
uint getKeypress ()
 Wait for a keypress. More...
 
void waitForPress ()
 Wait for a keyboard or mouse press. More...
 
uint32 getTotalPlayTicks () const
 Get the total number of frames played. More...
 
void setTotalPlayTicks (uint frames)
 Set the total number of frames played. More...
 
void redraw ()
 Flags the screen for redrawing. More...
 
void setCursor (CursorId cursorId)
 Sets the current cursor. More...
 
void showMouseCursor (bool visible)
 Sets whether the mouse cursor is visible. More...
 
void setTimerInterval (uint milli)
 Set a timer interval. More...
 
bool isTimerExpired () const
 Returns true if it's time for a timer event. More...
 

Public Attributes

bool _forceClick
 

Private Member Functions

void initializeCursors ()
 Initialize the cursor graphics. More...
 
void checkForNextFrameCounter ()
 Checks for whether it's time for the next game frame. More...
 
void dispatchEvent (Event &ev, bool polled)
 Dispatches an event. More...
 
void pollEvents ()
 Poll for user events. More...
 
void handleKeyDown (const Common::KeyState &ks)
 Handle a key down event. More...
 
void handleScroll (bool wheelUp)
 Handle scroll events. More...
 
void handleMouseMove (const Point &pos)
 Handle mouse move events. More...
 
void handleButtonDown (bool isLeft, const Point &pos)
 Handle mouse down events. More...
 
void handleButtonUp (bool isLeft, const Point &pos)
 Handle mouse up events. More...
 
bool isModifierKey (const Common::KeyCode &keycode) const
 Returns true if the passed keycode is for the Ctrl or Alt keys. More...
 

Private Attributes

EventQueue _eventsPolled
 User generated events. More...
 
EventQueue _eventsLogged
 Custom events generated by game code. More...
 
Event_currentEvent
 Event pointer passed during event retrieval. More...
 
uint32 _priorFrameTime
 Time of prior game frame. More...
 
uint32 _frameCounter
 Frame counter. More...
 
bool _redraw
 Screen needed redrawing. More...
 
CursorId _cursorId
 Current cursor Id. More...
 
Surface _cursors [4]
 Cursor pixel data. More...
 
uint _timerMilli
 Time in milliseconds between timer events. More...
 
uint _timerTimeExpiry
 When to trigger next timer event. More...
 

Detailed Description

Events manager.

Definition at line 163 of file events.h.

Constructor & Destructor Documentation

◆ Events()

Glk::Events::Events ( )

Constructor.

Definition at line 59 of file events.cpp.

◆ ~Events()

Glk::Events::~Events ( )

Destructor.

Definition at line 64 of file events.cpp.

Member Function Documentation

◆ checkForNextFrameCounter()

void Glk::Events::checkForNextFrameCounter ( )
private

Checks for whether it's time for the next game frame.

Definition at line 102 of file events.cpp.

◆ dispatchEvent()

void Glk::Events::dispatchEvent ( Event ev,
bool  polled 
)
private

Dispatches an event.

Definition at line 164 of file events.cpp.

◆ getEvent()

void Glk::Events::getEvent ( event_t event,
bool  polled 
)

Get any pending event.

Definition at line 119 of file events.cpp.

◆ getKeypress()

uint Glk::Events::getKeypress ( )

Wait for a keypress.

Definition at line 388 of file events.cpp.

◆ getTotalPlayTicks()

uint32 Glk::Events::getTotalPlayTicks ( ) const
inline

Get the total number of frames played.

Definition at line 264 of file events.h.

◆ handleButtonDown()

void Glk::Events::handleButtonDown ( bool  isLeft,
const Point pos 
)
private

Handle mouse down events.

Definition at line 362 of file events.cpp.

◆ handleButtonUp()

void Glk::Events::handleButtonUp ( bool  isLeft,
const Point pos 
)
private

Handle mouse up events.

Definition at line 371 of file events.cpp.

◆ handleKeyDown()

void Glk::Events::handleKeyDown ( const Common::KeyState ks)
private

Handle a key down event.

Definition at line 229 of file events.cpp.

◆ handleMouseMove()

void Glk::Events::handleMouseMove ( const Point pos)
private

Handle mouse move events.

Definition at line 344 of file events.cpp.

◆ handleScroll()

void Glk::Events::handleScroll ( bool  wheelUp)
private

Handle scroll events.

Definition at line 340 of file events.cpp.

◆ initializeCursors()

void Glk::Events::initializeCursors ( )
private

Initialize the cursor graphics.

Definition at line 69 of file events.cpp.

◆ isModifierKey()

bool Glk::Events::isModifierKey ( const Common::KeyCode keycode) const
private

Returns true if the passed keycode is for the Ctrl or Alt keys.

Definition at line 379 of file events.cpp.

◆ isTimerExpired()

bool Glk::Events::isTimerExpired ( ) const

Returns true if it's time for a timer event.

Definition at line 436 of file events.cpp.

◆ pollEvents()

void Glk::Events::pollEvents ( )
private

Poll for user events.

Definition at line 179 of file events.cpp.

◆ redraw()

void Glk::Events::redraw ( )
inline

Flags the screen for redrawing.

Definition at line 278 of file events.h.

◆ setCursor()

void Glk::Events::setCursor ( CursorId  cursorId)

Sets the current cursor.

Definition at line 409 of file events.cpp.

◆ setTimerInterval()

void Glk::Events::setTimerInterval ( uint  milli)

Set a timer interval.

Parameters
milliTime in millieseconds for intervals, or 0 for off

Definition at line 431 of file events.cpp.

◆ setTotalPlayTicks()

void Glk::Events::setTotalPlayTicks ( uint  frames)
inline

Set the total number of frames played.

Definition at line 271 of file events.h.

◆ showMouseCursor()

void Glk::Events::showMouseCursor ( bool  visible)

Sets whether the mouse cursor is visible.

Remarks
Normally the cursor is visible for all games, even for those that didn't have mouse originally, so as to allow for common Glk functionality for selecting ranges of text

Definition at line 427 of file events.cpp.

◆ store()

void Glk::Events::store ( EvType  type,
Window win,
uint  val1 = 0,
uint  val2 = 0 
)

Store an event for retrieval.

Definition at line 147 of file events.cpp.

◆ waitForPress()

void Glk::Events::waitForPress ( )

Wait for a keyboard or mouse press.

Definition at line 405 of file events.cpp.

Member Data Documentation

◆ _currentEvent

Event* Glk::Events::_currentEvent
private

Event pointer passed during event retrieval.

Definition at line 170 of file events.h.

◆ _cursorId

CursorId Glk::Events::_cursorId
private

Current cursor Id.

Definition at line 174 of file events.h.

◆ _cursors

Surface Glk::Events::_cursors[4]
private

Cursor pixel data.

Definition at line 175 of file events.h.

◆ _eventsLogged

EventQueue Glk::Events::_eventsLogged
private

Custom events generated by game code.

Definition at line 169 of file events.h.

◆ _eventsPolled

EventQueue Glk::Events::_eventsPolled
private

User generated events.

Definition at line 168 of file events.h.

◆ _forceClick

bool Glk::Events::_forceClick

Definition at line 229 of file events.h.

◆ _frameCounter

uint32 Glk::Events::_frameCounter
private

Frame counter.

Definition at line 172 of file events.h.

◆ _priorFrameTime

uint32 Glk::Events::_priorFrameTime
private

Time of prior game frame.

Definition at line 171 of file events.h.

◆ _redraw

bool Glk::Events::_redraw
private

Screen needed redrawing.

Definition at line 173 of file events.h.

◆ _timerMilli

uint Glk::Events::_timerMilli
private

Time in milliseconds between timer events.

Definition at line 176 of file events.h.

◆ _timerTimeExpiry

uint Glk::Events::_timerTimeExpiry
private

When to trigger next timer event.

Definition at line 177 of file events.h.


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