键盘、鼠标、手柄等输入检测
更多...
#include <dl_input.h>
|
| | Input () |
| |
| | ~Input () |
| |
| bool | KeyUp (KeyCode key_code) |
| | 检测一个按键按下并释放,只1帧有效。
|
| |
| bool | KeyDown (KeyCode key_code) |
| | 检测一个按键按下了,松开后再按下才会再次触发,只1帧有效。
|
| |
| bool | KeyDownAny () |
| | 检测是否按下任意键。
|
| |
| bool | KeyState (KeyCode key_code) |
| | 检测一个按键是否按下。
|
| |
| std::string | GetKeyName (KeyCode key_code) |
| | 返回按键的名称。
|
| |
| bool | KeyUp (MouseCode mouse_code) |
| | 鼠标键按下并释放,只1帧有效。
|
| |
| bool | KeyDown (MouseCode mouse_code) |
| | 鼠标键按下,只1帧有效。
|
| |
| bool | KeyState (MouseCode mouse_code) |
| | 鼠标键状态
|
| |
| bool | ClickDouble () |
| | 鼠标左键双击
|
| |
| void | SetMousePositionCenter () |
| | 设置鼠标居中窗口中。
|
| |
| Point | GetCursorPosition () |
| | 返回鼠标位置。限制到窗口范围
|
| |
| Position2 | GetCursorPos () |
| |
| Point | GetCursorPositionOutWindow () |
| | 返回鼠标位置,会超出窗口外,特殊情况使用。
|
| |
| Point | GetCursorPositionDelta () |
| | 和上帧的鼠标位置变化。
|
| |
| Position | GetScrollDelta () |
| | 获取滚动变化
|
| |
| void | ClearScrollDelta () |
| |
| void | SetRunBackground (bool run=false) |
| | 设置是否允许后台检测按键。
|
| |
| void | SetKeyNameType (KeyNameType type) |
| | 设置按键名字。
|
| |
| bool | WaitKeyDown (KeyCode &key_code, bool contain_special=false) |
| | 直到一个按键被按下 返回真。
|
| |
| void | SetGamePadOpen (bool open) |
| | 设置手柄是否启用。
|
| |
| GamePad * | GetGamePad (unsigned id) |
| | 返回手柄对象,失败返回nullptr。 @parma[in] id 手柄编号0-3
|
| |
| void | ControlCoor (Coor *coor, Float move_speed=200_f, Float scale_speed=1_f, Float rotate_speed=Math::PI(1, 2)) |
| | 控制一个Coor移动、缩放、旋转
|
| |
| void | _set_key (int key, bool down) |
| | 设置一个键是否按下
|
| |
| void | _set_key_mouse (int key, bool down) |
| | 设置鼠标键是否按下
|
| |
| void | _set_cursor (int xpos, int ypos, bool b_clear_cursor_dt) |
| | 设置光标位置
|
| |
| void | _set_scroll (double dx, double dy) |
| | 设置滚轮
|
| |
键盘、鼠标、手柄等输入检测
在文件 dl_input.h 第 211 行定义.
◆ KeyNameType
◆ Input()
◆ ~Input()
◆ _set_cursor()
| void dl::Input::_set_cursor |
( |
int | xpos, |
|
|
int | ypos, |
|
|
bool | b_clear_cursor_dt ) |
设置光标位置
- 注解
- 请勿调用,在轮询事件时会自动调用(传入系统层坐标)
◆ _set_key()
| void dl::Input::_set_key |
( |
int | key, |
|
|
bool | down ) |
|
inline |
设置一个键是否按下
- 注解
- 请勿调用,在轮询事件时会自动调用(按下 与 重复均为真)
在文件 dl_input.h 第 387 行定义.
◆ _set_key_mouse()
| void dl::Input::_set_key_mouse |
( |
int | key, |
|
|
bool | down ) |
|
inline |
设置鼠标键是否按下
- 注解
- 请勿调用,在轮询事件时会自动调用(按下 与 重复均为真)
在文件 dl_input.h 第 395 行定义.
◆ _set_scroll()
| void dl::Input::_set_scroll |
( |
double | dx, |
|
|
double | dy ) |
|
inline |
◆ ClearScrollDelta()
| void dl::Input::ClearScrollDelta |
( |
| ) |
|
|
inline |
◆ ClickDouble()
| bool dl::Input::ClickDouble |
( |
| ) |
|
|
inline |
◆ ControlCoor()
◆ GetCursorPos()
◆ GetCursorPosition()
| Point dl::Input::GetCursorPosition |
( |
| ) |
|
◆ GetCursorPositionDelta()
| Point dl::Input::GetCursorPositionDelta |
( |
| ) |
|
|
inline |
◆ GetCursorPositionOutWindow()
| Point dl::Input::GetCursorPositionOutWindow |
( |
| ) |
|
|
inline |
◆ GetGamePad()
| GamePad * dl::Input::GetGamePad |
( |
unsigned | id | ) |
|
返回手柄对象,失败返回nullptr。 @parma[in] id 手柄编号0-3
◆ GetKeyName()
| std::string dl::Input::GetKeyName |
( |
KeyCode | key_code | ) |
|
◆ GetScrollDelta()
◆ KeyDown() [1/2]
| bool dl::Input::KeyDown |
( |
KeyCode | key_code | ) |
|
|
inline |
◆ KeyDown() [2/2]
| bool dl::Input::KeyDown |
( |
MouseCode | mouse_code | ) |
|
|
inline |
◆ KeyDownAny()
| bool dl::Input::KeyDownAny |
( |
| ) |
|
◆ KeyState() [1/2]
| bool dl::Input::KeyState |
( |
KeyCode | key_code | ) |
|
|
inline |
检测一个按键是否按下。
- 返回
- 按回的是键盘的按键状态。和KeyUp、KeyDown不同,只要按键是被玩家按下了,就会返回真,否则返回假。
在文件 dl_input.h 第 269 行定义.
◆ KeyState() [2/2]
| bool dl::Input::KeyState |
( |
MouseCode | mouse_code | ) |
|
|
inline |
◆ KeyUp() [1/2]
| bool dl::Input::KeyUp |
( |
KeyCode | key_code | ) |
|
|
inline |
◆ KeyUp() [2/2]
| bool dl::Input::KeyUp |
( |
MouseCode | mouse_code | ) |
|
|
inline |
◆ SetGamePadOpen()
| void dl::Input::SetGamePadOpen |
( |
bool | open | ) |
|
◆ SetKeyNameType()
◆ SetMousePositionCenter()
| void dl::Input::SetMousePositionCenter |
( |
| ) |
|
◆ SetRunBackground()
| void dl::Input::SetRunBackground |
( |
bool | run = false | ) |
|
◆ WaitKeyDown()
| bool dl::Input::WaitKeyDown |
( |
KeyCode & | key_code, |
|
|
bool | contain_special = false ) |
◆ System
该类的文档由以下文件生成: