wavelength 1.0.0
Loading...
Searching...
No Matches
joypadanalogstickmsg.h
Go to the documentation of this file.
1#pragma once
2
3#include <cstddef>
4
5#include "msg/message.h"
6#include "os/mem.h"
7#include "os/prnstream.h"
8
16
24public:
35 JoypadAnalogStickMsg(int nPad, int nStick, float fX, float fY)
36 : mPad(nPad), mStick(nStick), mX(fX), mY(fY) {
37 }
38
45 void *operator new(size_t nSize) {
46 return PoolMemAlloc(static_cast<int>(nSize), "JoypadAnalogStickMsg", 0);
47 }
48
54 void operator delete(void *pBlock) {
55 PoolMemFree(pBlock);
56 }
57
65 Message *Clone() override {
66 return new JoypadAnalogStickMsg(*this);
67 }
68
76 int Type() override {
78 }
79
87 const char *GetName() const override {
88 return "JoypadAnalogStickMsg";
89 }
90
98 void PrintExtra(PrnStream &stream) const override;
99
100private:
101 int mPad;
102 int mStick;
103 float mX;
104 float mY;
105};
const char * GetName() const override
Report this message's class name.
Definition joypadanalogstickmsg.h:87
Message * Clone() override
Produce a heap copy of this message.
Definition joypadanalogstickmsg.h:65
void PrintExtra(PrnStream &stream) const override
Write the controller, the stick, and its position.
JoypadAnalogStickMsg(int nPad, int nStick, float fX, float fY)
Construct the message of a stick.
Definition joypadanalogstickmsg.h:35
int Type() override
Report this message's registered identity.
Definition joypadanalogstickmsg.h:76
Base of every event the game passes between a MsgSource and a MsgSink.
Definition message.h:40
Text output stream.
Definition prnstream.h:16
int g_nJoypadAnalogStickMsgType
Identity that JoypadAnalogStickMsg::Type() reports.
void * PoolMemAlloc(int nSize, const char *pszTag, int nAlign)
Allocate a block from the pool heaps and bill it to a tag.
void PoolMemFree(void *pBlock)
Return a block PoolMemAlloc() handed out to the pool heap that owns it.