diff options
| author | Reece Mackie <20544390+Rover656@users.noreply.github.com> | 2019-04-27 20:51:04 +0100 |
|---|---|---|
| committer | Reece Mackie <20544390+Rover656@users.noreply.github.com> | 2019-04-27 20:51:04 +0100 |
| commit | 9434dc588ab295ee909b119a86adbbdae889d6b2 (patch) | |
| tree | 782799f481a71ad0edb03b14148644d6bf4398ac /src | |
| parent | b911cefab3f39506e22d517088cc9869f363e897 (diff) | |
| parent | 2de1f318212dbceb71db6be053be995208748f2a (diff) | |
| download | raylib-9434dc588ab295ee909b119a86adbbdae889d6b2.tar.gz raylib-9434dc588ab295ee909b119a86adbbdae889d6b2.zip | |
Merge branch 'master' into gamepad-rework
Diffstat (limited to 'src')
| -rw-r--r-- | src/camera.h | 2 | ||||
| -rw-r--r-- | src/core.c | 260 | ||||
| -rw-r--r-- | src/external/ANGLE/EGL/eglplatform.h | 5 | ||||
| -rw-r--r-- | src/rlgl.h | 10 | ||||
| -rw-r--r-- | src/utils.c | 92 | ||||
| -rw-r--r-- | src/utils.h | 75 |
6 files changed, 419 insertions, 25 deletions
diff --git a/src/camera.h b/src/camera.h index e103b293..d80f8346 100644 --- a/src/camera.h +++ b/src/camera.h @@ -256,7 +256,7 @@ void SetCameraMode(Camera camera, int mode) //cameraAngle.y = -60.0f*DEG2RAD; // Camera angle in plane XY (0 aligned with X, move positive CW) playerEyesPosition = camera.position.y; - + // Lock cursor for first person and third person cameras if ((mode == CAMERA_FIRST_PERSON) || (mode == CAMERA_THIRD_PERSON)) DisableCursor(); else EnableCursor(); @@ -134,7 +134,7 @@ #include <ctype.h> // Required for: tolower() [Used in IsFileExtension()] #include <sys/stat.h> // Required for stat() [Used in GetLastWriteTime()] -#if defined(PLATFORM_DESKTOP) && defined(_WIN32) && (defined(_MSC_VER) || defined(__TINYC__)) +#if (defined(PLATFORM_DESKTOP) || defined(PLATFORM_UWP)) && defined(_WIN32) && (defined(_MSC_VER) || defined(__TINYC__)) #include "external/dirent.h" // Required for: DIR, opendir(), closedir() [Used in GetDirectoryFiles()] #else #include <dirent.h> // Required for: DIR, opendir(), closedir() [Used in GetDirectoryFiles()] @@ -391,6 +391,7 @@ static int gamepadStream[MAX_GAMEPADS] = { -1 };// Gamepad device file descripto static pthread_t gamepadThreadId; // Gamepad reading thread id static char gamepadName[64]; // Gamepad name holder #endif + //----------------------------------------------------------------------------------- // Timming system variables @@ -401,6 +402,7 @@ static double updateTime = 0.0; // Time measure for frame update static double drawTime = 0.0; // Time measure for frame draw static double frameTime = 0.0; // Time measure for one frame static double targetTime = 0.0; // Desired time for one frame, if 0 not applied + //----------------------------------------------------------------------------------- // Config internal variables @@ -486,10 +488,6 @@ static void InitGamepad(void); // Init raw gamepad inpu static void *GamepadThread(void *arg); // Mouse reading thread #endif -#if defined(PLATFORM_UWP) -// TODO: Define functions required to manage inputs -#endif - #if defined(_WIN32) // NOTE: We include Sleep() function signature here to avoid windows.h inclusion void __stdcall Sleep(unsigned long msTimeout); // Required for Wait() @@ -810,6 +808,7 @@ void SetWindowIcon(Image image) // Set title for window (only PLATFORM_DESKTOP) void SetWindowTitle(const char *title) { + windowTitle = title; #if defined(PLATFORM_DESKTOP) glfwSetWindowTitle(window, title); #endif @@ -887,7 +886,7 @@ int GetScreenHeight(void) // Get native window handle void *GetWindowHandle(void) { -#if defined(_WIN32) +#if defined(PLATFORM_DESKTOP) && defined(_WIN32) // NOTE: Returned handle is: void *HWND (windows.h) return glfwGetWin32Window(window); #elif defined(__linux__) @@ -1027,6 +1026,11 @@ void ShowCursor(void) #if defined(PLATFORM_DESKTOP) glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_NORMAL); #endif +#if defined(PLATFORM_UWP) + UWPMessage* msg = CreateUWPMessage(); + msg->Type = ShowMouse; + SendMessageToUWP(msg); +#endif cursorHidden = false; } @@ -1036,6 +1040,11 @@ void HideCursor(void) #if defined(PLATFORM_DESKTOP) glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_HIDDEN); #endif +#if defined(PLATFORM_UWP) + UWPMessage* msg = CreateUWPMessage(); + msg->Type = HideMouse; + SendMessageToUWP(msg); +#endif cursorHidden = true; } @@ -1054,6 +1063,11 @@ void EnableCursor(void) #if defined(PLATFORM_WEB) toggleCursorLock = true; #endif +#if defined(PLATFORM_UWP) + UWPMessage* msg = CreateUWPMessage(); + msg->Type = LockMouse; + SendMessageToUWP(msg); +#endif cursorHidden = false; } @@ -1066,6 +1080,11 @@ void DisableCursor(void) #if defined(PLATFORM_WEB) toggleCursorLock = true; #endif +#if defined(PLATFORM_UWP) + UWPMessage* msg = CreateUWPMessage(); + msg->Type = UnlockMouse; + SendMessageToUWP(msg); +#endif cursorHidden = true; } @@ -1145,6 +1164,8 @@ void EndDrawing(void) frameTime += extraTime; } + + return; } // Initialize 2D mode with custom camera (2D) @@ -1421,6 +1442,11 @@ double GetTime(void) return (double)(time - baseTime)*1e-9; // Elapsed time since InitTimer() #endif + +#if defined(PLATFORM_UWP) + //Updated through messages + return currentTime; +#endif } // Returns hexadecimal value for a Color @@ -2209,6 +2235,13 @@ void SetMousePosition(int x, int y) // NOTE: emscripten not implemented glfwSetCursorPos(window, mousePosition.x, mousePosition.y); #endif +#if defined(PLATFORM_UWP) + UWPMessage* msg = CreateUWPMessage(); + msg->Type = SetMouseLocation; + msg->Vector0.x = mousePosition.x; + msg->Vector0.y = mousePosition.y; + SendMessageToUWP(msg); +#endif } // Set mouse offset @@ -2736,6 +2769,8 @@ static bool InitGraphicsDevice(int width, int height) eglQuerySurface(display, surface, EGL_WIDTH, &screenWidth); eglQuerySurface(display, surface, EGL_HEIGHT, &screenHeight); + //SetupFramebuffer(displayWidth, displayHeight); //Borked + #else // PLATFORM_ANDROID, PLATFORM_RPI EGLint numConfigs; @@ -2906,8 +2941,8 @@ static void SetupFramebuffer(int width, int height) TraceLog(LOG_WARNING, "DOWNSCALING: Required screen size (%ix%i) is bigger than display size (%ix%i)", screenWidth, screenHeight, displayWidth, displayHeight); // Downscaling to fit display with border-bars - float widthRatio = (float)displayWidth/(float)screenWidth; - float heightRatio = (float)displayHeight/(float)screenHeight; + float widthRatio = (float)displayWidth / (float)screenWidth; + float heightRatio = (float)displayHeight / (float)screenHeight; if (widthRatio <= heightRatio) { @@ -2925,7 +2960,7 @@ static void SetupFramebuffer(int width, int height) } // Screen scaling required - float scaleRatio = (float)renderWidth/(float)screenWidth; + float scaleRatio = (float)renderWidth / (float)screenWidth; screenScaling = MatrixScale(scaleRatio, scaleRatio, scaleRatio); // NOTE: We render to full display resolution! @@ -2941,13 +2976,13 @@ static void SetupFramebuffer(int width, int height) TraceLog(LOG_INFO, "UPSCALING: Required screen size: %i x %i -> Display size: %i x %i", screenWidth, screenHeight, displayWidth, displayHeight); // Upscaling to fit display with border-bars - float displayRatio = (float)displayWidth/(float)displayHeight; - float screenRatio = (float)screenWidth/(float)screenHeight; + float displayRatio = (float)displayWidth / (float)displayHeight; + float screenRatio = (float)screenWidth / (float)screenHeight; if (displayRatio <= screenRatio) { renderWidth = screenWidth; - renderHeight = (int)round((float)screenWidth/displayRatio); + renderHeight = (int)round((float)screenWidth / displayRatio); renderOffsetX = 0; renderOffsetY = (renderHeight - screenHeight); } @@ -2996,7 +3031,7 @@ static void InitTimer(void) // http://stackoverflow.com/questions/43057578/c-programming-win32-games-sleep-taking-longer-than-expected static void Wait(float ms) { -#if defined(SUPPORT_BUSY_WAIT_LOOP) +#if defined(SUPPORT_BUSY_WAIT_LOOP) && !defined(PLATFORM_UWP) double prevTime = GetTime(); double nextTime = 0.0; @@ -3029,7 +3064,7 @@ static bool GetKeyStatus(int key) // NOTE: Android supports up to 260 keys if (key < 0 || key > 260) return false; else return currentKeyState[key]; -#elif defined(PLATFORM_RPI) +#elif defined(PLATFORM_RPI) || defined(PLATFORM_UWP) // NOTE: Keys states are filled in PollInputEvents() if (key < 0 || key > 511) return false; else return currentKeyState[key]; @@ -3044,7 +3079,7 @@ static bool GetMouseButtonStatus(int button) #elif defined(PLATFORM_ANDROID) // TODO: Check for virtual mouse? return false; -#elif defined(PLATFORM_RPI) +#elif defined(PLATFORM_RPI) || defined(PLATFORM_UWP) // NOTE: Mouse buttons states are filled in PollInputEvents() return currentMouseState[button]; #endif @@ -3170,6 +3205,197 @@ static void PollInputEvents(void) } #endif +#if defined(PLATFORM_UWP) + + // Register previous keys states + for (int i = 0; i < 512; i++) previousKeyState[i] = currentKeyState[i]; + + for (int i = 0; i < MAX_GAMEPADS; i++) + { + if (gamepadReady[i]) + { + for (int k = 0; k < MAX_GAMEPAD_BUTTONS; k++) previousGamepadState[i][k] = currentGamepadState[i][k]; + } + } + + // Register previous mouse states + previousMouseWheelY = currentMouseWheelY; + currentMouseWheelY = 0; + for (int i = 0; i < 3; i++) + { + previousMouseState[i] = currentMouseState[i]; + + } + + // Loop over pending messages + while (HasMessageFromUWP()) + { + UWPMessage* msg = GetMessageFromUWP(); + + switch (msg->Type) + { + case RegisterKey: + { + //Convert from virtualKey + int actualKey = -1; + + switch (msg->Int0) + { + case 0x08: actualKey = KEY_BACKSPACE; break; + case 0x20: actualKey = KEY_SPACE; break; + case 0x1B: actualKey = KEY_ESCAPE; break; + case 0x0D: actualKey = KEY_ENTER; break; + case 0x2E: actualKey = KEY_DELETE; break; + case 0x27: actualKey = KEY_RIGHT; break; + case 0x25: actualKey = KEY_LEFT; break; + case 0x28: actualKey = KEY_DOWN; break; + case 0x26: actualKey = KEY_UP; break; + case 0x70: actualKey = KEY_F1; break; + case 0x71: actualKey = KEY_F2; break; + case 0x72: actualKey = KEY_F3; break; + case 0x73: actualKey = KEY_F4; break; + case 0x74: actualKey = KEY_F5; break; + case 0x75: actualKey = KEY_F6; break; + case 0x76: actualKey = KEY_F7; break; + case 0x77: actualKey = KEY_F8; break; + case 0x78: actualKey = KEY_F9; break; + case 0x79: actualKey = KEY_F10; break; + case 0x7A: actualKey = KEY_F11; break; + case 0x7B: actualKey = KEY_F12; break; + case 0xA0: actualKey = KEY_LEFT_SHIFT; break; + case 0xA2: actualKey = KEY_LEFT_CONTROL; break; + case 0xA4: actualKey = KEY_LEFT_ALT; break; + case 0xA1: actualKey = KEY_RIGHT_SHIFT; break; + case 0xA3: actualKey = KEY_RIGHT_CONTROL; break; + case 0xA5: actualKey = KEY_RIGHT_ALT; break; + case 0x30: actualKey = KEY_ZERO; break; + case 0x31: actualKey = KEY_ONE; break; + case 0x32: actualKey = KEY_TWO; break; + case 0x33: actualKey = KEY_THREE; break; + case 0x34: actualKey = KEY_FOUR; break; + case 0x35: actualKey = KEY_FIVE; break; + case 0x36: actualKey = KEY_SIX; break; + case 0x37: actualKey = KEY_SEVEN; break; + case 0x38: actualKey = KEY_EIGHT; break; + case 0x39: actualKey = KEY_NINE; break; + case 0x41: actualKey = KEY_A; break; + case 0x42: actualKey = KEY_B; break; + case 0x43: actualKey = KEY_C; break; + case 0x44: actualKey = KEY_D; break; + case 0x45: actualKey = KEY_E; break; + case 0x46: actualKey = KEY_F; break; + case 0x47: actualKey = KEY_G; break; + case 0x48: actualKey = KEY_H; break; + case 0x49: actualKey = KEY_I; break; + case 0x4A: actualKey = KEY_J; break; + case 0x4B: actualKey = KEY_K; break; + case 0x4C: actualKey = KEY_L; break; + case 0x4D: actualKey = KEY_M; break; + case 0x4E: actualKey = KEY_N; break; + case 0x4F: actualKey = KEY_O; break; + case 0x50: actualKey = KEY_P; break; + case 0x51: actualKey = KEY_Q; break; + case 0x52: actualKey = KEY_R; break; + case 0x53: actualKey = KEY_S; break; + case 0x54: actualKey = KEY_T; break; + case 0x55: actualKey = KEY_U; break; + case 0x56: actualKey = KEY_V; break; + case 0x57: actualKey = KEY_W; break; + case 0x58: actualKey = KEY_X; break; + case 0x59: actualKey = KEY_Y; break; + case 0x5A: actualKey = KEY_Z; break; + } + + if (actualKey > -1) + currentKeyState[actualKey] = msg->Char0; + break; + } + + case RegisterClick: + { + currentMouseState[msg->Int0] = msg->Char0; + break; + } + + case ScrollWheelUpdate: + { + currentMouseWheelY += msg->Int0; + break; + } + + case UpdateMouseLocation: + { + mousePosition = msg->Vector0; + break; + } + + case MarkGamepadActive: + { + if (msg->Int0 < MAX_GAMEPADS) + gamepadReady[msg->Int0] = msg->Bool0; + break; + } + + case MarkGamepadButton: + { + if (msg->Int0 < MAX_GAMEPADS && msg->Int1 < MAX_GAMEPAD_BUTTONS) + currentGamepadState[msg->Int0][msg->Int1] = msg->Char0; + break; + } + + case MarkGamepadAxis: + { + if (msg->Int0 < MAX_GAMEPADS && msg->Int1 < MAX_GAMEPAD_AXIS) + gamepadAxisState[msg->Int0][msg->Int1] = msg->Float0; + break; + } + + case SetDisplayDims: + { + displayWidth = msg->Vector0.x; + displayHeight = msg->Vector0.y; + break; + } + + case HandleResize: + { + eglQuerySurface(display, surface, EGL_WIDTH, &screenWidth); + eglQuerySurface(display, surface, EGL_HEIGHT, &screenHeight); + + // If window is resized, viewport and projection matrix needs to be re-calculated + rlViewport(0, 0, screenWidth, screenHeight); // Set viewport width and height + rlMatrixMode(RL_PROJECTION); // Switch to PROJECTION matrix + rlLoadIdentity(); // Reset current matrix (PROJECTION) + rlOrtho(0, screenWidth, screenHeight, 0, 0.0f, 1.0f); // Orthographic projection mode with top-left corner at (0,0) + rlMatrixMode(RL_MODELVIEW); // Switch back to MODELVIEW matrix + rlLoadIdentity(); // Reset current matrix (MODELVIEW) + rlClearScreenBuffers(); // Clear screen buffers (color and depth) + + // Window size must be updated to be used on 3D mode to get new aspect ratio (BeginMode3D()) + // NOTE: Be careful! GLFW3 will choose the closest fullscreen resolution supported by current monitor, + // for example, if reescaling back to 800x450 (desired), it could set 720x480 (closest fullscreen supported) + currentWidth = screenWidth; + currentHeight = screenHeight; + + // NOTE: Postprocessing texture is not scaled to new size + + windowResized = true; + break; + } + + case SetGameTime: + { + currentTime = msg->Double0; + break; + } + + } + + DeleteUWPMessage(msg); //Delete, we are done + } + +#endif + #if defined(PLATFORM_DESKTOP) || defined(PLATFORM_WEB) // Mouse input polling double mouseX; @@ -4663,7 +4889,7 @@ static void *GamepadThread(void *arg) // Plays raylib logo appearing animation static void LogoAnimation(void) { -#if !defined(PLATFORM_WEB) +#if !defined(PLATFORM_WEB) && !defined(PLATFORM_UWP) int logoPositionX = screenWidth/2 - 128; int logoPositionY = screenHeight/2 - 128; @@ -4772,4 +4998,4 @@ static void LogoAnimation(void) #endif showLogo = false; // Prevent for repeating when reloading window (Android) -} +}
\ No newline at end of file diff --git a/src/external/ANGLE/EGL/eglplatform.h b/src/external/ANGLE/EGL/eglplatform.h index eb3ea70c..7e542ff7 100644 --- a/src/external/ANGLE/EGL/eglplatform.h +++ b/src/external/ANGLE/EGL/eglplatform.h @@ -74,11 +74,16 @@ //#include <windows.h> // raylib edit!!! +#ifndef PLATFORM_UWP typedef void *PVOID; // PVOID is a pointer to any type. This type is declared in WinNT.h typedef PVOID HANDLE; // HANDLE is handle to an object. This type is declared in WinNT.h typedef HANDLE HWND; // HWND is a handle to a window. This type is declared in WinDef.h typedef HANDLE HDC; // HDC is a handle to a device context (DC). This type is declared in WinDef.h typedef HANDLE HBITMAP; // HBITMAP is a handle to a bitmap. This type is declared in WinDef.h +#else +//UWP Fix +#include "Windows.h" +#endif // HDC, HBITMAP and HWND are actually pointers to void. You can cast a long to a HWND like this: HWND h = (HWND)my_long_var; // but very careful of what information is stored in my_long_var. You have to make sure that you have a pointer in there. @@ -999,17 +999,17 @@ void rlMultMatrixf(float *matf) } // 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); } @@ -1619,7 +1619,7 @@ void rlglInit(int width, int height) if (strcmp(extList[i], (const char *)"GL_EXT_debug_marker") == 0) debugMarkerSupported = true; } -#if defined(_WIN32) && defined(_MSC_VER) +#if defined(_WIN32) && defined(_MSC_VER) && !defined(PLATFORM_UWP) //is this a hotfix? I may need to find out why this is broken RL_FREE(extList); #endif diff --git a/src/utils.c b/src/utils.c index 3cff472b..c886d2a7 100644 --- a/src/utils.c +++ b/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 diff --git a/src/utils.h b/src/utils.h index d7ab8829..14e6bf70 100644 --- a/src/utils.h +++ b/src/utils.h @@ -59,6 +59,81 @@ void InitAssetManager(AAssetManager *manager); // Initialize asset manager from FILE *android_fopen(const char *fileName, const char *mode); // Replacement for fopen() #endif +#if defined(PLATFORM_UWP) + +// UWP Messages System + +typedef enum +{ + None = 0, + + //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 + SetGameTime, //Int0 +} UWPMessageType; + +typedef struct UWPMessage +{ + //The message type + UWPMessageType Type; + + //Vector parameters + Vector2 Vector0; + + //Int parameters + int Int0; + int Int1; + + //Char parameters + char Char0; + + //Float parameters + float Float0; + + //Double parameters + double Double0; + + //Bool parameters + bool Bool0; + + //More parameters can be added and fed to functions +} UWPMessage; + +//Allocate UWP Message +RLAPI UWPMessage* CreateUWPMessage(void); + +//Free UWP Message +RLAPI void DeleteUWPMessage(UWPMessage* msg); + +//Get messages into C++ +RLAPI bool UWPHasMessages(void); +RLAPI UWPMessage* UWPGetMessage(void); +RLAPI void UWPSendMessage(UWPMessage* msg); + +//For C to call +#ifndef _cplusplus //Hide from C++ code +void SendMessageToUWP(UWPMessage* msg); +bool HasMessageFromUWP(void); +UWPMessage* GetMessageFromUWP(void); +#endif + +#endif + #ifdef __cplusplus } #endif |
