mrjoystick.h

来自「Games programming all in one code chapte」· C头文件 代码 · 共 44 行

H
44
字号
 /* 'mrJoystick.h' */

 /* Mirus base types header */
#include "mrDatatypes.h"
 /* Mirus error definitions header */
#include "mrError.h"
 /* Mirus Input Manafer header file */
#include "mrInputManager.h"
 /* Windows header file */
#include <windows.h>
 /* Direct Music header file */
#include <dinput.h>

 /* Include this file only once */
#pragma once

 /* Joystick enumeration callback */
BOOL CALLBACK EnumJoysticksCallback (
        const DIDEVICEINSTANCE * pdidInstance, VOID* pContext);

 /* Mirus Joystick class */
class mrJoystick
{
protected:
  /* DirectInput objects */
 LPDIRECTINPUTDEVICE8 m_lpkDIDevice;
 DIJOYSTATE2          m_kDeviceData;

public:
  /* Constructors / Destructor */
 mrJoystick (void);
 ~mrJoystick (void);

  /* Joystick manipulation methods */
 mrError32 Init (HWND hWindow, mrInt32 iMin, mrInt32 iMax, 
                 mrInt32 iDeadZone);
 mrError32 Update (void);

 mrBool32 IsButtonDown (mrUInt32 iButton);
 mrBool32 IsButtonUp (mrUInt32 iButton);

 mrUInt32 GetXAxis (void);
 mrUInt32 GetYAxis (void);
};

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?