📄 input_device_win32keyboard.cpp
字号:
/* $Id: input_device_win32keyboard.cpp,v 1.10 2003/11/11 10:13:25 grumbel Exp $
**
** ClanLib Game SDK
** Copyright (C) 2003 The ClanLib Team
** For a total list of contributers see the file CREDITS.
**
** This library is free software; you can redistribute it and/or
** modify it under the terms of the GNU Lesser General Public
** License as published by the Free Software Foundation; either
** version 2.1 of the License, or (at your option) any later version.
**
** This library is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
** Lesser General Public License for more details.
**
** You should have received a copy of the GNU Lesser General Public
** License along with this library; if not, write to the Free Software
** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <windows.h>
#include "Display/display_precomp.h"
#include "input_device_win32keyboard.h"
/////////////////////////////////////////////////////////////////////////////
// CL_InputDevice_Win32Keyboard construction:
CL_InputDevice_Win32Keyboard::CL_InputDevice_Win32Keyboard(CL_DisplayWindow_Win32 *window) : window(window)
{
type = CL_InputDevice::keyboard;
}
CL_InputDevice_Win32Keyboard::~CL_InputDevice_Win32Keyboard()
{
}
/////////////////////////////////////////////////////////////////////////////
// CL_InputDevice_Win32Keyboard attributes:
bool CL_InputDevice_Win32Keyboard::get_keycode(int keycode) const
{
return (GetKeyState(keycode) & 0xfe) != 0;
}
std::string CL_InputDevice_Win32Keyboard::get_key_name(int virtual_key) const
{
char name[1024];
UINT scancode = MapVirtualKey(virtual_key, 0);
int length = GetKeyNameText(scancode << 16, name, 1024);
return std::string(name, length);
}
float CL_InputDevice_Win32Keyboard::get_axis(int index) const
{
return 0.0f;
}
std::string CL_InputDevice_Win32Keyboard::get_name() const
{
return "System Keyboard";
}
int CL_InputDevice_Win32Keyboard::get_axis_count() const
{
return 0;
}
int CL_InputDevice_Win32Keyboard::get_button_count() const
{
return -1;
}
/////////////////////////////////////////////////////////////////////////////
// CL_InputDevice_Win32Keyboard operations:
/////////////////////////////////////////////////////////////////////////////
// CL_InputDevice_Win32Keyboard implementation:
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -