UWP rework (#1231)

* First draft of UWP rework.

* Read desc

- Moved UWP specific functions to uwp_events.h
- Removed BaseApp.
- Implemented example UWP lifecycle.

* Added GIF recording and screenshot support.

* Character inputs and filesystem stuff

* Fix game closing on Xbox when B is pressed.

* Fix the gamepad binding hack

* Add as many keys as I believe are possible.

* Implemented mouse locking of a sort.

* Remove rogue todo, the rest are for a game dev using this example.

* Implemented touch how I "think" it should work. I cant test this.

* Review.
This commit is contained in:
Reece Mackie 2020-04-30 18:48:39 +01:00 committed by GitHub
parent 2f454aa4b0
commit 4b03860810
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 1162 additions and 901 deletions

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,69 +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 UWPSendMessage(UWPMessage *msg)
{
if ((UWPInMessageId + 1) < MAX_UWP_MESSAGES)
{
UWPInMessageId++;
UWPInMessages[UWPInMessageId] = msg;
}
else TRACELOG(LOG_WARNING, "UWP: Not enough array space to register new inbound message");
}
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");
}
bool HasMessageFromUWP(void)
{
return UWPInMessageId > -1;
}
UWPMessage *GetMessageFromUWP(void)
{
if (HasMessageFromUWP()) return UWPInMessages[UWPInMessageId--];
return NULL;
}
#endif // PLATFORM_UWP