Lib
QOLを高める
Public Types | Public Member Functions | Static Public Attributes | List of all members
yappy::input::DInput Class Reference

DirectInput8 wrapper. More...

#include <input.h>

Inheritance diagram for yappy::input::DInput:
yappy::util::noncopyable

Public Types

using KeyData = std::array< bool, KEY_NUM >
 Keyboard data: array[KEY_NUM] of bool. More...
 

Public Member Functions

 DInput (HINSTANCE hInst, HWND hWnd, bool foreground=true, bool exclusive=false)
 Initialize DirectInput8. More...
 
 ~DInput ()
 Finalize DirectInput8. More...
 
void updateControllers (HWND hwnd, bool foreground=true, bool exclusive=false)
 Update pad list. More...
 
void processFrame ()
 Must be called at every frame. More...
 
KeyData getKeys () const
 Get keyboard input data. More...
 
int getPadCount () const
 Get connected pad count. More...
 
void getPadState (DIJOYSTATE *state, int index) const
 Get pad input data. More...
 

Static Public Attributes

static const int KEY_NUM = 256
 Keyboard array count. More...
 
static const int AXIS_RANGE = 1000
 Pad analog value max. More...
 
static const int AXIS_THRESHOLD = AXIS_RANGE / 2
 Pad analog value threshold. More...
 

Detailed Description

DirectInput8 wrapper.

Definition at line 16 of file input.h.

Member Typedef Documentation

using yappy::input::DInput::KeyData = std::array<bool, KEY_NUM>

Keyboard data: array[KEY_NUM] of bool.

Index is DIK_XXX in dinput.h.

Definition at line 28 of file input.h.

Constructor & Destructor Documentation

yappy::input::DInput::DInput ( HINSTANCE  hInst,
HWND  hWnd,
bool  foreground = true,
bool  exclusive = false 
)

Initialize DirectInput8.

Parameters
[in]hInstInstance handle.
[in]hWndWindow handle.
[in]foregroundCan obtain input data only when the window is active.
[in]exclusiveObtain exclusive access to the device.

Definition at line 15 of file input.cpp.

yappy::input::DInput::~DInput ( )

Finalize DirectInput8.

Definition at line 52 of file input.cpp.

Member Function Documentation

DInput::KeyData yappy::input::DInput::getKeys ( ) const

Get keyboard input data.

Returns
Keyboard input data.

Definition at line 177 of file input.cpp.

int yappy::input::DInput::getPadCount ( ) const

Get connected pad count.

Definition at line 182 of file input.cpp.

void yappy::input::DInput::getPadState ( DIJOYSTATE *  state,
int  index 
) const

Get pad input data.

Parameters
[out]stateCurrent input state.
[in]indexPad index.
Precondition
0 <= index < getPadCount()

Definition at line 188 of file input.cpp.

void yappy::input::DInput::processFrame ( )

Must be called at every frame.

Update the key and pad input status.

Definition at line 134 of file input.cpp.

void yappy::input::DInput::updateControllers ( HWND  hwnd,
bool  foreground = true,
bool  exclusive = false 
)

Update pad list.

Also called in the constructor.

Parameters
[in]hInstInstance handle.
[in]hWndWindow handle.
[in]foregroundCan obtain input data only when the window is active.
[in]exclusiveObtain exclusive access to the device.

Definition at line 88 of file input.cpp.

Member Data Documentation

const int yappy::input::DInput::AXIS_RANGE = 1000
static

Pad analog value max.

Definition at line 21 of file input.h.

const int yappy::input::DInput::AXIS_THRESHOLD = AXIS_RANGE / 2
static

Pad analog value threshold.

Definition at line 23 of file input.h.

const int yappy::input::DInput::KEY_NUM = 256
static

Keyboard array count.

Definition at line 19 of file input.h.


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