Browse Source

Minor tweaks

pull/1862/head
raysan5 3 years ago
parent
commit
f81dfce19f
2 changed files with 27 additions and 32 deletions
  1. +27
    -28
      src/core.c
  2. +0
    -4
      src/raudio.c

+ 27
- 28
src/core.c View File

@ -6184,24 +6184,24 @@ static void *EventThread(void *arg)
// Basic movement // Basic movement
if (event.code == ABS_X) if (event.code == ABS_X)
{ {
CORE.Input.Mouse.currentPosition.x = (event.value - worker->absRange.x)*CORE.Window.screen.width/worker->absRange.width; // Scale acording to absRange
CORE.Input.Touch.position[0].x = (event.value - worker->absRange.x)*CORE.Window.screen.width/worker->absRange.width; // Scale acording to absRange
CORE.Input.Mouse.currentPosition.x = (event.value - worker->absRange.x)*CORE.Window.screen.width/worker->absRange.width; // Scale acording to absRange
CORE.Input.Touch.position[0].x = (event.value - worker->absRange.x)*CORE.Window.screen.width/worker->absRange.width; // Scale acording to absRange
#if defined(SUPPORT_GESTURES_SYSTEM)
touchAction = TOUCH_MOVE;
gestureUpdate = true;
#endif
#if defined(SUPPORT_GESTURES_SYSTEM)
touchAction = TOUCH_MOVE;
gestureUpdate = true;
#endif
} }
if (event.code == ABS_Y) if (event.code == ABS_Y)
{ {
CORE.Input.Mouse.currentPosition.y = (event.value - worker->absRange.y)*CORE.Window.screen.height/worker->absRange.height; // Scale acording to absRange
CORE.Input.Touch.position[0].y = (event.value - worker->absRange.y)*CORE.Window.screen.height/worker->absRange.height; // Scale acording to absRange
CORE.Input.Mouse.currentPosition.y = (event.value - worker->absRange.y)*CORE.Window.screen.height/worker->absRange.height; // Scale acording to absRange
CORE.Input.Touch.position[0].y = (event.value - worker->absRange.y)*CORE.Window.screen.height/worker->absRange.height; // Scale acording to absRange
#if defined(SUPPORT_GESTURES_SYSTEM)
touchAction = TOUCH_MOVE;
gestureUpdate = true;
#endif
#if defined(SUPPORT_GESTURES_SYSTEM)
touchAction = TOUCH_MOVE;
gestureUpdate = true;
#endif
} }
// Multitouch movement // Multitouch movement
@ -6236,20 +6236,20 @@ static void *EventThread(void *arg)
{ {
CORE.Input.Mouse.currentButtonStateEvdev[MOUSE_BUTTON_LEFT] = 0; CORE.Input.Mouse.currentButtonStateEvdev[MOUSE_BUTTON_LEFT] = 0;
#if defined(SUPPORT_GESTURES_SYSTEM)
touchAction = TOUCH_UP;
gestureUpdate = true;
#endif
#if defined(SUPPORT_GESTURES_SYSTEM)
touchAction = TOUCH_UP;
gestureUpdate = true;
#endif
} }
if (event.value && !previousMouseLeftButtonState) if (event.value && !previousMouseLeftButtonState)
{ {
CORE.Input.Mouse.currentButtonStateEvdev[MOUSE_BUTTON_LEFT] = 1; CORE.Input.Mouse.currentButtonStateEvdev[MOUSE_BUTTON_LEFT] = 1;
#if defined(SUPPORT_GESTURES_SYSTEM)
touchAction = TOUCH_DOWN;
gestureUpdate = true;
#endif
#if defined(SUPPORT_GESTURES_SYSTEM)
touchAction = TOUCH_DOWN;
gestureUpdate = true;
#endif
} }
} }
@ -6263,11 +6263,11 @@ static void *EventThread(void *arg)
{ {
CORE.Input.Mouse.currentButtonStateEvdev[MOUSE_BUTTON_LEFT] = event.value; CORE.Input.Mouse.currentButtonStateEvdev[MOUSE_BUTTON_LEFT] = event.value;
#if defined(SUPPORT_GESTURES_SYSTEM)
if (event.value > 0) touchAction = TOUCH_DOWN;
else touchAction = TOUCH_UP;
gestureUpdate = true;
#endif
#if defined(SUPPORT_GESTURES_SYSTEM)
if (event.value > 0) touchAction = TOUCH_DOWN;
else touchAction = TOUCH_UP;
gestureUpdate = true;
#endif
} }
if (event.code == BTN_RIGHT) CORE.Input.Mouse.currentButtonStateEvdev[MOUSE_BUTTON_RIGHT] = event.value; if (event.code == BTN_RIGHT) CORE.Input.Mouse.currentButtonStateEvdev[MOUSE_BUTTON_RIGHT] = event.value;
@ -6288,10 +6288,9 @@ static void *EventThread(void *arg)
if (CORE.Input.Mouse.currentPosition.y > CORE.Window.screen.height/CORE.Input.Mouse.scale.y) CORE.Input.Mouse.currentPosition.y = CORE.Window.screen.height/CORE.Input.Mouse.scale.y; if (CORE.Input.Mouse.currentPosition.y > CORE.Window.screen.height/CORE.Input.Mouse.scale.y) CORE.Input.Mouse.currentPosition.y = CORE.Window.screen.height/CORE.Input.Mouse.scale.y;
} }
// Gesture update
#if defined(SUPPORT_GESTURES_SYSTEM)
if (gestureUpdate) if (gestureUpdate)
{ {
#if defined(SUPPORT_GESTURES_SYSTEM)
GestureEvent gestureEvent = { 0 }; GestureEvent gestureEvent = { 0 };
gestureEvent.pointCount = 0; gestureEvent.pointCount = 0;
@ -6313,8 +6312,8 @@ static void *EventThread(void *arg)
gestureEvent.position[3] = CORE.Input.Touch.position[3]; gestureEvent.position[3] = CORE.Input.Touch.position[3];
ProcessGestureEvent(gestureEvent); ProcessGestureEvent(gestureEvent);
#endif
} }
#endif
} }
WaitTime(5); // Sleep for 5ms to avoid hogging CPU time WaitTime(5); // Sleep for 5ms to avoid hogging CPU time

+ 0
- 4
src/raudio.c View File

@ -371,10 +371,6 @@ static void OnLog(ma_context *pContext, ma_device *pDevice, ma_uint32 logLevel,
static void OnSendAudioDataToDevice(ma_device *pDevice, void *pFramesOut, const void *pFramesInput, ma_uint32 frameCount); static void OnSendAudioDataToDevice(ma_device *pDevice, void *pFramesOut, const void *pFramesInput, ma_uint32 frameCount);
static void MixAudioFrames(float *framesOut, const float *framesIn, ma_uint32 frameCount, float localVolume); static void MixAudioFrames(float *framesOut, const float *framesIn, ma_uint32 frameCount, float localVolume);
#if defined(SUPPORT_FILEFORMAT_WAV)
static int SaveWAV(Wave wave, const char *fileName); // Save wave data as WAV file
#endif
#if defined(RAUDIO_STANDALONE) #if defined(RAUDIO_STANDALONE)
static bool IsFileExtension(const char *fileName, const char *ext); // Check file extension static bool IsFileExtension(const char *fileName, const char *ext); // Check file extension
static const char *GetFileExtension(const char *fileName); // Get pointer to extension for a filename string (includes the dot: .png) static const char *GetFileExtension(const char *fileName); // Get pointer to extension for a filename string (includes the dot: .png)

Loading…
Cancel
Save