Topaz 5.0
Topaz Game Engine
Loading...
Searching...
No Matches
input.hpp
1#ifndef TOPAZ_OS_INPUT_HPP
2#define TOPAZ_OS_INPUT_HPP
3#include "tz/core/error.hpp"
4#include <utility>
5
6namespace tz::os
7{
18 enum class key
19 {
20 backspace,
21 tab,
22 enter,
23
24 left_shift,
25 left_control,
26 left_alt,
27
28 pause,
29 caps_lock,
30 escape,
31
32 spacebar,
33 page_down,
34 page_up,
35
36 end,
37 home,
38
39 left_arrow,
40 up_arrow,
41 right_arrow,
42 down_arrow,
43
44 select,
45 print,
46 printsc,
47 ins,
48 del,
49 n0,n1,n2,n3,n4,n5,n6,n7,n8,n9,
50 a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,
51
52 left_winkey,
53 right_winkey,
54 apps,
55 sleep,
56
57 np0,np1,np2,np3,np4,np5,np6,np7,np8,np9,
58 npmul,npadd,npsep,npsub,npdec,npdiv,
59 f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f11,f12,f13,f14,f15,f16,f17,f18,f19,f20,f21,f22,f23,f24,
60 num_lock,
61 scroll_lock,
62
63 right_shift,
64 right_control,
65 right_alt,
66 semicol,
67 period,
68 plus,
69 minus,
70
71 obrack,
72 cbrack,
73 forward_slash,
74 back_slash,
75 apostrophe,
76 grave,
77 _count
78 };
79
80 using char_type_callback = void(*)(char);
87 tz::error_code install_char_typed_callback(char_type_callback callback);
95 constexpr std::pair<unsigned int, unsigned int> invalid_mouse_position{-1u, -1u};
104 std::pair<unsigned int, unsigned int> get_mouse_position();
105
106 enum class mouse_button
107 {
108 left,
109 right,
110 middle,
111 _count
112 };
113
114 bool is_mouse_clicked(mouse_button b);
115 std::pair<unsigned int, unsigned int> get_mouse_click_position(mouse_button b);
116}
117
118#endif // TOPAZ_OS_INPUT_HPP
error_code
Error codes for Topaz.
Definition error.hpp:14
key
Definition input.hpp:19
std::pair< unsigned int, unsigned int > get_mouse_position()
Retrieve the mouse cursor's current position, in pixels, relative to the top-left of the window.
bool is_key_pressed(key k)
Query as to whether a specific key is pressed right now.
tz::error_code install_char_typed_callback(char_type_callback callback)
Install a callback which will be invoked whenever the user types a character on the keyboard.