-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathsdl_server.h
33 lines (25 loc) · 1.09 KB
/
sdl_server.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
// SPDX-License-Identifier: MIT
// Copyright (c) 2023 Ulrich Hecht
// SDL event server data structures
// WARNING: The allwinner-bare-metal toolchain as compiled with the included
// crosstool-ng configuration file defaults to compile code with
// "-fshort-enums", while Linux toolchains use "-fno-short-enums".
// Since SDL2 data structures make extensive use of enums, and the data is
// produced on the Linux side, it is mandatory to compile any bare-metal
// code that uses these data structures with "-fno-short-enums". The SDL
// header files check enum sizes and will throw an error if the size is not
// the same as an int.
// You will also have to make sure that any code compiled with
// "-fno-short-enums" doesn't use any bare-metal data structures with
// enums...
// There doesn't seem to be any easy way to configure the bare-metal
// toolchain to use "-fno-short-enums", unfortunately.
#ifndef USE_CUSTOM_SDL_HEADERS
#include <SDL2/SDL_events.h>
#endif
#define SDL_EVENT_BUFFER_SIZE 128
struct sdl_event_buffer {
int read_pos;
int write_pos;
SDL_Event events[SDL_EVENT_BUFFER_SIZE];
};