Implemented a ton more things, added BaseApp.h to provide common code to UWP apps.

This commit is contained in:
Reece Mackie 2019-04-25 18:08:42 +01:00
commit 4a131def4c
3 changed files with 443 additions and 506 deletions

View file

@ -252,11 +252,17 @@ 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;
//TODO: Tell UWP that cursor should be enabled/disabled
#if !defined(PLATFORM_UWP)
// Lock cursor for first person and third person cameras
if ((mode == CAMERA_FIRST_PERSON) ||
(mode == CAMERA_THIRD_PERSON)) DisableCursor();
else EnableCursor();
else EnableCursor();
#endif
cameraMode = mode;
}

View file

@ -1020,6 +1020,8 @@ void SetClipboardText(const char *text)
#endif
}
#if !defined(PLATFORM_UWP)
// Show mouse cursor
void ShowCursor(void)
{
@ -1068,6 +1070,8 @@ void DisableCursor(void)
cursorHidden = true;
}
#endif
// Set background color (framebuffer clear color)
void ClearBackground(Color color)
{
@ -3088,7 +3092,7 @@ static void PollInputEvents(void)
#if defined(PLATFORM_UWP)
// Register previous keys states
for (int i = 0; i < 512; i++)previousKeyState[i] = currentKeyState[i];
for (int i = 0; i < 512; i++) previousKeyState[i] = currentKeyState[i];
// Register previous mouse states
previousMouseWheelY = currentMouseWheelY;
@ -4587,7 +4591,7 @@ static void *GamepadThread(void *arg)
#if defined(PLATFORM_UWP)
void UWPRegisterKey(int key, int action) {
void UWPRegisterKey(int key, char action) {
//Convert from virtualKey
int actualKey = -1;
@ -4670,9 +4674,9 @@ void UWPScrollWheel(int delta) {
currentMouseWheelY += delta;
}
void UWPMouseMovement(float x, float y) {
mousePosition.x += x;
mousePosition.y += y;
void UWPMousePosition(float x, float y) {
mousePosition.x = x;
mousePosition.y = y;
}
void UWPMarkCursor(bool hidden) {

View file

@ -914,21 +914,25 @@ RLAPI const char *GetClipboardText(void); // Get clipboa
RLAPI void SetClipboardText(const char *text); // Set clipboard text content
// UWP-related functions
#if defined(PLATFORM_UWP)
RLAPI void UWPRegisterKey(int key, int action);
#if defined(PLATFORM_UWP)
RLAPI void UWPRegisterKey(int key, char action);
RLAPI void UWPRegisterClick(int btn, char action);
RLAPI void UWPScrollWheel(int delta);
RLAPI void UWPMouseMovement(float x, float y);
RLAPI void UWPMousePosition(float x, float y);
RLAPI void UWPMarkCursor(bool hidden);
//Gamepad functionality?
//Gamepad functionality?
#endif
// Cursor-related functions
#if !defined(PLATFORM_UWP) //These are implemented by BaseApp.h
RLAPI void ShowCursor(void); // Shows cursor
RLAPI void HideCursor(void); // Hides cursor
RLAPI bool IsCursorHidden(void); // Check if cursor is not visible
RLAPI void EnableCursor(void); // Enables cursor (unlock cursor)
RLAPI void DisableCursor(void); // Disables cursor (lock cursor)
#endif
// Drawing-related functions
RLAPI void ClearBackground(Color color); // Set background color (framebuffer clear color)