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
10class Window;
11
19class Input
20{
21public:
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
76private:
77 static const Window* window;
78};
79
键盘/鼠标输入.
Definition: Input.h:20
static Vector2 get_mouse_position()
获取光标相对窗口的位置.
Definition: Input.cpp:151
static void set_window(const Window &win)
设置接受输入的窗口.
Definition: Input.cpp:178
static void set_clipboard(const std::string &str)
设置剪切板内容, UTF-8 编码.
Definition: Input.cpp:173
static std::string_view get_clipboard()
获取剪切板内容, UTF-8 编码.
Definition: Input.cpp:168
static Key get_key_by_name(std::string_view name)
通过名称获取键盘按键.
Definition: Input.cpp:158
static bool is_pressed(Key key)
获取键盘按键状态.
Definition: Input.cpp:141
static Mouse get_mouse_by_name(std::string_view name)
通过鼠标获取键盘按键.
Definition: Input.cpp:163
窗体.
Definition: Window.h:24
Mouse
鼠标按键.
Definition: Key.h:151
Key
键盘按键.
Definition: Key.h:14