ScummVM API documentation
Sherlock::Events Class Reference

Public Member Functions

 Events (SherlockEngine *vm)
 
void loadCursors (const Common::Path &filename)
 
void setCursor (CursorId cursorId)
 
void setCursor (const Graphics::Surface &src, int hotspotX=0, int hotspotY=0)
 
void setCursor (CursorId cursorId, const Common::Point &cursorPos, const Graphics::Surface &surface)
 
void animateCursorIfNeeded ()
 
void showCursor ()
 
void hideCursor ()
 
CursorId getCursor () const
 
bool isCursorVisible () const
 
void pollEvents ()
 
void pollEventsAndWait ()
 
void warpMouse (const Common::Point &pt)
 
void warpMouse ()
 
Common::Point screenMousePos () const
 
Common::Point mousePos () const
 
void setFrameRate (int newRate)
 
void toggleSpeed ()
 
uint32 getFrameCounter () const
 
bool kbHit () const
 
Common::KeyState getKey ()
 
void clearEvents ()
 
void clearKeyboard ()
 
void wait (int numFrames)
 
bool delay (uint32 time, bool interruptable=false)
 
void setButtonState ()
 
bool checkInput ()
 
void incWaitCounter ()
 
void decWaitCounter ()
 

Public Attributes

CursorId _cursorId
 
bool _pressed
 
bool _released
 
bool _rightPressed
 
bool _rightReleased
 
bool _oldButtons
 
bool _oldRightButton
 
bool _firstPress
 
Common::Queue< Common::KeyState_pendingKeys
 
Common::Point _hotspotPos
 

Member Function Documentation

◆ loadCursors()

void Sherlock::Events::loadCursors ( const Common::Path filename)

Load a set of cursors from the specified file

◆ setCursor() [1/3]

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

Set the cursor to show

◆ setCursor() [2/3]

void Sherlock::Events::setCursor ( const Graphics::Surface src,
int  hotspotX = 0,
int  hotspotY = 0 
)

Set the cursor to show from a passed frame

◆ setCursor() [3/3]

void Sherlock::Events::setCursor ( CursorId  cursorId,
const Common::Point cursorPos,
const Graphics::Surface surface 
)

Set both a standard cursor as well as an inventory item above it

◆ animateCursorIfNeeded()

void Sherlock::Events::animateCursorIfNeeded ( )

Animates the mouse cursor if the Wait cursor is showing

◆ showCursor()

void Sherlock::Events::showCursor ( )

Show the mouse cursor

◆ hideCursor()

void Sherlock::Events::hideCursor ( )

Hide the mouse cursor

◆ getCursor()

CursorId Sherlock::Events::getCursor ( ) const

Returns the cursor

◆ isCursorVisible()

bool Sherlock::Events::isCursorVisible ( ) const

Returns true if the mouse cursor is visible

◆ pollEvents()

void Sherlock::Events::pollEvents ( )

Check for any pending events

◆ pollEventsAndWait()

void Sherlock::Events::pollEventsAndWait ( )

Poll for events and introduce a small delay, to allow the system to yield to other running programs

◆ warpMouse() [1/2]

void Sherlock::Events::warpMouse ( const Common::Point pt)

Move the mouse cursor

◆ warpMouse() [2/2]

void Sherlock::Events::warpMouse ( )

Move the mouse cursor to the center of the screen

◆ screenMousePos()

Common::Point Sherlock::Events::screenMousePos ( ) const
inline

Get the current mouse position

◆ mousePos()

Common::Point Sherlock::Events::mousePos ( ) const

Get the current mouse position within the scene, adjusted by the scroll position

◆ setFrameRate()

void Sherlock::Events::setFrameRate ( int  newRate)

Override the default frame rate

◆ toggleSpeed()

void Sherlock::Events::toggleSpeed ( )

Toggle between standard game speed and an "extra fast" mode

◆ getFrameCounter()

uint32 Sherlock::Events::getFrameCounter ( ) const
inline

Return the current game frame number

◆ kbHit()

bool Sherlock::Events::kbHit ( ) const
inline

Returns true if there's a pending keyboard key

◆ getKey()

Common::KeyState Sherlock::Events::getKey ( )

Get a pending keypress

◆ clearEvents()

void Sherlock::Events::clearEvents ( )

Clear any current keypress or mouse click

◆ clearKeyboard()

void Sherlock::Events::clearKeyboard ( )

Clear any pending keyboard inputs

◆ wait()

void Sherlock::Events::wait ( int  numFrames)

Delay for a given number of game frames, where each frame is 1/60th of a second

◆ delay()

bool Sherlock::Events::delay ( uint32  time,
bool  interruptable = false 
)

Does a delay of the specified number of milliseconds

◆ setButtonState()

void Sherlock::Events::setButtonState ( )

Sets the pressed and released button flags on the raw button state previously set in pollEvents calls.

Remarks
The events manager has separate variables for the raw immediate and old button state versus the current buttons states for the frame. This method is expected to be called only once per game frame

◆ checkInput()

bool Sherlock::Events::checkInput ( )

Checks to see to see if a key or a mouse button is pressed.

◆ incWaitCounter()

void Sherlock::Events::incWaitCounter ( )

Increment the wait counter

◆ decWaitCounter()

void Sherlock::Events::decWaitCounter ( )

Decrement the wait counter


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