wavelength 1.0.0
Loading...
Searching...
No Matches
expressionstick.h
Go to the documentation of this file.
1#pragma once
2
3#include "app/msgsink.h"
5#include "os/joypad.h"
6
13class ExpressionStick : public MsgSink {
14public:
23 ExpressionStick(int nPad, int nStick);
24
31 ~ExpressionStick() override;
32
41 bool DispatchPriv(Message *pMsg) override;
42
51 bool Poll();
52
59 void Reset();
60
72
74 float GetX() const {
75 return mX;
76 }
77
79 float GetY() const {
80 return mY;
81 }
82
83private:
84 int mPad;
85 int mStick;
86 float mX;
87 float mY;
88 float mSpeedX;
89 float mSpeedY;
90 JoypadStick mLastStick;
91 float mLastPollMs;
92};
bool Poll()
Take the stick position when the stick moved, otherwise move the position by the speed the directiona...
bool DispatchPriv(Message *pMsg) override
Act on a controller message.
~ExpressionStick() override
Remove the reader from the receivers of the controller messages.
float GetY() const
Definition expressionstick.h:79
float GetX() const
Definition expressionstick.h:74
bool HandleButton(JoypadInputMsg *pMsg)
Start or stop the movement of the position for a directional button of the controller.
void Reset()
Centre the position and stop its movement.
ExpressionStick(int nPad, int nStick)
Construct the reader of one stick and add it to the receivers of the controller messages.
Message the controller poll sends when a button is pressed or released.
Definition joypadinputmsg.h:23
Base of every event the game passes between a MsgSource and a MsgSink.
Definition message.h:40
Receiver of engine messages.
Definition msgsink.h:21
Position of one analogue stick.
Definition joypad.h:58