📄 keyboard.h
字号:
/************************************************************************************
Copyright (c) 2000 Aaron O'Neil
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1) Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
2) Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
3) Redistributions in binary form must reproduce the above copyright notice on
program startup. Additional credits for program modification are acceptable
but original copyright and credits must be visible at startup.
4) You may charge a reasonable copying fee for any distribution of Mud Master.
You may charge any fee you choose for support of Mud Master. You may not
charge a fee for Mud Master itself.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
**************************************************************************************/
// Control key modifiers.
#define KEYBOARD_ALT 1000
#define KEYBOARD_CONTROL 2000
#define KEYBOARD_SHIFT 4000
#define KEYBOARD_ENHANCED 8000
struct KEYBOARDCHAR
{
// Ascii key value.
unsigned char chKey;
// Device independant key code. VK_
WORD wKeyCode;
// The key's ID is created from the scan code. The defines
// for the control key states are added to the scan code to
// create the ID.
WORD wKeyID;
// This is set to TRUE when a non-ascii char is being returned.
// This would be set for any of the alt-keys, function keys, etc...
BOOL bSpecial;
// Set when an enhanced key is pressed.
BOOL bEnhanced;
// True if this is an alt-key combination.
BOOL bAlt;
// True if this is a shift-key combination.
BOOL bShift;
// True if this is a control-key combination.
BOOL bControl;
// This is set to TRUE if there are more events in the
// input buffer waiting. They may or may not actually
// be keyboard events.
BOOL bMoreEvents;
};
class CKeyboard
{
public:
CKeyboard();
// Returns TRUE if a key was put in the structure.
// The key routines will return a code for any key hit on
// the keyboard (shift, alt, ctrl, etc...), only want to
// return the key if it is NOT a control key. This function
// will not wait for a key to be readied. If there is
// nothing to read, it returns FALSE.
BOOL GetKey(KEYBOARDCHAR &kbch);
private:
// Handle to the input buffer.
HANDLE m_hInput;
// Used so I don't have to keep allocating one.
INPUT_RECORD m_ir;
};
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -