BEEP-8 Helper Lib 1.0.0
Loading...
Searching...
No Matches
pad.h
Go to the documentation of this file.
1
59#pragma once
60#include <cobj.h>
61#include <nesctrl.h>
62
63class CfgNesCtrl;
64class ImplCPadObj;
65
70enum class EPad {
71 START, SELECT, LEFT, UP, RIGHT, DOWN, BTN_A, BTN_B , EPAD_MAX
72};
73
81class CPadObj : public CObj {
82 ImplCPadObj* impl;
83 u32 _idx;
84private:
85 u32 _cnt_hold [ 8 ] = {0};
86 u32 _cnt_release[ 8 ] = {0};
87 void vOnStep() override;
88 void vOnDraw( b8PpuCmd* cmd_ ) override;
89public:
95 u32 GetCntHold( EPad epad_ ) const {
96 return _cnt_hold[ static_cast< u32 >( epad_ ) ];
97 }
98
104 u32 GetCntRelease( EPad epad_ ) const {
105 return _cnt_release[ static_cast< u32 >( epad_ ) ];
106 }
107public:
113 CPadObj( u32 idx_ , const CfgNesCtrl* pcfg_ = nullptr );
114
118 virtual ~CPadObj();
119};
120
126extern CPadObj* _CPadObj( u32 idx_ );
Definition cobj.h:44
Class for managing a gamepad's input and state.
Definition pad.h:81
CPadObj(u32 idx_, const CfgNesCtrl *pcfg_=nullptr)
Construct a new CPadObj object.
Definition pad.cpp:80
virtual ~CPadObj()
Destroy the CPadObj object.
Definition pad.cpp:92
u32 GetCntRelease(EPad epad_) const
Get the release count for a specific button.
Definition pad.h:104
u32 GetCntHold(EPad epad_) const
Get the hold count for a specific button.
Definition pad.h:95
Configuration for the NES controller.
Definition nesctrl.h:25
Definition pad.cpp:13
Header file for managing dynamic creation and destruction of objects in a game.
NES controller emulation module for touch screen devices.
CPadObj * _CPadObj(u32 idx_)
Get the CPadObj instance for a specific index.
Definition pad.cpp:97
EPad
Enum for gamepad buttons.
Definition pad.h:70