Apply requested changes and fix linux build
This commit is contained in:
parent
6861457f59
commit
33b3fde5de
4 changed files with 11656 additions and 771 deletions
1371
src/core.c
1371
src/core.c
File diff suppressed because it is too large
Load diff
14
src/rlgl.h
14
src/rlgl.h
|
|
@ -998,24 +998,18 @@ void rlMultMatrixf(float *matf)
|
|||
*currentMatrix = MatrixMultiply(*currentMatrix, mat);
|
||||
}
|
||||
|
||||
//Fix variable name issues
|
||||
#ifdef PLATFORM_UWP
|
||||
#undef near
|
||||
#undef far
|
||||
#endif
|
||||
|
||||
// Multiply the current matrix by a perspective matrix generated by parameters
|
||||
void rlFrustum(double left, double right, double bottom, double top, double near, double far)
|
||||
void rlFrustum(double left, double right, double bottom, double top, double znear, double zfar)
|
||||
{
|
||||
Matrix matPerps = MatrixFrustum(left, right, bottom, top, near, far);
|
||||
Matrix matPerps = MatrixFrustum(left, right, bottom, top, znear, zfar);
|
||||
|
||||
*currentMatrix = MatrixMultiply(*currentMatrix, matPerps);
|
||||
}
|
||||
|
||||
// Multiply the current matrix by an orthographic matrix generated by parameters
|
||||
void rlOrtho(double left, double right, double bottom, double top, double near, double far)
|
||||
void rlOrtho(double left, double right, double bottom, double top, double znear, double zfar)
|
||||
{
|
||||
Matrix matOrtho = MatrixOrtho(left, right, bottom, top, near, far);
|
||||
Matrix matOrtho = MatrixOrtho(left, right, bottom, top, znear, zfar);
|
||||
|
||||
*currentMatrix = MatrixMultiply(*currentMatrix, matOrtho);
|
||||
}
|
||||
|
|
|
|||
112
src/utils.c
112
src/utils.c
|
|
@ -34,7 +34,7 @@
|
|||
|
||||
// Check if config flags have been externally provided on compilation line
|
||||
#if !defined(EXTERNAL_CONFIG_FLAGS)
|
||||
#include "config.h" // Defines module configuration flags
|
||||
#include "config.h" // Defines module configuration flags
|
||||
#endif
|
||||
|
||||
#include "utils.h"
|
||||
|
|
@ -102,7 +102,7 @@ void SetTraceLogCallback(TraceLogCallback callback)
|
|||
}
|
||||
|
||||
// Show trace log messages (LOG_INFO, LOG_WARNING, LOG_ERROR, LOG_DEBUG)
|
||||
void TraceLog(int logType, const char *text, ...)
|
||||
void TraceLog(int logType, const char* text, ...)
|
||||
{
|
||||
#if defined(SUPPORT_TRACELOG)
|
||||
// Message has level below current threshold, don't emit
|
||||
|
|
@ -130,17 +130,23 @@ void TraceLog(int logType, const char *text, ...)
|
|||
default: break;
|
||||
}
|
||||
#else
|
||||
char buffer[MAX_TRACELOG_BUFFER_SIZE] = { 0 };
|
||||
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;
|
||||
case LOG_INFO: strcpy(buffer, "INFO: "); break;
|
||||
case LOG_WARNING: strcpy(buffer, "WARNING: "); break;
|
||||
case LOG_ERROR: strcpy(buffer, "ERROR: "); break;
|
||||
case LOG_FATAL: strcpy(buffer, "FATAL: "); break;
|
||||
default: break;
|
||||
case LOG_TRACE: strcpy(buffer, "TRACE: ");
|
||||
break;
|
||||
case LOG_DEBUG: strcpy(buffer, "DEBUG: ");
|
||||
break;
|
||||
case LOG_INFO: strcpy(buffer, "INFO: ");
|
||||
break;
|
||||
case LOG_WARNING: strcpy(buffer, "WARNING: ");
|
||||
break;
|
||||
case LOG_ERROR: strcpy(buffer, "ERROR: ");
|
||||
break;
|
||||
case LOG_FATAL: strcpy(buffer, "FATAL: ");
|
||||
break;
|
||||
default: break;
|
||||
}
|
||||
|
||||
strcat(buffer, text);
|
||||
|
|
@ -150,7 +156,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
|
||||
}
|
||||
|
|
@ -203,7 +209,7 @@ static int android_close(void *cookie)
|
|||
}
|
||||
#endif
|
||||
|
||||
#if defined(PLATFORM_UWP)
|
||||
#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
|
||||
|
||||
|
|
@ -215,75 +221,77 @@ 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->Bool0 = false;
|
||||
return msg;
|
||||
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->Bool0 = false;
|
||||
return msg;
|
||||
}
|
||||
|
||||
void DeleteUWPMessage(UWPMessage* msg)
|
||||
{
|
||||
RL_FREE(msg);
|
||||
RL_FREE(msg);
|
||||
}
|
||||
|
||||
bool UWPHasMessages(void)
|
||||
{
|
||||
return UWPOutMessageId > -1;
|
||||
return UWPOutMessageId > -1;
|
||||
}
|
||||
|
||||
UWPMessage* UWPGetMessage(void)
|
||||
{
|
||||
if (UWPHasMessages())
|
||||
{
|
||||
return UWPOutMessages[UWPOutMessageId--];
|
||||
}
|
||||
if (UWPHasMessages())
|
||||
{
|
||||
return UWPOutMessages[UWPOutMessageId--];
|
||||
}
|
||||
|
||||
return NULL;
|
||||
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.");
|
||||
}
|
||||
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.");
|
||||
}
|
||||
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;
|
||||
return UWPInMessageId > -1;
|
||||
}
|
||||
|
||||
UWPMessage* GetMessageFromUWP(void)
|
||||
{
|
||||
if (HasMessageFromUWP())
|
||||
{
|
||||
return UWPInMessages[UWPInMessageId--];
|
||||
}
|
||||
if (HasMessageFromUWP())
|
||||
{
|
||||
return UWPInMessages[UWPInMessageId--];
|
||||
}
|
||||
|
||||
return NULL;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
|||
77
src/utils.h
77
src/utils.h
|
|
@ -65,48 +65,59 @@ FILE *android_fopen(const char *fileName, const char *mode); // Replacement f
|
|||
|
||||
typedef enum
|
||||
{
|
||||
None = 0,
|
||||
None = 0,
|
||||
|
||||
//Send
|
||||
ShowMouse,
|
||||
HideMouse,
|
||||
LockMouse,
|
||||
UnlockMouse,
|
||||
SetMouseLocation, //Vector0 (pos)
|
||||
//Send
|
||||
ShowMouse,
|
||||
HideMouse,
|
||||
LockMouse,
|
||||
UnlockMouse,
|
||||
SetMouseLocation,
|
||||
//Vector0 (pos)
|
||||
|
||||
//Recieve (Into C)
|
||||
RegisterKey, //Int0 (key), Char0 (status)
|
||||
RegisterClick, //Int0 (button), Char0 (status)
|
||||
ScrollWheelUpdate, //Int0 (delta)
|
||||
UpdateMouseLocation, //Vector0 (pos)
|
||||
MarkGamepadActive, //Int0 (gamepad), Bool0 (active or not)
|
||||
MarkGamepadButton, //Int0 (gamepad), Int1 (button), Char0 (status)
|
||||
MarkGamepadAxis, //Int0 (gamepad), int1 (axis), Float0 (value)
|
||||
SetDisplayDims, //Vector0 (display dimensions)
|
||||
HandleResize, //Vector0 (new dimensions) - Onresized event
|
||||
//Recieve (Into C)
|
||||
RegisterKey,
|
||||
//Int0 (key), Char0 (status)
|
||||
RegisterClick,
|
||||
//Int0 (button), Char0 (status)
|
||||
ScrollWheelUpdate,
|
||||
//Int0 (delta)
|
||||
UpdateMouseLocation,
|
||||
//Vector0 (pos)
|
||||
MarkGamepadActive,
|
||||
//Int0 (gamepad), Bool0 (active or not)
|
||||
MarkGamepadButton,
|
||||
//Int0 (gamepad), Int1 (button), Char0 (status)
|
||||
MarkGamepadAxis,
|
||||
//Int0 (gamepad), int1 (axis), Float0 (value)
|
||||
SetDisplayDims,
|
||||
//Vector0 (display dimensions)
|
||||
HandleResize,
|
||||
//Vector0 (new dimensions) - Onresized event
|
||||
} UWPMessageType;
|
||||
|
||||
typedef struct UWPMessage {
|
||||
//The message type
|
||||
UWPMessageType Type;
|
||||
typedef struct UWPMessage
|
||||
{
|
||||
//The message type
|
||||
UWPMessageType Type;
|
||||
|
||||
//Vector parameters
|
||||
Vector2 Vector0;
|
||||
//Vector parameters
|
||||
Vector2 Vector0;
|
||||
|
||||
//Int parameters
|
||||
int Int0;
|
||||
int Int1;
|
||||
//Int parameters
|
||||
int Int0;
|
||||
int Int1;
|
||||
|
||||
//Char parameters
|
||||
char Char0;
|
||||
//Char parameters
|
||||
char Char0;
|
||||
|
||||
//Float parameters
|
||||
float Float0;
|
||||
//Float parameters
|
||||
float Float0;
|
||||
|
||||
//Bool parameters
|
||||
bool Bool0;
|
||||
//Bool parameters
|
||||
bool Bool0;
|
||||
|
||||
//More parameters can be added and fed to functions
|
||||
//More parameters can be added and fed to functions
|
||||
} UWPMessage;
|
||||
|
||||
//Allocate UWP Message
|
||||
|
|
@ -133,4 +144,4 @@ UWPMessage* GetMessageFromUWP(void);
|
|||
}
|
||||
#endif
|
||||
|
||||
#endif // UTILS_H
|
||||
#endif // UTILS_H
|
||||
|
|
|
|||
Loading…
Reference in a new issue