📄 keyboard_win32.cpp
字号:
/******************************************************************************
*******************************************************************************
** **
** Copyright (c) 2006 Videon Central, Inc. **
** All rights reserved. **
** **
** The computer program contained herein contains proprietary information **
** which is the property of Videon Central, Inc. The program may be used **
** and/or copied only with the written permission of Videon Central, Inc. **
** or in accordance with the terms and conditions stipulated in the **
** agreement/contract under which the programs have been supplied. **
** **
*******************************************************************************
******************************************************************************/
/**
* @file keyboard_windows.cpp
*
* $Revision: 1.2 $
*
* keyboard i/o on windows platform
*
*/
#include "keyboard.h"
#include "dbgprint.h"
#include <conio.h>
/**
*******************************************************************************
* Keyboard_Open prepares for keyboard input/output
*
*******************************************************************************/
void Keyboard_Open ( void )
{
}
/**
*******************************************************************************
* Keyboard_Close releases any resources obtained for keyboard input/output
*
*******************************************************************************/
void Keyboard_Close ( void )
{
}
/**
*******************************************************************************
* Keyboard_IsKeyAvailable checks if a key has been pressed on the keyboard
*
* @return TRUE if the keyboard has been pressed, FALSE otherwise
*******************************************************************************/
BOOLEAN Keyboard_IsKeyAvailable( void )
{
if ( _kbhit() != 0 )
{
return ( TRUE );
}
return ( FALSE );
}
/**
*******************************************************************************
* Keyboard_GetKey returns next available key from keyboard.
* NOTE: This routine will block if no key is available until the keyboard is pressed
*
* @return keycode as a KeyboardKeycodeType
*******************************************************************************/
KeyboardKeycodeType Keyboard_GetKey ( void )
{
int rawKeycode;
rawKeycode = _getch();
if ( rawKeycode == 0xE0 )
{
rawKeycode = rawKeycode << 8;
rawKeycode = rawKeycode | _getch();
}
switch ( rawKeycode )
{
case 0xE04b: return ( KEYBOARD_KEYCODE_LEFT_ARROW );
case 0xE048: return ( KEYBOARD_KEYCODE_UP_ARROW );
case 0xE050: return ( KEYBOARD_KEYCODE_DOWN_ARROW );
case 0xE04d: return ( KEYBOARD_KEYCODE_RIGHT_ARROW );
case 13: return ( KEYBOARD_KEYCODE_ENTER );
case 32: return ( KEYBOARD_KEYCODE_SPACEBAR );
default:
return ( (KeyboardKeycodeType)rawKeycode );
break;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -