📄 main.h
字号:
//-----------------------------------------------------------------------------
// Name: DInput_Simple
//
// Description: Example code showing how to use DirectInput
//
// File Function: Header file for the program (main.h)
//
// Code:
// Copyright (c) 2002-2003 LostLogic Corporation. All rights reserved.
//
// Libraries Required:
// dxguid.lib dinput8.lib
//
// Local Files Required:
// main.cpp
// main.h
//
// DX Files:
// Copyright (c) 1997-2001 Microsoft Corporation. All rights reserved.
//-----------------------------------------------------------------------------
#ifndef MAIN_H
#define MAIN_H
// Set the direct input version
#define DIRECTINPUT_VERSION 0x0800
#define STRICT
#include <windows.h>
#include <stdio.h>
#include <D3DX9.h>
#include <dinput.h>
// Keyboard buffer size
const int KEYBOARD_BUFFERSIZE = 10;
// Error codes
const int INPUTERROR_SUCCESS = 0;
const int INPUTERROR_NODI = 1;
const int INPUTERROR_NOKEYBOARD = 2;
const int INPUTERROR_KEYBOARDEXISTS = 3;
const int INPUTERROR_DI_EXISTS = 4;
// Device pointers
LPDIRECTINPUT8 pDI = NULL;
LPDIRECTINPUTDEVICE8 pKeyboard = NULL;
// Keyboard buffers
BYTE diks[ 256 ][ KEYBOARD_BUFFERSIZE ];
BYTE ascKeys[ 256 ][ KEYBOARD_BUFFERSIZE ];
// Keyboard layout
HKL g_Layout;
// Program instance pointer
HINSTANCE g_hInstance;
//-----------------------------------------------------------------------------
// Function headers
//-----------------------------------------------------------------------------
LRESULT WINAPI fnMessageProcessor( HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam );
void vCleanup( void );
int iInitDirectInput(void);
int iInitKeyboard(HWND hWnd);
BYTE Scan2Ascii(DWORD scancode);
int iReadKeyboard( void );
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -