Read desc

- Moved UWP specific functions to uwp_events.h
- Removed BaseApp.
- Implemented example UWP lifecycle.
This commit is contained in:
Reece Mackie 2020-04-30 14:10:08 +01:00
commit 0357230af8

View file

@ -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