⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mrjoystick.h

📁 Games programming all in one code chapter 18
💻 H
字号:
 /* '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 + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -