Remove trail spaces and some tweaks
This commit is contained in:
parent
2a408d789c
commit
5ff0776235
7 changed files with 63 additions and 63 deletions
78
src/core.c
78
src/core.c
|
@ -221,33 +221,33 @@
|
||||||
#include <android/window.h> // Defines AWINDOW_FLAG_FULLSCREEN and others
|
#include <android/window.h> // Defines AWINDOW_FLAG_FULLSCREEN and others
|
||||||
#include <android_native_app_glue.h> // Defines basic app state struct and manages activity
|
#include <android_native_app_glue.h> // Defines basic app state struct and manages activity
|
||||||
|
|
||||||
#include <EGL/egl.h> // Khronos EGL library - Native platform display device control functions
|
#include <EGL/egl.h> // Khronos EGL library - Native platform display device control functions
|
||||||
#include <GLES2/gl2.h> // Khronos OpenGL ES 2.0 library
|
#include <GLES2/gl2.h> // Khronos OpenGL ES 2.0 library
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(PLATFORM_RPI)
|
#if defined(PLATFORM_RPI)
|
||||||
#include <fcntl.h> // POSIX file control definitions - open(), creat(), fcntl()
|
#include <fcntl.h> // POSIX file control definitions - open(), creat(), fcntl()
|
||||||
#include <unistd.h> // POSIX standard function definitions - read(), close(), STDIN_FILENO
|
#include <unistd.h> // POSIX standard function definitions - read(), close(), STDIN_FILENO
|
||||||
#include <termios.h> // POSIX terminal control definitions - tcgetattr(), tcsetattr()
|
#include <termios.h> // POSIX terminal control definitions - tcgetattr(), tcsetattr()
|
||||||
#include <pthread.h> // POSIX threads management (inputs reading)
|
#include <pthread.h> // POSIX threads management (inputs reading)
|
||||||
#include <dirent.h> // POSIX directory browsing
|
#include <dirent.h> // POSIX directory browsing
|
||||||
|
|
||||||
#include <sys/ioctl.h> // UNIX System call for device-specific input/output operations - ioctl()
|
#include <sys/ioctl.h> // UNIX System call for device-specific input/output operations - ioctl()
|
||||||
#include <linux/kd.h> // Linux: KDSKBMODE, K_MEDIUMRAM constants definition
|
#include <linux/kd.h> // Linux: KDSKBMODE, K_MEDIUMRAM constants definition
|
||||||
#include <linux/input.h> // Linux: Keycodes constants definition (KEY_A, ...)
|
#include <linux/input.h> // Linux: Keycodes constants definition (KEY_A, ...)
|
||||||
#include <linux/joystick.h> // Linux: Joystick support library
|
#include <linux/joystick.h> // Linux: Joystick support library
|
||||||
|
|
||||||
#include "bcm_host.h" // Raspberry Pi VideoCore IV access functions
|
#include "bcm_host.h" // Raspberry Pi VideoCore IV access functions
|
||||||
|
|
||||||
#include "EGL/egl.h" // Khronos EGL library - Native platform display device control functions
|
#include "EGL/egl.h" // Khronos EGL library - Native platform display device control functions
|
||||||
#include "EGL/eglext.h" // Khronos EGL library - Extensions
|
#include "EGL/eglext.h" // Khronos EGL library - Extensions
|
||||||
#include "GLES2/gl2.h" // Khronos OpenGL ES 2.0 library
|
#include "GLES2/gl2.h" // Khronos OpenGL ES 2.0 library
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(PLATFORM_UWP)
|
#if defined(PLATFORM_UWP)
|
||||||
#include "EGL/egl.h" // Khronos EGL library - Native platform display device control functions
|
#include "EGL/egl.h" // Khronos EGL library - Native platform display device control functions
|
||||||
#include "EGL/eglext.h" // Khronos EGL library - Extensions
|
#include "EGL/eglext.h" // Khronos EGL library - Extensions
|
||||||
#include "GLES2/gl2.h" // Khronos OpenGL ES 2.0 library
|
#include "GLES2/gl2.h" // Khronos OpenGL ES 2.0 library
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(PLATFORM_WEB)
|
#if defined(PLATFORM_WEB)
|
||||||
|
@ -299,22 +299,22 @@
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
#if defined(PLATFORM_RPI)
|
#if defined(PLATFORM_RPI)
|
||||||
typedef struct {
|
typedef struct {
|
||||||
pthread_t threadId; // Event reading thread id
|
pthread_t threadId; // Event reading thread id
|
||||||
int fd; // File descriptor to the device it is assigned to
|
int fd; // File descriptor to the device it is assigned to
|
||||||
int eventNum; // Number of 'event<N>' device
|
int eventNum; // Number of 'event<N>' device
|
||||||
Rectangle absRange; // Range of values for absolute pointing devices (touchscreens)
|
Rectangle absRange; // Range of values for absolute pointing devices (touchscreens)
|
||||||
int touchSlot; // Hold the touch slot number of the currently being sent multitouch block
|
int touchSlot; // Hold the touch slot number of the currently being sent multitouch block
|
||||||
bool isMouse; // True if device supports relative X Y movements
|
bool isMouse; // True if device supports relative X Y movements
|
||||||
bool isTouch; // True if device supports absolute X Y movements and has BTN_TOUCH
|
bool isTouch; // True if device supports absolute X Y movements and has BTN_TOUCH
|
||||||
bool isMultitouch; // True if device supports multiple absolute movevents and has BTN_TOUCH
|
bool isMultitouch; // True if device supports multiple absolute movevents and has BTN_TOUCH
|
||||||
bool isKeyboard; // True if device has letter keycodes
|
bool isKeyboard; // True if device has letter keycodes
|
||||||
bool isGamepad; // True if device has gamepad buttons
|
bool isGamepad; // True if device has gamepad buttons
|
||||||
} InputEventWorker;
|
} InputEventWorker;
|
||||||
|
|
||||||
typedef struct{
|
typedef struct {
|
||||||
int Contents[8];
|
int contents[8]; // Key events FIFO contents (8 positions)
|
||||||
char Head;
|
char head; // Key events FIFO head position
|
||||||
char Tail;
|
char tail; // Key events FIFO tail position
|
||||||
} KeyEventFifo;
|
} KeyEventFifo;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -3598,12 +3598,12 @@ static void PollInputEvents(void)
|
||||||
for (int i = 0; i < 512; i++)CORE.Input.Keyboard.previousKeyState[i] = CORE.Input.Keyboard.currentKeyState[i];
|
for (int i = 0; i < 512; i++)CORE.Input.Keyboard.previousKeyState[i] = CORE.Input.Keyboard.currentKeyState[i];
|
||||||
|
|
||||||
// Grab a keypress from the evdev fifo if avalable
|
// Grab a keypress from the evdev fifo if avalable
|
||||||
if (CORE.Input.Keyboard.lastKeyPressed.Head != CORE.Input.Keyboard.lastKeyPressed.Tail)
|
if (CORE.Input.Keyboard.lastKeyPressed.head != CORE.Input.Keyboard.lastKeyPressed.tail)
|
||||||
{
|
{
|
||||||
CORE.Input.Keyboard.keyPressedQueue[CORE.Input.Keyboard.keyPressedQueueCount] = CORE.Input.Keyboard.lastKeyPressed.Contents[CORE.Input.Keyboard.lastKeyPressed.Tail]; // Read the key from the buffer
|
CORE.Input.Keyboard.keyPressedQueue[CORE.Input.Keyboard.keyPressedQueueCount] = CORE.Input.Keyboard.lastKeyPressed.contents[CORE.Input.Keyboard.lastKeyPressed.tail]; // Read the key from the buffer
|
||||||
CORE.Input.Keyboard.keyPressedQueueCount++;
|
CORE.Input.Keyboard.keyPressedQueueCount++;
|
||||||
|
|
||||||
CORE.Input.Keyboard.lastKeyPressed.Tail = (CORE.Input.Keyboard.lastKeyPressed.Tail + 1) & 0x07; // Increment the tail pointer forwards and binary wraparound after 7 (fifo is 8 elements long)
|
CORE.Input.Keyboard.lastKeyPressed.tail = (CORE.Input.Keyboard.lastKeyPressed.tail + 1) & 0x07; // Increment the tail pointer forwards and binary wraparound after 7 (fifo is 8 elements long)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Register previous mouse states
|
// Register previous mouse states
|
||||||
|
@ -4767,8 +4767,8 @@ static void InitEvdevInput(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Reset keypress buffer
|
// Reset keypress buffer
|
||||||
CORE.Input.Keyboard.lastKeyPressed.Head = 0;
|
CORE.Input.Keyboard.lastKeyPressed.head = 0;
|
||||||
CORE.Input.Keyboard.lastKeyPressed.Tail = 0;
|
CORE.Input.Keyboard.lastKeyPressed.tail = 0;
|
||||||
|
|
||||||
// Reset keyboard key state
|
// Reset keyboard key state
|
||||||
for (int i = 0; i < 512; i++) CORE.Input.Keyboard.currentKeyState[i] = 0;
|
for (int i = 0; i < 512; i++) CORE.Input.Keyboard.currentKeyState[i] = 0;
|
||||||
|
@ -5131,8 +5131,8 @@ static void *EventThread(void *arg)
|
||||||
if (event.value > 0)
|
if (event.value > 0)
|
||||||
{
|
{
|
||||||
// Add the key int the fifo
|
// Add the key int the fifo
|
||||||
CORE.Input.Keyboard.lastKeyPressed.Contents[CORE.Input.Keyboard.lastKeyPressed.Head] = keycode; // Put the data at the front of the fifo snake
|
CORE.Input.Keyboard.lastKeyPressed.contents[CORE.Input.Keyboard.lastKeyPressed.head] = keycode; // Put the data at the front of the fifo snake
|
||||||
CORE.Input.Keyboard.lastKeyPressed.Head = (CORE.Input.Keyboard.lastKeyPressed.Head + 1) & 0x07; // Increment the head pointer forwards and binary wraparound after 7 (fifo is 8 elements long)
|
CORE.Input.Keyboard.lastKeyPressed.head = (CORE.Input.Keyboard.lastKeyPressed.head + 1) & 0x07; // Increment the head pointer forwards and binary wraparound after 7 (fifo is 8 elements long)
|
||||||
// TODO: This fifo is not fully threadsafe with multiple writers, so multiple keyboards hitting a key at the exact same time could miss a key (double write to head before it was incremented)
|
// TODO: This fifo is not fully threadsafe with multiple writers, so multiple keyboards hitting a key at the exact same time could miss a key (double write to head before it was incremented)
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue