Read desc
- Moved UWP specific functions to uwp_events.h - Removed BaseApp. - Implemented example UWP lifecycle.
This commit is contained in:
parent
8061116f0e
commit
0357230af8
4 changed files with 674 additions and 755 deletions
174
src/core.c
174
src/core.c
|
|
@ -255,6 +255,7 @@
|
|||
#include "EGL/egl.h" // Khronos EGL library - Native platform display device control functions
|
||||
#include "EGL/eglext.h" // Khronos EGL library - Extensions
|
||||
#include "GLES2/gl2.h" // Khronos OpenGL ES 2.0 library
|
||||
#include "uwp_events.h" // UWP bootstrapping functions
|
||||
#endif
|
||||
|
||||
#if defined(PLATFORM_WEB)
|
||||
|
|
@ -1249,9 +1250,7 @@ void EnableCursor(void)
|
|||
CORE.Input.Mouse.cursorLockRequired = true;
|
||||
#endif
|
||||
#if defined(PLATFORM_UWP)
|
||||
UWPMessage *msg = CreateUWPMessage();
|
||||
msg->type = UWP_MSG_LOCK_MOUSE;
|
||||
SendMessageToUWP(msg);
|
||||
UWPGetMouseUnlockFunc()();
|
||||
#endif
|
||||
CORE.Input.Mouse.cursorHidden = false;
|
||||
}
|
||||
|
|
@ -1266,9 +1265,7 @@ void DisableCursor(void)
|
|||
CORE.Input.Mouse.cursorLockRequired = true;
|
||||
#endif
|
||||
#if defined(PLATFORM_UWP)
|
||||
UWPMessage *msg = CreateUWPMessage();
|
||||
msg->type = UWP_MSG_UNLOCK_MOUSE;
|
||||
SendMessageToUWP(msg);
|
||||
UWPGetMouseLockFunc()();
|
||||
#endif
|
||||
CORE.Input.Mouse.cursorHidden = true;
|
||||
}
|
||||
|
|
@ -2640,11 +2637,7 @@ void SetMousePosition(int x, int y)
|
|||
glfwSetCursorPos(CORE.Window.handle, CORE.Input.Mouse.position.x, CORE.Input.Mouse.position.y);
|
||||
#endif
|
||||
#if defined(PLATFORM_UWP)
|
||||
UWPMessage *msg = CreateUWPMessage();
|
||||
msg->type = UWP_MSG_SET_MOUSE_LOCATION;
|
||||
msg->paramVector0.x = CORE.Input.Mouse.position.x;
|
||||
msg->paramVector0.y = CORE.Input.Mouse.position.y;
|
||||
SendMessageToUWP(msg);
|
||||
UWPGetMouseSetPosFunc()(x, y);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
@ -5139,6 +5132,165 @@ static void *GamepadThread(void *arg)
|
|||
|
||||
#if defined(PLATFORM_UWP)
|
||||
|
||||
static UWPQueryTimeFunc uwpQueryTimeFunc = NULL;
|
||||
static UWPSleepFunc uwpSleepFunc = NULL;
|
||||
static UWPDisplaySizeFunc uwpDisplaySizeFunc = NULL;
|
||||
static UWPMouseFunc uwpMouseLockFunc = NULL;
|
||||
static UWPMouseFunc uwpMouseUnlockFunc = NULL;
|
||||
static UWPMouseFunc uwpMouseShowFunc = NULL;
|
||||
static UWPMouseFunc uwpMouseHideFunc = NULL;
|
||||
static UWPMouseSetPosFunc uwpMouseSetPosFunc = NULL;
|
||||
static void* uwpCoreWindow = NULL;
|
||||
|
||||
bool UWPIsConfigured()
|
||||
{
|
||||
bool pass = true;
|
||||
if (uwpQueryTimeFunc == NULL)
|
||||
{
|
||||
TRACELOG(LOG_ERROR, "You must call UWPSetQueryTimeFunc with a valid function before calling InitWindow()");
|
||||
pass = false;
|
||||
}
|
||||
|
||||
if (uwpSleepFunc == NULL)
|
||||
{
|
||||
TRACELOG(LOG_ERROR, "You must call UWPSetSleepFunc with a valid function before calling InitWindow()");
|
||||
pass = false;
|
||||
}
|
||||
|
||||
if (uwpDisplaySizeFunc == NULL)
|
||||
{
|
||||
TRACELOG(LOG_ERROR, "You must call UWPSetDisplaySizeFunc with a valid function before calling InitWindow()");
|
||||
pass = false;
|
||||
}
|
||||
|
||||
if (uwpMouseLockFunc == NULL)
|
||||
{
|
||||
TRACELOG(LOG_ERROR, "You must call UWPSetMouseLockFunc with a valid function before calling InitWindow()");
|
||||
pass = false;
|
||||
}
|
||||
|
||||
if (uwpMouseUnlockFunc == NULL)
|
||||
{
|
||||
TRACELOG(LOG_ERROR, "You must call UWPSetMouseUnlockFunc with a valid function before calling InitWindow()");
|
||||
pass = false;
|
||||
}
|
||||
|
||||
if (uwpMouseShowFunc == NULL)
|
||||
{
|
||||
TRACELOG(LOG_ERROR, "You must call UWPSetMouseShowFunc with a valid function before calling InitWindow()");
|
||||
pass = false;
|
||||
}
|
||||
|
||||
if (uwpMouseHideFunc == NULL)
|
||||
{
|
||||
TRACELOG(LOG_ERROR, "You must call UWPSetMouseHideFunc with a valid function before calling InitWindow()");
|
||||
pass = false;
|
||||
}
|
||||
|
||||
if (uwpMouseSetPosFunc == NULL)
|
||||
{
|
||||
TRACELOG(LOG_ERROR, "You must call UWPSetMouseSetPosFunc with a valid function before calling InitWindow()");
|
||||
pass = false;
|
||||
}
|
||||
|
||||
if (uwpCoreWindow == NULL)
|
||||
{
|
||||
TRACELOG(LOG_ERROR, "You must set a pointer to the UWP core window before calling InitWindow()");
|
||||
pass = false;
|
||||
}
|
||||
return pass;
|
||||
}
|
||||
|
||||
UWPQueryTimeFunc UWPGetQueryTimeFunc(void)
|
||||
{
|
||||
return uwpQueryTimeFunc;
|
||||
}
|
||||
|
||||
void UWPSetQueryTimeFunc(UWPQueryTimeFunc func)
|
||||
{
|
||||
uwpQueryTimeFunc = func;
|
||||
}
|
||||
|
||||
UWPSleepFunc UWPGetSleepFunc(void)
|
||||
{
|
||||
return uwpSleepFunc;
|
||||
}
|
||||
|
||||
void UWPSetSleepFunc(UWPSleepFunc func)
|
||||
{
|
||||
uwpSleepFunc = func;
|
||||
}
|
||||
|
||||
UWPDisplaySizeFunc UWPGetDisplaySizeFunc(void)
|
||||
{
|
||||
return uwpDisplaySizeFunc;
|
||||
}
|
||||
|
||||
void UWPSetDisplaySizeFunc(UWPDisplaySizeFunc func)
|
||||
{
|
||||
uwpDisplaySizeFunc = func;
|
||||
}
|
||||
|
||||
UWPMouseFunc UWPGetMouseLockFunc()
|
||||
{
|
||||
return uwpMouseLockFunc;
|
||||
}
|
||||
|
||||
void UWPSetMouseLockFunc(UWPMouseFunc func)
|
||||
{
|
||||
uwpMouseLockFunc = func;
|
||||
}
|
||||
|
||||
UWPMouseFunc UWPGetMouseUnlockFunc()
|
||||
{
|
||||
return uwpMouseUnlockFunc;
|
||||
}
|
||||
|
||||
void UWPSetMouseUnlockFunc(UWPMouseFunc func)
|
||||
{
|
||||
uwpMouseUnlockFunc = func;
|
||||
}
|
||||
|
||||
UWPMouseFunc UWPGetMouseShowFunc()
|
||||
{
|
||||
return uwpMouseShowFunc;
|
||||
}
|
||||
|
||||
void UWPSetMouseShowFunc(UWPMouseFunc func)
|
||||
{
|
||||
uwpMouseShowFunc = func;
|
||||
}
|
||||
|
||||
UWPMouseFunc UWPGetMouseHideFunc()
|
||||
{
|
||||
return uwpMouseHideFunc;
|
||||
}
|
||||
|
||||
void UWPSetMouseHideFunc(UWPMouseFunc func)
|
||||
{
|
||||
uwpMouseHideFunc = func;
|
||||
}
|
||||
|
||||
UWPMouseSetPosFunc UWPGetMouseSetPosFunc()
|
||||
{
|
||||
return uwpMouseSetPosFunc;
|
||||
}
|
||||
|
||||
void UWPSetMouseSetPosFunc(UWPMouseSetPosFunc func)
|
||||
{
|
||||
uwpMouseSetPosFunc = func;
|
||||
}
|
||||
|
||||
void* UWPGetCoreWindowPtr()
|
||||
{
|
||||
return uwpCoreWindow;
|
||||
}
|
||||
|
||||
void UWPSetCoreWindowPtr(void* ptr)
|
||||
{
|
||||
uwpCoreWindow = ptr;
|
||||
}
|
||||
|
||||
void UWPMouseWheelEvent(int deltaY)
|
||||
{
|
||||
CORE.Input.Mouse.currentWheelMove = (int)deltaY;
|
||||
|
|
|
|||
214
src/utils.c
214
src/utils.c
|
|
@ -68,13 +68,6 @@ static AAssetManager *assetManager = NULL; // Android assets manage
|
|||
static const char *internalDataPath = NULL; // Android internal data path
|
||||
#endif
|
||||
|
||||
#if defined(PLATFORM_UWP)
|
||||
static int UWPOutMessageId = -1; // Last index of output message
|
||||
static UWPMessage *UWPOutMessages[MAX_UWP_MESSAGES]; // Messages out to UWP
|
||||
static int UWPInMessageId = -1; // Last index of input message
|
||||
static UWPMessage *UWPInMessages[MAX_UWP_MESSAGES]; // Messages in from UWP
|
||||
#endif
|
||||
|
||||
//----------------------------------------------------------------------------------
|
||||
// Module specific Functions Declaration
|
||||
//----------------------------------------------------------------------------------
|
||||
|
|
@ -361,210 +354,3 @@ static int android_close(void *cookie)
|
|||
return 0;
|
||||
}
|
||||
#endif // PLATFORM_ANDROID
|
||||
|
||||
#if defined(PLATFORM_UWP)
|
||||
UWPMessage *CreateUWPMessage(void)
|
||||
{
|
||||
UWPMessage *msg = (UWPMessage *)RL_MALLOC(sizeof(UWPMessage));
|
||||
msg->type = UWP_MSG_NONE;
|
||||
Vector2 v0 = { 0, 0 };
|
||||
msg->paramVector0 = v0;
|
||||
msg->paramInt0 = 0;
|
||||
msg->paramInt1 = 0;
|
||||
msg->paramChar0 = 0;
|
||||
msg->paramFloat0 = 0;
|
||||
msg->paramDouble0 = 0;
|
||||
msg->paramBool0 = false;
|
||||
return msg;
|
||||
}
|
||||
|
||||
void DeleteUWPMessage(UWPMessage *msg)
|
||||
{
|
||||
RL_FREE(msg);
|
||||
}
|
||||
|
||||
bool UWPHasMessages(void)
|
||||
{
|
||||
return (UWPOutMessageId > -1);
|
||||
}
|
||||
|
||||
UWPMessage *UWPGetMessage(void)
|
||||
{
|
||||
if (UWPHasMessages()) return UWPOutMessages[UWPOutMessageId--];
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void SendMessageToUWP(UWPMessage *msg)
|
||||
{
|
||||
if ((UWPOutMessageId + 1) < MAX_UWP_MESSAGES)
|
||||
{
|
||||
UWPOutMessageId++;
|
||||
UWPOutMessages[UWPOutMessageId] = msg;
|
||||
}
|
||||
else TRACELOG(LOG_WARNING, "UWP: Not enough array space to register new outward message");
|
||||
}
|
||||
|
||||
|
||||
// NEW UWP API
|
||||
|
||||
static UWPQueryTimeFunc uwpQueryTimeFunc = NULL;
|
||||
static UWPSleepFunc uwpSleepFunc = NULL;
|
||||
static UWPDisplaySizeFunc uwpDisplaySizeFunc = NULL;
|
||||
static UWPMouseFunc uwpMouseLockFunc = NULL;
|
||||
static UWPMouseFunc uwpMouseUnlockFunc = NULL;
|
||||
static UWPMouseFunc uwpMouseShowFunc = NULL;
|
||||
static UWPMouseFunc uwpMouseHideFunc = NULL;
|
||||
static UWPMouseSetPosFunc uwpMouseSetPosFunc = NULL;
|
||||
static void* uwpCoreWindow = NULL;
|
||||
|
||||
bool UWPIsConfigured()
|
||||
{
|
||||
bool pass = true;
|
||||
if (uwpQueryTimeFunc == NULL)
|
||||
{
|
||||
TRACELOG(LOG_ERROR, "You must call UWPSetQueryTimeFunc with a valid function before calling InitWindow()");
|
||||
pass = false;
|
||||
}
|
||||
|
||||
if (uwpSleepFunc == NULL)
|
||||
{
|
||||
TRACELOG(LOG_ERROR, "You must call UWPSetSleepFunc with a valid function before calling InitWindow()");
|
||||
pass = false;
|
||||
}
|
||||
|
||||
if (uwpDisplaySizeFunc == NULL)
|
||||
{
|
||||
TRACELOG(LOG_ERROR, "You must call UWPSetDisplaySizeFunc with a valid function before calling InitWindow()");
|
||||
pass = false;
|
||||
}
|
||||
|
||||
if (uwpMouseLockFunc == NULL)
|
||||
{
|
||||
TRACELOG(LOG_ERROR, "You must call UWPSetMouseLockFunc with a valid function before calling InitWindow()");
|
||||
pass = false;
|
||||
}
|
||||
|
||||
if (uwpMouseUnlockFunc == NULL)
|
||||
{
|
||||
TRACELOG(LOG_ERROR, "You must call UWPSetMouseUnlockFunc with a valid function before calling InitWindow()");
|
||||
pass = false;
|
||||
}
|
||||
|
||||
if (uwpMouseShowFunc == NULL)
|
||||
{
|
||||
TRACELOG(LOG_ERROR, "You must call UWPSetMouseShowFunc with a valid function before calling InitWindow()");
|
||||
pass = false;
|
||||
}
|
||||
|
||||
if (uwpMouseHideFunc == NULL)
|
||||
{
|
||||
TRACELOG(LOG_ERROR, "You must call UWPSetMouseHideFunc with a valid function before calling InitWindow()");
|
||||
pass = false;
|
||||
}
|
||||
|
||||
if (uwpMouseSetPosFunc == NULL)
|
||||
{
|
||||
TRACELOG(LOG_ERROR, "You must call UWPSetMouseSetPosFunc with a valid function before calling InitWindow()");
|
||||
pass = false;
|
||||
}
|
||||
|
||||
if (uwpCoreWindow == NULL)
|
||||
{
|
||||
TRACELOG(LOG_ERROR, "You must set a pointer to the UWP core window before calling InitWindow()");
|
||||
pass = false;
|
||||
}
|
||||
return pass;
|
||||
}
|
||||
|
||||
UWPQueryTimeFunc UWPGetQueryTimeFunc(void)
|
||||
{
|
||||
return uwpQueryTimeFunc;
|
||||
}
|
||||
|
||||
void UWPSetQueryTimeFunc(UWPQueryTimeFunc func)
|
||||
{
|
||||
uwpQueryTimeFunc = func;
|
||||
}
|
||||
|
||||
UWPSleepFunc UWPGetSleepFunc(void)
|
||||
{
|
||||
return uwpSleepFunc;
|
||||
}
|
||||
|
||||
void UWPSetSleepFunc(UWPSleepFunc func)
|
||||
{
|
||||
uwpSleepFunc = func;
|
||||
}
|
||||
|
||||
UWPDisplaySizeFunc UWPGetDisplaySizeFunc(void)
|
||||
{
|
||||
return uwpDisplaySizeFunc;
|
||||
}
|
||||
|
||||
void UWPSetDisplaySizeFunc(UWPDisplaySizeFunc func)
|
||||
{
|
||||
uwpDisplaySizeFunc = func;
|
||||
}
|
||||
|
||||
UWPMouseFunc UWPGetMouseLockFunc()
|
||||
{
|
||||
return uwpMouseLockFunc;
|
||||
}
|
||||
|
||||
void UWPSetMouseLockFunc(UWPMouseFunc func)
|
||||
{
|
||||
uwpMouseLockFunc = func;
|
||||
}
|
||||
|
||||
UWPMouseFunc UWPGetMouseUnlockFunc()
|
||||
{
|
||||
return uwpMouseUnlockFunc;
|
||||
}
|
||||
|
||||
void UWPSetMouseUnlockFunc(UWPMouseFunc func)
|
||||
{
|
||||
uwpMouseUnlockFunc = func;
|
||||
}
|
||||
|
||||
UWPMouseFunc UWPGetMouseShowFunc()
|
||||
{
|
||||
return uwpMouseShowFunc;
|
||||
}
|
||||
|
||||
void UWPSetMouseShowFunc(UWPMouseFunc func)
|
||||
{
|
||||
uwpMouseShowFunc = func;
|
||||
}
|
||||
|
||||
UWPMouseFunc UWPGetMouseHideFunc()
|
||||
{
|
||||
return uwpMouseHideFunc;
|
||||
}
|
||||
|
||||
void UWPSetMouseHideFunc(UWPMouseFunc func)
|
||||
{
|
||||
uwpMouseHideFunc = func;
|
||||
}
|
||||
|
||||
UWPMouseSetPosFunc UWPGetMouseSetPosFunc()
|
||||
{
|
||||
return uwpMouseSetPosFunc;
|
||||
}
|
||||
|
||||
void UWPSetMouseSetPosFunc(UWPMouseSetPosFunc func)
|
||||
{
|
||||
uwpMouseSetPosFunc = func;
|
||||
}
|
||||
|
||||
void* UWPGetCoreWindowPtr()
|
||||
{
|
||||
return uwpCoreWindow;
|
||||
}
|
||||
|
||||
void UWPSetCoreWindowPtr(void* ptr)
|
||||
{
|
||||
uwpCoreWindow = ptr;
|
||||
}
|
||||
|
||||
#endif // PLATFORM_UWP
|
||||
|
|
|
|||
70
src/utils.h
70
src/utils.h
|
|
@ -72,76 +72,6 @@ void InitAssetManager(AAssetManager *manager, const char *dataPath); // Initia
|
|||
FILE *android_fopen(const char *fileName, const char *mode); // Replacement for fopen() -> Read-only!
|
||||
#endif
|
||||
|
||||
#if defined(PLATFORM_UWP)
|
||||
// UWP Implementation Features
|
||||
|
||||
// Determine if UWP functions are set and ready for raylib's use.
|
||||
bool UWPIsConfigured();
|
||||
|
||||
// Function for getting program time.
|
||||
typedef double(*UWPQueryTimeFunc)();
|
||||
UWPQueryTimeFunc UWPGetQueryTimeFunc(void);
|
||||
void UWPSetQueryTimeFunc(UWPQueryTimeFunc func);
|
||||
|
||||
// Function for sleeping the current thread
|
||||
typedef void (*UWPSleepFunc)(double sleepUntil);
|
||||
UWPSleepFunc UWPGetSleepFunc(void);
|
||||
void UWPSetSleepFunc(UWPSleepFunc func);
|
||||
|
||||
// Function for querying the display size
|
||||
typedef void(*UWPDisplaySizeFunc)(int *width, int* height);
|
||||
UWPDisplaySizeFunc UWPGetDisplaySizeFunc(void);
|
||||
void UWPSetDisplaySizeFunc(UWPDisplaySizeFunc func);
|
||||
|
||||
// Functions for mouse cursor control
|
||||
typedef void(*UWPMouseFunc)(void);
|
||||
UWPMouseFunc UWPGetMouseLockFunc();
|
||||
void UWPSetMouseLockFunc(UWPMouseFunc func);
|
||||
UWPMouseFunc UWPGetMouseUnlockFunc();
|
||||
void UWPSetMouseUnlockFunc(UWPMouseFunc func);
|
||||
UWPMouseFunc UWPGetMouseShowFunc();
|
||||
void UWPSetMouseShowFunc(UWPMouseFunc func);
|
||||
UWPMouseFunc UWPGetMouseHideFunc();
|
||||
void UWPSetMouseHideFunc(UWPMouseFunc func);
|
||||
|
||||
// Function for setting mouse cursor position.
|
||||
typedef void (*UWPMouseSetPosFunc)(int x, int y);
|
||||
UWPMouseSetPosFunc UWPGetMouseSetPosFunc();
|
||||
void UWPSetMouseSetPosFunc(UWPMouseSetPosFunc func);
|
||||
|
||||
// The below functions are implemented in core.c but are placed here so they can be called by user code.
|
||||
// This choice is made as platform-specific code is preferred to be kept away from raylib.h
|
||||
|
||||
// Call this when a Key is pressed or released.
|
||||
void UWPKeyDownEvent(int key, bool down);
|
||||
|
||||
// Call when a mouse button state changes
|
||||
void UWPMouseButtonEvent(int button, bool down);
|
||||
|
||||
// Call when the mouse cursor moves
|
||||
void UWPMousePosEvent(double x, double y);
|
||||
|
||||
// Call when the mouse wheel moves
|
||||
void UWPMouseWheelEvent(int deltaY);
|
||||
|
||||
// Call when the window resizes
|
||||
void UWPResizeEvent(int width, int height);
|
||||
|
||||
// Call when a gamepad is made active
|
||||
void UWPActivateGamepadEvent(int gamepad, bool active);
|
||||
|
||||
// Call when a gamepad button state changes
|
||||
void UWPRegisterGamepadButton(int gamepad, int button, bool down);
|
||||
|
||||
// Call when a gamepad axis state changes
|
||||
void UWPRegisterGamepadAxis(int gamepad, int axis, float value);
|
||||
|
||||
// Set the core window pointer so that we can pass it to EGL.
|
||||
void* UWPGetCoreWindowPtr();
|
||||
void UWPSetCoreWindowPtr(void* ptr);
|
||||
|
||||
#endif // defined(PLATFORM_UWP)
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
107
src/uwp_events.h
Normal file
107
src/uwp_events.h
Normal file
|
|
@ -0,0 +1,107 @@
|
|||
/**********************************************************************************************
|
||||
*
|
||||
* raylib.uwp_events - Functions for bootstrapping UWP functionality within raylib's core.
|
||||
*
|
||||
*
|
||||
* LICENSE: zlib/libpng
|
||||
*
|
||||
* Copyright (c) 2014-2020 Ramon Santamaria (@raysan5)
|
||||
*
|
||||
* This software is provided "as-is", without any express or implied warranty. In no event
|
||||
* will the authors be held liable for any damages arising from the use of this software.
|
||||
*
|
||||
* Permission is granted to anyone to use this software for any purpose, including commercial
|
||||
* applications, and to alter it and redistribute it freely, subject to the following restrictions:
|
||||
*
|
||||
* 1. The origin of this software must not be misrepresented; you must not claim that you
|
||||
* wrote the original software. If you use this software in a product, an acknowledgment
|
||||
* in the product documentation would be appreciated but is not required.
|
||||
*
|
||||
* 2. Altered source versions must be plainly marked as such, and must not be misrepresented
|
||||
* as being the original software.
|
||||
*
|
||||
* 3. This notice may not be removed or altered from any source distribution.
|
||||
*
|
||||
**********************************************************************************************/
|
||||
|
||||
#ifndef UWP_EVENTS_H
|
||||
#define UWP_EVENTS_H
|
||||
|
||||
#if defined(__cplusplus)
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#if defined(PLATFORM_UWP)
|
||||
|
||||
// Determine if UWP functions are set and ready for raylib's use.
|
||||
bool UWPIsConfigured();
|
||||
|
||||
// Function for getting program time.
|
||||
typedef double(*UWPQueryTimeFunc)();
|
||||
UWPQueryTimeFunc UWPGetQueryTimeFunc(void);
|
||||
void UWPSetQueryTimeFunc(UWPQueryTimeFunc func);
|
||||
|
||||
// Function for sleeping the current thread
|
||||
typedef void (*UWPSleepFunc)(double sleepUntil);
|
||||
UWPSleepFunc UWPGetSleepFunc(void);
|
||||
void UWPSetSleepFunc(UWPSleepFunc func);
|
||||
|
||||
// Function for querying the display size
|
||||
typedef void(*UWPDisplaySizeFunc)(int* width, int* height);
|
||||
UWPDisplaySizeFunc UWPGetDisplaySizeFunc(void);
|
||||
void UWPSetDisplaySizeFunc(UWPDisplaySizeFunc func);
|
||||
|
||||
// Functions for mouse cursor control
|
||||
typedef void(*UWPMouseFunc)(void);
|
||||
UWPMouseFunc UWPGetMouseLockFunc();
|
||||
void UWPSetMouseLockFunc(UWPMouseFunc func);
|
||||
UWPMouseFunc UWPGetMouseUnlockFunc();
|
||||
void UWPSetMouseUnlockFunc(UWPMouseFunc func);
|
||||
UWPMouseFunc UWPGetMouseShowFunc();
|
||||
void UWPSetMouseShowFunc(UWPMouseFunc func);
|
||||
UWPMouseFunc UWPGetMouseHideFunc();
|
||||
void UWPSetMouseHideFunc(UWPMouseFunc func);
|
||||
|
||||
// Function for setting mouse cursor position.
|
||||
typedef void (*UWPMouseSetPosFunc)(int x, int y);
|
||||
UWPMouseSetPosFunc UWPGetMouseSetPosFunc();
|
||||
void UWPSetMouseSetPosFunc(UWPMouseSetPosFunc func);
|
||||
|
||||
// The below functions are implemented in core.c but are placed here so they can be called by user code.
|
||||
// This choice is made as platform-specific code is preferred to be kept away from raylib.h
|
||||
|
||||
// Call this when a Key is pressed or released.
|
||||
void UWPKeyDownEvent(int key, bool down);
|
||||
|
||||
// Call when a mouse button state changes
|
||||
void UWPMouseButtonEvent(int button, bool down);
|
||||
|
||||
// Call when the mouse cursor moves
|
||||
void UWPMousePosEvent(double x, double y);
|
||||
|
||||
// Call when the mouse wheel moves
|
||||
void UWPMouseWheelEvent(int deltaY);
|
||||
|
||||
// Call when the window resizes
|
||||
void UWPResizeEvent(int width, int height);
|
||||
|
||||
// Call when a gamepad is made active
|
||||
void UWPActivateGamepadEvent(int gamepad, bool active);
|
||||
|
||||
// Call when a gamepad button state changes
|
||||
void UWPRegisterGamepadButton(int gamepad, int button, bool down);
|
||||
|
||||
// Call when a gamepad axis state changes
|
||||
void UWPRegisterGamepadAxis(int gamepad, int axis, float value);
|
||||
|
||||
// Set the core window pointer so that we can pass it to EGL.
|
||||
void* UWPGetCoreWindowPtr();
|
||||
void UWPSetCoreWindowPtr(void* ptr);
|
||||
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // PLATFORM_UWP
|
||||
|
||||
#endif // UWP_EVENTS_H
|
||||
Loading…
Reference in a new issue