FifeGUI 0.2.0
A C++ GUI library designed for games.
fcn::MouseInput Class Reference

#include <mouseinput.hpp>

Public Types

enum class  Button : std::uint8_t {
  Empty = 0 , Left , Right , Middle ,
  X1 , X2
}
enum class  Type : std::uint8_t {
  Moved = 0 , Pressed , Released , WheelMovedDown ,
  WheelMovedUp , WheelMovedRight , WheelMovedLeft
}

Public Member Functions

Button getButton () const
int getTimeStamp () const
Type getType () const
int getX () const
int getY () const
 MouseInput (Button button, Type type, int x, int y, int timeStamp)
void setButton (Button button)
void setTimeStamp (int timeStamp)
void setType (Type type)
void setX (int x)
void setY (int y)

Protected Attributes

Button mButton {Button::Empty}
int mTimeStamp {0}
Type mType {Type::Moved}
int mX {0}
int mY {0}

Detailed Description

Internal class representing raw mouse input data.

Generally you won't have to bother using this class unless you implement an Input class fora backend.

Definition at line 23 of file mouseinput.hpp.

Member Enumeration Documentation

◆ Button

enum class fcn::MouseInput::Button : std::uint8_t
strong

Definition at line 39 of file mouseinput.hpp.

◆ Type

enum class fcn::MouseInput::Type : std::uint8_t
strong

Definition at line 28 of file mouseinput.hpp.

Constructor & Destructor Documentation

◆ MouseInput()

fcn::MouseInput::MouseInput ( Button button,
Type type,
int x,
int y,
int timeStamp )

Constructor.

Parameters
buttonThe button pressed.
typeThe type of mouse input.
xThe mouse x coordinate.
yThe mouse y coordinate.
timeStampThe timestamp of the mouse input. Used to check for double clicks.

Definition at line 9 of file mouseinput.cpp.

References mButton, mTimeStamp, mType, mX, and mY.

Member Function Documentation

◆ getButton()

MouseInput::Button fcn::MouseInput::getButton ( ) const

◆ getTimeStamp()

int fcn::MouseInput::getTimeStamp ( ) const

Gets the time stamp of the input.

Used to check for double clicks.

Returns
The time stamp of the mouse input.
See also
setTimeStamp

Definition at line 34 of file mouseinput.cpp.

References mTimeStamp.

Referenced by fcn::Gui::handleMousePressed().

◆ getType()

MouseInput::Type fcn::MouseInput::getType ( ) const

Gets the type of the mouse input.

Returns
The type of the mouse input.
See also
setType

Definition at line 19 of file mouseinput.cpp.

References mType.

Referenced by fcn::Gui::handleMouseInput().

◆ getX()

int fcn::MouseInput::getX ( ) const

◆ getY()

int fcn::MouseInput::getY ( ) const

◆ setButton()

void fcn::MouseInput::setButton ( Button button)

Sets the button pressed.

Parameters
buttonThe button pressed.
See also
getButton.

Definition at line 24 of file mouseinput.cpp.

References mButton.

Referenced by fcn::sdl2::Input::pushInput(), fcn::GenericInput::pushMouseButtonPressed(), and fcn::GenericInput::pushMouseButtonReleased().

◆ setTimeStamp()

void fcn::MouseInput::setTimeStamp ( int timeStamp)

Sets the timestamp for the mouse input.

Used to check for double clicks.

Parameters
timeStampThe timestamp of the mouse input.
See also
getTimeStamp

Definition at line 39 of file mouseinput.cpp.

References mTimeStamp.

Referenced by fcn::sdl2::Input::pushInput().

◆ setType()

◆ setX()

◆ setY()

Member Data Documentation

◆ mButton

Button fcn::MouseInput::mButton {Button::Empty}
protected

Holds the button of the mouse input.

Definition at line 152 of file mouseinput.hpp.

Referenced by getButton(), MouseInput(), and setButton().

◆ mTimeStamp

int fcn::MouseInput::mTimeStamp {0}
protected

Holds the timestamp of the mouse input.

Used to check for double clicks.

Definition at line 158 of file mouseinput.hpp.

Referenced by getTimeStamp(), MouseInput(), and setTimeStamp().

◆ mType

Type fcn::MouseInput::mType {Type::Moved}
protected

Holds the type of the mouse input.

Definition at line 147 of file mouseinput.hpp.

Referenced by getType(), MouseInput(), and setType().

◆ mX

int fcn::MouseInput::mX {0}
protected

Holds the x coordinate of the mouse input.

Definition at line 163 of file mouseinput.hpp.

Referenced by getX(), MouseInput(), and setX().

◆ mY

int fcn::MouseInput::mY {0}
protected

Holds the y coordinate of the mouse input.

Definition at line 168 of file mouseinput.hpp.

Referenced by getY(), MouseInput(), and setY().


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