UWP Support Overhaul (#819)
* Working build * Fix build again, stop deleting files * Hotfix crash, needs investigating * Remove VS2015.UWP, I cannot update the project * Lots of UWP work, added keyboard and mouse press support. Still need to finish scroll wheel, mouse position and cursor hiding, plus other stuff that I haven't seen yet. * Implemented a ton more things, added BaseApp.h to provide common code to UWP apps. * Remove constant window dimensions * Enable and Disable cursor support. * Actually use mouse delta * Gamepad Support * Cleaning and small tweaks * Restore original example. * Update comment * Use 'Messages' to handle the cursor functions so code is more portable. * Comment * Comment unused message fields and use vector for mouse pos instead. * Move messages to utils.h and use messages for everything. No more plat-specific code in raylib.h * Working build * Fix build again, stop deleting files * Hotfix crash, needs investigating * Remove VS2015.UWP, I cannot update the project * Lots of UWP work, added keyboard and mouse press support. Still need to finish scroll wheel, mouse position and cursor hiding, plus other stuff that I haven't seen yet. * Implemented a ton more things, added BaseApp.h to provide common code to UWP apps. * Remove constant window dimensions * Enable and Disable cursor support. * Actually use mouse delta * Gamepad Support * Cleaning and small tweaks * Restore original example. * Update comment * Use 'Messages' to handle the cursor functions so code is more portable. * Comment * Comment unused message fields and use vector for mouse pos instead. * Move messages to utils.h and use messages for everything. No more plat-specific code in raylib.h * Tested some desktop stuff and added projection matrix updates for window resizing. * Fixed big bad mouse bug * Fix alt buttons and add hack to combat flickery key presses (far from perfect) * Remove debug code * Final commit * Well, so I thought * Wow, i am bad * Remove packages folder * Remove useless include * Apply requested changes and fix linux build * Try to stop packages folder * Have we fixed the formatting properly? * Third time's the charm? * Where did this come from? * Re-fix * Autoformat is gonna kill * Fixed XBOX ONE Support * Fix tabs
This commit is contained in:
parent
f37e55a77b
commit
2de1f31821
29 changed files with 1382 additions and 838 deletions
92
src/utils.c
92
src/utils.c
|
@ -132,7 +132,7 @@ void TraceLog(int logType, const char *text, ...)
|
|||
#else
|
||||
char buffer[MAX_TRACELOG_BUFFER_SIZE] = { 0 };
|
||||
|
||||
switch(logType)
|
||||
switch (logType)
|
||||
{
|
||||
case LOG_TRACE: strcpy(buffer, "TRACE: "); break;
|
||||
case LOG_DEBUG: strcpy(buffer, "DEBUG: "); break;
|
||||
|
@ -150,7 +150,7 @@ void TraceLog(int logType, const char *text, ...)
|
|||
|
||||
va_end(args);
|
||||
|
||||
if (logType >= logTypeExit) exit(1); // If exit message, exit program
|
||||
if (logType >= logTypeExit) exit(1); // If exit message, exit program
|
||||
|
||||
#endif // SUPPORT_TRACELOG
|
||||
}
|
||||
|
@ -202,3 +202,91 @@ static int android_close(void *cookie)
|
|||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(PLATFORM_UWP)
|
||||
|
||||
#define MAX_MESSAGES 512 //If there are over 128 messages, I will cry... either way, this may be too much EDIT: Welp, 512
|
||||
|
||||
static int UWPOutMessageId = -1; //Stores the last index for the message
|
||||
static UWPMessage* UWPOutMessages[MAX_MESSAGES]; //Messages out to UWP
|
||||
|
||||
static int UWPInMessageId = -1; //Stores the last index for the message
|
||||
static UWPMessage* UWPInMessages[MAX_MESSAGES]; //Messages in from UWP
|
||||
|
||||
UWPMessage* CreateUWPMessage(void)
|
||||
{
|
||||
UWPMessage* msg = (UWPMessage*)RL_MALLOC(sizeof(UWPMessage));
|
||||
msg->Type = None;
|
||||
Vector2 v0 = {0, 0};
|
||||
msg->Vector0 = v0;
|
||||
msg->Int0 = 0;
|
||||
msg->Int1 = 0;
|
||||
msg->Char0 = 0;
|
||||
msg->Float0 = 0;
|
||||
msg->Double0 = 0;
|
||||
msg->Bool0 = 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_MESSAGES)
|
||||
{
|
||||
UWPInMessageId++;
|
||||
UWPInMessages[UWPInMessageId] = msg;
|
||||
}
|
||||
else
|
||||
{
|
||||
TraceLog(LOG_WARNING, "[UWP Messaging] Not enough array space to register new UWP inbound Message.");
|
||||
}
|
||||
}
|
||||
|
||||
void SendMessageToUWP(UWPMessage* msg)
|
||||
{
|
||||
if (UWPOutMessageId + 1 < MAX_MESSAGES)
|
||||
{
|
||||
UWPOutMessageId++;
|
||||
UWPOutMessages[UWPOutMessageId] = msg;
|
||||
}
|
||||
else
|
||||
{
|
||||
TraceLog(LOG_WARNING, "[UWP Messaging] Not enough array space to register new UWP outward Message.");
|
||||
}
|
||||
}
|
||||
|
||||
bool HasMessageFromUWP(void)
|
||||
{
|
||||
return UWPInMessageId > -1;
|
||||
}
|
||||
|
||||
UWPMessage* GetMessageFromUWP(void)
|
||||
{
|
||||
if (HasMessageFromUWP())
|
||||
{
|
||||
return UWPInMessages[UWPInMessageId--];
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue