Graphics
v0.0.0
A simple abstraction layer for the modern graphics APIs.
载入中...
搜索中...
未找到
Input.h
1
// Copyright 2022 ShenMian
2
// License(Apache-2.0)
3
4
#pragma once
5
6
#include "Key.h"
7
#include <math/math.hpp>
8
#include <string_view>
9
10
class
Window
;
11
19
class
Input
20
{
21
public
:
29
static
bool
is_pressed
(
Key
key);
30
38
static
bool
is_pressed
(
Mouse
key);
39
43
static
Vector2
get_mouse_position
();
44
50
static
Key
get_key_by_name
(std::string_view name);
51
57
static
Mouse
get_mouse_by_name
(std::string_view name);
58
62
static
std::string_view
get_clipboard
();
63
69
static
void
set_clipboard
(
const
std::string& str);
70
74
static
void
set_window
(
const
Window
& win);
75
76
private
:
77
static
const
Window
* window;
78
};
79
Input
键盘/鼠标输入.
Definition:
Input.h:20
Input::get_mouse_position
static Vector2 get_mouse_position()
获取光标相对窗口的位置.
Definition:
Input.cpp:151
Input::set_window
static void set_window(const Window &win)
设置接受输入的窗口.
Definition:
Input.cpp:178
Input::set_clipboard
static void set_clipboard(const std::string &str)
设置剪切板内容, UTF-8 编码.
Definition:
Input.cpp:173
Input::get_clipboard
static std::string_view get_clipboard()
获取剪切板内容, UTF-8 编码.
Definition:
Input.cpp:168
Input::get_key_by_name
static Key get_key_by_name(std::string_view name)
通过名称获取键盘按键.
Definition:
Input.cpp:158
Input::is_pressed
static bool is_pressed(Key key)
获取键盘按键状态.
Definition:
Input.cpp:141
Input::get_mouse_by_name
static Mouse get_mouse_by_name(std::string_view name)
通过鼠标获取键盘按键.
Definition:
Input.cpp:163
Window
窗体.
Definition:
Window.h:24
Mouse
Mouse
鼠标按键.
Definition:
Key.h:151
Key
Key
键盘按键.
Definition:
Key.h:14
src
Core
Input.h
制作者
1.9.5