wavelength 1.0.0
Loading...
Searching...
No Matches
joypadconnectionmsg.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:
33 JoypadConnectionMsg(int nPad, int nConnected) : mPad(nPad), mConnected(nConnected) {
34 }
35
42 void *operator new(size_t nSize) {
43 return PoolMemAlloc(static_cast<int>(nSize), "JoypadConnectionMsg", 0);
44 }
45
51 void operator delete(void *pBlock) {
52 PoolMemFree(pBlock);
53 }
54
62 Message *Clone() override {
63 return new JoypadConnectionMsg(*this);
64 }
65
73 int Type() override {
75 }
76
84 const char *GetName() const override {
85 return "JoypadConnectionMsg";
86 }
87
95 void PrintExtra(PrnStream &stream) const override;
96
98 int GetConnected() const {
99 return mConnected;
100 }
101
103 int GetPad() const {
104 return mPad;
105 }
106
107private:
108 int mPad;
109 int mConnected;
110};
const char * GetName() const override
Report this message's class name.
Definition joypadconnectionmsg.h:84
void PrintExtra(PrnStream &stream) const override
Write the controller and whether it is connected.
int GetConnected() const
Definition joypadconnectionmsg.h:98
int GetPad() const
Definition joypadconnectionmsg.h:103
Message * Clone() override
Produce a heap copy of this message.
Definition joypadconnectionmsg.h:62
JoypadConnectionMsg(int nPad, int nConnected)
Construct the message of a controller.
Definition joypadconnectionmsg.h:33
int Type() override
Report this message's registered identity.
Definition joypadconnectionmsg.h:73
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_nJoypadConnectionMsgType
Identity that JoypadConnectionMsg::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.