]> git.sesse.net Git - pistorm/blob - raylib/uwp_events.h
Add Meson build files.
[pistorm] / raylib / uwp_events.h
1 /**********************************************************************************************
2 *
3 *   raylib.uwp_events - Functions for bootstrapping UWP functionality within raylib's core.
4 *
5 *
6 *   LICENSE: zlib/libpng
7 *
8 *   Copyright (c) 2020-2020 Reece Mackie (@Rover656)
9 *
10 *   This software is provided "as-is", without any express or implied warranty. In no event
11 *   will the authors be held liable for any damages arising from the use of this software.
12 *
13 *   Permission is granted to anyone to use this software for any purpose, including commercial
14 *   applications, and to alter it and redistribute it freely, subject to the following restrictions:
15 *
16 *     1. The origin of this software must not be misrepresented; you must not claim that you
17 *     wrote the original software. If you use this software in a product, an acknowledgment
18 *     in the product documentation would be appreciated but is not required.
19 *
20 *     2. Altered source versions must be plainly marked as such, and must not be misrepresented
21 *     as being the original software.
22 *
23 *     3. This notice may not be removed or altered from any source distribution.
24 *
25 **********************************************************************************************/
26
27 #ifndef UWP_EVENTS_H
28 #define UWP_EVENTS_H
29
30 #if defined(__cplusplus)
31 extern "C" {
32 #endif
33
34 #if defined(PLATFORM_UWP)
35
36 // Determine if UWP functions are set and ready for raylib's use.
37 bool UWPIsConfigured();
38
39 // Call this to set the UWP data path you wish for saving and loading.
40 void UWPSetDataPath(const char* path);
41
42 // Function for getting program time.
43 typedef double(*UWPQueryTimeFunc)();
44 UWPQueryTimeFunc UWPGetQueryTimeFunc(void);
45 void UWPSetQueryTimeFunc(UWPQueryTimeFunc func);
46
47 // Function for sleeping the current thread
48 typedef void (*UWPSleepFunc)(double sleepUntil);
49 UWPSleepFunc UWPGetSleepFunc(void);
50 void UWPSetSleepFunc(UWPSleepFunc func);
51
52 // Function for querying the display size
53 typedef void(*UWPDisplaySizeFunc)(int* width, int* height);
54 UWPDisplaySizeFunc UWPGetDisplaySizeFunc(void);
55 void UWPSetDisplaySizeFunc(UWPDisplaySizeFunc func);
56
57 // Functions for mouse cursor control
58 typedef void(*UWPMouseFunc)(void);
59 UWPMouseFunc UWPGetMouseLockFunc();
60 void UWPSetMouseLockFunc(UWPMouseFunc func);
61 UWPMouseFunc UWPGetMouseUnlockFunc();
62 void UWPSetMouseUnlockFunc(UWPMouseFunc func);
63 UWPMouseFunc UWPGetMouseShowFunc();
64 void UWPSetMouseShowFunc(UWPMouseFunc func);
65 UWPMouseFunc UWPGetMouseHideFunc();
66 void UWPSetMouseHideFunc(UWPMouseFunc func);
67
68 // Function for setting mouse cursor position.
69 typedef void (*UWPMouseSetPosFunc)(int x, int y);
70 UWPMouseSetPosFunc UWPGetMouseSetPosFunc();
71 void UWPSetMouseSetPosFunc(UWPMouseSetPosFunc func);
72
73 // The below functions are implemented in core.c but are placed here so they can be called by user code.
74 // This choice is made as platform-specific code is preferred to be kept away from raylib.h
75
76 // Call this when a Key is pressed or released.
77 void UWPKeyDownEvent(int key, bool down, bool controlKey);
78
79 // Call this on the CoreWindow::CharacterRecieved event
80 void UWPKeyCharEvent(int key);
81
82 // Call when a mouse button state changes
83 void UWPMouseButtonEvent(int button, bool down);
84
85 // Call when the mouse cursor moves
86 void UWPMousePosEvent(double x, double y);
87
88 // Call when the mouse wheel moves
89 void UWPMouseWheelEvent(int deltaY);
90
91 // Call when the window resizes
92 void UWPResizeEvent(int width, int height);
93
94 // Call when a gamepad is made active
95 void UWPActivateGamepadEvent(int gamepad, bool active);
96
97 // Call when a gamepad button state changes
98 void UWPRegisterGamepadButton(int gamepad, int button, bool down);
99
100 // Call when a gamepad axis state changes
101 void UWPRegisterGamepadAxis(int gamepad, int axis, float value);
102
103 // Call when the touch point moves
104 void UWPGestureMove(int pointer, float x, float y);
105
106 // Call when there is a touch down or up
107 void UWPGestureTouch(int pointer, float x, float y, bool touch);
108
109 // Set the core window pointer so that we can pass it to EGL.
110 void* UWPGetCoreWindowPtr();
111 void UWPSetCoreWindowPtr(void* ptr);
112
113 #if defined(__cplusplus)
114 }
115 #endif
116
117 #endif // PLATFORM_UWP
118
119 #endif // UWP_EVENTS_H