initial commit
This commit is contained in:
commit
6f73f2d443
4
.gitignore
vendored
Normal file
4
.gitignore
vendored
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
shaders/compiled/*
|
||||||
|
lettuce
|
||||||
|
gpu_triangle
|
||||||
|
test_enum
|
33
compile-shaders.sh
Executable file
33
compile-shaders.sh
Executable file
@ -0,0 +1,33 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
source_directory="shaders/source"
|
||||||
|
compiled_directory="shaders/compiled"
|
||||||
|
vulkan_version="1.0"
|
||||||
|
mkdir -p $compiled_directory
|
||||||
|
rm -f $compiled_directory/*
|
||||||
|
|
||||||
|
|
||||||
|
echo "compiling from $source_directory -> $compiled_directory"
|
||||||
|
for file in "$source_directory"/*; do
|
||||||
|
filename=$(basename "$file")
|
||||||
|
if [[ "$filename" =~ ^([^\.]+)\.([^\.]+)\.([^\.]+)$ ]]; then
|
||||||
|
middlepart="${BASH_REMATCH[2]}"
|
||||||
|
filename="${BASH_REMATCH[1]}.${BASH_REMATCH[2]}"
|
||||||
|
shader_language="${BASH_REMATCH[3]}"
|
||||||
|
|
||||||
|
if [[ "$shader_language" != "glsl" ]]; then
|
||||||
|
echo "FUCK YOU I'M NOT COMPILING HLSL SHADERS, DO IT YOURSELF"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
if [[ "$middlepart" == "frag" ]]; then
|
||||||
|
echo "frag $filename.$shader_language > $filename.spv"
|
||||||
|
glslc -O -fshader-stage=fragment --target-env=vulkan$vulkan_version "$source_directory/$filename.$shader_language" -fshader-stage=fragment -o "$compiled_directory/$filename.spv"
|
||||||
|
elif [[ "$middlepart" == "vert" ]]; then
|
||||||
|
echo "vert $filename.$shader_language > $filename.spv"
|
||||||
|
glslc -O -fshader-stage=vertex --target-env=vulkan$vulkan_version "$source_directory/$filename.$shader_language" -o "$compiled_directory/$filename.spv"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
tree $compiled_directory
|
BIN
lettuce.bmp
Normal file
BIN
lettuce.bmp
Normal file
Binary file not shown.
After Width: | Height: | Size: 481 KiB |
9
sdl3.c3l/manifest.json
Normal file
9
sdl3.c3l/manifest.json
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
{
|
||||||
|
"provides": "sdl3",
|
||||||
|
"targets": {
|
||||||
|
"linux-x64": {
|
||||||
|
"dependencies": [],
|
||||||
|
"linked-libraries": ["SDL3", "c"]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
14
sdl3.c3l/project.json
Normal file
14
sdl3.c3l/project.json
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
{
|
||||||
|
"langrev": "1",
|
||||||
|
"warnings": ["no-unused"],
|
||||||
|
"dependency-search-paths": [".."],
|
||||||
|
"dependencies": ["sdl3"],
|
||||||
|
"authors": ["Alessandro Mauri <alemauri001@gmail.com>", "Sam Lantinga <slouken@libsdl.org>"],
|
||||||
|
"version": "0.1.0",
|
||||||
|
"sources": [],
|
||||||
|
"output": "build",
|
||||||
|
"target": "linux-x64",
|
||||||
|
"features": [],
|
||||||
|
"cpu": "generic",
|
||||||
|
"opt": "O0"
|
||||||
|
}
|
3
sdl3.c3l/sdl3_audio.c3i
Normal file
3
sdl3.c3l/sdl3_audio.c3i
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
module sdl3::sdl;
|
||||||
|
|
||||||
|
typedef AudioDeviceID = uint;
|
35
sdl3.c3l/sdl3_blendmode.c3i
Normal file
35
sdl3.c3l/sdl3_blendmode.c3i
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
module sdl3::sdl;
|
||||||
|
|
||||||
|
typedef BlendMode = uint;
|
||||||
|
|
||||||
|
const BlendMode BLENDMODE_NONE = 0x00000000;
|
||||||
|
const BlendMode BLENDMODE_BLEND = 0x00000001;
|
||||||
|
const BlendMode BLENDMODE_BLEND_PREMULTIPLIED = 0x00000010;
|
||||||
|
const BlendMode BLENDMODE_ADD = 0x00000002;
|
||||||
|
const BlendMode BLENDMODE_ADD_PREMULTIPLIED = 0x00000020;
|
||||||
|
const BlendMode BLENDMODE_MOD = 0x00000004;
|
||||||
|
const BlendMode BLENDMODE_MUL = 0x00000008;
|
||||||
|
const BlendMode BLENDMODE_INVALID = 0x7FFFFFFF;
|
||||||
|
|
||||||
|
typedef BlendOperation = CInt;
|
||||||
|
|
||||||
|
const BlendOperation BLENDOPERATION_ADD = 0x1;
|
||||||
|
const BlendOperation BLENDOPERATION_SUBTRACT = 0x2;
|
||||||
|
const BlendOperation BLENDOPERATION_REV_SUBTRACT = 0x3;
|
||||||
|
const BlendOperation BLENDOPERATION_MINIMUM = 0x4;
|
||||||
|
const BlendOperation BLENDOPERATION_MAXIMUM = 0x5;
|
||||||
|
|
||||||
|
typedef BlendFactor = CInt;
|
||||||
|
|
||||||
|
const BlendFactor BLENDFACTOR_ZERO = 0x1;
|
||||||
|
const BlendFactor BLENDFACTOR_ONE = 0x2;
|
||||||
|
const BlendFactor BLENDFACTOR_SRC_COLOR = 0x3;
|
||||||
|
const BlendFactor BLENDFACTOR_ONE_MINUS_SRC_COLOR = 0x4;
|
||||||
|
const BlendFactor BLENDFACTOR_SRC_ALPHA = 0x5;
|
||||||
|
const BlendFactor BLENDFACTOR_ONE_MINUS_SRC_ALPHA = 0x6;
|
||||||
|
const BlendFactor BLENDFACTOR_DST_COLOR = 0x7;
|
||||||
|
const BlendFactor BLENDFACTOR_ONE_MINUS_DST_COLOR = 0x8;
|
||||||
|
const BlendFactor BLENDFACTOR_DST_ALPHA = 0x9;
|
||||||
|
const BlendFactor BLENDFACTOR_ONE_MINUS_DST_ALPHA = 0xA;
|
||||||
|
|
||||||
|
extern fn BlendMode compose_custom_blend_mode(BlendFactor srcColorFactor, BlendFactor dstColorFactor, BlendOperation colorOperation, BlendFactor srcAlphaFactor, BlendFactor dstAlphaFactor, BlendOperation alphaOperation) @extern("SDL_ComposeCustomBlendMode");
|
3
sdl3.c3l/sdl3_camera.c3i
Normal file
3
sdl3.c3l/sdl3_camera.c3i
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
module sdl3::sdl;
|
||||||
|
|
||||||
|
typedef CameraID = uint;
|
11
sdl3.c3l/sdl3_error.c3i
Normal file
11
sdl3.c3l/sdl3_error.c3i
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
module sdl3::sdl;
|
||||||
|
|
||||||
|
extern fn bool set_error(ZString fmt, ...) @extern("SDL_SetError");
|
||||||
|
// extern fn bool set_error_v(SDL_PRINTF_FORMAT_STRING ZString fmt, va_list ap) SDL_PRINTF_VARARG_FUNCV(1) @extern("SDL_SetErrorV");
|
||||||
|
extern fn bool out_of_memory() @extern("SDL_OutOfMemory");
|
||||||
|
extern fn ZString get_error() @extern("SDL_GetError");
|
||||||
|
extern fn bool clear_error() @extern("SDL_ClearError");
|
||||||
|
|
||||||
|
macro unsupported() => set_error("That operation is not supported");
|
||||||
|
macro invalid_param_error(param) => set_error("Parameter '%s' is invalid", param);
|
||||||
|
|
604
sdl3.c3l/sdl3_events.c3i
Normal file
604
sdl3.c3l/sdl3_events.c3i
Normal file
@ -0,0 +1,604 @@
|
|||||||
|
module sdl3::sdl;
|
||||||
|
|
||||||
|
alias EventType = uint;
|
||||||
|
|
||||||
|
const EventType EVENT_FIRST = 0;
|
||||||
|
|
||||||
|
const EventType EVENT_QUIT = 0x100;
|
||||||
|
const EventType EVENT_TERMINATING = 0x101;
|
||||||
|
const EventType EVENT_LOW_MEMORY = 0x102;
|
||||||
|
const EventType EVENT_WILL_ENTER_BACKGROUND = 0x103;
|
||||||
|
const EventType EVENT_DID_ENTER_BACKGROUND = 0x104;
|
||||||
|
const EventType EVENT_WILL_ENTER_FOREGROUND = 0x105;
|
||||||
|
const EventType EVENT_DID_ENTER_FOREGROUND = 0x106;
|
||||||
|
const EventType EVENT_LOCALE_CHANGED = 0x107;
|
||||||
|
const EventType EVENT_SYSTEM_THEME_CHANGED = 0x108;
|
||||||
|
|
||||||
|
const EventType EVENT_DISPLAY_ORIENTATION = 0x151;
|
||||||
|
const EventType EVENT_DISPLAY_ADDED = 0x152;
|
||||||
|
const EventType EVENT_DISPLAY_REMOVED = 0x153;
|
||||||
|
const EventType EVENT_DISPLAY_MOVED = 0x154;
|
||||||
|
const EventType EVENT_DISPLAY_DESKTOP_MODE_CHANGED = 0x155;
|
||||||
|
const EventType EVENT_DISPLAY_CURRENT_MODE_CHANGED = 0x156;
|
||||||
|
const EventType EVENT_DISPLAY_CONTENT_SCALE_CHANGED = 0x157;
|
||||||
|
const EventType EVENT_DISPLAY_FIRST = EVENT_DISPLAY_ORIENTATION;
|
||||||
|
const EventType EVENT_DISPLAY_LAST = EVENT_DISPLAY_CONTENT_SCALE_CHANGED;
|
||||||
|
|
||||||
|
const EventType EVENT_WINDOW_SHOWN = 0x202;
|
||||||
|
const EventType EVENT_WINDOW_HIDDEN = 0x203;
|
||||||
|
const EventType EVENT_WINDOW_EXPOSED = 0x204;
|
||||||
|
const EventType EVENT_WINDOW_MOVED = 0x205;
|
||||||
|
const EventType EVENT_WINDOW_RESIZED = 0x206;
|
||||||
|
const EventType EVENT_WINDOW_PIXEL_SIZE_CHANGED = 0x207;
|
||||||
|
const EventType EVENT_WINDOW_METAL_VIEW_RESIZED = 0x208;
|
||||||
|
const EventType EVENT_WINDOW_MINIMIZED = 0x208;
|
||||||
|
const EventType EVENT_WINDOW_MAXIMIZED = 0x209;
|
||||||
|
const EventType EVENT_WINDOW_RESTORED = 0x20a;
|
||||||
|
const EventType EVENT_WINDOW_MOUSE_ENTER = 0x20b;
|
||||||
|
const EventType EVENT_WINDOW_MOUSE_LEAVE = 0x20c;
|
||||||
|
const EventType EVENT_WINDOW_FOCUS_GAINED = 0x20d;
|
||||||
|
const EventType EVENT_WINDOW_FOCUS_LOST = 0x20e;
|
||||||
|
const EventType EVENT_WINDOW_CLOSE_REQUESTED = 0x20f;
|
||||||
|
const EventType EVENT_WINDOW_HIT_TEST = 0x210;
|
||||||
|
const EventType EVENT_WINDOW_ICCPROF_CHANGED = 0x211;
|
||||||
|
const EventType EVENT_WINDOW_DISPLAY_CHANGED = 0x212;
|
||||||
|
const EventType EVENT_WINDOW_DISPLAY_SCALE_CHANGED = 0x213;
|
||||||
|
const EventType EVENT_WINDOW_SAFE_AREA_CHANGED = 0x214;
|
||||||
|
const EventType EVENT_WINDOW_OCCLUDED = 0x215;
|
||||||
|
const EventType EVENT_WINDOW_ENTER_FULLSCREEN = 0x216;
|
||||||
|
const EventType EVENT_WINDOW_LEAVE_FULLSCREEN = 0x217;
|
||||||
|
const EventType EVENT_WINDOW_DESTROYED = 0x218;
|
||||||
|
const EventType EVENT_WINDOW_HDR_STATE_CHANGED = 0x219;
|
||||||
|
const EventType EVENT_WINDOW_FIRST = EVENT_WINDOW_SHOWN;
|
||||||
|
const EventType EVENT_WINDOW_LAST = EVENT_WINDOW_HDR_STATE_CHANGED;
|
||||||
|
|
||||||
|
const EventType EVENT_KEY_DOWN = 0x300;
|
||||||
|
const EventType EVENT_KEY_UP = 0x301;
|
||||||
|
const EventType EVENT_TEXT_EDITING = 0x302;
|
||||||
|
const EventType EVENT_TEXT_INPUT = 0x303;
|
||||||
|
const EventType EVENT_KEYMAP_CHANGED = 0x304;
|
||||||
|
const EventType EVENT_KEYBOARD_ADDED = 0x305;
|
||||||
|
const EventType EVENT_KEYBOARD_REMOVED = 0x306;
|
||||||
|
const EventType EVENT_TEXT_EDITING_CANDIDATES = 0x307;
|
||||||
|
|
||||||
|
const EventType EVENT_MOUSE_MOTION = 0x400;
|
||||||
|
const EventType EVENT_MOUSE_BUTTON_DOWN = 0x401;
|
||||||
|
const EventType EVENT_MOUSE_BUTTON_UP = 0x402;
|
||||||
|
const EventType EVENT_MOUSE_WHEEL = 0x403;
|
||||||
|
const EventType EVENT_MOUSE_ADDED = 0x404;
|
||||||
|
const EventType EVENT_MOUSE_REMOVED = 0x405;
|
||||||
|
|
||||||
|
const EventType EVENT_JOYSTICK_AXIS_MOTION = 0x600;
|
||||||
|
const EventType EVENT_JOYSTICK_BALL_MOTION = 0x601;
|
||||||
|
const EventType EVENT_JOYSTICK_HAT_MOTION = 0x602;
|
||||||
|
const EventType EVENT_JOYSTICK_BUTTON_DOWN = 0x603;
|
||||||
|
const EventType EVENT_JOYSTICK_BUTTON_UP = 0x604;
|
||||||
|
const EventType EVENT_JOYSTICK_ADDED = 0x605;
|
||||||
|
const EventType EVENT_JOYSTICK_REMOVED = 0x606;
|
||||||
|
const EventType EVENT_JOYSTICK_BATTERY_UPDATED = 0x607;
|
||||||
|
const EventType EVENT_JOYSTICK_UPDATE_COMPLETE = 0x608;
|
||||||
|
|
||||||
|
const EventType EVENT_GAMEPAD_AXIS_MOTION = 0x650;
|
||||||
|
const EventType EVENT_GAMEPAD_BUTTON_DOWN = 0x651;
|
||||||
|
const EventType EVENT_GAMEPAD_BUTTON_UP = 0x652;
|
||||||
|
const EventType EVENT_GAMEPAD_ADDED = 0x653;
|
||||||
|
const EventType EVENT_GAMEPAD_REMOVED = 0x654;
|
||||||
|
const EventType EVENT_GAMEPAD_REMAPPED = 0x655;
|
||||||
|
const EventType EVENT_GAMEPAD_TOUCHPAD_DOWN = 0x656;
|
||||||
|
const EventType EVENT_GAMEPAD_TOUCHPAD_MOTION = 0x657;
|
||||||
|
const EventType EVENT_GAMEPAD_TOUCHPAD_UP = 0x658;
|
||||||
|
const EventType EVENT_GAMEPAD_SENSOR_UPDATE = 0x659;
|
||||||
|
const EventType EVENT_GAMEPAD_UPDATE_COMPLETE = 0x65a;
|
||||||
|
const EventType EVENT_GAMEPAD_STEAM_HANDLE_UPDATED = 0x65b;
|
||||||
|
|
||||||
|
const EventType EVENT_FINGER_DOWN = 0x700;
|
||||||
|
const EventType EVENT_FINGER_UP = 0x701;
|
||||||
|
const EventType EVENT_FINGER_MOTION = 0x702;
|
||||||
|
const EventType EVENT_FINGER_CANCELED = 0x703;
|
||||||
|
|
||||||
|
|
||||||
|
const EventType EVENT_CLIPBOARD_UPDATE = 0x900;
|
||||||
|
|
||||||
|
const EventType EVENT_DROP_FILE = 0x1000;
|
||||||
|
const EventType EVENT_DROP_TEXT = 0x1001;
|
||||||
|
const EventType EVENT_DROP_BEGIN = 0x1002;
|
||||||
|
const EventType EVENT_DROP_COMPLETE = 0x1003;
|
||||||
|
const EventType EVENT_DROP_POSITION = 0x1004;
|
||||||
|
|
||||||
|
const EventType EVENT_AUDIO_DEVICE_ADDED = 0x1100;
|
||||||
|
const EventType EVENT_AUDIO_DEVICE_REMOVED = 0x1101;
|
||||||
|
const EventType EVENT_AUDIO_DEVICE_FORMAT_CHANGED = 0x1102;
|
||||||
|
|
||||||
|
const EventType EVENT_SENSOR_UPDATE = 0x1200;
|
||||||
|
|
||||||
|
const EventType EVENT_PEN_PROXIMITY_IN = 0x1300;
|
||||||
|
const EventType EVENT_PEN_PROXIMITY_OUT = 0x1301;
|
||||||
|
const EventType EVENT_PEN_DOWN = 0x1302;
|
||||||
|
const EventType EVENT_PEN_UP = 0x1303;
|
||||||
|
const EventType EVENT_PEN_BUTTON_DOWN = 0x1304;
|
||||||
|
const EventType EVENT_PEN_BUTTON_UP = 0x1305;
|
||||||
|
const EventType EVENT_PEN_MOTION = 0x1306;
|
||||||
|
const EventType EVENT_PEN_AXIS = 0x1307;
|
||||||
|
|
||||||
|
const EventType EVENT_CAMERA_DEVICE_ADDED = 0x1400;
|
||||||
|
const EventType EVENT_CAMERA_DEVICE_REMOVED = 0x1401;
|
||||||
|
const EventType EVENT_CAMERA_DEVICE_APPROVED = 0x1402;
|
||||||
|
const EventType EVENT_CAMERA_DEVICE_DENIED = 0x1403;
|
||||||
|
|
||||||
|
const EventType EVENT_RENDER_TARGETS_RESET = 0x2000;
|
||||||
|
const EventType EVENT_RENDER_DEVICE_RESET = 0x2001;
|
||||||
|
const EventType EVENT_RENDER_DEVICE_LOST = 0x2002;
|
||||||
|
|
||||||
|
const EventType EVENT_PRIVATE0 = 0x4000;
|
||||||
|
const EventType EVENT_PRIVATE1 = 0x4001;
|
||||||
|
const EventType EVENT_PRIVATE2 = 0x4002;
|
||||||
|
const EventType EVENT_PRIVATE3 = 0x4003;
|
||||||
|
|
||||||
|
const EventType EVENT_POLL_SENTINEL = 0x7F00;
|
||||||
|
const EventType EVENT_USER = 0x8000;
|
||||||
|
const EventType EVENT_LAST = 0xFFFF;
|
||||||
|
const EventType EVENT_ENUM_PADDING = 0x7FFFFFFF;
|
||||||
|
|
||||||
|
|
||||||
|
struct CommonEvent {
|
||||||
|
uint type;
|
||||||
|
uint reserved;
|
||||||
|
ulong timestamp;
|
||||||
|
}
|
||||||
|
|
||||||
|
struct DisplayEvent {
|
||||||
|
EventType type;
|
||||||
|
uint reserved;
|
||||||
|
ulong timestamp;
|
||||||
|
DisplayID displayID;
|
||||||
|
int data1;
|
||||||
|
int data2;
|
||||||
|
}
|
||||||
|
|
||||||
|
struct WindowEvent {
|
||||||
|
EventType type;
|
||||||
|
uint reserved;
|
||||||
|
ulong timestamp;
|
||||||
|
WindowID windowID;
|
||||||
|
int data1;
|
||||||
|
int data2;
|
||||||
|
}
|
||||||
|
|
||||||
|
struct KeyboardDeviceEvent {
|
||||||
|
EventType type;
|
||||||
|
uint reserved;
|
||||||
|
ulong timestamp;
|
||||||
|
KeyboardID which;
|
||||||
|
}
|
||||||
|
|
||||||
|
struct KeyboardEvent {
|
||||||
|
EventType type;
|
||||||
|
uint reserved;
|
||||||
|
ulong timestamp;
|
||||||
|
WindowID windowID;
|
||||||
|
KeyboardID which;
|
||||||
|
Scancode scancode;
|
||||||
|
Keycode key;
|
||||||
|
Keymod mod;
|
||||||
|
ushort raw;
|
||||||
|
bool down;
|
||||||
|
bool repeat;
|
||||||
|
}
|
||||||
|
|
||||||
|
struct TextEditingEvent {
|
||||||
|
EventType type;
|
||||||
|
uint reserved;
|
||||||
|
ulong timestamp;
|
||||||
|
WindowID windowID;
|
||||||
|
ZString text;
|
||||||
|
int start;
|
||||||
|
int length;
|
||||||
|
}
|
||||||
|
|
||||||
|
struct TextEditingCandidatesEvent {
|
||||||
|
EventType type;
|
||||||
|
uint reserved;
|
||||||
|
ulong timestamp;
|
||||||
|
WindowID windowID;
|
||||||
|
ZString* candidates;
|
||||||
|
int num_candidates;
|
||||||
|
int selected_candidate;
|
||||||
|
bool horizontal;
|
||||||
|
char padding1;
|
||||||
|
char padding2;
|
||||||
|
char padding3;
|
||||||
|
}
|
||||||
|
|
||||||
|
struct TextInputEvent {
|
||||||
|
EventType type;
|
||||||
|
uint reserved;
|
||||||
|
ulong timestamp;
|
||||||
|
WindowID windowID;
|
||||||
|
ZString text;
|
||||||
|
}
|
||||||
|
|
||||||
|
struct MouseDeviceEvent {
|
||||||
|
EventType type;
|
||||||
|
uint reserved;
|
||||||
|
ulong timestamp;
|
||||||
|
MouseID which;
|
||||||
|
}
|
||||||
|
|
||||||
|
struct MouseMotionEvent {
|
||||||
|
EventType type;
|
||||||
|
uint reserved;
|
||||||
|
ulong timestamp;
|
||||||
|
WindowID windowID;
|
||||||
|
MouseID which;
|
||||||
|
MouseButtonFlags state;
|
||||||
|
float x;
|
||||||
|
float y;
|
||||||
|
float xrel;
|
||||||
|
float yrel;
|
||||||
|
}
|
||||||
|
|
||||||
|
struct MouseButtonEvent {
|
||||||
|
EventType type;
|
||||||
|
uint reserved;
|
||||||
|
ulong timestamp;
|
||||||
|
WindowID windowID;
|
||||||
|
MouseID which;
|
||||||
|
char button;
|
||||||
|
bool down;
|
||||||
|
char clicks;
|
||||||
|
char padding;
|
||||||
|
float x;
|
||||||
|
float y;
|
||||||
|
}
|
||||||
|
|
||||||
|
struct MouseWheelEvent {
|
||||||
|
EventType type;
|
||||||
|
uint reserved;
|
||||||
|
ulong timestamp;
|
||||||
|
WindowID windowID;
|
||||||
|
MouseID which;
|
||||||
|
float x;
|
||||||
|
float y;
|
||||||
|
MouseWheelDirection direction;
|
||||||
|
float mouse_x;
|
||||||
|
float mouse_y;
|
||||||
|
int integer_x;
|
||||||
|
int integer_y;
|
||||||
|
}
|
||||||
|
|
||||||
|
struct JoyAxisEvent {
|
||||||
|
EventType type;
|
||||||
|
uint reserved;
|
||||||
|
ulong timestamp;
|
||||||
|
JoystickID which;
|
||||||
|
char axis;
|
||||||
|
char padding1;
|
||||||
|
char padding2;
|
||||||
|
char padding3;
|
||||||
|
short value;
|
||||||
|
ushort padding4;
|
||||||
|
}
|
||||||
|
|
||||||
|
struct JoyBallEvent {
|
||||||
|
EventType type;
|
||||||
|
uint reserved;
|
||||||
|
ulong timestamp;
|
||||||
|
JoystickID which;
|
||||||
|
char ball;
|
||||||
|
char padding1;
|
||||||
|
char padding2;
|
||||||
|
char padding3;
|
||||||
|
short xrel;
|
||||||
|
short yrel;
|
||||||
|
}
|
||||||
|
|
||||||
|
struct JoyHatEvent {
|
||||||
|
EventType type;
|
||||||
|
uint reserved;
|
||||||
|
ulong timestamp;
|
||||||
|
JoystickID which;
|
||||||
|
char hat;
|
||||||
|
char value;
|
||||||
|
char padding1;
|
||||||
|
char padding2;
|
||||||
|
}
|
||||||
|
|
||||||
|
struct JoyButtonEvent {
|
||||||
|
EventType type;
|
||||||
|
uint reserved;
|
||||||
|
ulong timestamp;
|
||||||
|
JoystickID which;
|
||||||
|
char button;
|
||||||
|
bool down;
|
||||||
|
char padding1;
|
||||||
|
char padding2;
|
||||||
|
}
|
||||||
|
|
||||||
|
struct JoyDeviceEvent {
|
||||||
|
EventType type;
|
||||||
|
uint reserved;
|
||||||
|
ulong timestamp;
|
||||||
|
JoystickID which;
|
||||||
|
}
|
||||||
|
|
||||||
|
struct JoyBatteryEvent {
|
||||||
|
EventType type;
|
||||||
|
uint reserved;
|
||||||
|
ulong timestamp;
|
||||||
|
JoystickID which;
|
||||||
|
PowerState state;
|
||||||
|
int percent;
|
||||||
|
}
|
||||||
|
|
||||||
|
struct GamepadAxisEvent {
|
||||||
|
EventType type;
|
||||||
|
uint reserved;
|
||||||
|
ulong timestamp;
|
||||||
|
JoystickID which;
|
||||||
|
char axis;
|
||||||
|
char padding1;
|
||||||
|
char padding2;
|
||||||
|
char padding3;
|
||||||
|
short value;
|
||||||
|
ushort padding4;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
struct GamepadButtonEvent {
|
||||||
|
EventType type;
|
||||||
|
uint reserved;
|
||||||
|
ulong timestamp;
|
||||||
|
JoystickID which;
|
||||||
|
char button;
|
||||||
|
bool down;
|
||||||
|
char padding1;
|
||||||
|
char padding2;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
struct GamepadDeviceEvent {
|
||||||
|
EventType type;
|
||||||
|
uint reserved;
|
||||||
|
ulong timestamp;
|
||||||
|
JoystickID which;
|
||||||
|
}
|
||||||
|
|
||||||
|
struct GamepadTouchpadEvent {
|
||||||
|
EventType type;
|
||||||
|
uint reserved;
|
||||||
|
ulong timestamp;
|
||||||
|
JoystickID which;
|
||||||
|
int touchpad;
|
||||||
|
int finger;
|
||||||
|
float x;
|
||||||
|
float y;
|
||||||
|
float pressure;
|
||||||
|
}
|
||||||
|
|
||||||
|
struct GamepadSensorEvent {
|
||||||
|
EventType type;
|
||||||
|
uint reserved;
|
||||||
|
ulong timestamp;
|
||||||
|
JoystickID which;
|
||||||
|
int sensor;
|
||||||
|
float[3] data;
|
||||||
|
ulong sensor_timestamp;
|
||||||
|
}
|
||||||
|
|
||||||
|
struct AudioDeviceEvent {
|
||||||
|
EventType type;
|
||||||
|
uint reserved;
|
||||||
|
ulong timestamp;
|
||||||
|
AudioDeviceID which;
|
||||||
|
bool recording;
|
||||||
|
char padding1;
|
||||||
|
char padding2;
|
||||||
|
char padding3;
|
||||||
|
}
|
||||||
|
|
||||||
|
struct CameraDeviceEvent {
|
||||||
|
EventType type;
|
||||||
|
uint reserved;
|
||||||
|
ulong timestamp;
|
||||||
|
CameraID which;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
struct RenderEvent {
|
||||||
|
EventType type;
|
||||||
|
uint reserved;
|
||||||
|
ulong timestamp;
|
||||||
|
WindowID windowID;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
struct TouchFingerEvent {
|
||||||
|
EventType type;
|
||||||
|
uint reserved;
|
||||||
|
ulong timestamp;
|
||||||
|
TouchID touchID;
|
||||||
|
FingerID fingerID;
|
||||||
|
float x;
|
||||||
|
float y;
|
||||||
|
float dx;
|
||||||
|
float dy;
|
||||||
|
float pressure;
|
||||||
|
WindowID windowID;
|
||||||
|
}
|
||||||
|
|
||||||
|
struct PenProximityEvent {
|
||||||
|
EventType type;
|
||||||
|
uint reserved;
|
||||||
|
ulong timestamp;
|
||||||
|
WindowID windowID;
|
||||||
|
PenID which;
|
||||||
|
}
|
||||||
|
|
||||||
|
struct PenMotionEvent {
|
||||||
|
EventType type;
|
||||||
|
uint reserved;
|
||||||
|
ulong timestamp;
|
||||||
|
WindowID windowID;
|
||||||
|
PenID which;
|
||||||
|
PenInputFlags pen_state;
|
||||||
|
float x;
|
||||||
|
float y;
|
||||||
|
}
|
||||||
|
|
||||||
|
struct PenTouchEvent {
|
||||||
|
EventType type;
|
||||||
|
uint reserved;
|
||||||
|
ulong timestamp;
|
||||||
|
WindowID windowID;
|
||||||
|
PenID which;
|
||||||
|
PenInputFlags pen_state;
|
||||||
|
float x;
|
||||||
|
float y;
|
||||||
|
bool eraser;
|
||||||
|
bool down;
|
||||||
|
}
|
||||||
|
|
||||||
|
struct PenButtonEvent {
|
||||||
|
EventType type;
|
||||||
|
uint reserved;
|
||||||
|
ulong timestamp;
|
||||||
|
WindowID windowID;
|
||||||
|
PenID which;
|
||||||
|
PenInputFlags pen_state;
|
||||||
|
float x;
|
||||||
|
float y;
|
||||||
|
char button;
|
||||||
|
bool down;
|
||||||
|
}
|
||||||
|
|
||||||
|
struct PenAxisEvent {
|
||||||
|
EventType type;
|
||||||
|
uint reserved;
|
||||||
|
ulong timestamp;
|
||||||
|
WindowID windowID;
|
||||||
|
PenID which;
|
||||||
|
PenInputFlags pen_state;
|
||||||
|
float x;
|
||||||
|
float y;
|
||||||
|
PenAxis axis;
|
||||||
|
float value;
|
||||||
|
}
|
||||||
|
|
||||||
|
struct DropEvent {
|
||||||
|
EventType type;
|
||||||
|
uint reserved;
|
||||||
|
ulong timestamp;
|
||||||
|
WindowID windowID;
|
||||||
|
float x;
|
||||||
|
float y;
|
||||||
|
ZString source;
|
||||||
|
ZString data;
|
||||||
|
}
|
||||||
|
|
||||||
|
struct ClipboardEvent {
|
||||||
|
EventType type;
|
||||||
|
uint reserved;
|
||||||
|
ulong timestamp;
|
||||||
|
bool owner;
|
||||||
|
int num_mime_types;
|
||||||
|
ZString* mime_types;
|
||||||
|
}
|
||||||
|
|
||||||
|
struct SensorEvent {
|
||||||
|
EventType type;
|
||||||
|
uint reserved;
|
||||||
|
ulong timestamp;
|
||||||
|
SensorID which;
|
||||||
|
float[6] data;
|
||||||
|
ulong sensor_timestamp;
|
||||||
|
}
|
||||||
|
|
||||||
|
struct QuitEvent {
|
||||||
|
EventType type;
|
||||||
|
uint reserved;
|
||||||
|
ulong timestamp;
|
||||||
|
}
|
||||||
|
|
||||||
|
struct UserEvent {
|
||||||
|
uint type;
|
||||||
|
uint reserved;
|
||||||
|
ulong timestamp;
|
||||||
|
WindowID windowID;
|
||||||
|
int code;
|
||||||
|
void* data1;
|
||||||
|
void* data2;
|
||||||
|
}
|
||||||
|
|
||||||
|
union Event {
|
||||||
|
uint type;
|
||||||
|
CommonEvent common;
|
||||||
|
DisplayEvent display;
|
||||||
|
WindowEvent window;
|
||||||
|
KeyboardDeviceEvent kdevice;
|
||||||
|
KeyboardEvent key;
|
||||||
|
TextEditingEvent edit;
|
||||||
|
TextEditingCandidatesEvent edit_candidates;
|
||||||
|
TextInputEvent text;
|
||||||
|
MouseDeviceEvent mdevice;
|
||||||
|
MouseMotionEvent motion;
|
||||||
|
MouseButtonEvent button;
|
||||||
|
MouseWheelEvent wheel;
|
||||||
|
JoyDeviceEvent jdevice;
|
||||||
|
JoyAxisEvent jaxis;
|
||||||
|
JoyBallEvent jball;
|
||||||
|
JoyHatEvent jhat;
|
||||||
|
JoyButtonEvent jbutton;
|
||||||
|
JoyBatteryEvent jbattery;
|
||||||
|
GamepadDeviceEvent gdevice;
|
||||||
|
GamepadAxisEvent gaxis;
|
||||||
|
GamepadButtonEvent gbutton;
|
||||||
|
GamepadTouchpadEvent gtouchpad;
|
||||||
|
GamepadSensorEvent gsensor;
|
||||||
|
AudioDeviceEvent adevice;
|
||||||
|
CameraDeviceEvent cdevice;
|
||||||
|
SensorEvent sensor;
|
||||||
|
QuitEvent quit;
|
||||||
|
UserEvent user;
|
||||||
|
TouchFingerEvent tfinger;
|
||||||
|
PenProximityEvent pproximity;
|
||||||
|
PenTouchEvent ptouch;
|
||||||
|
PenMotionEvent pmotion;
|
||||||
|
PenButtonEvent pbutton;
|
||||||
|
PenAxisEvent paxis;
|
||||||
|
RenderEvent render;
|
||||||
|
DropEvent drop;
|
||||||
|
ClipboardEvent clipboard;
|
||||||
|
char[128] padding;
|
||||||
|
}
|
||||||
|
|
||||||
|
extern fn void pump_events() @extern("SDL_PumpEvents");
|
||||||
|
|
||||||
|
|
||||||
|
enum EventAction : inline CInt {
|
||||||
|
ADDEVENT,
|
||||||
|
PEEKEVENT,
|
||||||
|
GETEVENT
|
||||||
|
}
|
||||||
|
|
||||||
|
extern fn int peep_events(Event* events, int numevents, EventAction action, uint minType, uint maxType) @extern("SDL_PeepEvents");
|
||||||
|
extern fn bool has_event(uint type) @extern("SDL_HasEvent");
|
||||||
|
extern fn bool has_events(uint minType, uint maxType) @extern("SDL_HasEvents");
|
||||||
|
extern fn void flush_event(uint type) @extern("SDL_FlushEvent");
|
||||||
|
extern fn void flush_events(uint minType, uint maxType) @extern("SDL_FlushEvents");
|
||||||
|
extern fn bool poll_event(Event* event) @extern("SDL_PollEvent");
|
||||||
|
extern fn bool wait_event(Event* event) @extern("SDL_WaitEvent");
|
||||||
|
extern fn bool wait_event_timeout(Event* event, int timeoutMS) @extern("SDL_WaitEventTimeout");
|
||||||
|
extern fn bool push_event(Event* event) @extern("SDL_PushEvent");
|
||||||
|
|
||||||
|
alias EventFilter = fn bool(void* userdata, Event* event);
|
||||||
|
|
||||||
|
extern fn void set_event_filter(EventFilter filter, void* userdata) @extern("SDL_SetEventFilter");
|
||||||
|
extern fn bool get_event_filter(EventFilter *filter, void** userdata) @extern("SDL_GetEventFilter");
|
||||||
|
extern fn bool add_event_watch(EventFilter filter, void* userdata) @extern("SDL_AddEventWatch");
|
||||||
|
extern fn void remove_event_watch(EventFilter filter, void* userdata) @extern("SDL_RemoveEventWatch");
|
||||||
|
extern fn void filter_events(EventFilter filter, void* userdata) @extern("SDL_FilterEvents");
|
||||||
|
extern fn void set_event_enabled(uint type, bool enabled) @extern("SDL_SetEventEnabled");
|
||||||
|
extern fn bool event_enabled(uint type) @extern("SDL_EventEnabled");
|
||||||
|
extern fn uint register_events(int numevents) @extern("SDL_RegisterEvents");
|
||||||
|
extern fn Window* get_window_from_event(Event* event) @extern("SDL_GetWindowFromEvent");
|
||||||
|
|
861
sdl3.c3l/sdl3_gpu.c3i
Normal file
861
sdl3.c3l/sdl3_gpu.c3i
Normal file
@ -0,0 +1,861 @@
|
|||||||
|
module sdl3::sdl;
|
||||||
|
|
||||||
|
/* SDL3_gpu.h ported to C3 */
|
||||||
|
|
||||||
|
// these are opaque in C
|
||||||
|
typedef GPUDevice = void;
|
||||||
|
typedef GPUBuffer = void;
|
||||||
|
typedef GPUTransferBuffer = void;
|
||||||
|
typedef GPUTexture = void;
|
||||||
|
typedef GPUSampler = void;
|
||||||
|
typedef GPUShader = void;
|
||||||
|
typedef GPUComputePipeline = void;
|
||||||
|
typedef GPUGraphicsPipeline = void;
|
||||||
|
typedef GPUCommandBuffer = void;
|
||||||
|
typedef GPURenderPass = void;
|
||||||
|
typedef GPUComputePass = void;
|
||||||
|
typedef GPUCopyPass = void;
|
||||||
|
typedef GPUFence = void;
|
||||||
|
|
||||||
|
/* ----- */
|
||||||
|
/* Enums */
|
||||||
|
/* ----- */
|
||||||
|
|
||||||
|
enum GPUPrimitiveType : inline CInt {
|
||||||
|
GPU_PRIMITIVETYPE_TRIANGLELIST,
|
||||||
|
GPU_PRIMITIVETYPE_TRIANGLESTRIP,
|
||||||
|
GPU_PRIMITIVETYPE_LINELIST,
|
||||||
|
GPU_PRIMITIVETYPE_LINESTRIP,
|
||||||
|
GPU_PRIMITIVETYPE_POINTLIST
|
||||||
|
}
|
||||||
|
|
||||||
|
enum GPULoadOp : inline CInt {
|
||||||
|
GPU_LOADOP_LOAD,
|
||||||
|
GPU_LOADOP_CLEAR,
|
||||||
|
GPU_LOADOP_DONT_CARE
|
||||||
|
}
|
||||||
|
|
||||||
|
enum GPUStoreOp : inline CInt {
|
||||||
|
GPU_STOREOP_STORE,
|
||||||
|
GPU_STOREOP_DONT_CARE,
|
||||||
|
GPU_STOREOP_RESOLVE,
|
||||||
|
GPU_STOREOP_RESOLVE_AND_STORE
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
enum GPUIndexElementSize : inline CInt {
|
||||||
|
GPU_INDEXELEMENTSIZE_16BIT,
|
||||||
|
GPU_INDEXELEMENTSIZE_32BIT
|
||||||
|
}
|
||||||
|
|
||||||
|
enum GPUTextureFormat : inline CInt {
|
||||||
|
GPU_TEXTUREFORMAT_INVALID,
|
||||||
|
/* Unsigned Normalized Float Color Formats */
|
||||||
|
GPU_TEXTUREFORMAT_A8_UNORM,
|
||||||
|
GPU_TEXTUREFORMAT_R8_UNORM,
|
||||||
|
GPU_TEXTUREFORMAT_R8G8_UNORM,
|
||||||
|
GPU_TEXTUREFORMAT_R8G8B8A8_UNORM,
|
||||||
|
GPU_TEXTUREFORMAT_R16_UNORM,
|
||||||
|
GPU_TEXTUREFORMAT_R16G16_UNORM,
|
||||||
|
GPU_TEXTUREFORMAT_R16G16B16A16_UNORM,
|
||||||
|
GPU_TEXTUREFORMAT_R10G10B10A2_UNORM,
|
||||||
|
GPU_TEXTUREFORMAT_B5G6R5_UNORM,
|
||||||
|
GPU_TEXTUREFORMAT_B5G5R5A1_UNORM,
|
||||||
|
GPU_TEXTUREFORMAT_B4G4R4A4_UNORM,
|
||||||
|
GPU_TEXTUREFORMAT_B8G8R8A8_UNORM,
|
||||||
|
/* Compressed Unsigned Normalized Float Color Formats */
|
||||||
|
GPU_TEXTUREFORMAT_BC1_RGBA_UNORM,
|
||||||
|
GPU_TEXTUREFORMAT_BC2_RGBA_UNORM,
|
||||||
|
GPU_TEXTUREFORMAT_BC3_RGBA_UNORM,
|
||||||
|
GPU_TEXTUREFORMAT_BC4_R_UNORM,
|
||||||
|
GPU_TEXTUREFORMAT_BC5_RG_UNORM,
|
||||||
|
GPU_TEXTUREFORMAT_BC7_RGBA_UNORM,
|
||||||
|
/* Compressed Signed Float Color Formats */
|
||||||
|
GPU_TEXTUREFORMAT_BC6H_RGB_FLOAT,
|
||||||
|
/* Compressed Unsigned Float Color Formats */
|
||||||
|
GPU_TEXTUREFORMAT_BC6H_RGB_UFLOAT,
|
||||||
|
/* Signed Normalized Float Color Formats */
|
||||||
|
GPU_TEXTUREFORMAT_R8_SNORM,
|
||||||
|
GPU_TEXTUREFORMAT_R8G8_SNORM,
|
||||||
|
GPU_TEXTUREFORMAT_R8G8B8A8_SNORM,
|
||||||
|
GPU_TEXTUREFORMAT_R16_SNORM,
|
||||||
|
GPU_TEXTUREFORMAT_R16G16_SNORM,
|
||||||
|
GPU_TEXTUREFORMAT_R16G16B16A16_SNORM,
|
||||||
|
/* Signed Float Color Formats */
|
||||||
|
GPU_TEXTUREFORMAT_R16_FLOAT,
|
||||||
|
GPU_TEXTUREFORMAT_R16G16_FLOAT,
|
||||||
|
GPU_TEXTUREFORMAT_R16G16B16A16_FLOAT,
|
||||||
|
GPU_TEXTUREFORMAT_R32_FLOAT,
|
||||||
|
GPU_TEXTUREFORMAT_R32G32_FLOAT,
|
||||||
|
GPU_TEXTUREFORMAT_R32G32B32A32_FLOAT,
|
||||||
|
/* Unsigned Float Color Formats */
|
||||||
|
GPU_TEXTUREFORMAT_R11G11B10_UFLOAT,
|
||||||
|
/* Unsigned Integer Color Formats */
|
||||||
|
GPU_TEXTUREFORMAT_R8_UINT,
|
||||||
|
GPU_TEXTUREFORMAT_R8G8_UINT,
|
||||||
|
GPU_TEXTUREFORMAT_R8G8B8A8_UINT,
|
||||||
|
GPU_TEXTUREFORMAT_R16_UINT,
|
||||||
|
GPU_TEXTUREFORMAT_R16G16_UINT,
|
||||||
|
GPU_TEXTUREFORMAT_R16G16B16A16_UINT,
|
||||||
|
GPU_TEXTUREFORMAT_R32_UINT,
|
||||||
|
GPU_TEXTUREFORMAT_R32G32_UINT,
|
||||||
|
GPU_TEXTUREFORMAT_R32G32B32A32_UINT,
|
||||||
|
/* Signed Integer Color Formats */
|
||||||
|
GPU_TEXTUREFORMAT_R8_INT,
|
||||||
|
GPU_TEXTUREFORMAT_R8G8_INT,
|
||||||
|
GPU_TEXTUREFORMAT_R8G8B8A8_INT,
|
||||||
|
GPU_TEXTUREFORMAT_R16_INT,
|
||||||
|
GPU_TEXTUREFORMAT_R16G16_INT,
|
||||||
|
GPU_TEXTUREFORMAT_R16G16B16A16_INT,
|
||||||
|
GPU_TEXTUREFORMAT_R32_INT,
|
||||||
|
GPU_TEXTUREFORMAT_R32G32_INT,
|
||||||
|
GPU_TEXTUREFORMAT_R32G32B32A32_INT,
|
||||||
|
/* SRGB Unsigned Normalized Color Formats */
|
||||||
|
GPU_TEXTUREFORMAT_R8G8B8A8_UNORM_SRGB,
|
||||||
|
GPU_TEXTUREFORMAT_B8G8R8A8_UNORM_SRGB,
|
||||||
|
/* Compressed SRGB Unsigned Normalized Color Formats */
|
||||||
|
GPU_TEXTUREFORMAT_BC1_RGBA_UNORM_SRGB,
|
||||||
|
GPU_TEXTUREFORMAT_BC2_RGBA_UNORM_SRGB,
|
||||||
|
GPU_TEXTUREFORMAT_BC3_RGBA_UNORM_SRGB,
|
||||||
|
GPU_TEXTUREFORMAT_BC7_RGBA_UNORM_SRGB,
|
||||||
|
/* Depth Formats */
|
||||||
|
GPU_TEXTUREFORMAT_D16_UNORM,
|
||||||
|
GPU_TEXTUREFORMAT_D24_UNORM,
|
||||||
|
GPU_TEXTUREFORMAT_D32_FLOAT,
|
||||||
|
GPU_TEXTUREFORMAT_D24_UNORM_S8_UINT,
|
||||||
|
GPU_TEXTUREFORMAT_D32_FLOAT_S8_UINT,
|
||||||
|
/* Compressed ASTC Normalized Float Color Formats*/
|
||||||
|
GPU_TEXTUREFORMAT_ASTC_4X4_UNORM,
|
||||||
|
GPU_TEXTUREFORMAT_ASTC_5X4_UNORM,
|
||||||
|
GPU_TEXTUREFORMAT_ASTC_5X5_UNORM,
|
||||||
|
GPU_TEXTUREFORMAT_ASTC_6X5_UNORM,
|
||||||
|
GPU_TEXTUREFORMAT_ASTC_6X6_UNORM,
|
||||||
|
GPU_TEXTUREFORMAT_ASTC_8X5_UNORM,
|
||||||
|
GPU_TEXTUREFORMAT_ASTC_8X6_UNORM,
|
||||||
|
GPU_TEXTUREFORMAT_ASTC_8X8_UNORM,
|
||||||
|
GPU_TEXTUREFORMAT_ASTC_10X5_UNORM,
|
||||||
|
GPU_TEXTUREFORMAT_ASTC_10X6_UNORM,
|
||||||
|
GPU_TEXTUREFORMAT_ASTC_10X8_UNORM,
|
||||||
|
GPU_TEXTUREFORMAT_ASTC_10X10_UNORM,
|
||||||
|
GPU_TEXTUREFORMAT_ASTC_12X10_UNORM,
|
||||||
|
GPU_TEXTUREFORMAT_ASTC_12X12_UNORM,
|
||||||
|
/* Compressed SRGB ASTC Normalized Float Color Formats*/
|
||||||
|
GPU_TEXTUREFORMAT_ASTC_4X4_UNORM_SRGB,
|
||||||
|
GPU_TEXTUREFORMAT_ASTC_5X4_UNORM_SRGB,
|
||||||
|
GPU_TEXTUREFORMAT_ASTC_5X5_UNORM_SRGB,
|
||||||
|
GPU_TEXTUREFORMAT_ASTC_6X5_UNORM_SRGB,
|
||||||
|
GPU_TEXTUREFORMAT_ASTC_6X6_UNORM_SRGB,
|
||||||
|
GPU_TEXTUREFORMAT_ASTC_8X5_UNORM_SRGB,
|
||||||
|
GPU_TEXTUREFORMAT_ASTC_8X6_UNORM_SRGB,
|
||||||
|
GPU_TEXTUREFORMAT_ASTC_8X8_UNORM_SRGB,
|
||||||
|
GPU_TEXTUREFORMAT_ASTC_10X5_UNORM_SRGB,
|
||||||
|
GPU_TEXTUREFORMAT_ASTC_10X6_UNORM_SRGB,
|
||||||
|
GPU_TEXTUREFORMAT_ASTC_10X8_UNORM_SRGB,
|
||||||
|
GPU_TEXTUREFORMAT_ASTC_10X10_UNORM_SRGB,
|
||||||
|
GPU_TEXTUREFORMAT_ASTC_12X10_UNORM_SRGB,
|
||||||
|
GPU_TEXTUREFORMAT_ASTC_12X12_UNORM_SRGB,
|
||||||
|
/* Compressed ASTC Signed Float Color Formats*/
|
||||||
|
GPU_TEXTUREFORMAT_ASTC_4X4_FLOAT,
|
||||||
|
GPU_TEXTUREFORMAT_ASTC_5X4_FLOAT,
|
||||||
|
GPU_TEXTUREFORMAT_ASTC_5X5_FLOAT,
|
||||||
|
GPU_TEXTUREFORMAT_ASTC_6X5_FLOAT,
|
||||||
|
GPU_TEXTUREFORMAT_ASTC_6X6_FLOAT,
|
||||||
|
GPU_TEXTUREFORMAT_ASTC_8X5_FLOAT,
|
||||||
|
GPU_TEXTUREFORMAT_ASTC_8X6_FLOAT,
|
||||||
|
GPU_TEXTUREFORMAT_ASTC_8X8_FLOAT,
|
||||||
|
GPU_TEXTUREFORMAT_ASTC_10X5_FLOAT,
|
||||||
|
GPU_TEXTUREFORMAT_ASTC_10X6_FLOAT,
|
||||||
|
GPU_TEXTUREFORMAT_ASTC_10X8_FLOAT,
|
||||||
|
GPU_TEXTUREFORMAT_ASTC_10X10_FLOAT,
|
||||||
|
GPU_TEXTUREFORMAT_ASTC_12X10_FLOAT,
|
||||||
|
GPU_TEXTUREFORMAT_ASTC_12X12_FLOAT
|
||||||
|
}
|
||||||
|
|
||||||
|
typedef GPUTextureUsageFlags = uint;
|
||||||
|
|
||||||
|
const GPUTextureUsageFlags GPU_TEXTUREUSAGE_SAMPLER = (1 << 0);
|
||||||
|
const GPUTextureUsageFlags GPU_TEXTUREUSAGE_COLOR_TARGET = (1 << 1);
|
||||||
|
const GPUTextureUsageFlags GPU_TEXTUREUSAGE_DEPTH_STENCIL_TARGET = (1 << 2);
|
||||||
|
const GPUTextureUsageFlags GPU_TEXTUREUSAGE_GRAPHICS_STORAGE_READ = (1 << 3);
|
||||||
|
const GPUTextureUsageFlags GPU_TEXTUREUSAGE_COMPUTE_STORAGE_READ = (1 << 4);
|
||||||
|
const GPUTextureUsageFlags GPU_TEXTUREUSAGE_COMPUTE_STORAGE_WRITE = (1 << 5);
|
||||||
|
const GPUTextureUsageFlags GPU_TEXTUREUSAGE_COMPUTE_STORAGE_SIMULTANEOUS_READ_WRITE = (1 << 6);
|
||||||
|
|
||||||
|
enum GPUTextureType : inline CInt {
|
||||||
|
GPU_TEXTURETYPE_2D,
|
||||||
|
GPU_TEXTURETYPE_2D_ARRAY,
|
||||||
|
GPU_TEXTURETYPE_3D,
|
||||||
|
GPU_TEXTURETYPE_CUBE,
|
||||||
|
GPU_TEXTURETYPE_CUBE_ARRAY
|
||||||
|
}
|
||||||
|
|
||||||
|
enum GPUSampleCount : inline CInt {
|
||||||
|
GPU_SAMPLECOUNT_1,
|
||||||
|
GPU_SAMPLECOUNT_2,
|
||||||
|
GPU_SAMPLECOUNT_4,
|
||||||
|
GPU_SAMPLECOUNT_8
|
||||||
|
}
|
||||||
|
|
||||||
|
enum GPUCubeMapFace : inline CInt {
|
||||||
|
GPU_CUBEMAPFACE_POSITIVEX,
|
||||||
|
GPU_CUBEMAPFACE_NEGATIVEX,
|
||||||
|
GPU_CUBEMAPFACE_POSITIVEY,
|
||||||
|
GPU_CUBEMAPFACE_NEGATIVEY,
|
||||||
|
GPU_CUBEMAPFACE_POSITIVEZ,
|
||||||
|
GPU_CUBEMAPFACE_NEGATIVEZ
|
||||||
|
}
|
||||||
|
|
||||||
|
typedef GPUBufferUsageFlags = uint;
|
||||||
|
|
||||||
|
const GPUBufferUsageFlags GPU_BUFFERUSAGE_VERTEX = (1 << 0);
|
||||||
|
const GPUBufferUsageFlags GPU_BUFFERUSAGE_INDEX = (1 << 1);
|
||||||
|
const GPUBufferUsageFlags GPU_BUFFERUSAGE_INDIRECT = (1 << 2);
|
||||||
|
const GPUBufferUsageFlags GPU_BUFFERUSAGE_GRAPHICS_STORAGE_READ = (1 << 3);
|
||||||
|
const GPUBufferUsageFlags GPU_BUFFERUSAGE_COMPUTE_STORAGE_READ = (1 << 4);
|
||||||
|
const GPUBufferUsageFlags GPU_BUFFERUSAGE_COMPUTE_STORAGE_WRITE = (1 << 5);
|
||||||
|
|
||||||
|
|
||||||
|
enum GPUTransferBufferUsage : inline CInt {
|
||||||
|
GPU_TRANSFERBUFFERUSAGE_UPLOAD,
|
||||||
|
GPU_TRANSFERBUFFERUSAGE_DOWNLOAD
|
||||||
|
}
|
||||||
|
|
||||||
|
enum GPUShaderStage : inline CInt {
|
||||||
|
GPU_SHADERSTAGE_VERTEX,
|
||||||
|
GPU_SHADERSTAGE_FRAGMENT
|
||||||
|
}
|
||||||
|
|
||||||
|
typedef GPUShaderFormat = uint;
|
||||||
|
const GPUShaderFormat GPU_SHADERFORMAT_INVALID = 0;
|
||||||
|
const GPUShaderFormat GPU_SHADERFORMAT_PRIVATE = (1 << 0);
|
||||||
|
const GPUShaderFormat GPU_SHADERFORMAT_SPIRV = (1 << 1);
|
||||||
|
const GPUShaderFormat GPU_SHADERFORMAT_DXBC = (1 << 2);
|
||||||
|
const GPUShaderFormat GPU_SHADERFORMAT_DXIL = (1 << 3);
|
||||||
|
const GPUShaderFormat GPU_SHADERFORMAT_MSL = (1 << 4);
|
||||||
|
const GPUShaderFormat GPU_SHADERFORMAT_METALLIB = (1 << 5);
|
||||||
|
|
||||||
|
enum GPUVertexElementFormat : inline CInt {
|
||||||
|
GPU_VERTEXELEMENTFORMAT_INVALID,
|
||||||
|
|
||||||
|
/* 32-bit Signed Integers */
|
||||||
|
GPU_VERTEXELEMENTFORMAT_INT,
|
||||||
|
GPU_VERTEXELEMENTFORMAT_INT2,
|
||||||
|
GPU_VERTEXELEMENTFORMAT_INT3,
|
||||||
|
GPU_VERTEXELEMENTFORMAT_INT4,
|
||||||
|
|
||||||
|
/* 32-bit Unsigned Integers */
|
||||||
|
GPU_VERTEXELEMENTFORMAT_UINT,
|
||||||
|
GPU_VERTEXELEMENTFORMAT_UINT2,
|
||||||
|
GPU_VERTEXELEMENTFORMAT_UINT3,
|
||||||
|
GPU_VERTEXELEMENTFORMAT_UINT4,
|
||||||
|
|
||||||
|
/* 32-bit Floats */
|
||||||
|
GPU_VERTEXELEMENTFORMAT_FLOAT,
|
||||||
|
GPU_VERTEXELEMENTFORMAT_FLOAT2,
|
||||||
|
GPU_VERTEXELEMENTFORMAT_FLOAT3,
|
||||||
|
GPU_VERTEXELEMENTFORMAT_FLOAT4,
|
||||||
|
|
||||||
|
/* 8-bit Signed Integers */
|
||||||
|
GPU_VERTEXELEMENTFORMAT_BYTE2,
|
||||||
|
GPU_VERTEXELEMENTFORMAT_BYTE4,
|
||||||
|
|
||||||
|
/* 8-bit Unsigned Integers */
|
||||||
|
GPU_VERTEXELEMENTFORMAT_UBYTE2,
|
||||||
|
GPU_VERTEXELEMENTFORMAT_UBYTE4,
|
||||||
|
|
||||||
|
/* 8-bit Signed Normalized */
|
||||||
|
GPU_VERTEXELEMENTFORMAT_BYTE2_NORM,
|
||||||
|
GPU_VERTEXELEMENTFORMAT_BYTE4_NORM,
|
||||||
|
|
||||||
|
/* 8-bit Unsigned Normalized */
|
||||||
|
GPU_VERTEXELEMENTFORMAT_UBYTE2_NORM,
|
||||||
|
GPU_VERTEXELEMENTFORMAT_UBYTE4_NORM,
|
||||||
|
|
||||||
|
/* 16-bit Signed Integers */
|
||||||
|
GPU_VERTEXELEMENTFORMAT_SHORT2,
|
||||||
|
GPU_VERTEXELEMENTFORMAT_SHORT4,
|
||||||
|
|
||||||
|
/* 16-bit Unsigned Integers */
|
||||||
|
GPU_VERTEXELEMENTFORMAT_USHORT2,
|
||||||
|
GPU_VERTEXELEMENTFORMAT_USHORT4,
|
||||||
|
|
||||||
|
/* 16-bit Signed Normalized */
|
||||||
|
GPU_VERTEXELEMENTFORMAT_SHORT2_NORM,
|
||||||
|
GPU_VERTEXELEMENTFORMAT_SHORT4_NORM,
|
||||||
|
|
||||||
|
/* 16-bit Unsigned Normalized */
|
||||||
|
GPU_VERTEXELEMENTFORMAT_USHORT2_NORM,
|
||||||
|
GPU_VERTEXELEMENTFORMAT_USHORT4_NORM,
|
||||||
|
|
||||||
|
/* 16-bit Floats */
|
||||||
|
GPU_VERTEXELEMENTFORMAT_HALF2,
|
||||||
|
GPU_VERTEXELEMENTFORMAT_HALF4
|
||||||
|
}
|
||||||
|
|
||||||
|
enum GPUVertexInputRate : inline CInt {
|
||||||
|
GPU_VERTEXINPUTRATE_VERTEX,
|
||||||
|
GPU_VERTEXINPUTRATE_INSTANCE
|
||||||
|
}
|
||||||
|
|
||||||
|
enum GPUFillMode : inline CInt {
|
||||||
|
GPU_FILLMODE_FILL,
|
||||||
|
GPU_FILLMODE_LINE
|
||||||
|
}
|
||||||
|
|
||||||
|
enum GPUCullMode : inline CInt {
|
||||||
|
GPU_CULLMODE_NONE,
|
||||||
|
GPU_CULLMODE_FRONT,
|
||||||
|
GPU_CULLMODE_BACK
|
||||||
|
}
|
||||||
|
|
||||||
|
enum GPUFrontFace : inline CInt {
|
||||||
|
GPU_FRONTFACE_COUNTER_CLOCKWISE,
|
||||||
|
GPU_FRONTFACE_CLOCKWISE
|
||||||
|
}
|
||||||
|
|
||||||
|
enum GPUCompareOp : inline CInt {
|
||||||
|
GPU_COMPAREOP_INVALID,
|
||||||
|
GPU_COMPAREOP_NEVER,
|
||||||
|
GPU_COMPAREOP_LESS,
|
||||||
|
GPU_COMPAREOP_EQUAL,
|
||||||
|
GPU_COMPAREOP_LESS_OR_EQUAL,
|
||||||
|
GPU_COMPAREOP_GREATER,
|
||||||
|
GPU_COMPAREOP_NOT_EQUAL,
|
||||||
|
GPU_COMPAREOP_GREATER_OR_EQUAL,
|
||||||
|
GPU_COMPAREOP_ALWAYS
|
||||||
|
}
|
||||||
|
|
||||||
|
enum GPUStencilOp : inline CInt {
|
||||||
|
GPU_STENCILOP_INVALID,
|
||||||
|
GPU_STENCILOP_KEEP,
|
||||||
|
GPU_STENCILOP_ZERO,
|
||||||
|
GPU_STENCILOP_REPLACE,
|
||||||
|
GPU_STENCILOP_INCREMENT_AND_CLAMP,
|
||||||
|
GPU_STENCILOP_DECREMENT_AND_CLAMP,
|
||||||
|
GPU_STENCILOP_INVERT,
|
||||||
|
GPU_STENCILOP_INCREMENT_AND_WRAP,
|
||||||
|
GPU_STENCILOP_DECREMENT_AND_WRAP
|
||||||
|
}
|
||||||
|
|
||||||
|
enum GPUBlendOp : inline CInt
|
||||||
|
{
|
||||||
|
GPU_BLENDOP_INVALID,
|
||||||
|
GPU_BLENDOP_ADD,
|
||||||
|
GPU_BLENDOP_SUBTRACT,
|
||||||
|
GPU_BLENDOP_REVERSE_SUBTRACT,
|
||||||
|
GPU_BLENDOP_MIN,
|
||||||
|
GPU_BLENDOP_MAX
|
||||||
|
}
|
||||||
|
|
||||||
|
enum GPUBlendFactor : inline CInt {
|
||||||
|
GPU_BLENDFACTOR_INVALID,
|
||||||
|
GPU_BLENDFACTOR_ZERO,
|
||||||
|
GPU_BLENDFACTOR_ONE,
|
||||||
|
GPU_BLENDFACTOR_SRC_COLOR,
|
||||||
|
GPU_BLENDFACTOR_ONE_MINUS_SRC_COLOR,
|
||||||
|
GPU_BLENDFACTOR_DST_COLOR,
|
||||||
|
GPU_BLENDFACTOR_ONE_MINUS_DST_COLOR,
|
||||||
|
GPU_BLENDFACTOR_SRC_ALPHA,
|
||||||
|
GPU_BLENDFACTOR_ONE_MINUS_SRC_ALPHA,
|
||||||
|
GPU_BLENDFACTOR_DST_ALPHA,
|
||||||
|
GPU_BLENDFACTOR_ONE_MINUS_DST_ALPHA,
|
||||||
|
GPU_BLENDFACTOR_CONSTANT_COLOR,
|
||||||
|
GPU_BLENDFACTOR_ONE_MINUS_CONSTANT_COLOR,
|
||||||
|
GPU_BLENDFACTOR_SRC_ALPHA_SATURATE
|
||||||
|
}
|
||||||
|
|
||||||
|
typedef GPUColorComponentFlags = char;
|
||||||
|
const GPUColorComponentFlags GPU_COLORCOMPONENT_R = (1 << 0);
|
||||||
|
const GPUColorComponentFlags GPU_COLORCOMPONENT_G = (1 << 1);
|
||||||
|
const GPUColorComponentFlags GPU_COLORCOMPONENT_B = (1 << 2);
|
||||||
|
const GPUColorComponentFlags GPU_COLORCOMPONENT_A = (1 << 3);
|
||||||
|
|
||||||
|
enum GPUFilter : inline CInt {
|
||||||
|
GPU_FILTER_NEAREST,
|
||||||
|
GPU_FILTER_LINEAR
|
||||||
|
}
|
||||||
|
|
||||||
|
enum GPUSamplerMipmapMode : inline CInt {
|
||||||
|
GPU_SAMPLERMIPMAPMODE_NEAREST,
|
||||||
|
GPU_SAMPLERMIPMAPMODE_LINEAR
|
||||||
|
}
|
||||||
|
|
||||||
|
enum GPUSamplerAddressMode : inline CInt {
|
||||||
|
GPU_SAMPLERADDRESSMODE_REPEAT,
|
||||||
|
GPU_SAMPLERADDRESSMODE_MIRRORED_REPEAT,
|
||||||
|
GPU_SAMPLERADDRESSMODE_CLAMP_TO_EDGE
|
||||||
|
}
|
||||||
|
|
||||||
|
enum GPUPresentMode : inline CInt {
|
||||||
|
GPU_PRESENTMODE_VSYNC,
|
||||||
|
GPU_PRESENTMODE_IMMEDIATE,
|
||||||
|
GPU_PRESENTMODE_MAILBOX
|
||||||
|
}
|
||||||
|
|
||||||
|
enum GPUSwapchainComposition : inline CInt {
|
||||||
|
GPU_SWAPCHAINCOMPOSITION_SDR,
|
||||||
|
GPU_SWAPCHAINCOMPOSITION_SDR_LINEAR,
|
||||||
|
GPU_SWAPCHAINCOMPOSITION_HDR_EXTENDED_LINEAR,
|
||||||
|
GPU_SWAPCHAINCOMPOSITION_HDR10_ST2084
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ---------- */
|
||||||
|
/* Structures */
|
||||||
|
/* ---------- */
|
||||||
|
|
||||||
|
struct GPUViewport {
|
||||||
|
float x;
|
||||||
|
float y;
|
||||||
|
float w;
|
||||||
|
float h;
|
||||||
|
float min_depth;
|
||||||
|
float max_depth;
|
||||||
|
}
|
||||||
|
|
||||||
|
struct GPUTextureTransferInfo {
|
||||||
|
GPUTransferBuffer* transfer_buffer;
|
||||||
|
uint offset;
|
||||||
|
uint pixels_per_row;
|
||||||
|
uint rows_per_layer;
|
||||||
|
}
|
||||||
|
|
||||||
|
struct GPUTransferBufferLocation {
|
||||||
|
GPUTransferBuffer* transfer_buffer;
|
||||||
|
uint offset;
|
||||||
|
}
|
||||||
|
|
||||||
|
struct GPUTextureLocation {
|
||||||
|
GPUTexture* texture;
|
||||||
|
uint mip_level;
|
||||||
|
uint layer;
|
||||||
|
uint x;
|
||||||
|
uint y;
|
||||||
|
uint z;
|
||||||
|
}
|
||||||
|
|
||||||
|
struct GPUTextureRegion {
|
||||||
|
GPUTexture* texture;
|
||||||
|
uint mip_level;
|
||||||
|
uint layer;
|
||||||
|
uint x;
|
||||||
|
uint y;
|
||||||
|
uint z;
|
||||||
|
uint w;
|
||||||
|
uint h;
|
||||||
|
uint d;
|
||||||
|
}
|
||||||
|
|
||||||
|
struct GPUBlitRegion {
|
||||||
|
GPUTexture* texture;
|
||||||
|
uint mip_level;
|
||||||
|
uint layer_or_depth_plane;
|
||||||
|
uint x;
|
||||||
|
uint y;
|
||||||
|
uint w;
|
||||||
|
uint h;
|
||||||
|
}
|
||||||
|
|
||||||
|
struct GPUBufferLocation {
|
||||||
|
GPUBuffer* buffer;
|
||||||
|
uint offset;
|
||||||
|
}
|
||||||
|
|
||||||
|
struct GPUBufferRegion {
|
||||||
|
GPUBuffer* buffer;
|
||||||
|
uint offset;
|
||||||
|
uint size;
|
||||||
|
}
|
||||||
|
|
||||||
|
struct GPUIndirectDrawCommand {
|
||||||
|
uint num_vertices;
|
||||||
|
uint num_instances;
|
||||||
|
uint first_vertex;
|
||||||
|
uint first_instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
struct GPUIndexedIndirectDrawCommand {
|
||||||
|
uint num_indices;
|
||||||
|
uint num_instances;
|
||||||
|
uint first_index;
|
||||||
|
int vertex_offset;
|
||||||
|
uint first_instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
struct GPUIndirectDispatchCommand {
|
||||||
|
uint groupcount_x;
|
||||||
|
uint groupcount_y;
|
||||||
|
uint groupcount_z;
|
||||||
|
}
|
||||||
|
|
||||||
|
struct GPUSamplerCreateInfo {
|
||||||
|
GPUFilter min_filter;
|
||||||
|
GPUFilter mag_filter;
|
||||||
|
GPUSamplerMipmapMode mipmap_mode;
|
||||||
|
GPUSamplerAddressMode address_mode_u;
|
||||||
|
GPUSamplerAddressMode address_mode_v;
|
||||||
|
GPUSamplerAddressMode address_mode_w;
|
||||||
|
float mip_lod_bias;
|
||||||
|
float max_anisotropy;
|
||||||
|
GPUCompareOp compare_op;
|
||||||
|
float min_lod;
|
||||||
|
float max_lod;
|
||||||
|
bool enable_anisotropy;
|
||||||
|
bool enable_compare;
|
||||||
|
char padding1;
|
||||||
|
char padding2;
|
||||||
|
PropertiesID props;
|
||||||
|
}
|
||||||
|
|
||||||
|
struct GPUVertexBufferDescription {
|
||||||
|
uint slot;
|
||||||
|
uint pitch;
|
||||||
|
GPUVertexInputRate input_rate;
|
||||||
|
uint instance_step_rate;
|
||||||
|
}
|
||||||
|
|
||||||
|
struct GPUVertexAttribute {
|
||||||
|
uint location;
|
||||||
|
uint buffer_slot;
|
||||||
|
GPUVertexElementFormat format;
|
||||||
|
uint offset;
|
||||||
|
}
|
||||||
|
|
||||||
|
struct GPUVertexInputState {
|
||||||
|
GPUVertexBufferDescription* vertex_buffer_descriptions;
|
||||||
|
uint num_vertex_buffers;
|
||||||
|
GPUVertexAttribute* vertex_attributes;
|
||||||
|
uint num_vertex_attributes;
|
||||||
|
}
|
||||||
|
|
||||||
|
struct GPUStencilOpState {
|
||||||
|
GPUStencilOp fail_op;
|
||||||
|
GPUStencilOp pass_op;
|
||||||
|
GPUStencilOp depth_fail_op;
|
||||||
|
GPUCompareOp compare_op;
|
||||||
|
}
|
||||||
|
|
||||||
|
struct GPUColorTargetBlendState {
|
||||||
|
GPUBlendFactor src_color_blendfactor;
|
||||||
|
GPUBlendFactor dst_color_blendfactor;
|
||||||
|
GPUBlendOp color_blend_op;
|
||||||
|
GPUBlendFactor src_alpha_blendfactor;
|
||||||
|
GPUBlendFactor dst_alpha_blendfactor;
|
||||||
|
GPUBlendOp alpha_blend_op;
|
||||||
|
GPUColorComponentFlags color_write_mask;
|
||||||
|
bool enable_blend;
|
||||||
|
bool enable_color_write_mask;
|
||||||
|
char padding1;
|
||||||
|
char padding2;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
struct GPUShaderCreateInfo {
|
||||||
|
isz code_size;
|
||||||
|
char* code;
|
||||||
|
ZString entrypoint;
|
||||||
|
GPUShaderFormat format;
|
||||||
|
GPUShaderStage stage;
|
||||||
|
uint num_samplers;
|
||||||
|
uint num_storage_textures;
|
||||||
|
uint num_storage_buffers;
|
||||||
|
uint num_uniform_buffers;
|
||||||
|
PropertiesID props;
|
||||||
|
}
|
||||||
|
|
||||||
|
struct GPUTextureCreateInfo {
|
||||||
|
GPUTextureType type;
|
||||||
|
GPUTextureFormat format;
|
||||||
|
GPUTextureUsageFlags usage;
|
||||||
|
uint width;
|
||||||
|
uint height;
|
||||||
|
uint layer_count_or_depth;
|
||||||
|
uint num_levels;
|
||||||
|
GPUSampleCount sample_count;
|
||||||
|
PropertiesID props;
|
||||||
|
}
|
||||||
|
|
||||||
|
struct GPUBufferCreateInfo {
|
||||||
|
GPUBufferUsageFlags usage;
|
||||||
|
uint size;
|
||||||
|
PropertiesID props;
|
||||||
|
}
|
||||||
|
|
||||||
|
struct GPUTransferBufferCreateInfo {
|
||||||
|
GPUTransferBufferUsage usage;
|
||||||
|
uint size;
|
||||||
|
PropertiesID props;
|
||||||
|
}
|
||||||
|
|
||||||
|
struct GPURasterizerState {
|
||||||
|
GPUFillMode fill_mode;
|
||||||
|
GPUCullMode cull_mode;
|
||||||
|
GPUFrontFace front_face;
|
||||||
|
float depth_bias_constant_factor;
|
||||||
|
float depth_bias_clamp;
|
||||||
|
float depth_bias_slope_factor;
|
||||||
|
bool enable_depth_bias;
|
||||||
|
bool enable_depth_clip;
|
||||||
|
char padding1;
|
||||||
|
char padding2;
|
||||||
|
}
|
||||||
|
|
||||||
|
struct GPUMultisampleState {
|
||||||
|
GPUSampleCount sample_count;
|
||||||
|
uint sample_mask;
|
||||||
|
bool enable_mask;
|
||||||
|
char padding1;
|
||||||
|
char padding2;
|
||||||
|
char padding3;
|
||||||
|
}
|
||||||
|
|
||||||
|
struct GPUDepthStencilState {
|
||||||
|
GPUCompareOp compare_op;
|
||||||
|
GPUStencilOpState back_stencil_state;
|
||||||
|
GPUStencilOpState front_stencil_state;
|
||||||
|
char compare_mask;
|
||||||
|
char write_mask;
|
||||||
|
bool enable_depth_test;
|
||||||
|
bool enable_depth_write;
|
||||||
|
bool enable_stencil_test;
|
||||||
|
char padding1;
|
||||||
|
char padding2;
|
||||||
|
char padding3;
|
||||||
|
}
|
||||||
|
|
||||||
|
struct GPUColorTargetDescription {
|
||||||
|
GPUTextureFormat format;
|
||||||
|
GPUColorTargetBlendState blend_state;
|
||||||
|
}
|
||||||
|
|
||||||
|
struct GPUGraphicsPipelineTargetInfo {
|
||||||
|
GPUColorTargetDescription* color_target_descriptions;
|
||||||
|
uint num_color_targets;
|
||||||
|
GPUTextureFormat depth_stencil_format;
|
||||||
|
bool has_depth_stencil_target;
|
||||||
|
char padding1;
|
||||||
|
char padding2;
|
||||||
|
char padding3;
|
||||||
|
}
|
||||||
|
|
||||||
|
struct GPUGraphicsPipelineCreateInfo {
|
||||||
|
GPUShader* vertex_shader;
|
||||||
|
GPUShader* fragment_shader;
|
||||||
|
GPUVertexInputState vertex_input_state;
|
||||||
|
GPUPrimitiveType primitive_type;
|
||||||
|
GPURasterizerState rasterizer_state;
|
||||||
|
GPUMultisampleState multisample_state;
|
||||||
|
GPUDepthStencilState depth_stencil_state;
|
||||||
|
GPUGraphicsPipelineTargetInfo target_info;
|
||||||
|
PropertiesID props;
|
||||||
|
}
|
||||||
|
|
||||||
|
struct GPUComputePipelineCreateInfo {
|
||||||
|
isz code_size;
|
||||||
|
char* code;
|
||||||
|
char* entrypoint;
|
||||||
|
GPUShaderFormat format;
|
||||||
|
uint num_samplers;
|
||||||
|
uint num_readonly_storage_textures;
|
||||||
|
uint num_readonly_storage_buffers;
|
||||||
|
uint num_readwrite_storage_textures;
|
||||||
|
uint num_readwrite_storage_buffers;
|
||||||
|
uint num_uniform_buffers;
|
||||||
|
uint threadcount_x;
|
||||||
|
uint threadcount_y;
|
||||||
|
uint threadcount_z;
|
||||||
|
PropertiesID props;
|
||||||
|
}
|
||||||
|
|
||||||
|
struct GPUColorTargetInfo {
|
||||||
|
GPUTexture* texture;
|
||||||
|
uint mip_level;
|
||||||
|
uint layer_or_depth_plane;
|
||||||
|
FColor clear_color;
|
||||||
|
GPULoadOp load_op;
|
||||||
|
GPUStoreOp store_op;
|
||||||
|
GPUTexture *resolve_texture;
|
||||||
|
uint resolve_mip_level;
|
||||||
|
uint resolve_layer;
|
||||||
|
bool cycle;
|
||||||
|
bool cycle_resolve_texture;
|
||||||
|
char padding1;
|
||||||
|
char padding2;
|
||||||
|
}
|
||||||
|
|
||||||
|
struct GPUDepthStencilTargetInfo {
|
||||||
|
GPUTexture* texture;
|
||||||
|
float clear_depth;
|
||||||
|
GPULoadOp load_op;
|
||||||
|
GPUStoreOp store_op;
|
||||||
|
GPULoadOp stencil_load_op;
|
||||||
|
GPUStoreOp stencil_store_op;
|
||||||
|
bool cycle;
|
||||||
|
char clear_stencil;
|
||||||
|
char padding1;
|
||||||
|
char padding2;
|
||||||
|
}
|
||||||
|
|
||||||
|
struct GPUBlitInfo {
|
||||||
|
GPUBlitRegion source;
|
||||||
|
GPUBlitRegion destination;
|
||||||
|
GPULoadOp load_op;
|
||||||
|
FColor clear_color;
|
||||||
|
FlipMode flip_mode;
|
||||||
|
GPUFilter filter;
|
||||||
|
bool cycle;
|
||||||
|
char padding1;
|
||||||
|
char padding2;
|
||||||
|
char padding3;
|
||||||
|
}
|
||||||
|
|
||||||
|
struct GPUBufferBinding {
|
||||||
|
GPUBuffer* buffer;
|
||||||
|
uint offset;
|
||||||
|
}
|
||||||
|
|
||||||
|
struct GPUTextureSamplerBinding {
|
||||||
|
GPUTexture* texture;
|
||||||
|
GPUSampler* sampler;
|
||||||
|
}
|
||||||
|
|
||||||
|
struct SDL_GPUStorageBufferReadWriteBinding {
|
||||||
|
GPUBuffer* buffer;
|
||||||
|
bool cycle;
|
||||||
|
char padding1;
|
||||||
|
char padding2;
|
||||||
|
char padding3;
|
||||||
|
}
|
||||||
|
|
||||||
|
struct GPUStorageTextureReadWriteBinding {
|
||||||
|
GPUTexture* texture;
|
||||||
|
uint mip_level;
|
||||||
|
uint layer;
|
||||||
|
bool cycle;
|
||||||
|
char padding1;
|
||||||
|
char padding2;
|
||||||
|
char padding3;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* --------- */
|
||||||
|
/* Functions */
|
||||||
|
/* --------- */
|
||||||
|
|
||||||
|
const ZString PROP_GPU_DEVICE_CREATE_DEBUGMODE_BOOLEAN = "SDL.gpu.device.create.debugmode";
|
||||||
|
const ZString PROP_GPU_DEVICE_CREATE_PREFERLOWPOWER_BOOLEAN = "SDL.gpu.device.create.preferlowpower";
|
||||||
|
const ZString PROP_GPU_DEVICE_CREATE_NAME_STRING = "SDL.gpu.device.create.name";
|
||||||
|
const ZString PROP_GPU_DEVICE_CREATE_SHADERS_PRIVATE_BOOLEAN = "SDL.gpu.device.create.shaders.private";
|
||||||
|
const ZString PROP_GPU_DEVICE_CREATE_SHADERS_SPIRV_BOOLEAN = "SDL.gpu.device.create.shaders.spirv";
|
||||||
|
const ZString PROP_GPU_DEVICE_CREATE_SHADERS_DXBC_BOOLEAN = "SDL.gpu.device.create.shaders.dxbc";
|
||||||
|
const ZString PROP_GPU_DEVICE_CREATE_SHADERS_DXIL_BOOLEAN = "SDL.gpu.device.create.shaders.dxil";
|
||||||
|
const ZString PROP_GPU_DEVICE_CREATE_SHADERS_MSL_BOOLEAN = "SDL.gpu.device.create.shaders.msl";
|
||||||
|
const ZString PROP_GPU_DEVICE_CREATE_SHADERS_METALLIB_BOOLEAN = "SDL.gpu.device.create.shaders.metallib";
|
||||||
|
const ZString PROP_GPU_DEVICE_CREATE_D3D12_SEMANTIC_NAME_STRING = "SDL.gpu.device.create.d3d12.semantic";
|
||||||
|
const ZString PROP_GPU_COMPUTEPIPELINE_CREATE_NAME_STRING = "SDL.gpu.computepipeline.create.name";
|
||||||
|
const ZString PROP_GPU_GRAPHICSPIPELINE_CREATE_NAME_STRING = "SDL.gpu.graphicspipeline.create.name";
|
||||||
|
const ZString PROP_GPU_SAMPLER_CREATE_NAME_STRING = "SDL.gpu.sampler.create.name";
|
||||||
|
const ZString PROP_GPU_SHADER_CREATE_NAME_STRING = "SDL.gpu.shader.create.name";
|
||||||
|
const ZString PROP_GPU_TEXTURE_CREATE_D3D12_CLEAR_R_FLOAT = "SDL.gpu.texture.create.d3d12.clear.r";
|
||||||
|
const ZString PROP_GPU_TEXTURE_CREATE_D3D12_CLEAR_G_FLOAT = "SDL.gpu.texture.create.d3d12.clear.g";
|
||||||
|
const ZString PROP_GPU_TEXTURE_CREATE_D3D12_CLEAR_B_FLOAT = "SDL.gpu.texture.create.d3d12.clear.b";
|
||||||
|
const ZString PROP_GPU_TEXTURE_CREATE_D3D12_CLEAR_A_FLOAT = "SDL.gpu.texture.create.d3d12.clear.a";
|
||||||
|
const ZString PROP_GPU_TEXTURE_CREATE_D3D12_CLEAR_DEPTH_FLOAT = "SDL.gpu.texture.create.d3d12.clear.depth";
|
||||||
|
const ZString PROP_GPU_TEXTURE_CREATE_D3D12_CLEAR_STENCIL_NUMBER = "SDL.gpu.texture.create.d3d12.clear.stencil";
|
||||||
|
const ZString PROP_GPU_TEXTURE_CREATE_NAME_STRING = "SDL.gpu.texture.create.name";
|
||||||
|
const ZString PROP_GPU_BUFFER_CREATE_NAME_STRING = "SDL.gpu.buffer.create.name";
|
||||||
|
const ZString PROP_GPU_TRANSFERBUFFER_CREATE_NAME_STRING = "SDL.gpu.transferbuffer.create.name";
|
||||||
|
|
||||||
|
|
||||||
|
extern fn bool gpu_supports_shader_formats(GPUShaderFormat format_flags, ZString name) @extern("SDL_GPUSupportsShaderFormats");
|
||||||
|
extern fn bool gpu_supports_properties(PropertiesID props) @extern("SDL_GPUSupportsProperties");
|
||||||
|
extern fn GPUDevice* create_gpu_device(GPUShaderFormat format_flags, bool debug_mode, ZString name) @extern("SDL_CreateGPUDevice");
|
||||||
|
extern fn GPUDevice* create_gpu_device_with_properties(PropertiesID props) @extern("SDL_CreateGPUDeviceWithProperties");
|
||||||
|
extern fn void destroy_gpu_device(GPUDevice* device) @extern("SDL_DestroyGPUDevice");
|
||||||
|
extern fn int get_num_gpu_drivers() @extern("SDL_GetNumGPUDrivers");
|
||||||
|
extern fn ZString get_gpu_driver(int index) @extern("SDL_GetGPUDriver");
|
||||||
|
extern fn ZString get_gpu_device_driver(GPUDevice* device) @extern("SDL_GetGPUDeviceDriver");
|
||||||
|
extern fn GPUShaderFormat get_gpu_shader_formats(GPUDevice* device) @extern("SDL_GetGPUShaderFormats");
|
||||||
|
extern fn GPUComputePipeline* create_gpu_compute_pipeline(GPUDevice* device, GPUComputePipelineCreateInfo* createinfo) @extern("SDL_CreateGPUComputePipeline");
|
||||||
|
extern fn GPUGraphicsPipeline* create_gpu_graphics_pipeline(GPUDevice* device, GPUGraphicsPipelineCreateInfo* createinfo) @extern("SDL_CreateGPUGraphicsPipeline");
|
||||||
|
extern fn GPUSampler* create_gpu_sampler(GPUDevice* device, GPUSamplerCreateInfo* createinfo) @extern("SDL_CreateGPUSampler");
|
||||||
|
extern fn GPUShader* create_gpu_shader(GPUDevice* device, GPUShaderCreateInfo* createinfo) @extern("SDL_CreateGPUShader");
|
||||||
|
extern fn GPUTexture* create_gpu_texture(GPUDevice* device, GPUTextureCreateInfo* createinfo) @extern("SDL_CreateGPUTexture");
|
||||||
|
extern fn GPUBuffer* create_gpu_buffer(GPUDevice* device, GPUBufferCreateInfo* createinfo) @extern("SDL_CreateGPUBuffer");
|
||||||
|
extern fn GPUTransferBuffer* create_gpu_transfer_buffer(GPUDevice* device, GPUTransferBufferCreateInfo *createinfo) @extern("SDL_CreateGPUTransferBuffer");
|
||||||
|
extern fn void set_gpu_buffer_name(GPUDevice* device, GPUBuffer* buffer, ZString text) @extern("SDL_SetGPUBufferName");
|
||||||
|
extern fn void set_gpu_texture_name(GPUDevice* device, GPUTexture* texture, ZString text) @extern("SDL_SetGPUTextureName");
|
||||||
|
extern fn void insert_gpu_debug_label(GPUCommandBuffer* command_buffer, ZString text) @extern("SDL_InsertGPUDebugLabel");
|
||||||
|
extern fn void push_gpu_debug_group(GPUCommandBuffer* command_buffer, ZString name) @extern("SDL_PushGPUDebugGroup");
|
||||||
|
extern fn void pop_gpu_debug_group(GPUCommandBuffer* command_buffer) @extern("SDL_PopGPUDebugGroup");
|
||||||
|
extern fn void release_gpu_texture(GPUDevice* device, GPUTexture* texture) @extern("SDL_ReleaseGPUTexture");
|
||||||
|
extern fn void release_gpu_sampler(GPUDevice* device, GPUSampler* sampler) @extern("SDL_ReleaseGPUSampler");
|
||||||
|
extern fn void release_gpu_buffer(GPUDevice* device, GPUBuffer* buffer) @extern("SDL_ReleaseGPUBuffer");
|
||||||
|
extern fn void release_gpu_transfer_buffer(GPUDevice* device, GPUTransferBuffer* transfer_buffer) @extern("SDL_ReleaseGPUTransferBuffer");
|
||||||
|
extern fn void release_gpu_compute_pipeline(GPUDevice* device, GPUComputePipeline* compute_pipeline) @extern("SDL_ReleaseGPUComputePipeline");
|
||||||
|
extern fn void release_gpu_shader(GPUDevice* device, GPUShader* shader) @extern("SDL_ReleaseGPUShader");
|
||||||
|
extern fn void release_gpu_graphics_pipeline(GPUDevice* device, GPUGraphicsPipeline* graphics_pipeline) @extern("SDL_ReleaseGPUGraphicsPipeline");
|
||||||
|
extern fn GPUCommandBuffer* acquire_gpu_command_buffer(GPUDevice* device) @extern("SDL_AcquireGPUCommandBuffer");
|
||||||
|
extern fn void push_gpu_vertex_uniform_data(GPUCommandBuffer* command_buffer, uint slot_index, void* data, uint length) @extern("SDL_PushGPUVertexUniformData");
|
||||||
|
extern fn void push_gpu_fragment_uniform_data(GPUCommandBuffer* command_buffer, uint slot_index, void* data, uint length) @extern("SDL_PushGPUFragmentUniformData");
|
||||||
|
extern fn void push_gpu_compute_uniform_data(GPUCommandBuffer* command_buffer, uint slot_index, void* data, uint length) @extern("SDL_PushGPUComputeUniformData");
|
||||||
|
extern fn GPURenderPass* begin_gpu_render_pass(GPUCommandBuffer* command_buffer, GPUColorTargetInfo* color_target_infos, uint num_color_targets, GPUDepthStencilTargetInfo* depth_stencil_target_info) @extern("SDL_BeginGPURenderPass");
|
||||||
|
extern fn void bind_gpu_graphics_pipeline(GPURenderPass* render_pass, GPUGraphicsPipeline* graphics_pipeline) @extern("SDL_BindGPUGraphicsPipeline");
|
||||||
|
extern fn void set_gpu_viewport(GPURenderPass* render_pass, GPUViewport* viewport) @extern("SDL_SetGPUViewport");
|
||||||
|
extern fn void set_gpu_scissor(GPURenderPass* render_pass, Rect* scissor) @extern("SDL_SetGPUScissor");
|
||||||
|
extern fn void set_gpu_blend_constants(GPURenderPass* render_pass, FColor blend_constants) @extern("SDL_SetGPUBlendConstants");
|
||||||
|
extern fn void set_gpu_stencil_reference(GPURenderPass* render_pass, char reference) @extern("SDL_SetGPUStencilReference");
|
||||||
|
extern fn void bind_gpu_vertex_buffers(GPURenderPass* render_pass, uint first_slot, GPUBufferBinding* bindings, uint num_bindings) @extern("SDL_BindGPUVertexBuffers");
|
||||||
|
extern fn void bind_gpu_index_buffer(GPURenderPass* render_pass, GPUBufferBinding* binding, GPUIndexElementSize index_element_size) @extern("SDL_BindGPUIndexBuffer");
|
||||||
|
extern fn void bind_gpu_vertex_samplers(GPURenderPass* render_pass, uint first_slot, GPUTextureSamplerBinding* texture_sampler_bindings, uint num_bindings) @extern("SDL_BindGPUVertexSamplers");
|
||||||
|
extern fn void bind_gpu_vertex_storage_textures(GPURenderPass* render_pass, uint first_slot,GPUTexture* *storage_textures, uint num_bindings) @extern("SDL_BindGPUVertexStorageTextures");
|
||||||
|
extern fn void bind_gpu_vertex_storage_buffers(GPURenderPass* render_pass, uint first_slot,GPUBuffer* *storage_buffers, uint num_bindings) @extern("SDL_BindGPUVertexStorageBuffers");
|
||||||
|
extern fn void bind_gpu_fragment_samplers(GPURenderPass* render_pass, uint first_slot, GPUTextureSamplerBinding* texture_sampler_bindings, uint num_bindings) @extern("SDL_BindGPUFragmentSamplers");
|
||||||
|
extern fn void bind_gpu_fragment_storage_textures(GPURenderPass* render_pass, uint first_slot,GPUTexture* *storage_textures, uint num_bindings) @extern("SDL_BindGPUFragmentStorageTextures");
|
||||||
|
extern fn void bind_gpu_fragment_storage_buffers(GPURenderPass* render_pass, uint first_slot,GPUBuffer* *storage_buffers, uint num_bindings) @extern("SDL_BindGPUFragmentStorageBuffers");
|
||||||
|
extern fn void draw_gpu_indexed_primitives(GPURenderPass* render_pass, uint num_indices, uint num_instances, uint first_index, int vertex_offset, uint first_instance) @extern("SDL_DrawGPUIndexedPrimitives");
|
||||||
|
extern fn void draw_gpu_primitives(GPURenderPass* render_pass, uint num_vertices, uint num_instances, uint first_vertex, uint first_instance) @extern("SDL_DrawGPUPrimitives");
|
||||||
|
extern fn void draw_gpu_primitives_indirect(GPURenderPass* render_pass,GPUBuffer* buffer, uint offset, uint draw_count) @extern("SDL_DrawGPUPrimitivesIndirect");
|
||||||
|
extern fn void draw_gpu_indexed_primitives_indirect(GPURenderPass* render_pass,GPUBuffer* buffer, uint offset, uint draw_count) @extern("SDL_DrawGPUIndexedPrimitivesIndirect");
|
||||||
|
extern fn void end_gpu_render_pass(GPURenderPass* render_pass) @extern("SDL_EndGPURenderPass");
|
||||||
|
extern fn GPUComputePass* begin_gpu_compute_pass(GPUCommandBuffer* command_buffer, GPUStorageTextureReadWriteBinding* storage_texture_bindings, uint num_storage_texture_bindings, SDL_GPUStorageBufferReadWriteBinding *storage_buffer_bindings, uint num_storage_buffer_bindings) @extern("SDL_BeginGPUComputePass");
|
||||||
|
extern fn void bind_gpu_compute_pipeline(GPUComputePass* compute_pass, GPUComputePipeline* compute_pipeline) @extern("SDL_BindGPUComputePipeline");
|
||||||
|
extern fn void bind_gpu_compute_samplers(GPUComputePass* compute_pass, uint first_slot, GPUTextureSamplerBinding* texture_sampler_bindings, uint num_bindings) @extern("SDL_BindGPUComputeSamplers");
|
||||||
|
extern fn void bind_gpu_compute_storage_textures(GPUComputePass* compute_pass, uint first_slot, GPUTexture* *storage_textures, uint num_bindings) @extern("SDL_BindGPUComputeStorageTextures");
|
||||||
|
extern fn void bind_gpu_compute_storage_buffers(GPUComputePass* compute_pass, uint first_slot, GPUBuffer* *storage_buffers, uint num_bindings) @extern("SDL_BindGPUComputeStorageBuffers");
|
||||||
|
extern fn void dispatch_gpu_compute(GPUComputePass* compute_pass, uint groupcount_x, uint groupcount_y, uint groupcount_z) @extern("SDL_DispatchGPUCompute");
|
||||||
|
extern fn void dispatch_gpu_compute_indirect(GPUComputePass* compute_pass, GPUBuffer* buffer, uint offset) @extern("SDL_DispatchGPUComputeIndirect");
|
||||||
|
extern fn void end_gpu_compute_pass(GPUComputePass* compute_pass) @extern("SDL_EndGPUComputePass");
|
||||||
|
extern fn void* map_gpu_transfer_buffer(GPUDevice* device, GPUTransferBuffer* transfer_buffer,bool cycle) @extern("SDL_MapGPUTransferBuffer");
|
||||||
|
extern fn void unmap_gpu_transfer_buffer(GPUDevice* device, GPUTransferBuffer* transfer_buffer) @extern("SDL_UnmapGPUTransferBuffer");
|
||||||
|
extern fn GPUCopyPass* begin_gpu_copy_pass(GPUCommandBuffer* command_buffer) @extern("SDL_BeginGPUCopyPass");
|
||||||
|
extern fn void upload_to_gpu_texture(GPUCopyPass* copy_pass, GPUTextureTransferInfo* source, GPUTextureRegion* destination,bool cycle) @extern("SDL_UploadToGPUTexture");
|
||||||
|
extern fn void upload_to_gpu_buffer(GPUCopyPass* copy_pass, GPUTransferBufferLocation* source, GPUBufferRegion* destination,bool cycle) @extern("SDL_UploadToGPUBuffer");
|
||||||
|
extern fn void copy_gpu_texture_to_texture(GPUCopyPass* copy_pass, GPUTextureLocation* source, GPUTextureLocation* destination, uint w, uint h, uint d,bool cycle) @extern("SDL_CopyGPUTextureToTexture");
|
||||||
|
extern fn void copy_gpu_buffer_to_buffer(GPUCopyPass* copy_pass, GPUBufferLocation* source, GPUBufferLocation* destination, uint size,bool cycle) @extern("SDL_CopyGPUBufferToBuffer");
|
||||||
|
extern fn void download_from_gpu_texture(GPUCopyPass* copy_pass, GPUTextureRegion* source, GPUTextureTransferInfo* destination) @extern("SDL_DownloadFromGPUTexture");
|
||||||
|
extern fn void download_from_gpu_buffer(GPUCopyPass* copy_pass, GPUBufferRegion* source, GPUTransferBufferLocation* destination) @extern("SDL_DownloadFromGPUBuffer");
|
||||||
|
extern fn void end_gpu_copy_pass(GPUCopyPass* copy_pass) @extern("SDL_EndGPUCopyPass");
|
||||||
|
extern fn void generate_mipmaps_for_gpu_texture(GPUCommandBuffer* command_buffer,GPUTexture* texture) @extern("SDL_GenerateMipmapsForGPUTexture");
|
||||||
|
extern fn void blit_gpu_texture(GPUCommandBuffer* command_buffer, GPUBlitInfo* info) @extern("SDL_BlitGPUTexture");
|
||||||
|
extern fn bool window_supports_gpu_swapchain_composition(GPUDevice* device, Window* window, GPUSwapchainComposition swapchain_composition) @extern("SDL_WindowSupportsGPUSwapchainComposition");
|
||||||
|
extern fn bool window_supports_gpu_present_mode(GPUDevice* device, Window* window, GPUPresentMode present_mode) @extern("SDL_WindowSupportsGPUPresentMode");
|
||||||
|
extern fn bool claim_window_for_gpu_device(GPUDevice* device, Window* window) @extern("SDL_ClaimWindowForGPUDevice");
|
||||||
|
extern fn void release_window_from_gpu_device(GPUDevice* device, Window* window) @extern("SDL_ReleaseWindowFromGPUDevice");
|
||||||
|
extern fn bool set_gpu_swapchain_parameters(GPUDevice* device, Window* window, GPUSwapchainComposition swapchain_composition, GPUPresentMode present_mode) @extern("SDL_SetGPUSwapchainParameters");
|
||||||
|
extern fn bool set_gpu_allowed_frames_in_flight(GPUDevice* device, uint allowed_frames_in_flight) @extern("SDL_SetGPUAllowedFramesInFlight");
|
||||||
|
extern fn GPUTextureFormat get_gpu_swapchain_texture_format(GPUDevice* device, Window* window) @extern("SDL_GetGPUSwapchainTextureFormat");
|
||||||
|
extern fn bool acquire_gpu_swapchain_texture(GPUCommandBuffer* command_buffer,Window* window,GPUTexture* *swapchain_texture, uint *swapchain_texture_width, uint *swapchain_texture_height) @extern("SDL_AcquireGPUSwapchainTexture");
|
||||||
|
extern fn bool wait_for_gpu_swapchain(GPUDevice* device, Window* window) @extern("SDL_WaitForGPUSwapchain");
|
||||||
|
extern fn bool wait_and_acquire_gpu_swapchain_texture(GPUCommandBuffer* command_buffer,Window* window,GPUTexture* *swapchain_texture, uint *swapchain_texture_width, uint *swapchain_texture_height) @extern("SDL_WaitAndAcquireGPUSwapchainTexture");
|
||||||
|
extern fn bool submit_gpu_command_buffer(GPUCommandBuffer* command_buffer) @extern("SDL_SubmitGPUCommandBuffer");
|
||||||
|
extern fn GPUFence* submit_gpu_command_buffer_and_acquire_fence(GPUCommandBuffer* command_buffer) @extern("SDL_SubmitGPUCommandBufferAndAcquireFence");
|
||||||
|
extern fn bool cancel_gpu_command_buffer(GPUCommandBuffer* command_buffer) @extern("SDL_CancelGPUCommandBuffer");
|
||||||
|
extern fn bool wait_for_gpu_idle(GPUDevice* device) @extern("SDL_WaitForGPUIdle");
|
||||||
|
extern fn bool wait_for_gpu_fences(GPUDevice* device, bool wait_all,GPUFence* *fences, uint num_fences) @extern("SDL_WaitForGPUFences");
|
||||||
|
extern fn bool query_gpu_fence(GPUDevice* device, GPUFence* fence) @extern("SDL_QueryGPUFence");
|
||||||
|
extern fn void release_gpu_fence(GPUDevice* device, GPUFence* fence) @extern("SDL_ReleaseGPUFence");
|
||||||
|
extern fn uint gpu_texture_format_texel_block_size(GPUTextureFormat format) @extern("GPUTextureFormatTexelBlockSize");
|
||||||
|
extern fn bool gpu_texture_supports_format(GPUDevice* device, GPUTextureFormat format, GPUTextureType type, GPUTextureUsageFlags usage) @extern("SDL_GPUTextureSupportsFormat");
|
||||||
|
extern fn bool gpu_texture_supports_sample_count(GPUDevice* device, GPUTextureFormat format, GPUSampleCount sample_count) @extern("SDL_GPUTextureSupportsSampleCount");
|
||||||
|
extern fn uint calculate_gpu_texture_format_size(GPUTextureFormat format, uint width, uint height, uint depth_or_layer_count) @extern("SDL_CalculateGPUTextureFormatSize");
|
||||||
|
|
||||||
|
|
260
sdl3.c3l/sdl3_hints.c3i
Normal file
260
sdl3.c3l/sdl3_hints.c3i
Normal file
@ -0,0 +1,260 @@
|
|||||||
|
|
||||||
|
module sdl3::sdl;
|
||||||
|
|
||||||
|
const ZString HINT_ALLOW_ALT_TAB_WHILE_GRABBED = "SDL_ALLOW_ALT_TAB_WHILE_GRABBED";
|
||||||
|
const ZString HINT_ANDROID_ALLOW_RECREATE_ACTIVITY = "SDL_ANDROID_ALLOW_RECREATE_ACTIVITY";
|
||||||
|
const ZString HINT_ANDROID_BLOCK_ON_PAUSE = "SDL_ANDROID_BLOCK_ON_PAUSE";
|
||||||
|
const ZString HINT_ANDROID_LOW_LATENCY_AUDIO = "SDL_ANDROID_LOW_LATENCY_AUDIO";
|
||||||
|
const ZString HINT_ANDROID_TRAP_BACK_BUTTON = "SDL_ANDROID_TRAP_BACK_BUTTON";
|
||||||
|
const ZString HINT_APP_ID = "SDL_APP_ID";
|
||||||
|
const ZString HINT_APP_NAME = "SDL_APP_NAME";
|
||||||
|
const ZString HINT_APPLE_TV_CONTROLLER_UI_EVENTS = "SDL_APPLE_TV_CONTROLLER_UI_EVENTS";
|
||||||
|
const ZString HINT_APPLE_TV_REMOTE_ALLOW_ROTATION = "SDL_APPLE_TV_REMOTE_ALLOW_ROTATION";
|
||||||
|
const ZString HINT_AUDIO_ALSA_DEFAULT_DEVICE = "SDL_AUDIO_ALSA_DEFAULT_DEVICE";
|
||||||
|
const ZString HINT_AUDIO_ALSA_DEFAULT_PLAYBACK_DEVICE = "SDL_AUDIO_ALSA_DEFAULT_PLAYBACK_DEVICE";
|
||||||
|
const ZString HINT_AUDIO_ALSA_DEFAULT_RECORDING_DEVICE = "SDL_AUDIO_ALSA_DEFAULT_RECORDING_DEVICE";
|
||||||
|
const ZString HINT_AUDIO_CATEGORY = "SDL_AUDIO_CATEGORY";
|
||||||
|
const ZString HINT_AUDIO_CHANNELS = "SDL_AUDIO_CHANNELS";
|
||||||
|
const ZString HINT_AUDIO_DEVICE_APP_ICON_NAME = "SDL_AUDIO_DEVICE_APP_ICON_NAME";
|
||||||
|
const ZString HINT_AUDIO_DEVICE_SAMPLE_FRAMES = "SDL_AUDIO_DEVICE_SAMPLE_FRAMES";
|
||||||
|
const ZString HINT_AUDIO_DEVICE_STREAM_NAME = "SDL_AUDIO_DEVICE_STREAM_NAME";
|
||||||
|
const ZString HINT_AUDIO_DEVICE_STREAM_ROLE = "SDL_AUDIO_DEVICE_STREAM_ROLE";
|
||||||
|
const ZString HINT_AUDIO_DISK_INPUT_FILE = "SDL_AUDIO_DISK_INPUT_FILE";
|
||||||
|
const ZString HINT_AUDIO_DISK_OUTPUT_FILE = "SDL_AUDIO_DISK_OUTPUT_FILE";
|
||||||
|
const ZString HINT_AUDIO_DISK_TIMESCALE = "SDL_AUDIO_DISK_TIMESCALE";
|
||||||
|
const ZString HINT_AUDIO_DRIVER = "SDL_AUDIO_DRIVER";
|
||||||
|
const ZString HINT_AUDIO_DUMMY_TIMESCALE = "SDL_AUDIO_DUMMY_TIMESCALE";
|
||||||
|
const ZString HINT_AUDIO_FORMAT = "SDL_AUDIO_FORMAT";
|
||||||
|
const ZString HINT_AUDIO_FREQUENCY = "SDL_AUDIO_FREQUENCY";
|
||||||
|
const ZString HINT_AUDIO_INCLUDE_MONITORS = "SDL_AUDIO_INCLUDE_MONITORS";
|
||||||
|
const ZString HINT_AUTO_UPDATE_JOYSTICKS = "SDL_AUTO_UPDATE_JOYSTICKS";
|
||||||
|
const ZString HINT_AUTO_UPDATE_SENSORS = "SDL_AUTO_UPDATE_SENSORS";
|
||||||
|
const ZString HINT_BMP_SAVE_LEGACY_FORMAT = "SDL_BMP_SAVE_LEGACY_FORMAT";
|
||||||
|
const ZString HINT_CAMERA_DRIVER = "SDL_CAMERA_DRIVER";
|
||||||
|
const ZString HINT_CPU_FEATURE_MASK = "SDL_CPU_FEATURE_MASK";
|
||||||
|
const ZString HINT_JOYSTICK_DIRECTINPUT = "SDL_JOYSTICK_DIRECTINPUT";
|
||||||
|
const ZString HINT_FILE_DIALOG_DRIVER = "SDL_FILE_DIALOG_DRIVER";
|
||||||
|
const ZString HINT_DISPLAY_USABLE_BOUNDS = "SDL_DISPLAY_USABLE_BOUNDS";
|
||||||
|
const ZString HINT_EMSCRIPTEN_ASYNCIFY = "SDL_EMSCRIPTEN_ASYNCIFY";
|
||||||
|
const ZString HINT_EMSCRIPTEN_CANVAS_SELECTOR = "SDL_EMSCRIPTEN_CANVAS_SELECTOR";
|
||||||
|
const ZString HINT_EMSCRIPTEN_KEYBOARD_ELEMENT = "SDL_EMSCRIPTEN_KEYBOARD_ELEMENT";
|
||||||
|
const ZString HINT_ENABLE_SCREEN_KEYBOARD = "SDL_ENABLE_SCREEN_KEYBOARD";
|
||||||
|
const ZString HINT_EVDEV_DEVICES = "SDL_EVDEV_DEVICES";
|
||||||
|
const ZString HINT_EVENT_LOGGING = "SDL_EVENT_LOGGING";
|
||||||
|
const ZString HINT_FORCE_RAISEWINDOW = "SDL_FORCE_RAISEWINDOW";
|
||||||
|
const ZString HINT_FRAMEBUFFER_ACCELERATION = "SDL_FRAMEBUFFER_ACCELERATION";
|
||||||
|
const ZString HINT_GAMECONTROLLERCONFIG = "SDL_GAMECONTROLLERCONFIG";
|
||||||
|
const ZString HINT_GAMECONTROLLERCONFIG_FILE = "SDL_GAMECONTROLLERCONFIG_FILE";
|
||||||
|
const ZString HINT_GAMECONTROLLERTYPE = "SDL_GAMECONTROLLERTYPE";
|
||||||
|
const ZString HINT_GAMECONTROLLER_IGNORE_DEVICES = "SDL_GAMECONTROLLER_IGNORE_DEVICES";
|
||||||
|
const ZString HINT_GAMECONTROLLER_IGNORE_DEVICES_EXCEPT = "SDL_GAMECONTROLLER_IGNORE_DEVICES_EXCEPT";
|
||||||
|
const ZString HINT_GAMECONTROLLER_SENSOR_FUSION = "SDL_GAMECONTROLLER_SENSOR_FUSION";
|
||||||
|
const ZString HINT_GDK_TEXTINPUT_DEFAULT_TEXT = "SDL_GDK_TEXTINPUT_DEFAULT_TEXT";
|
||||||
|
const ZString HINT_GDK_TEXTINPUT_DESCRIPTION = "SDL_GDK_TEXTINPUT_DESCRIPTION";
|
||||||
|
const ZString HINT_GDK_TEXTINPUT_MAX_LENGTH = "SDL_GDK_TEXTINPUT_MAX_LENGTH";
|
||||||
|
const ZString HINT_GDK_TEXTINPUT_SCOPE = "SDL_GDK_TEXTINPUT_SCOPE";
|
||||||
|
const ZString HINT_GDK_TEXTINPUT_TITLE = "SDL_GDK_TEXTINPUT_TITLE";
|
||||||
|
const ZString HINT_HIDAPI_LIBUSB = "SDL_HIDAPI_LIBUSB";
|
||||||
|
const ZString HINT_HIDAPI_LIBUSB_WHITELIST = "SDL_HIDAPI_LIBUSB_WHITELIST";
|
||||||
|
const ZString HINT_HIDAPI_UDEV = "SDL_HIDAPI_UDEV";
|
||||||
|
const ZString HINT_GPU_DRIVER = "SDL_GPU_DRIVER";
|
||||||
|
const ZString HINT_HIDAPI_ENUMERATE_ONLY_CONTROLLERS = "SDL_HIDAPI_ENUMERATE_ONLY_CONTROLLERS";
|
||||||
|
const ZString HINT_HIDAPI_IGNORE_DEVICES = "SDL_HIDAPI_IGNORE_DEVICES";
|
||||||
|
const ZString HINT_IME_IMPLEMENTED_UI = "SDL_IME_IMPLEMENTED_UI";
|
||||||
|
const ZString HINT_IOS_HIDE_HOME_INDICATOR = "SDL_IOS_HIDE_HOME_INDICATOR";
|
||||||
|
const ZString HINT_JOYSTICK_ALLOW_BACKGROUND_EVENTS = "SDL_JOYSTICK_ALLOW_BACKGROUND_EVENTS";
|
||||||
|
const ZString HINT_JOYSTICK_ARCADESTICK_DEVICES = "SDL_JOYSTICK_ARCADESTICK_DEVICES";
|
||||||
|
const ZString HINT_JOYSTICK_ARCADESTICK_DEVICES_EXCLUDED = "SDL_JOYSTICK_ARCADESTICK_DEVICES_EXCLUDED";
|
||||||
|
const ZString HINT_JOYSTICK_BLACKLIST_DEVICES = "SDL_JOYSTICK_BLACKLIST_DEVICES";
|
||||||
|
const ZString HINT_JOYSTICK_BLACKLIST_DEVICES_EXCLUDED = "SDL_JOYSTICK_BLACKLIST_DEVICES_EXCLUDED";
|
||||||
|
const ZString HINT_JOYSTICK_DEVICE = "SDL_JOYSTICK_DEVICE";
|
||||||
|
const ZString HINT_JOYSTICK_ENHANCED_REPORTS = "SDL_JOYSTICK_ENHANCED_REPORTS";
|
||||||
|
const ZString HINT_JOYSTICK_FLIGHTSTICK_DEVICES = "SDL_JOYSTICK_FLIGHTSTICK_DEVICES";
|
||||||
|
const ZString HINT_JOYSTICK_FLIGHTSTICK_DEVICES_EXCLUDED = "SDL_JOYSTICK_FLIGHTSTICK_DEVICES_EXCLUDED";
|
||||||
|
const ZString HINT_JOYSTICK_GAMEINPUT = "SDL_JOYSTICK_GAMEINPUT";
|
||||||
|
const ZString HINT_JOYSTICK_GAMECUBE_DEVICES = "SDL_JOYSTICK_GAMECUBE_DEVICES";
|
||||||
|
const ZString HINT_JOYSTICK_GAMECUBE_DEVICES_EXCLUDED = "SDL_JOYSTICK_GAMECUBE_DEVICES_EXCLUDED";
|
||||||
|
const ZString HINT_JOYSTICK_HIDAPI = "SDL_JOYSTICK_HIDAPI";
|
||||||
|
const ZString HINT_JOYSTICK_HIDAPI_COMBINE_JOY_CONS = "SDL_JOYSTICK_HIDAPI_COMBINE_JOY_CONS";
|
||||||
|
const ZString HINT_JOYSTICK_HIDAPI_GAMECUBE = "SDL_JOYSTICK_HIDAPI_GAMECUBE";
|
||||||
|
const ZString HINT_JOYSTICK_HIDAPI_GAMECUBE_RUMBLE_BRAKE = "SDL_JOYSTICK_HIDAPI_GAMECUBE_RUMBLE_BRAKE";
|
||||||
|
const ZString HINT_JOYSTICK_HIDAPI_JOY_CONS = "SDL_JOYSTICK_HIDAPI_JOY_CONS";
|
||||||
|
const ZString HINT_JOYSTICK_HIDAPI_JOYCON_HOME_LED = "SDL_JOYSTICK_HIDAPI_JOYCON_HOME_LED";
|
||||||
|
const ZString HINT_JOYSTICK_HIDAPI_LUNA = "SDL_JOYSTICK_HIDAPI_LUNA";
|
||||||
|
const ZString HINT_JOYSTICK_HIDAPI_NINTENDO_CLASSIC = "SDL_JOYSTICK_HIDAPI_NINTENDO_CLASSIC";
|
||||||
|
const ZString HINT_JOYSTICK_HIDAPI_PS3 = "SDL_JOYSTICK_HIDAPI_PS3";
|
||||||
|
const ZString HINT_JOYSTICK_HIDAPI_PS3_SIXAXIS_DRIVER = "SDL_JOYSTICK_HIDAPI_PS3_SIXAXIS_DRIVER";
|
||||||
|
const ZString HINT_JOYSTICK_HIDAPI_PS4 = "SDL_JOYSTICK_HIDAPI_PS4";
|
||||||
|
const ZString HINT_JOYSTICK_HIDAPI_PS4_REPORT_INTERVAL = "SDL_JOYSTICK_HIDAPI_PS4_REPORT_INTERVAL";
|
||||||
|
const ZString HINT_JOYSTICK_HIDAPI_PS5 = "SDL_JOYSTICK_HIDAPI_PS5";
|
||||||
|
const ZString HINT_JOYSTICK_HIDAPI_PS5_PLAYER_LED = "SDL_JOYSTICK_HIDAPI_PS5_PLAYER_LED";
|
||||||
|
const ZString HINT_JOYSTICK_HIDAPI_SHIELD = "SDL_JOYSTICK_HIDAPI_SHIELD";
|
||||||
|
const ZString HINT_JOYSTICK_HIDAPI_STADIA = "SDL_JOYSTICK_HIDAPI_STADIA";
|
||||||
|
const ZString HINT_JOYSTICK_HIDAPI_STEAM = "SDL_JOYSTICK_HIDAPI_STEAM";
|
||||||
|
const ZString HINT_JOYSTICK_HIDAPI_STEAM_HOME_LED = "SDL_JOYSTICK_HIDAPI_STEAM_HOME_LED";
|
||||||
|
const ZString HINT_JOYSTICK_HIDAPI_STEAMDECK = "SDL_JOYSTICK_HIDAPI_STEAMDECK";
|
||||||
|
const ZString HINT_JOYSTICK_HIDAPI_STEAM_HORI = "SDL_JOYSTICK_HIDAPI_STEAM_HORI";
|
||||||
|
const ZString HINT_JOYSTICK_HIDAPI_SWITCH = "SDL_JOYSTICK_HIDAPI_SWITCH";
|
||||||
|
const ZString HINT_JOYSTICK_HIDAPI_SWITCH_HOME_LED = "SDL_JOYSTICK_HIDAPI_SWITCH_HOME_LED";
|
||||||
|
const ZString HINT_JOYSTICK_HIDAPI_SWITCH_PLAYER_LED = "SDL_JOYSTICK_HIDAPI_SWITCH_PLAYER_LED";
|
||||||
|
const ZString HINT_JOYSTICK_HIDAPI_VERTICAL_JOY_CONS = "SDL_JOYSTICK_HIDAPI_VERTICAL_JOY_CONS";
|
||||||
|
const ZString HINT_JOYSTICK_HIDAPI_WII = "SDL_JOYSTICK_HIDAPI_WII";
|
||||||
|
const ZString HINT_JOYSTICK_HIDAPI_WII_PLAYER_LED = "SDL_JOYSTICK_HIDAPI_WII_PLAYER_LED";
|
||||||
|
const ZString HINT_JOYSTICK_HIDAPI_XBOX = "SDL_JOYSTICK_HIDAPI_XBOX";
|
||||||
|
const ZString HINT_JOYSTICK_HIDAPI_XBOX_360 = "SDL_JOYSTICK_HIDAPI_XBOX_360";
|
||||||
|
const ZString HINT_JOYSTICK_HIDAPI_XBOX_360_PLAYER_LED = "SDL_JOYSTICK_HIDAPI_XBOX_360_PLAYER_LED";
|
||||||
|
const ZString HINT_JOYSTICK_HIDAPI_XBOX_360_WIRELESS = "SDL_JOYSTICK_HIDAPI_XBOX_360_WIRELESS";
|
||||||
|
const ZString HINT_JOYSTICK_HIDAPI_XBOX_ONE = "SDL_JOYSTICK_HIDAPI_XBOX_ONE";
|
||||||
|
const ZString HINT_JOYSTICK_HIDAPI_XBOX_ONE_HOME_LED = "SDL_JOYSTICK_HIDAPI_XBOX_ONE_HOME_LED";
|
||||||
|
const ZString HINT_JOYSTICK_IOKIT = "SDL_JOYSTICK_IOKIT";
|
||||||
|
const ZString HINT_JOYSTICK_LINUX_CLASSIC = "SDL_JOYSTICK_LINUX_CLASSIC";
|
||||||
|
const ZString HINT_JOYSTICK_LINUX_DEADZONES = "SDL_JOYSTICK_LINUX_DEADZONES";
|
||||||
|
const ZString HINT_JOYSTICK_LINUX_DIGITAL_HATS = "SDL_JOYSTICK_LINUX_DIGITAL_HATS";
|
||||||
|
const ZString HINT_JOYSTICK_LINUX_HAT_DEADZONES = "SDL_JOYSTICK_LINUX_HAT_DEADZONES";
|
||||||
|
const ZString HINT_JOYSTICK_MFI = "SDL_JOYSTICK_MFI";
|
||||||
|
const ZString HINT_JOYSTICK_RAWINPUT = "SDL_JOYSTICK_RAWINPUT";
|
||||||
|
const ZString HINT_JOYSTICK_RAWINPUT_CORRELATE_XINPUT = "SDL_JOYSTICK_RAWINPUT_CORRELATE_XINPUT";
|
||||||
|
const ZString HINT_JOYSTICK_ROG_CHAKRAM = "SDL_JOYSTICK_ROG_CHAKRAM";
|
||||||
|
const ZString HINT_JOYSTICK_THREAD = "SDL_JOYSTICK_THREAD";
|
||||||
|
const ZString HINT_JOYSTICK_THROTTLE_DEVICES = "SDL_JOYSTICK_THROTTLE_DEVICES";
|
||||||
|
const ZString HINT_JOYSTICK_THROTTLE_DEVICES_EXCLUDED = "SDL_JOYSTICK_THROTTLE_DEVICES_EXCLUDED";
|
||||||
|
const ZString HINT_JOYSTICK_WGI = "SDL_JOYSTICK_WGI";
|
||||||
|
const ZString HINT_JOYSTICK_WHEEL_DEVICES = "SDL_JOYSTICK_WHEEL_DEVICES";
|
||||||
|
const ZString HINT_JOYSTICK_WHEEL_DEVICES_EXCLUDED = "SDL_JOYSTICK_WHEEL_DEVICES_EXCLUDED";
|
||||||
|
const ZString HINT_JOYSTICK_ZERO_CENTERED_DEVICES = "SDL_JOYSTICK_ZERO_CENTERED_DEVICES";
|
||||||
|
const ZString HINT_JOYSTICK_HAPTIC_AXES = "SDL_JOYSTICK_HAPTIC_AXES";
|
||||||
|
const ZString HINT_KEYCODE_OPTIONS = "SDL_KEYCODE_OPTIONS";
|
||||||
|
const ZString HINT_KMSDRM_DEVICE_INDEX = "SDL_KMSDRM_DEVICE_INDEX";
|
||||||
|
const ZString HINT_KMSDRM_REQUIRE_DRM_MASTER = "SDL_KMSDRM_REQUIRE_DRM_MASTER";
|
||||||
|
const ZString HINT_LOGGING = "SDL_LOGGING";
|
||||||
|
const ZString HINT_MAC_BACKGROUND_APP = "SDL_MAC_BACKGROUND_APP";
|
||||||
|
const ZString HINT_MAC_CTRL_CLICK_EMULATE_RIGHT_CLICK = "SDL_MAC_CTRL_CLICK_EMULATE_RIGHT_CLICK";
|
||||||
|
const ZString HINT_MAC_OPENGL_ASYNC_DISPATCH = "SDL_MAC_OPENGL_ASYNC_DISPATCH";
|
||||||
|
const ZString HINT_MAC_OPTION_AS_ALT = "SDL_MAC_OPTION_AS_ALT";
|
||||||
|
const ZString HINT_MAC_SCROLL_MOMENTUM = "SDL_MAC_SCROLL_MOMENTUM";
|
||||||
|
const ZString HINT_MAIN_CALLBACK_RATE = "SDL_MAIN_CALLBACK_RATE";
|
||||||
|
const ZString HINT_MOUSE_AUTO_CAPTURE = "SDL_MOUSE_AUTO_CAPTURE";
|
||||||
|
const ZString HINT_MOUSE_DOUBLE_CLICK_RADIUS = "SDL_MOUSE_DOUBLE_CLICK_RADIUS";
|
||||||
|
const ZString HINT_MOUSE_DOUBLE_CLICK_TIME = "SDL_MOUSE_DOUBLE_CLICK_TIME";
|
||||||
|
const ZString HINT_MOUSE_DEFAULT_SYSTEM_CURSOR = "SDL_MOUSE_DEFAULT_SYSTEM_CURSOR";
|
||||||
|
const ZString HINT_MOUSE_EMULATE_WARP_WITH_RELATIVE = "SDL_MOUSE_EMULATE_WARP_WITH_RELATIVE";
|
||||||
|
const ZString HINT_MOUSE_FOCUS_CLICKTHROUGH = "SDL_MOUSE_FOCUS_CLICKTHROUGH";
|
||||||
|
const ZString HINT_MOUSE_NORMAL_SPEED_SCALE = "SDL_MOUSE_NORMAL_SPEED_SCALE";
|
||||||
|
const ZString HINT_MOUSE_RELATIVE_MODE_CENTER = "SDL_MOUSE_RELATIVE_MODE_CENTER";
|
||||||
|
const ZString HINT_MOUSE_RELATIVE_SPEED_SCALE = "SDL_MOUSE_RELATIVE_SPEED_SCALE";
|
||||||
|
const ZString HINT_MOUSE_RELATIVE_SYSTEM_SCALE = "SDL_MOUSE_RELATIVE_SYSTEM_SCALE";
|
||||||
|
const ZString HINT_MOUSE_RELATIVE_WARP_MOTION = "SDL_MOUSE_RELATIVE_WARP_MOTION";
|
||||||
|
const ZString HINT_MOUSE_RELATIVE_CURSOR_VISIBLE = "SDL_MOUSE_RELATIVE_CURSOR_VISIBLE";
|
||||||
|
const ZString HINT_MOUSE_TOUCH_EVENTS = "SDL_MOUSE_TOUCH_EVENTS";
|
||||||
|
const ZString HINT_MUTE_CONSOLE_KEYBOARD = "SDL_MUTE_CONSOLE_KEYBOARD";
|
||||||
|
const ZString HINT_NO_SIGNAL_HANDLERS = "SDL_NO_SIGNAL_HANDLERS";
|
||||||
|
const ZString HINT_OPENGL_LIBRARY = "SDL_OPENGL_LIBRARY";
|
||||||
|
const ZString HINT_EGL_LIBRARY = "SDL_EGL_LIBRARY";
|
||||||
|
const ZString HINT_OPENGL_ES_DRIVER = "SDL_OPENGL_ES_DRIVER";
|
||||||
|
const ZString HINT_OPENVR_LIBRARY = "SDL_OPENVR_LIBRARY";
|
||||||
|
const ZString HINT_ORIENTATIONS = "SDL_ORIENTATIONS";
|
||||||
|
const ZString HINT_POLL_SENTINEL = "SDL_POLL_SENTINEL";
|
||||||
|
const ZString HINT_PREFERRED_LOCALES = "SDL_PREFERRED_LOCALES";
|
||||||
|
const ZString HINT_QUIT_ON_LAST_WINDOW_CLOSE = "SDL_QUIT_ON_LAST_WINDOW_CLOSE";
|
||||||
|
const ZString HINT_RENDER_DIRECT3D_THREADSAFE = "SDL_RENDER_DIRECT3D_THREADSAFE";
|
||||||
|
const ZString HINT_RENDER_DIRECT3D11_DEBUG = "SDL_RENDER_DIRECT3D11_DEBUG";
|
||||||
|
const ZString HINT_RENDER_VULKAN_DEBUG = "SDL_RENDER_VULKAN_DEBUG";
|
||||||
|
const ZString HINT_RENDER_GPU_DEBUG = "SDL_RENDER_GPU_DEBUG";
|
||||||
|
const ZString HINT_RENDER_GPU_LOW_POWER = "SDL_RENDER_GPU_LOW_POWER";
|
||||||
|
const ZString HINT_RENDER_DRIVER = "SDL_RENDER_DRIVER";
|
||||||
|
const ZString HINT_RENDER_LINE_METHOD = "SDL_RENDER_LINE_METHOD";
|
||||||
|
const ZString HINT_RENDER_METAL_PREFER_LOW_POWER_DEVICE = "SDL_RENDER_METAL_PREFER_LOW_POWER_DEVICE";
|
||||||
|
const ZString HINT_RENDER_VSYNC = "SDL_RENDER_VSYNC";
|
||||||
|
const ZString HINT_RETURN_KEY_HIDES_IME = "SDL_RETURN_KEY_HIDES_IME";
|
||||||
|
const ZString HINT_ROG_GAMEPAD_MICE = "SDL_ROG_GAMEPAD_MICE";
|
||||||
|
const ZString HINT_ROG_GAMEPAD_MICE_EXCLUDED = "SDL_ROG_GAMEPAD_MICE_EXCLUDED";
|
||||||
|
const ZString HINT_RPI_VIDEO_LAYER = "SDL_RPI_VIDEO_LAYER";
|
||||||
|
const ZString HINT_SCREENSAVER_INHIBIT_ACTIVITY_NAME = "SDL_SCREENSAVER_INHIBIT_ACTIVITY_NAME";
|
||||||
|
const ZString HINT_SHUTDOWN_DBUS_ON_QUIT = "SDL_SHUTDOWN_DBUS_ON_QUIT";
|
||||||
|
const ZString HINT_STORAGE_TITLE_DRIVER = "SDL_STORAGE_TITLE_DRIVER";
|
||||||
|
const ZString HINT_STORAGE_USER_DRIVER = "SDL_STORAGE_USER_DRIVER";
|
||||||
|
const ZString HINT_THREAD_FORCE_REALTIME_TIME_CRITICAL = "SDL_THREAD_FORCE_REALTIME_TIME_CRITICAL";
|
||||||
|
const ZString HINT_THREAD_PRIORITY_POLICY = "SDL_THREAD_PRIORITY_POLICY";
|
||||||
|
const ZString HINT_TIMER_RESOLUTION = "SDL_TIMER_RESOLUTION";
|
||||||
|
const ZString HINT_TOUCH_MOUSE_EVENTS = "SDL_TOUCH_MOUSE_EVENTS";
|
||||||
|
const ZString HINT_TRACKPAD_IS_TOUCH_ONLY = "SDL_TRACKPAD_IS_TOUCH_ONLY";
|
||||||
|
const ZString HINT_TV_REMOTE_AS_JOYSTICK = "SDL_TV_REMOTE_AS_JOYSTICK";
|
||||||
|
const ZString HINT_VIDEO_ALLOW_SCREENSAVER = "SDL_VIDEO_ALLOW_SCREENSAVER";
|
||||||
|
const ZString HINT_VIDEO_DISPLAY_PRIORITY = "SDL_VIDEO_DISPLAY_PRIORITY";
|
||||||
|
const ZString HINT_VIDEO_DOUBLE_BUFFER = "SDL_VIDEO_DOUBLE_BUFFER";
|
||||||
|
const ZString HINT_VIDEO_DRIVER = "SDL_VIDEO_DRIVER";
|
||||||
|
const ZString HINT_VIDEO_DUMMY_SAVE_FRAMES = "SDL_VIDEO_DUMMY_SAVE_FRAMES";
|
||||||
|
const ZString HINT_VIDEO_EGL_ALLOW_GETDISPLAY_FALLBACK = "SDL_VIDEO_EGL_ALLOW_GETDISPLAY_FALLBACK";
|
||||||
|
const ZString HINT_VIDEO_FORCE_EGL = "SDL_VIDEO_FORCE_EGL";
|
||||||
|
const ZString HINT_VIDEO_MAC_FULLSCREEN_SPACES = "SDL_VIDEO_MAC_FULLSCREEN_SPACES";
|
||||||
|
const ZString HINT_VIDEO_MAC_FULLSCREEN_MENU_VISIBILITY = "SDL_VIDEO_MAC_FULLSCREEN_MENU_VISIBILITY";
|
||||||
|
const ZString HINT_VIDEO_MINIMIZE_ON_FOCUS_LOSS = "SDL_VIDEO_MINIMIZE_ON_FOCUS_LOSS";
|
||||||
|
const ZString HINT_VIDEO_OFFSCREEN_SAVE_FRAMES = "SDL_VIDEO_OFFSCREEN_SAVE_FRAMES";
|
||||||
|
const ZString HINT_VIDEO_SYNC_WINDOW_OPERATIONS = "SDL_VIDEO_SYNC_WINDOW_OPERATIONS";
|
||||||
|
const ZString HINT_VIDEO_WAYLAND_ALLOW_LIBDECOR = "SDL_VIDEO_WAYLAND_ALLOW_LIBDECOR";
|
||||||
|
const ZString HINT_VIDEO_WAYLAND_MODE_EMULATION = "SDL_VIDEO_WAYLAND_MODE_EMULATION";
|
||||||
|
const ZString HINT_VIDEO_WAYLAND_MODE_SCALING = "SDL_VIDEO_WAYLAND_MODE_SCALING";
|
||||||
|
const ZString HINT_VIDEO_WAYLAND_PREFER_LIBDECOR = "SDL_VIDEO_WAYLAND_PREFER_LIBDECOR";
|
||||||
|
const ZString HINT_VIDEO_WAYLAND_SCALE_TO_DISPLAY = "SDL_VIDEO_WAYLAND_SCALE_TO_DISPLAY";
|
||||||
|
const ZString HINT_VIDEO_WIN_D3DCOMPILER = "SDL_VIDEO_WIN_D3DCOMPILER";
|
||||||
|
const ZString HINT_VIDEO_X11_EXTERNAL_WINDOW_INPUT = "SDL_VIDEO_X11_EXTERNAL_WINDOW_INPUT";
|
||||||
|
const ZString HINT_VIDEO_X11_NET_WM_BYPASS_COMPOSITOR = "SDL_VIDEO_X11_NET_WM_BYPASS_COMPOSITOR";
|
||||||
|
const ZString HINT_VIDEO_X11_NET_WM_PING = "SDL_VIDEO_X11_NET_WM_PING";
|
||||||
|
const ZString HINT_VIDEO_X11_NODIRECTCOLOR = "SDL_VIDEO_X11_NODIRECTCOLOR";
|
||||||
|
const ZString HINT_VIDEO_X11_SCALING_FACTOR = "SDL_VIDEO_X11_SCALING_FACTOR";
|
||||||
|
const ZString HINT_VIDEO_X11_VISUALID = "SDL_VIDEO_X11_VISUALID";
|
||||||
|
const ZString HINT_VIDEO_X11_WINDOW_VISUALID = "SDL_VIDEO_X11_WINDOW_VISUALID";
|
||||||
|
const ZString HINT_VIDEO_X11_XRANDR = "SDL_VIDEO_X11_XRANDR";
|
||||||
|
const ZString HINT_VITA_ENABLE_BACK_TOUCH = "SDL_VITA_ENABLE_BACK_TOUCH";
|
||||||
|
const ZString HINT_VITA_ENABLE_FRONT_TOUCH = "SDL_VITA_ENABLE_FRONT_TOUCH";
|
||||||
|
const ZString HINT_VITA_MODULE_PATH = "SDL_VITA_MODULE_PATH";
|
||||||
|
const ZString HINT_VITA_PVR_INIT = "SDL_VITA_PVR_INIT";
|
||||||
|
const ZString HINT_VITA_RESOLUTION = "SDL_VITA_RESOLUTION";
|
||||||
|
const ZString HINT_VITA_PVR_OPENGL = "SDL_VITA_PVR_OPENGL";
|
||||||
|
const ZString HINT_VITA_TOUCH_MOUSE_DEVICE = "SDL_VITA_TOUCH_MOUSE_DEVICE";
|
||||||
|
const ZString HINT_VULKAN_DISPLAY = "SDL_VULKAN_DISPLAY";
|
||||||
|
const ZString HINT_VULKAN_LIBRARY = "SDL_VULKAN_LIBRARY";
|
||||||
|
const ZString HINT_WAVE_FACT_CHUNK = "SDL_WAVE_FACT_CHUNK";
|
||||||
|
const ZString HINT_WAVE_CHUNK_LIMIT = "SDL_WAVE_CHUNK_LIMIT";
|
||||||
|
const ZString HINT_WAVE_RIFF_CHUNK_SIZE = "SDL_WAVE_RIFF_CHUNK_SIZE";
|
||||||
|
const ZString HINT_WAVE_TRUNCATION = "SDL_WAVE_TRUNCATION";
|
||||||
|
const ZString HINT_WINDOW_ACTIVATE_WHEN_RAISED = "SDL_WINDOW_ACTIVATE_WHEN_RAISED";
|
||||||
|
const ZString HINT_WINDOW_ACTIVATE_WHEN_SHOWN = "SDL_WINDOW_ACTIVATE_WHEN_SHOWN";
|
||||||
|
const ZString HINT_WINDOW_ALLOW_TOPMOST = "SDL_WINDOW_ALLOW_TOPMOST";
|
||||||
|
const ZString HINT_WINDOW_FRAME_USABLE_WHILE_CURSOR_HIDDEN = "SDL_WINDOW_FRAME_USABLE_WHILE_CURSOR_HIDDEN";
|
||||||
|
const ZString HINT_WINDOWS_CLOSE_ON_ALT_F4 = "SDL_WINDOWS_CLOSE_ON_ALT_F4";
|
||||||
|
const ZString HINT_WINDOWS_ENABLE_MENU_MNEMONICS = "SDL_WINDOWS_ENABLE_MENU_MNEMONICS";
|
||||||
|
const ZString HINT_WINDOWS_ENABLE_MESSAGELOOP = "SDL_WINDOWS_ENABLE_MESSAGELOOP";
|
||||||
|
const ZString HINT_WINDOWS_GAMEINPUT = "SDL_WINDOWS_GAMEINPUT";
|
||||||
|
const ZString HINT_WINDOWS_RAW_KEYBOARD = "SDL_WINDOWS_RAW_KEYBOARD";
|
||||||
|
const ZString HINT_WINDOWS_FORCE_SEMAPHORE_KERNEL = "SDL_WINDOWS_FORCE_SEMAPHORE_KERNEL";
|
||||||
|
const ZString HINT_WINDOWS_INTRESOURCE_ICON = "SDL_WINDOWS_INTRESOURCE_ICON";
|
||||||
|
const ZString HINT_WINDOWS_INTRESOURCE_ICON_SMALL = "SDL_WINDOWS_INTRESOURCE_ICON_SMALL";
|
||||||
|
const ZString HINT_WINDOWS_USE_D3D9EX = "SDL_WINDOWS_USE_D3D9EX";
|
||||||
|
const ZString HINT_WINDOWS_ERASE_BACKGROUND_MODE = "SDL_WINDOWS_ERASE_BACKGROUND_MODE";
|
||||||
|
const ZString HINT_X11_FORCE_OVERRIDE_REDIRECT = "SDL_X11_FORCE_OVERRIDE_REDIRECT";
|
||||||
|
const ZString HINT_X11_WINDOW_TYPE = "SDL_X11_WINDOW_TYPE";
|
||||||
|
const ZString HINT_X11_XCB_LIBRARY = "SDL_X11_XCB_LIBRARY";
|
||||||
|
const ZString HINT_XINPUT_ENABLED = "SDL_XINPUT_ENABLED";
|
||||||
|
const ZString HINT_ASSERT = "SDL_ASSERT";
|
||||||
|
const ZString HINT_PEN_MOUSE_EVENTS = "SDL_PEN_MOUSE_EVENTS";
|
||||||
|
const ZString HINT_PEN_TOUCH_EVENTS = "SDL_PEN_TOUCH_EVENTS";
|
||||||
|
|
||||||
|
|
||||||
|
enum HintPriority : inline CInt {
|
||||||
|
SDL_HINT_DEFAULT,
|
||||||
|
SDL_HINT_NORMAL,
|
||||||
|
SDL_HINT_OVERRIDE
|
||||||
|
}
|
||||||
|
|
||||||
|
extern fn bool set_hint_with_priority(ZString name, ZString value, HintPriority priority) @extern("SDL_SetHintWithPriority");
|
||||||
|
extern fn bool set_hint(ZString name, ZString value) @extern("SDL_SetHint");
|
||||||
|
extern fn bool reset_hint(ZString name) @extern("SDL_ResetHint");
|
||||||
|
extern fn void reset_hints() @extern("SDL_ResetHints");
|
||||||
|
extern fn ZString get_hint(ZString name) @extern("SDL_GetHint");
|
||||||
|
extern fn bool get_hint_boolean(ZString name, bool default_value) @extern("SDL_GetHintBoolean");
|
||||||
|
|
||||||
|
alias HintCallback = fn void(void *userdata, ZString name, ZString oldValue, ZString newValue);
|
||||||
|
|
||||||
|
extern fn bool add_hint_callback(ZString name, HintCallback callback, void *userdata) @extern("SDL_AddHintCallback");
|
||||||
|
extern fn void remove_hint_callback(ZString name, HintCallback callback, void *userdata) @extern("SDL_RemoveHintCallback");
|
47
sdl3.c3l/sdl3_init.c3i
Normal file
47
sdl3.c3l/sdl3_init.c3i
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
module sdl3::sdl;
|
||||||
|
|
||||||
|
typedef InitFlags = uint;
|
||||||
|
|
||||||
|
const InitFlags INIT_AUDIO = 0x00000010;
|
||||||
|
const InitFlags INIT_VIDEO = 0x00000020;
|
||||||
|
const InitFlags INIT_JOYSTICK = 0x00000200;
|
||||||
|
const InitFlags INIT_HAPTIC = 0x00001000;
|
||||||
|
const InitFlags INIT_GAMEPAD = 0x00002000;
|
||||||
|
const InitFlags INIT_EVENTS = 0x00004000;
|
||||||
|
const InitFlags INIT_SENSOR = 0x00008000;
|
||||||
|
const InitFlags INIT_CAMERA = 0x00010000;
|
||||||
|
|
||||||
|
enum AppResult : inline CInt {
|
||||||
|
APP_CONTINUE,
|
||||||
|
APP_SUCCESS,
|
||||||
|
APP_FAILURE
|
||||||
|
}
|
||||||
|
|
||||||
|
alias AppInit_func = fn AppResult(void **appstate, int argc, char[]* argv);
|
||||||
|
alias AppIterate_func = fn AppResult(void *appstate);
|
||||||
|
alias AppEvent_func = fn AppResult(void *appstate, Event *event);
|
||||||
|
alias AppQuit_func = fn void(void *appstate, AppResult result);
|
||||||
|
|
||||||
|
|
||||||
|
extern fn bool init(InitFlags flags) @extern("SDL_Init");
|
||||||
|
extern fn bool init_sub_system(InitFlags flags) @extern("SDL_InitSubSystem");
|
||||||
|
extern fn void quit_sub_system(InitFlags flags) @extern("SDL_QuitSubSystem");
|
||||||
|
extern fn InitFlags was_init(InitFlags flags) @extern("SDL_WasInit");
|
||||||
|
extern fn void quit() @extern("SDL_Quit");
|
||||||
|
extern fn bool is_main_thread() @extern("SDL_IsMainThread");
|
||||||
|
|
||||||
|
alias MainThreadCallback = fn void(void *userdata);
|
||||||
|
|
||||||
|
extern fn bool run_on_main_thread(MainThreadCallback callback, void *userdata, bool wait_complete) @extern("SDL_RunOnMainThread");
|
||||||
|
extern fn bool set_app_metadata(ZString appname, ZString appversion, ZString appidentifier) @extern("SDL_SetAppMetadata");
|
||||||
|
extern fn bool set_app_metadata_property(ZString name, ZString value) @extern("SDL_SetAppMetadataProperty");
|
||||||
|
|
||||||
|
const ZString PROP_APP_METADATA_NAME_STRING = "SDL.app.metadata.name";
|
||||||
|
const ZString PROP_APP_METADATA_VERSION_STRING = "SDL.app.metadata.version";
|
||||||
|
const ZString PROP_APP_METADATA_IDENTIFIER_STRING = "SDL.app.metadata.identifier";
|
||||||
|
const ZString PROP_APP_METADATA_CREATOR_STRING = "SDL.app.metadata.creator";
|
||||||
|
const ZString PROP_APP_METADATA_COPYRIGHT_STRING = "SDL.app.metadata.copyright";
|
||||||
|
const ZString PROP_APP_METADATA_URL_STRING = "SDL.app.metadata.url";
|
||||||
|
const ZString PROP_APP_METADATA_TYPE_STRING = "SDL.app.metadata.type";
|
||||||
|
|
||||||
|
extern fn ZString get_app_metadata_property(ZString name) @extern("SDL_GetAppMetadataProperty");
|
3
sdl3.c3l/sdl3_iostream.c3i
Normal file
3
sdl3.c3l/sdl3_iostream.c3i
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
module sdl3::sdl;
|
||||||
|
|
||||||
|
typedef IOStream = void;
|
155
sdl3.c3l/sdl3_joystick.c3i
Normal file
155
sdl3.c3l/sdl3_joystick.c3i
Normal file
@ -0,0 +1,155 @@
|
|||||||
|
module sdl3::sdl;
|
||||||
|
|
||||||
|
typedef Joystick = void;
|
||||||
|
typedef JoystickID = uint;
|
||||||
|
|
||||||
|
enum JoystickType : inline CInt {
|
||||||
|
JOYSTICK_TYPE_UNKNOWN,
|
||||||
|
JOYSTICK_TYPE_GAMEPAD,
|
||||||
|
JOYSTICK_TYPE_WHEEL,
|
||||||
|
JOYSTICK_TYPE_ARCADE_STICK,
|
||||||
|
JOYSTICK_TYPE_FLIGHT_STICK,
|
||||||
|
JOYSTICK_TYPE_DANCE_PAD,
|
||||||
|
JOYSTICK_TYPE_GUITAR,
|
||||||
|
JOYSTICK_TYPE_DRUM_KIT,
|
||||||
|
JOYSTICK_TYPE_ARCADE_PAD,
|
||||||
|
JOYSTICK_TYPE_THROTTLE,
|
||||||
|
JOYSTICK_TYPE_COUNT
|
||||||
|
}
|
||||||
|
|
||||||
|
typedef JoystickConnectionState = CInt;
|
||||||
|
|
||||||
|
const JoystickConnectionState JOYSTICK_CONNECTION_INVALID = -1;
|
||||||
|
const JoystickConnectionState JOYSTICK_CONNECTION_UNKNOWN = 0;
|
||||||
|
const JoystickConnectionState JOYSTICK_CONNECTION_WIRED = 1;
|
||||||
|
const JoystickConnectionState JOYSTICK_CONNECTION_WIRELESS = 2;
|
||||||
|
|
||||||
|
const int JOYSTICK_AXIS_MAX = 32767;
|
||||||
|
const int JOYSTICK_AXIS_MIN = -32768;
|
||||||
|
|
||||||
|
extern fn void lock_joysticks() @extern("SDL_LockJoysticks");
|
||||||
|
extern fn void unlock_joysticks() @extern("SDL_UnlockJoysticks");
|
||||||
|
extern fn bool has_joystick() @extern("SDL_HasJoystick");
|
||||||
|
extern fn JoystickID* get_joysticks(int *count) @extern("SDL_GetJoysticks");
|
||||||
|
extern fn ZString get_joystick_name_for_id(JoystickID instance_id) @extern("SDL_GetJoystickNameForID");
|
||||||
|
extern fn ZString get_joystick_path_for_id(JoystickID instance_id) @extern("SDL_GetJoystickPathForID");
|
||||||
|
extern fn int get_joystick_player_index_for_id(JoystickID instance_id) @extern("SDL_GetJoystickPlayerIndexForID");
|
||||||
|
// extern fn SDL_GUID get_joystick_guid_for_id(JoystickID instance_id) @extern("SDL_GetJoystickGUIDForID");
|
||||||
|
extern fn ushort get_joystick_vendor_for_id(JoystickID instance_id) @extern("SDL_GetJoystickVendorForID");
|
||||||
|
extern fn ushort get_joystick_product_for_id(JoystickID instance_id) @extern("SDL_GetJoystickProductForID");
|
||||||
|
extern fn ushort get_joystick_product_version_for_id(JoystickID instance_id) @extern("SDL_GetJoystickProductVersionForID");
|
||||||
|
extern fn JoystickType get_joystick_type_for_id(JoystickID instance_id) @extern("SDL_GetJoystickTypeForID");
|
||||||
|
extern fn Joystick* open_joystick(JoystickID instance_id) @extern("SDL_OpenJoystick");
|
||||||
|
extern fn Joystick* get_joystick_from_id(JoystickID instance_id) @extern("SDL_GetJoystickFromID");
|
||||||
|
extern fn Joystick* get_joystick_from_player_index(int player_index) @extern("SDL_GetJoystickFromPlayerIndex");
|
||||||
|
|
||||||
|
struct VirtualJoystickTouchpadDesc {
|
||||||
|
ushort nfingers;
|
||||||
|
ushort[3] padding;
|
||||||
|
}
|
||||||
|
|
||||||
|
struct VirtualJoystickSensorDesc {
|
||||||
|
SensorType type;
|
||||||
|
float rate;
|
||||||
|
}
|
||||||
|
|
||||||
|
alias VirtualJoystickUpdate = fn void(void *userdata);
|
||||||
|
alias VirtualJoystickSetPlayerIndex = fn void(void *userdata, int player_index);
|
||||||
|
alias VirtualJoystickRumble = fn bool(void *userdata, ushort low_frequency_rumble, ushort high_frequency_rumble);
|
||||||
|
alias VirtualJoystickRumbleTriggers = fn bool(void *userdata, ushort left_rumble, ushort right_rumble);
|
||||||
|
alias VirtualJoystickSetLED = fn bool(void *userdata, char red, char green, char blue);
|
||||||
|
alias VirtualJoystickSendEffect = fn bool(void *userdata, void *data, int size);
|
||||||
|
alias VirtualJoystickSetSensorsEnabled = fn bool(void *userdata, bool enabled);
|
||||||
|
alias VirtualJoystickCleanup = fn void(void *userdata);
|
||||||
|
|
||||||
|
struct VirtualJoystickDesc {
|
||||||
|
uint version;
|
||||||
|
ushort type;
|
||||||
|
ushort padding;
|
||||||
|
ushort vendor_id;
|
||||||
|
ushort product_id;
|
||||||
|
ushort naxes;
|
||||||
|
ushort nbuttons;
|
||||||
|
ushort nballs;
|
||||||
|
ushort nhats;
|
||||||
|
ushort ntouchpads;
|
||||||
|
ushort nsensors;
|
||||||
|
ushort[2] padding2;
|
||||||
|
uint button_mask;
|
||||||
|
uint axis_mask;
|
||||||
|
ZString name;
|
||||||
|
VirtualJoystickTouchpadDesc* touchpads;
|
||||||
|
VirtualJoystickSensorDesc* sensors;
|
||||||
|
|
||||||
|
void *userdata;
|
||||||
|
VirtualJoystickUpdate update;
|
||||||
|
VirtualJoystickSetPlayerIndex set_player_index;
|
||||||
|
VirtualJoystickRumble rumble;
|
||||||
|
VirtualJoystickRumbleTriggers rumble_triggers;
|
||||||
|
VirtualJoystickSetLED set_led;
|
||||||
|
VirtualJoystickSendEffect send_effect;
|
||||||
|
VirtualJoystickSetSensorsEnabled set_sensors_enabled;
|
||||||
|
VirtualJoystickCleanup cleanup;
|
||||||
|
}
|
||||||
|
|
||||||
|
extern fn JoystickID attach_virtual_joystick(VirtualJoystickDesc *desc) @extern("SDL_AttachVirtualJoystick");
|
||||||
|
extern fn bool detach_virtual_joystick(JoystickID instance_id) @extern("SDL_DetachVirtualJoystick");
|
||||||
|
extern fn bool is_joystick_virtual(JoystickID instance_id) @extern("SDL_IsJoystickVirtual");
|
||||||
|
extern fn bool set_joystick_virtual_axis(Joystick* joystick, int axis, short value) @extern("SDL_SetJoystickVirtualAxis");
|
||||||
|
extern fn bool set_joystick_virtual_ball(Joystick* joystick, int ball, short xrel, short yrel) @extern("SDL_SetJoystickVirtualBall");
|
||||||
|
extern fn bool set_joystick_virtual_button(Joystick* joystick, int button, bool down) @extern("SDL_SetJoystickVirtualButton");
|
||||||
|
extern fn bool set_joystick_virtual_hat(Joystick* joystick, int hat, char value) @extern("SDL_SetJoystickVirtualHat");
|
||||||
|
extern fn bool set_joystick_virtual_touchpad(Joystick* joystick, int touchpad, int finger, bool down, float x, float y, float pressure) @extern("SDL_SetJoystickVirtualTouchpad");
|
||||||
|
extern fn bool send_joystick_virtual_sensor_data(Joystick* joystick, SensorType type, ulong sensor_timestamp, float *data, int num_values) @extern("SDL_SendJoystickVirtualSensorData");
|
||||||
|
extern fn PropertiesID get_joystick_properties(Joystick* joystick) @extern("SDL_GetJoystickProperties");
|
||||||
|
|
||||||
|
const ZString PROP_JOYSTICK_CAP_MONO_LED_BOOLEAN = "SDL.joystick.cap.mono_led";
|
||||||
|
const ZString PROP_JOYSTICK_CAP_RGB_LED_BOOLEAN = "SDL.joystick.cap.rgb_led";
|
||||||
|
const ZString PROP_JOYSTICK_CAP_PLAYER_LED_BOOLEAN = "SDL.joystick.cap.player_led";
|
||||||
|
const ZString PROP_JOYSTICK_CAP_RUMBLE_BOOLEAN = "SDL.joystick.cap.rumble";
|
||||||
|
const ZString PROP_JOYSTICK_CAP_TRIGGER_RUMBLE_BOOLEAN = "SDL.joystick.cap.trigger_rumble";
|
||||||
|
|
||||||
|
extern fn ZString get_joystick_name(Joystick* joystick) @extern("SDL_GetJoystickName");
|
||||||
|
extern fn ZString get_joystick_path(Joystick* joystick) @extern("SDL_GetJoystickPath");
|
||||||
|
extern fn int get_joystick_player_index(Joystick* joystick) @extern("SDL_GetJoystickPlayerIndex");
|
||||||
|
extern fn bool set_joystick_player_index(Joystick* joystick, int player_index) @extern("SDL_SetJoystickPlayerIndex");
|
||||||
|
//extern fn SDL_GUID get_joystick_guid(Joystick* joystick) @extern("SDL_GetJoystickGUID");
|
||||||
|
extern fn ushort get_joystick_vendor(Joystick* joystick) @extern("SDL_GetJoystickVendor");
|
||||||
|
extern fn ushort get_joystick_product(Joystick* joystick) @extern("SDL_GetJoystickProduct");
|
||||||
|
extern fn ushort get_joystick_product_version(Joystick* joystick) @extern("SDL_GetJoystickProductVersion");
|
||||||
|
extern fn ushort get_joystick_firmware_version(Joystick* joystick) @extern("SDL_GetJoystickFirmwareVersion");
|
||||||
|
extern fn ZString get_joystick_serial(Joystick* joystick) @extern("SDL_GetJoystickSerial");
|
||||||
|
extern fn JoystickType get_joystick_type(Joystick* joystick) @extern("SDL_GetJoystickType");
|
||||||
|
//extern fn void get_joystick_guid_info(SDL_GUID guid, ushort *vendor, ushort *product, ushort *version, ushort *crc16) @extern("SDL_GetJoystickGUIDInfo");
|
||||||
|
extern fn bool joystick_connected(Joystick* joystick) @extern("SDL_JoystickConnected");
|
||||||
|
extern fn JoystickID get_joystick_id(Joystick* joystick) @extern("SDL_GetJoystickID");
|
||||||
|
extern fn int get_num_joystick_axes(Joystick* joystick) @extern("SDL_GetNumJoystickAxes");
|
||||||
|
extern fn int get_num_joystick_balls(Joystick* joystick) @extern("SDL_GetNumJoystickBalls");
|
||||||
|
extern fn int get_num_joystick_hats(Joystick* joystick) @extern("SDL_GetNumJoystickHats");
|
||||||
|
extern fn int get_num_joystick_buttons(Joystick* joystick) @extern("SDL_GetNumJoystickButtons");
|
||||||
|
extern fn void set_joystick_events_enabled(bool enabled) @extern("SDL_SetJoystickEventsEnabled");
|
||||||
|
extern fn bool joystick_events_enabled() @extern("SDL_JoystickEventsEnabled");
|
||||||
|
extern fn void update_joysticks() @extern("SDL_UpdateJoysticks");
|
||||||
|
extern fn short get_joystick_axis(Joystick* joystick, int axis) @extern("SDL_GetJoystickAxis");
|
||||||
|
extern fn bool get_joystick_axis_initial_state(Joystick* joystick, int axis, short *state) @extern("SDL_GetJoystickAxisInitialState");
|
||||||
|
extern fn bool get_joystick_ball(Joystick* joystick, int ball, int *dx, int *dy) @extern("SDL_GetJoystickBall");
|
||||||
|
extern fn char get_joystick_hat(Joystick* joystick, int hat) @extern("SDL_GetJoystickHat");
|
||||||
|
|
||||||
|
const ushort HAT_CENTERED = 0x00;
|
||||||
|
const ushort HAT_UP = 0x01;
|
||||||
|
const ushort HAT_RIGHT = 0x02;
|
||||||
|
const ushort HAT_DOWN = 0x04;
|
||||||
|
const ushort HAT_LEFT = 0x08;
|
||||||
|
const ushort HAT_RIGHTUP = (HAT_RIGHT|HAT_UP);
|
||||||
|
const ushort HAT_RIGHTDOWN = (HAT_RIGHT|HAT_DOWN);
|
||||||
|
const ushort HAT_LEFTUP = (HAT_LEFT|HAT_UP);
|
||||||
|
const ushort HAT_LEFTDOWN = (HAT_LEFT|HAT_DOWN);
|
||||||
|
|
||||||
|
extern fn bool get_joystick_button(Joystick* joystick, int button) @extern("SDL_GetJoystickButton");
|
||||||
|
extern fn bool rumble_joystick(Joystick* joystick, ushort low_frequency_rumble, ushort high_frequency_rumble, uint duration_ms) @extern("SDL_RumbleJoystick");
|
||||||
|
extern fn bool rumble_joystick_triggers(Joystick* joystick, ushort left_rumble, ushort right_rumble, uint duration_ms) @extern("SDL_RumbleJoystickTriggers");
|
||||||
|
extern fn bool set_joystick_led(Joystick* joystick, char red, char green, char blue) @extern("SDL_SetJoystickLED");
|
||||||
|
extern fn bool send_joystick_effect(Joystick* joystick, void *data, int size) @extern("SDL_SendJoystickEffect");
|
||||||
|
extern fn void close_joystick(Joystick* joystick) @extern("SDL_CloseJoystick");
|
||||||
|
extern fn JoystickConnectionState get_joystick_connection_state(Joystick* joystick) @extern("SDL_GetJoystickConnectionState");
|
||||||
|
extern fn PowerState get_joystick_power_info(Joystick* joystick, int *percent) @extern("SDL_GetJoystickPowerInfo");
|
55
sdl3.c3l/sdl3_keyboard.c3i
Normal file
55
sdl3.c3l/sdl3_keyboard.c3i
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
module sdl3::sdl;
|
||||||
|
|
||||||
|
typedef KeyboardID = uint;
|
||||||
|
|
||||||
|
extern fn bool has_keyboard() @extern("SDL_HasKeyboard");
|
||||||
|
extern fn KeyboardID* get_keyboards(int *count) @extern("SDL_GetKeyboards");
|
||||||
|
extern fn ZString get_keyboard_name_for_id(KeyboardID instance_id) @extern("SDL_GetKeyboardNameForID");
|
||||||
|
extern fn Window* get_keyboard_focus() @extern("SDL_GetKeyboardFocus");
|
||||||
|
extern fn bool* get_keyboard_state(int *numkeys) @extern("SDL_GetKeyboardState");
|
||||||
|
extern fn void reset_keyboard() @extern("SDL_ResetKeyboard");
|
||||||
|
extern fn Keymod get_mod_state() @extern("SDL_GetModState");
|
||||||
|
extern fn void set_mod_state(Keymod modstate) @extern("SDL_SetModState");
|
||||||
|
extern fn Keycode get_key_from_scancode(Scancode scancode, Keymod modstate, bool key_event) @extern("SDL_GetKeyFromScancode");
|
||||||
|
extern fn Scancode get_scancode_from_key(Keycode key, Keymod *modstate) @extern("SDL_GetScancodeFromKey");
|
||||||
|
extern fn bool set_scancode_name(Scancode scancode, ZString name) @extern("SDL_SetScancodeName");
|
||||||
|
extern fn ZString get_scancode_name(Scancode scancode) @extern("SDL_GetScancodeName");
|
||||||
|
extern fn Scancode get_scancode_from_name(ZString name) @extern("SDL_GetScancodeFromName");
|
||||||
|
extern fn ZString get_key_name(Keycode key) @extern("SDL_GetKeyName");
|
||||||
|
extern fn Keycode get_key_from_name(ZString name) @extern("SDL_GetKeyFromName");
|
||||||
|
extern fn bool start_text_input(Window* window) @extern("SDL_StartTextInput");
|
||||||
|
|
||||||
|
enum TextInputType : inline CInt {
|
||||||
|
SDL_TEXTINPUT_TYPE_TEXT,
|
||||||
|
SDL_TEXTINPUT_TYPE_TEXT_NAME,
|
||||||
|
SDL_TEXTINPUT_TYPE_TEXT_EMAIL,
|
||||||
|
SDL_TEXTINPUT_TYPE_TEXT_USERNAME,
|
||||||
|
SDL_TEXTINPUT_TYPE_TEXT_PASSWORD_HIDDEN,
|
||||||
|
SDL_TEXTINPUT_TYPE_TEXT_PASSWORD_VISIBLE,
|
||||||
|
SDL_TEXTINPUT_TYPE_NUMBER,
|
||||||
|
SDL_TEXTINPUT_TYPE_NUMBER_PASSWORD_HIDDEN,
|
||||||
|
SDL_TEXTINPUT_TYPE_NUMBER_PASSWORD_VISIBLE
|
||||||
|
}
|
||||||
|
|
||||||
|
enum Capitalization : inline CInt {
|
||||||
|
SDL_CAPITALIZE_NONE,
|
||||||
|
SDL_CAPITALIZE_SENTENCES,
|
||||||
|
SDL_CAPITALIZE_WORDS,
|
||||||
|
SDL_CAPITALIZE_LETTERS
|
||||||
|
}
|
||||||
|
|
||||||
|
extern fn bool start_text_input_with_properties(Window* window, PropertiesID props) @extern("SDL_StartTextInputWithProperties");
|
||||||
|
|
||||||
|
const ZString PROP_TEXTINPUT_TYPE_NUMBER = "SDL.textinput.type";
|
||||||
|
const ZString PROP_TEXTINPUT_CAPITALIZATION_NUMBER = "SDL.textinput.capitalization";
|
||||||
|
const ZString PROP_TEXTINPUT_AUTOCORRECT_BOOLEAN = "SDL.textinput.autocorrect";
|
||||||
|
const ZString PROP_TEXTINPUT_MULTILINE_BOOLEAN = "SDL.textinput.multiline";
|
||||||
|
const ZString PROP_TEXTINPUT_ANDROID_INPUTTYPE_NUMBER = "SDL.textinput.android.inputtype";
|
||||||
|
|
||||||
|
extern fn bool text_input_active(Window* window) @extern("SDL_TextInputActive");
|
||||||
|
extern fn bool stop_text_input(Window* window) @extern("SDL_StopTextInput");
|
||||||
|
extern fn bool clear_composition(Window* window) @extern("SDL_ClearComposition");
|
||||||
|
extern fn bool set_text_input_area(Window* window, Rect* rect, int cursor) @extern("SDL_SetTextInputArea");
|
||||||
|
extern fn bool get_text_input_area(Window* window, Rect* rect, int *cursor) @extern("SDL_GetTextInputArea");
|
||||||
|
extern fn bool has_screen_keyboard_support() @extern("SDL_HasScreenKeyboardSupport");
|
||||||
|
extern fn bool screen_keyboard_shown(Window* window) @extern("SDL_ScreenKeyboardShown");
|
286
sdl3.c3l/sdl3_keycode.c3i
Normal file
286
sdl3.c3l/sdl3_keycode.c3i
Normal file
@ -0,0 +1,286 @@
|
|||||||
|
module sdl3::sdl;
|
||||||
|
|
||||||
|
typedef Keycode = uint;
|
||||||
|
|
||||||
|
|
||||||
|
const Keycode K_EXTENDED_MASK = (1 << 29);
|
||||||
|
const Keycode K_SCANCODE_MASK = (1 << 30);
|
||||||
|
macro Keycode @scancode_to_keycode(Scancode $x) => ($x | K_SCANCODE_MASK);
|
||||||
|
|
||||||
|
const Keycode K_UNKNOWN = 0x00000000;
|
||||||
|
const Keycode K_RETURN = 0x0000000d;
|
||||||
|
const Keycode K_ESCAPE = 0x0000001b;
|
||||||
|
const Keycode K_BACKSPACE = 0x00000008;
|
||||||
|
const Keycode K_TAB = 0x00000009;
|
||||||
|
const Keycode K_SPACE = 0x00000020;
|
||||||
|
const Keycode K_EXCLAIM = 0x00000021;
|
||||||
|
const Keycode K_DBLAPOSTROPHE = 0x00000022;
|
||||||
|
const Keycode K_HASH = 0x00000023;
|
||||||
|
const Keycode K_DOLLAR = 0x00000024;
|
||||||
|
const Keycode K_PERCENT = 0x00000025;
|
||||||
|
const Keycode K_AMPERSAND = 0x00000026;
|
||||||
|
const Keycode K_APOSTROPHE = 0x00000027;
|
||||||
|
const Keycode K_LEFTPAREN = 0x00000028;
|
||||||
|
const Keycode K_RIGHTPAREN = 0x00000029;
|
||||||
|
const Keycode K_ASTERISK = 0x0000002a;
|
||||||
|
const Keycode K_PLUS = 0x0000002b;
|
||||||
|
const Keycode K_COMMA = 0x0000002c;
|
||||||
|
const Keycode K_MINUS = 0x0000002d;
|
||||||
|
const Keycode K_PERIOD = 0x0000002e;
|
||||||
|
const Keycode K_SLASH = 0x0000002f;
|
||||||
|
const Keycode K_0 = 0x00000030;
|
||||||
|
const Keycode K_1 = 0x00000031;
|
||||||
|
const Keycode K_2 = 0x00000032;
|
||||||
|
const Keycode K_3 = 0x00000033;
|
||||||
|
const Keycode K_4 = 0x00000034;
|
||||||
|
const Keycode K_5 = 0x00000035;
|
||||||
|
const Keycode K_6 = 0x00000036;
|
||||||
|
const Keycode K_7 = 0x00000037;
|
||||||
|
const Keycode K_8 = 0x00000038;
|
||||||
|
const Keycode K_9 = 0x00000039;
|
||||||
|
const Keycode K_COLON = 0x0000003a;
|
||||||
|
const Keycode K_SEMICOLON = 0x0000003b;
|
||||||
|
const Keycode K_LESS = 0x0000003c;
|
||||||
|
const Keycode K_EQUALS = 0x0000003d;
|
||||||
|
const Keycode K_GREATER = 0x0000003e;
|
||||||
|
const Keycode K_QUESTION = 0x0000003f;
|
||||||
|
const Keycode K_AT = 0x00000040;
|
||||||
|
const Keycode K_LEFTBRACKET = 0x0000005b;
|
||||||
|
const Keycode K_BACKSLASH = 0x0000005c;
|
||||||
|
const Keycode K_RIGHTBRACKET = 0x0000005d;
|
||||||
|
const Keycode K_CARET = 0x0000005e;
|
||||||
|
const Keycode K_UNDERSCORE = 0x0000005f;
|
||||||
|
const Keycode K_GRAVE = 0x00000060;
|
||||||
|
const Keycode K_A = 0x00000061;
|
||||||
|
const Keycode K_B = 0x00000062;
|
||||||
|
const Keycode K_C = 0x00000063;
|
||||||
|
const Keycode K_D = 0x00000064;
|
||||||
|
const Keycode K_E = 0x00000065;
|
||||||
|
const Keycode K_F = 0x00000066;
|
||||||
|
const Keycode K_G = 0x00000067;
|
||||||
|
const Keycode K_H = 0x00000068;
|
||||||
|
const Keycode K_I = 0x00000069;
|
||||||
|
const Keycode K_J = 0x0000006a;
|
||||||
|
const Keycode K_K = 0x0000006b;
|
||||||
|
const Keycode K_L = 0x0000006c;
|
||||||
|
const Keycode K_M = 0x0000006d;
|
||||||
|
const Keycode K_N = 0x0000006e;
|
||||||
|
const Keycode K_O = 0x0000006f;
|
||||||
|
const Keycode K_P = 0x00000070;
|
||||||
|
const Keycode K_Q = 0x00000071;
|
||||||
|
const Keycode K_R = 0x00000072;
|
||||||
|
const Keycode K_S = 0x00000073;
|
||||||
|
const Keycode K_T = 0x00000074;
|
||||||
|
const Keycode K_U = 0x00000075;
|
||||||
|
const Keycode K_V = 0x00000076;
|
||||||
|
const Keycode K_W = 0x00000077;
|
||||||
|
const Keycode K_X = 0x00000078;
|
||||||
|
const Keycode K_Y = 0x00000079;
|
||||||
|
const Keycode K_Z = 0x0000007a;
|
||||||
|
const Keycode K_LEFTBRACE = 0x0000007b;
|
||||||
|
const Keycode K_PIPE = 0x0000007c;
|
||||||
|
const Keycode K_RIGHTBRACE = 0x0000007d;
|
||||||
|
const Keycode K_TILDE = 0x0000007e;
|
||||||
|
const Keycode K_DELETE = 0x0000007f;
|
||||||
|
const Keycode K_PLUSMINUS = 0x000000b1;
|
||||||
|
const Keycode K_CAPSLOCK = 0x40000039;
|
||||||
|
const Keycode K_F1 = 0x4000003a;
|
||||||
|
const Keycode K_F2 = 0x4000003b;
|
||||||
|
const Keycode K_F3 = 0x4000003c;
|
||||||
|
const Keycode K_F4 = 0x4000003d;
|
||||||
|
const Keycode K_F5 = 0x4000003e;
|
||||||
|
const Keycode K_F6 = 0x4000003f;
|
||||||
|
const Keycode K_F7 = 0x40000040;
|
||||||
|
const Keycode K_F8 = 0x40000041;
|
||||||
|
const Keycode K_F9 = 0x40000042;
|
||||||
|
const Keycode K_F10 = 0x40000043;
|
||||||
|
const Keycode K_F11 = 0x40000044;
|
||||||
|
const Keycode K_F12 = 0x40000045;
|
||||||
|
const Keycode K_PRINTSCREEN = 0x40000046;
|
||||||
|
const Keycode K_SCROLLLOCK = 0x40000047;
|
||||||
|
const Keycode K_PAUSE = 0x40000048;
|
||||||
|
const Keycode K_INSERT = 0x40000049;
|
||||||
|
const Keycode K_HOME = 0x4000004a;
|
||||||
|
const Keycode K_PAGEUP = 0x4000004b;
|
||||||
|
const Keycode K_END = 0x4000004d;
|
||||||
|
const Keycode K_PAGEDOWN = 0x4000004e;
|
||||||
|
const Keycode K_RIGHT = 0x4000004f;
|
||||||
|
const Keycode K_LEFT = 0x40000050;
|
||||||
|
const Keycode K_DOWN = 0x40000051;
|
||||||
|
const Keycode K_UP = 0x40000052;
|
||||||
|
const Keycode K_NUMLOCKCLEAR = 0x40000053;
|
||||||
|
const Keycode K_KP_DIVIDE = 0x40000054;
|
||||||
|
const Keycode K_KP_MULTIPLY = 0x40000055;
|
||||||
|
const Keycode K_KP_MINUS = 0x40000056;
|
||||||
|
const Keycode K_KP_PLUS = 0x40000057;
|
||||||
|
const Keycode K_KP_ENTER = 0x40000058;
|
||||||
|
const Keycode K_KP_1 = 0x40000059;
|
||||||
|
const Keycode K_KP_2 = 0x4000005a;
|
||||||
|
const Keycode K_KP_3 = 0x4000005b;
|
||||||
|
const Keycode K_KP_4 = 0x4000005c;
|
||||||
|
const Keycode K_KP_5 = 0x4000005d;
|
||||||
|
const Keycode K_KP_6 = 0x4000005e;
|
||||||
|
const Keycode K_KP_7 = 0x4000005f;
|
||||||
|
const Keycode K_KP_8 = 0x40000060;
|
||||||
|
const Keycode K_KP_9 = 0x40000061;
|
||||||
|
const Keycode K_KP_0 = 0x40000062;
|
||||||
|
const Keycode K_KP_PERIOD = 0x40000063;
|
||||||
|
const Keycode K_APPLICATION = 0x40000065;
|
||||||
|
const Keycode K_POWER = 0x40000066;
|
||||||
|
const Keycode K_KP_EQUALS = 0x40000067;
|
||||||
|
const Keycode K_F13 = 0x40000068;
|
||||||
|
const Keycode K_F14 = 0x40000069;
|
||||||
|
const Keycode K_F15 = 0x4000006a;
|
||||||
|
const Keycode K_F16 = 0x4000006b;
|
||||||
|
const Keycode K_F17 = 0x4000006c;
|
||||||
|
const Keycode K_F18 = 0x4000006d;
|
||||||
|
const Keycode K_F19 = 0x4000006e;
|
||||||
|
const Keycode K_F20 = 0x4000006f;
|
||||||
|
const Keycode K_F21 = 0x40000070;
|
||||||
|
const Keycode K_F22 = 0x40000071;
|
||||||
|
const Keycode K_F23 = 0x40000072;
|
||||||
|
const Keycode K_F24 = 0x40000073;
|
||||||
|
const Keycode K_EXECUTE = 0x40000074;
|
||||||
|
const Keycode K_HELP = 0x40000075;
|
||||||
|
const Keycode K_MENU = 0x40000076;
|
||||||
|
const Keycode K_SELECT = 0x40000077;
|
||||||
|
const Keycode K_STOP = 0x40000078;
|
||||||
|
const Keycode K_AGAIN = 0x40000079;
|
||||||
|
const Keycode K_UNDO = 0x4000007a;
|
||||||
|
const Keycode K_CUT = 0x4000007b;
|
||||||
|
const Keycode K_COPY = 0x4000007c;
|
||||||
|
const Keycode K_PASTE = 0x4000007d;
|
||||||
|
const Keycode K_FIND = 0x4000007e;
|
||||||
|
const Keycode K_MUTE = 0x4000007f;
|
||||||
|
const Keycode K_VOLUMEUP = 0x40000080;
|
||||||
|
const Keycode K_VOLUMEDOWN = 0x40000081;
|
||||||
|
const Keycode K_KP_COMMA = 0x40000085;
|
||||||
|
const Keycode K_KP_EQUALSAS400 = 0x40000086;
|
||||||
|
const Keycode K_ALTERASE = 0x40000099;
|
||||||
|
const Keycode K_SYSREQ = 0x4000009a;
|
||||||
|
const Keycode K_CANCEL = 0x4000009b;
|
||||||
|
const Keycode K_CLEAR = 0x4000009c;
|
||||||
|
const Keycode K_PRIOR = 0x4000009d;
|
||||||
|
const Keycode K_RETURN2 = 0x4000009e;
|
||||||
|
const Keycode K_SEPARATOR = 0x4000009f;
|
||||||
|
const Keycode K_OUT = 0x400000a0;
|
||||||
|
const Keycode K_OPER = 0x400000a1;
|
||||||
|
const Keycode K_CLEARAGAIN = 0x400000a2;
|
||||||
|
const Keycode K_CRSEL = 0x400000a3;
|
||||||
|
const Keycode K_EXSEL = 0x400000a4;
|
||||||
|
const Keycode K_KP_00 = 0x400000b0;
|
||||||
|
const Keycode K_KP_000 = 0x400000b1;
|
||||||
|
const Keycode K_THOUSANDSSEPARATOR = 0x400000b2;
|
||||||
|
const Keycode K_DECIMALSEPARATOR = 0x400000b3;
|
||||||
|
const Keycode K_CURRENCYUNIT = 0x400000b4;
|
||||||
|
const Keycode K_CURRENCYSUBUNIT = 0x400000b5;
|
||||||
|
const Keycode K_KP_LEFTPAREN = 0x400000b6;
|
||||||
|
const Keycode K_KP_RIGHTPAREN = 0x400000b7;
|
||||||
|
const Keycode K_KP_LEFTBRACE = 0x400000b8;
|
||||||
|
const Keycode K_KP_RIGHTBRACE = 0x400000b9;
|
||||||
|
const Keycode K_KP_TAB = 0x400000ba;
|
||||||
|
const Keycode K_KP_BACKSPACE = 0x400000bb;
|
||||||
|
const Keycode K_KP_A = 0x400000bc;
|
||||||
|
const Keycode K_KP_B = 0x400000bd;
|
||||||
|
const Keycode K_KP_C = 0x400000be;
|
||||||
|
const Keycode K_KP_D = 0x400000bf;
|
||||||
|
const Keycode K_KP_E = 0x400000c0;
|
||||||
|
const Keycode K_KP_F = 0x400000c1;
|
||||||
|
const Keycode K_KP_XOR = 0x400000c2;
|
||||||
|
const Keycode K_KP_POWER = 0x400000c3;
|
||||||
|
const Keycode K_KP_PERCENT = 0x400000c4;
|
||||||
|
const Keycode K_KP_LESS = 0x400000c5;
|
||||||
|
const Keycode K_KP_GREATER = 0x400000c6;
|
||||||
|
const Keycode K_KP_AMPERSAND = 0x400000c7;
|
||||||
|
const Keycode K_KP_DBLAMPERSAND = 0x400000c8;
|
||||||
|
const Keycode K_KP_VERTICALBAR = 0x400000c9;
|
||||||
|
const Keycode K_KP_DBLVERTICALBAR = 0x400000ca;
|
||||||
|
const Keycode K_KP_COLON = 0x400000cb;
|
||||||
|
const Keycode K_KP_HASH = 0x400000cc;
|
||||||
|
const Keycode K_KP_SPACE = 0x400000cd;
|
||||||
|
const Keycode K_KP_AT = 0x400000ce;
|
||||||
|
const Keycode K_KP_EXCLAM = 0x400000cf;
|
||||||
|
const Keycode K_KP_MEMSTORE = 0x400000d0;
|
||||||
|
const Keycode K_KP_MEMRECALL = 0x400000d1;
|
||||||
|
const Keycode K_KP_MEMCLEAR = 0x400000d2;
|
||||||
|
const Keycode K_KP_MEMADD = 0x400000d3;
|
||||||
|
const Keycode K_KP_MEMSUBTRACT = 0x400000d4;
|
||||||
|
const Keycode K_KP_MEMMULTIPLY = 0x400000d5;
|
||||||
|
const Keycode K_KP_MEMDIVIDE = 0x400000d6;
|
||||||
|
const Keycode K_KP_PLUSMINUS = 0x400000d7;
|
||||||
|
const Keycode K_KP_CLEAR = 0x400000d8;
|
||||||
|
const Keycode K_KP_CLEARENTRY = 0x400000d9;
|
||||||
|
const Keycode K_KP_BINARY = 0x400000da;
|
||||||
|
const Keycode K_KP_OCTAL = 0x400000db;
|
||||||
|
const Keycode K_KP_DECIMAL = 0x400000dc;
|
||||||
|
const Keycode K_KP_HEXADECIMAL = 0x400000dd;
|
||||||
|
const Keycode K_LCTRL = 0x400000e0;
|
||||||
|
const Keycode K_LSHIFT = 0x400000e1;
|
||||||
|
const Keycode K_LALT = 0x400000e2;
|
||||||
|
const Keycode K_LGUI = 0x400000e3;
|
||||||
|
const Keycode K_RCTRL = 0x400000e4;
|
||||||
|
const Keycode K_RSHIFT = 0x400000e5;
|
||||||
|
const Keycode K_RALT = 0x400000e6;
|
||||||
|
const Keycode K_RGUI = 0x400000e7;
|
||||||
|
const Keycode K_MODE = 0x40000101;
|
||||||
|
const Keycode K_SLEEP = 0x40000102;
|
||||||
|
const Keycode K_WAKE = 0x40000103;
|
||||||
|
const Keycode K_CHANNEL_INCREMENT = 0x40000104;
|
||||||
|
const Keycode K_CHANNEL_DECREMENT = 0x40000105;
|
||||||
|
const Keycode K_MEDIA_PLAY = 0x40000106;
|
||||||
|
const Keycode K_MEDIA_PAUSE = 0x40000107;
|
||||||
|
const Keycode K_MEDIA_RECORD = 0x40000108;
|
||||||
|
const Keycode K_MEDIA_FAST_FORWARD = 0x40000109;
|
||||||
|
const Keycode K_MEDIA_REWIND = 0x4000010a;
|
||||||
|
const Keycode K_MEDIA_NEXT_TRACK = 0x4000010b;
|
||||||
|
const Keycode K_MEDIA_PREVIOUS_TRACK = 0x4000010c;
|
||||||
|
const Keycode K_MEDIA_STOP = 0x4000010d;
|
||||||
|
const Keycode K_MEDIA_EJECT = 0x4000010e;
|
||||||
|
const Keycode K_MEDIA_PLAY_PAUSE = 0x4000010f;
|
||||||
|
const Keycode K_MEDIA_SELECT = 0x40000110;
|
||||||
|
const Keycode K_AC_NEW = 0x40000111;
|
||||||
|
const Keycode K_AC_OPEN = 0x40000112;
|
||||||
|
const Keycode K_AC_CLOSE = 0x40000113;
|
||||||
|
const Keycode K_AC_EXIT = 0x40000114;
|
||||||
|
const Keycode K_AC_SAVE = 0x40000115;
|
||||||
|
const Keycode K_AC_PRINT = 0x40000116;
|
||||||
|
const Keycode K_AC_PROPERTIES = 0x40000117;
|
||||||
|
const Keycode K_AC_SEARCH = 0x40000118;
|
||||||
|
const Keycode K_AC_HOME = 0x40000119;
|
||||||
|
const Keycode K_AC_BACK = 0x4000011a;
|
||||||
|
const Keycode K_AC_FORWARD = 0x4000011b;
|
||||||
|
const Keycode K_AC_STOP = 0x4000011c;
|
||||||
|
const Keycode K_AC_REFRESH = 0x4000011d;
|
||||||
|
const Keycode K_AC_BOOKMARKS = 0x4000011e;
|
||||||
|
const Keycode K_SOFTLEFT = 0x4000011f;
|
||||||
|
const Keycode K_SOFTRIGHT = 0x40000120;
|
||||||
|
const Keycode K_CALL = 0x40000121;
|
||||||
|
const Keycode K_ENDCALL = 0x40000122;
|
||||||
|
const Keycode K_LEFT_TAB = 0x20000001;
|
||||||
|
const Keycode K_LEVEL5_SHIFT = 0x20000002;
|
||||||
|
const Keycode K_MULTI_KEY_COMPOSE = 0x20000003;
|
||||||
|
const Keycode K_LMETA = 0x20000004;
|
||||||
|
const Keycode K_RMETA = 0x20000005;
|
||||||
|
const Keycode K_LHYPER = 0x20000006;
|
||||||
|
const Keycode K_RHYPER = 0x20000007;
|
||||||
|
|
||||||
|
typedef Keymod = ushort;
|
||||||
|
|
||||||
|
const Keymod KMOD_NONE = 0x0000;
|
||||||
|
const Keymod KMOD_LSHIFT = 0x0001;
|
||||||
|
const Keymod KMOD_RSHIFT = 0x0002;
|
||||||
|
const Keymod KMOD_LEVEL5 = 0x0004;
|
||||||
|
const Keymod KMOD_LCTRL = 0x0040;
|
||||||
|
const Keymod KMOD_RCTRL = 0x0080;
|
||||||
|
const Keymod KMOD_LALT = 0x0100;
|
||||||
|
const Keymod KMOD_RALT = 0x0200;
|
||||||
|
const Keymod KMOD_LGUI = 0x0400;
|
||||||
|
const Keymod KMOD_RGUI = 0x0800;
|
||||||
|
const Keymod KMOD_NUM = 0x1000;
|
||||||
|
const Keymod KMOD_CAPS = 0x2000;
|
||||||
|
const Keymod KMOD_MODE = 0x4000;
|
||||||
|
const Keymod KMOD_SCROLL = 0x8000;
|
||||||
|
const Keymod KMOD_CTRL = (KMOD_LCTRL | KMOD_RCTRL);
|
||||||
|
const Keymod KMOD_SHIFT = (KMOD_LSHIFT | KMOD_RSHIFT);
|
||||||
|
const Keymod KMOD_ALT = (KMOD_LALT | KMOD_RALT);
|
||||||
|
const Keymod KMOD_GUI = (KMOD_LGUI | KMOD_RGUI);
|
72
sdl3.c3l/sdl3_mouse.c3i
Normal file
72
sdl3.c3l/sdl3_mouse.c3i
Normal file
@ -0,0 +1,72 @@
|
|||||||
|
module sdl3::sdl;
|
||||||
|
|
||||||
|
typedef MouseID = uint;
|
||||||
|
|
||||||
|
typedef Cursor = void;
|
||||||
|
|
||||||
|
enum SystemCursor : inline CInt {
|
||||||
|
SYSTEM_CURSOR_DEFAULT,
|
||||||
|
SYSTEM_CURSOR_TEXT,
|
||||||
|
SYSTEM_CURSOR_WAIT,
|
||||||
|
SYSTEM_CURSOR_CROSSHAIR,
|
||||||
|
SYSTEM_CURSOR_PROGRESS,
|
||||||
|
SYSTEM_CURSOR_NWSE_RESIZE,
|
||||||
|
SYSTEM_CURSOR_NESW_RESIZE,
|
||||||
|
SYSTEM_CURSOR_EW_RESIZE,
|
||||||
|
SYSTEM_CURSOR_NS_RESIZE,
|
||||||
|
SYSTEM_CURSOR_MOVE,
|
||||||
|
SYSTEM_CURSOR_NOT_ALLOWED,
|
||||||
|
SYSTEM_CURSOR_POINTER,
|
||||||
|
SYSTEM_CURSOR_NW_RESIZE,
|
||||||
|
SYSTEM_CURSOR_N_RESIZE,
|
||||||
|
SYSTEM_CURSOR_NE_RESIZE,
|
||||||
|
SYSTEM_CURSOR_E_RESIZE,
|
||||||
|
SYSTEM_CURSOR_SE_RESIZE,
|
||||||
|
SYSTEM_CURSOR_S_RESIZE,
|
||||||
|
SYSTEM_CURSOR_SW_RESIZE,
|
||||||
|
SYSTEM_CURSOR_W_RESIZE,
|
||||||
|
SYSTEM_CURSOR_COUNT
|
||||||
|
}
|
||||||
|
|
||||||
|
enum MouseWheelDirection : inline CInt {
|
||||||
|
SDL_MOUSEWHEEL_NORMAL,
|
||||||
|
SDL_MOUSEWHEEL_FLIPPED
|
||||||
|
}
|
||||||
|
|
||||||
|
typedef MouseButtonFlags = uint;
|
||||||
|
|
||||||
|
const MouseButtonFlags BUTTON_LEFT = 1;
|
||||||
|
const MouseButtonFlags BUTTON_MIDDLE = 2;
|
||||||
|
const MouseButtonFlags BUTTON_RIGHT = 3;
|
||||||
|
const MouseButtonFlags BUTTON_X1 = 4;
|
||||||
|
const MouseButtonFlags BUTTON_X2 = 5;
|
||||||
|
|
||||||
|
macro MouseButtonFlags @button_mask(MouseButtonFlags $x) => (1 << (($x)-1));
|
||||||
|
const MouseButtonFlags BUTTON_LMASK = @button_mask(BUTTON_LEFT);
|
||||||
|
const MouseButtonFlags BUTTON_MMASK = @button_mask(BUTTON_MIDDLE);
|
||||||
|
const MouseButtonFlags BUTTON_RMASK = @button_mask(BUTTON_RIGHT);
|
||||||
|
const MouseButtonFlags BUTTON_X1MASK = @button_mask(BUTTON_X1);
|
||||||
|
const MouseButtonFlags BUTTON_X2MASK = @button_mask(BUTTON_X2);
|
||||||
|
|
||||||
|
extern fn bool has_mouse() @extern("SDL_HasMouse");
|
||||||
|
extern fn MouseID* get_mice(int *count) @extern("SDL_GetMice");
|
||||||
|
extern fn ZString get_mouse_name_for_id(MouseID instance_id) @extern("SDL_GetMouseNameForID");
|
||||||
|
extern fn Window* get_mouse_focus() @extern("SDL_GetMouseFocus");
|
||||||
|
extern fn MouseButtonFlags get_mouse_state(float *x, float *y) @extern("SDL_GetMouseState");
|
||||||
|
extern fn MouseButtonFlags get_global_mouse_state(float *x, float *y) @extern("SDL_GetGlobalMouseState");
|
||||||
|
extern fn MouseButtonFlags get_relative_mouse_state(float *x, float *y) @extern("SDL_GetRelativeMouseState");
|
||||||
|
extern fn void warp_mouse_in_window(Window* window, float x, float y) @extern("SDL_WarpMouseInWindow");
|
||||||
|
extern fn bool warp_mouse_global(float x, float y) @extern("SDL_WarpMouseGlobal");
|
||||||
|
extern fn bool set_window_relative_mouse_mode(Window* window, bool enabled) @extern("SDL_SetWindowRelativeMouseMode");
|
||||||
|
extern fn bool get_window_relative_mouse_mode(Window* window) @extern("SDL_GetWindowRelativeMouseMode");
|
||||||
|
extern fn bool capture_mouse(bool enabled) @extern("SDL_CaptureMouse");
|
||||||
|
extern fn Cursor* create_cursor(char *data, char *mask, int w, int h, int hot_x, int hot_y) @extern("SDL_CreateCursor");
|
||||||
|
extern fn Cursor* create_color_cursor(Surface *surface, int hot_x, int hot_y) @extern("SDL_CreateColorCursor");
|
||||||
|
extern fn Cursor* create_system_cursor(SystemCursor id) @extern("SDL_CreateSystemCursor");
|
||||||
|
extern fn bool set_cursor(Cursor* cursor) @extern("SDL_SetCursor");
|
||||||
|
extern fn Cursor* get_cursor() @extern("SDL_GetCursor");
|
||||||
|
extern fn Cursor* get_default_cursor() @extern("SDL_GetDefaultCursor");
|
||||||
|
extern fn void destroy_cursor(Cursor* cursor) @extern("SDL_DestroyCursor");
|
||||||
|
extern fn bool show_cursor() @extern("SDL_ShowCursor");
|
||||||
|
extern fn bool hide_cursor() @extern("SDL_HideCursor");
|
||||||
|
extern fn bool cursor_visible() @extern("SDL_CursorVisible");
|
27
sdl3.c3l/sdl3_pen.c3i
Normal file
27
sdl3.c3l/sdl3_pen.c3i
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
module sdl3::sdl;
|
||||||
|
|
||||||
|
typedef PenID = uint;
|
||||||
|
|
||||||
|
const MouseID PEN_MOUSEID = ((MouseID)-2);
|
||||||
|
const TouchID PEN_TOUCHID = ((TouchID)-2);
|
||||||
|
|
||||||
|
typedef PenInputFlags = uint;
|
||||||
|
|
||||||
|
const PenInputFlags PEN_INPUT_DOWN = (1 << 0);
|
||||||
|
const PenInputFlags PEN_INPUT_BUTTON_1 = (1 << 1);
|
||||||
|
const PenInputFlags PEN_INPUT_BUTTON_2 = (1 << 2);
|
||||||
|
const PenInputFlags PEN_INPUT_BUTTON_3 = (1 << 3);
|
||||||
|
const PenInputFlags PEN_INPUT_BUTTON_4 = (1 << 4);
|
||||||
|
const PenInputFlags PEN_INPUT_BUTTON_5 = (1 << 5);
|
||||||
|
const PenInputFlags PEN_INPUT_ERASER_TIP = (1 << 30);
|
||||||
|
|
||||||
|
enum PenAxis : inline CInt {
|
||||||
|
SDL_PEN_AXIS_PRESSURE,
|
||||||
|
SDL_PEN_AXIS_XTILT,
|
||||||
|
SDL_PEN_AXIS_YTILT,
|
||||||
|
SDL_PEN_AXIS_DISTANCE,
|
||||||
|
SDL_PEN_AXIS_ROTATION,
|
||||||
|
SDL_PEN_AXIS_SLIDER,
|
||||||
|
SDL_PEN_AXIS_TANGENTIAL_PRESSURE,
|
||||||
|
SDL_PEN_AXIS_COUNT
|
||||||
|
}
|
290
sdl3.c3l/sdl3_pixels.c3i
Normal file
290
sdl3.c3l/sdl3_pixels.c3i
Normal file
@ -0,0 +1,290 @@
|
|||||||
|
module sdl3::sdl;
|
||||||
|
|
||||||
|
const char ALPHA_OPAQUE = 255;
|
||||||
|
const char ALPHA_TRANSPARENT = 0;
|
||||||
|
const float ALPHA_OPAQUE_FLOAT = 1.0;
|
||||||
|
const float ALPHA_TRANSPARENT_FLOAT = 0.0;
|
||||||
|
|
||||||
|
enum PixelType : inline CInt {
|
||||||
|
PIXELTYPE_UNKNOWN,
|
||||||
|
PIXELTYPE_INDEX1,
|
||||||
|
PIXELTYPE_INDEX4,
|
||||||
|
PIXELTYPE_INDEX8,
|
||||||
|
PIXELTYPE_PACKED8,
|
||||||
|
PIXELTYPE_PACKED16,
|
||||||
|
PIXELTYPE_PACKED32,
|
||||||
|
PIXELTYPE_ARRAYU8,
|
||||||
|
PIXELTYPE_ARRAYU16,
|
||||||
|
PIXELTYPE_ARRAYU32,
|
||||||
|
PIXELTYPE_ARRAYF16,
|
||||||
|
PIXELTYPE_ARRAYF32,
|
||||||
|
PIXELTYPE_INDEX2
|
||||||
|
}
|
||||||
|
|
||||||
|
enum SDL_BitmapOrder : inline CInt {
|
||||||
|
BITMAPORDER_NONE,
|
||||||
|
BITMAPORDER_4321,
|
||||||
|
BITMAPORDER_1234
|
||||||
|
}
|
||||||
|
|
||||||
|
enum PackedOrder : inline CInt {
|
||||||
|
PACKEDORDER_NONE,
|
||||||
|
PACKEDORDER_XRGB,
|
||||||
|
PACKEDORDER_RGBX,
|
||||||
|
PACKEDORDER_ARGB,
|
||||||
|
PACKEDORDER_RGBA,
|
||||||
|
PACKEDORDER_XBGR,
|
||||||
|
PACKEDORDER_BGRX,
|
||||||
|
PACKEDORDER_ABGR,
|
||||||
|
PACKEDORDER_BGRA
|
||||||
|
}
|
||||||
|
|
||||||
|
enum ArrayOrder : inline CInt {
|
||||||
|
ARRAYORDER_NONE,
|
||||||
|
ARRAYORDER_RGB,
|
||||||
|
ARRAYORDER_RGBA,
|
||||||
|
ARRAYORDER_ARGB,
|
||||||
|
ARRAYORDER_BGR,
|
||||||
|
ARRAYORDER_BGRA,
|
||||||
|
ARRAYORDER_ABGR
|
||||||
|
}
|
||||||
|
|
||||||
|
enum PackedLayout : inline CInt {
|
||||||
|
PACKEDLAYOUT_NONE,
|
||||||
|
PACKEDLAYOUT_332,
|
||||||
|
PACKEDLAYOUT_4444,
|
||||||
|
PACKEDLAYOUT_1555,
|
||||||
|
PACKEDLAYOUT_5551,
|
||||||
|
PACKEDLAYOUT_565,
|
||||||
|
PACKEDLAYOUT_8888,
|
||||||
|
PACKEDLAYOUT_2101010,
|
||||||
|
PACKEDLAYOUT_1010102
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO: a bunch of pixleformat related macros here i don't want to bother implementing
|
||||||
|
|
||||||
|
typedef PixelFormat = CInt;
|
||||||
|
|
||||||
|
const PixelFormat PIXELFORMAT_UNKNOWN = 0;
|
||||||
|
const PixelFormat PIXELFORMAT_INDEX1LSB = 0x11100100;
|
||||||
|
const PixelFormat PIXELFORMAT_INDEX1MSB = 0x11200100;
|
||||||
|
const PixelFormat PIXELFORMAT_INDEX2LSB = 0x1c100200;
|
||||||
|
const PixelFormat PIXELFORMAT_INDEX2MSB = 0x1c200200;
|
||||||
|
const PixelFormat PIXELFORMAT_INDEX4LSB = 0x12100400;
|
||||||
|
const PixelFormat PIXELFORMAT_INDEX4MSB = 0x12200400;
|
||||||
|
const PixelFormat PIXELFORMAT_INDEX8 = 0x13000801;
|
||||||
|
const PixelFormat PIXELFORMAT_RGB332 = 0x14110801;
|
||||||
|
const PixelFormat PIXELFORMAT_XRGB4444 = 0x15120c02;
|
||||||
|
const PixelFormat PIXELFORMAT_XBGR4444 = 0x15520c02;
|
||||||
|
const PixelFormat PIXELFORMAT_XRGB1555 = 0x15130f02;
|
||||||
|
const PixelFormat PIXELFORMAT_XBGR1555 = 0x15530f02;
|
||||||
|
const PixelFormat PIXELFORMAT_ARGB4444 = 0x15321002;
|
||||||
|
const PixelFormat PIXELFORMAT_RGBA4444 = 0x15421002;
|
||||||
|
const PixelFormat PIXELFORMAT_ABGR4444 = 0x15721002;
|
||||||
|
const PixelFormat PIXELFORMAT_BGRA4444 = 0x15821002;
|
||||||
|
const PixelFormat PIXELFORMAT_ARGB1555 = 0x15331002;
|
||||||
|
const PixelFormat PIXELFORMAT_RGBA5551 = 0x15441002;
|
||||||
|
const PixelFormat PIXELFORMAT_ABGR1555 = 0x15731002;
|
||||||
|
const PixelFormat PIXELFORMAT_BGRA5551 = 0x15841002;
|
||||||
|
const PixelFormat PIXELFORMAT_RGB565 = 0x15151002;
|
||||||
|
const PixelFormat PIXELFORMAT_BGR565 = 0x15551002;
|
||||||
|
const PixelFormat PIXELFORMAT_RGB24 = 0x17101803;
|
||||||
|
const PixelFormat PIXELFORMAT_BGR24 = 0x17401803;
|
||||||
|
const PixelFormat PIXELFORMAT_XRGB8888 = 0x16161804;
|
||||||
|
const PixelFormat PIXELFORMAT_RGBX8888 = 0x16261804;
|
||||||
|
const PixelFormat PIXELFORMAT_XBGR8888 = 0x16561804;
|
||||||
|
const PixelFormat PIXELFORMAT_BGRX8888 = 0x16661804;
|
||||||
|
const PixelFormat PIXELFORMAT_ARGB8888 = 0x16362004;
|
||||||
|
const PixelFormat PIXELFORMAT_RGBA8888 = 0x16462004;
|
||||||
|
const PixelFormat PIXELFORMAT_ABGR8888 = 0x16762004;
|
||||||
|
const PixelFormat PIXELFORMAT_BGRA8888 = 0x16862004;
|
||||||
|
const PixelFormat PIXELFORMAT_XRGB2101010 = 0x16172004;
|
||||||
|
const PixelFormat PIXELFORMAT_XBGR2101010 = 0x16572004;
|
||||||
|
const PixelFormat PIXELFORMAT_ARGB2101010 = 0x16372004;
|
||||||
|
const PixelFormat PIXELFORMAT_ABGR2101010 = 0x16772004;
|
||||||
|
const PixelFormat PIXELFORMAT_RGB48 = 0x18103006;
|
||||||
|
const PixelFormat PIXELFORMAT_BGR48 = 0x18403006;
|
||||||
|
const PixelFormat PIXELFORMAT_RGBA64 = 0x18204008;
|
||||||
|
const PixelFormat PIXELFORMAT_ARGB64 = 0x18304008;
|
||||||
|
const PixelFormat PIXELFORMAT_BGRA64 = 0x18504008;
|
||||||
|
const PixelFormat PIXELFORMAT_ABGR64 = 0x18604008;
|
||||||
|
const PixelFormat PIXELFORMAT_RGB48_FLOAT = 0x1a103006;
|
||||||
|
const PixelFormat PIXELFORMAT_BGR48_FLOAT = 0x1a403006;
|
||||||
|
const PixelFormat PIXELFORMAT_RGBA64_FLOAT = 0x1a204008;
|
||||||
|
const PixelFormat PIXELFORMAT_ARGB64_FLOAT = 0x1a304008;
|
||||||
|
const PixelFormat PIXELFORMAT_BGRA64_FLOAT = 0x1a504008;
|
||||||
|
const PixelFormat PIXELFORMAT_ABGR64_FLOAT = 0x1a604008;
|
||||||
|
const PixelFormat PIXELFORMAT_RGB96_FLOAT = 0x1b10600c;
|
||||||
|
const PixelFormat PIXELFORMAT_BGR96_FLOAT = 0x1b40600c;
|
||||||
|
const PixelFormat PIXELFORMAT_RGBA128_FLOAT = 0x1b208010;
|
||||||
|
const PixelFormat PIXELFORMAT_ARGB128_FLOAT = 0x1b308010;
|
||||||
|
const PixelFormat PIXELFORMAT_BGRA128_FLOAT = 0x1b508010;
|
||||||
|
const PixelFormat PIXELFORMAT_ABGR128_FLOAT = 0x1b608010;
|
||||||
|
const PixelFormat PIXELFORMAT_YV12 = 0x32315659;
|
||||||
|
const PixelFormat PIXELFORMAT_IYUV = 0x56555949;
|
||||||
|
const PixelFormat PIXELFORMAT_YUY2 = 0x32595559;
|
||||||
|
const PixelFormat PIXELFORMAT_UYVY = 0x59565955;
|
||||||
|
const PixelFormat PIXELFORMAT_YVYU = 0x55595659;
|
||||||
|
const PixelFormat PIXELFORMAT_NV12 = 0x3231564e;
|
||||||
|
const PixelFormat PIXELFORMAT_NV21 = 0x3132564e;
|
||||||
|
const PixelFormat PIXELFORMAT_P010 = 0x30313050;
|
||||||
|
const PixelFormat PIXELFORMAT_EXTERNAL_OES = 0x2053454f;
|
||||||
|
const PixelFormat PIXELFORMAT_MJPG = 0x47504a4d;
|
||||||
|
// FIXME: this only works in little-endian systems
|
||||||
|
const PixelFormat PIXELFORMAT_RGBA32 = PIXELFORMAT_ABGR8888;
|
||||||
|
const PixelFormat PIXELFORMAT_ARGB32 = PIXELFORMAT_BGRA8888;
|
||||||
|
const PixelFormat PIXELFORMAT_BGRA32 = PIXELFORMAT_ARGB8888;
|
||||||
|
const PixelFormat PIXELFORMAT_ABGR32 = PIXELFORMAT_RGBA8888;
|
||||||
|
const PixelFormat PIXELFORMAT_RGBX32 = PIXELFORMAT_XBGR8888;
|
||||||
|
const PixelFormat PIXELFORMAT_XRGB32 = PIXELFORMAT_BGRX8888;
|
||||||
|
const PixelFormat PIXELFORMAT_BGRX32 = PIXELFORMAT_XRGB8888;
|
||||||
|
const PixelFormat PIXELFORMAT_XBGR32 = PIXELFORMAT_RGBX8888;
|
||||||
|
|
||||||
|
|
||||||
|
enum ColorType : inline CInt {
|
||||||
|
COLOR_TYPE_UNKNOWN,
|
||||||
|
COLOR_TYPE_RGB,
|
||||||
|
COLOR_TYPE_YCBCR
|
||||||
|
}
|
||||||
|
|
||||||
|
enum ColorRange : inline CInt {
|
||||||
|
COLOR_RANGE_UNKNOWN,
|
||||||
|
COLOR_RANGE_LIMITED,
|
||||||
|
COLOR_RANGE_FULL
|
||||||
|
}
|
||||||
|
|
||||||
|
typedef ColorPrimaries = CInt;
|
||||||
|
|
||||||
|
const ColorPrimaries COLOR_PRIMARIES_UNKNOWN = 0;
|
||||||
|
const ColorPrimaries COLOR_PRIMARIES_BT709 = 1;
|
||||||
|
const ColorPrimaries COLOR_PRIMARIES_UNSPECIFIED = 2;
|
||||||
|
const ColorPrimaries COLOR_PRIMARIES_BT470M = 4;
|
||||||
|
const ColorPrimaries COLOR_PRIMARIES_BT470BG = 5;
|
||||||
|
const ColorPrimaries COLOR_PRIMARIES_BT601 = 6;
|
||||||
|
const ColorPrimaries COLOR_PRIMARIES_SMPTE240 = 7;
|
||||||
|
const ColorPrimaries COLOR_PRIMARIES_GENERIC_FILM = 8;
|
||||||
|
const ColorPrimaries COLOR_PRIMARIES_BT2020 = 9;
|
||||||
|
const ColorPrimaries COLOR_PRIMARIES_XYZ = 10;
|
||||||
|
const ColorPrimaries COLOR_PRIMARIES_SMPTE431 = 11;
|
||||||
|
const ColorPrimaries COLOR_PRIMARIES_SMPTE432 = 12;
|
||||||
|
const ColorPrimaries COLOR_PRIMARIES_EBU3213 = 22;
|
||||||
|
const ColorPrimaries COLOR_PRIMARIES_CUSTOM = 31;
|
||||||
|
|
||||||
|
typedef TransferCharacteristics = CInt;
|
||||||
|
|
||||||
|
const TransferCharacteristics TRANSFER_CHARACTERISTICS_UNKNOWN = 0;
|
||||||
|
const TransferCharacteristics TRANSFER_CHARACTERISTICS_BT709 = 1;
|
||||||
|
const TransferCharacteristics TRANSFER_CHARACTERISTICS_UNSPECIFIED = 2;
|
||||||
|
const TransferCharacteristics TRANSFER_CHARACTERISTICS_GAMMA22 = 4;
|
||||||
|
const TransferCharacteristics TRANSFER_CHARACTERISTICS_GAMMA28 = 5;
|
||||||
|
const TransferCharacteristics TRANSFER_CHARACTERISTICS_BT601 = 6;
|
||||||
|
const TransferCharacteristics TRANSFER_CHARACTERISTICS_SMPTE240 = 7;
|
||||||
|
const TransferCharacteristics TRANSFER_CHARACTERISTICS_LINEAR = 8;
|
||||||
|
const TransferCharacteristics TRANSFER_CHARACTERISTICS_LOG100 = 9;
|
||||||
|
const TransferCharacteristics TRANSFER_CHARACTERISTICS_LOG100_SQRT10 = 10;
|
||||||
|
const TransferCharacteristics TRANSFER_CHARACTERISTICS_IEC61966 = 11;
|
||||||
|
const TransferCharacteristics TRANSFER_CHARACTERISTICS_BT1361 = 12;
|
||||||
|
const TransferCharacteristics TRANSFER_CHARACTERISTICS_SRGB = 13;
|
||||||
|
const TransferCharacteristics TRANSFER_CHARACTERISTICS_BT2020_10BIT = 14;
|
||||||
|
const TransferCharacteristics TRANSFER_CHARACTERISTICS_BT2020_12BIT = 15;
|
||||||
|
const TransferCharacteristics TRANSFER_CHARACTERISTICS_PQ = 16;
|
||||||
|
const TransferCharacteristics TRANSFER_CHARACTERISTICS_SMPTE428 = 17;
|
||||||
|
const TransferCharacteristics TRANSFER_CHARACTERISTICS_HLG = 18;
|
||||||
|
const TransferCharacteristics TRANSFER_CHARACTERISTICS_CUSTOM = 31;
|
||||||
|
|
||||||
|
typedef MatrixCoefficients = CInt;
|
||||||
|
|
||||||
|
const MatrixCoefficients MATRIX_COEFFICIENTS_IDENTITY = 0;
|
||||||
|
const MatrixCoefficients MATRIX_COEFFICIENTS_BT709 = 1;
|
||||||
|
const MatrixCoefficients MATRIX_COEFFICIENTS_UNSPECIFIED = 2;
|
||||||
|
const MatrixCoefficients MATRIX_COEFFICIENTS_FCC = 4;
|
||||||
|
const MatrixCoefficients MATRIX_COEFFICIENTS_BT470BG = 5;
|
||||||
|
const MatrixCoefficients MATRIX_COEFFICIENTS_BT601 = 6;
|
||||||
|
const MatrixCoefficients MATRIX_COEFFICIENTS_SMPTE240 = 7;
|
||||||
|
const MatrixCoefficients MATRIX_COEFFICIENTS_YCGCO = 8;
|
||||||
|
const MatrixCoefficients MATRIX_COEFFICIENTS_BT2020_NCL = 9;
|
||||||
|
const MatrixCoefficients MATRIX_COEFFICIENTS_BT2020_CL = 10;
|
||||||
|
const MatrixCoefficients MATRIX_COEFFICIENTS_SMPTE2085 = 11;
|
||||||
|
const MatrixCoefficients MATRIX_COEFFICIENTS_CHROMA_DERIVED_NCL = 12;
|
||||||
|
const MatrixCoefficients MATRIX_COEFFICIENTS_CHROMA_DERIVED_CL = 13;
|
||||||
|
const MatrixCoefficients MATRIX_COEFFICIENTS_ICTCP = 14;
|
||||||
|
const MatrixCoefficients MATRIX_COEFFICIENTS_CUSTOM = 31;
|
||||||
|
|
||||||
|
|
||||||
|
typedef ChromaLocation = CInt;
|
||||||
|
|
||||||
|
const ChromaLocation CHROMA_LOCATION_NONE = 0;
|
||||||
|
const ChromaLocation CHROMA_LOCATION_LEFT = 1;
|
||||||
|
const ChromaLocation CHROMA_LOCATION_CENTER = 2;
|
||||||
|
const ChromaLocation CHROMA_LOCATION_TOPLEFT = 3;
|
||||||
|
|
||||||
|
|
||||||
|
// TODO: a bunch color space related macros are omitted
|
||||||
|
|
||||||
|
typedef Colorspace = CInt;
|
||||||
|
|
||||||
|
const Colorspace COLORSPACE_UNKNOWN = 0;
|
||||||
|
const Colorspace COLORSPACE_SRGB = 0x120005a0;
|
||||||
|
const Colorspace COLORSPACE_SRGB_LINEAR = 0x12000500;
|
||||||
|
const Colorspace COLORSPACE_HDR10 = 0x12002600;
|
||||||
|
const Colorspace COLORSPACE_JPEG = 0x220004c6;
|
||||||
|
const Colorspace COLORSPACE_BT601_LIMITED = 0x211018c6;
|
||||||
|
const Colorspace COLORSPACE_BT601_FULL = 0x221018c6;
|
||||||
|
const Colorspace COLORSPACE_BT709_LIMITED = 0x21100421;
|
||||||
|
const Colorspace COLORSPACE_BT709_FULL = 0x22100421;
|
||||||
|
const Colorspace COLORSPACE_BT2020_LIMITED = 0x21102609;
|
||||||
|
const Colorspace COLORSPACE_BT2020_FULL = 0x22102609;
|
||||||
|
const Colorspace COLORSPACE_RGB_DEFAULT = COLORSPACE_SRGB;
|
||||||
|
const Colorspace COLORSPACE_YUV_DEFAULT = COLORSPACE_JPEG;
|
||||||
|
|
||||||
|
struct Color {
|
||||||
|
char r;
|
||||||
|
char g;
|
||||||
|
char b;
|
||||||
|
char a;
|
||||||
|
}
|
||||||
|
|
||||||
|
struct FColor {
|
||||||
|
float r;
|
||||||
|
float g;
|
||||||
|
float b;
|
||||||
|
float a;
|
||||||
|
}
|
||||||
|
|
||||||
|
struct Palette {
|
||||||
|
int ncolors;
|
||||||
|
Color* colors;
|
||||||
|
uint version;
|
||||||
|
int refcount;
|
||||||
|
}
|
||||||
|
|
||||||
|
struct PixelFormatDetails {
|
||||||
|
PixelFormat format;
|
||||||
|
char bits_per_pixel;
|
||||||
|
char bytes_per_pixel;
|
||||||
|
char[2] padding;
|
||||||
|
uint rmask;
|
||||||
|
uint gmask;
|
||||||
|
uint bmask;
|
||||||
|
uint amask;
|
||||||
|
char rbits;
|
||||||
|
char gbits;
|
||||||
|
char bbits;
|
||||||
|
char abits;
|
||||||
|
char rshift;
|
||||||
|
char gshift;
|
||||||
|
char bshift;
|
||||||
|
char ashift;
|
||||||
|
}
|
||||||
|
|
||||||
|
extern fn ZString get_pixel_format_name(PixelFormat format) @extern("SDL_GetPixelFormatName");
|
||||||
|
extern fn bool get_masks_for_pixel_format(PixelFormat format, int *bpp, uint *rmask, uint *gmask, uint *bmask, uint *amask) @extern("SDL_GetMasksForPixelFormat");
|
||||||
|
extern fn PixelFormat get_pixel_format_for_masks(int bpp, uint rmask, uint gmask, uint bmask, uint amask) @extern("SDL_GetPixelFormatForMasks");
|
||||||
|
extern fn PixelFormatDetails* get_pixel_format_details(PixelFormat format) @extern("SDL_GetPixelFormatDetails");
|
||||||
|
extern fn Palette* create_palette(int ncolors) @extern("SDL_CreatePalette");
|
||||||
|
extern fn bool set_palette_colors(Palette* palette, Color* colors, int firstcolor, int ncolors) @extern("SDL_SetPaletteColors");
|
||||||
|
extern fn void destroy_palette(Palette* palette) @extern("SDL_DestroyPalette");
|
||||||
|
extern fn uint map_rgb(PixelFormatDetails *format, Palette* palette, char r, char g, char b) @extern("SDL_MapRGB");
|
||||||
|
extern fn uint map_rgba(PixelFormatDetails *format, Palette* palette, char r, char g, char b, char a) @extern("SDL_MapRGBA");
|
||||||
|
extern fn void get_rgb(uint pixel, PixelFormatDetails *format, Palette* palette, char *r, char *g, char *b) @extern("SDL_GetRGB");
|
||||||
|
extern fn void get_rgba(uint pixel, PixelFormatDetails *format, Palette* palette, char *r, char *g, char *b, char *a) @extern("SDL_GetRGBA");
|
12
sdl3.c3l/sdl3_power.c3i
Normal file
12
sdl3.c3l/sdl3_power.c3i
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
module sdl3::sdl;
|
||||||
|
|
||||||
|
typedef PowerState = CInt;
|
||||||
|
|
||||||
|
const PowerState POWERSTATE_ERROR = -1;
|
||||||
|
const PowerState POWERSTATE_UNKNOWN = 0;
|
||||||
|
const PowerState POWERSTATE_ON_BATTERY = 1;
|
||||||
|
const PowerState POWERSTATE_NO_BATTERY = 2;
|
||||||
|
const PowerState POWERSTATE_CHARGING = 3;
|
||||||
|
const PowerState POWERSTATE_CHARGED = 4;
|
||||||
|
|
||||||
|
extern fn PowerState get_power_info(int *seconds, int *percent) @extern("SDL_GetPowerInfo");
|
40
sdl3.c3l/sdl3_properties.c3i
Normal file
40
sdl3.c3l/sdl3_properties.c3i
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
module sdl3::sdl;
|
||||||
|
|
||||||
|
typedef PropertiesID = uint;
|
||||||
|
|
||||||
|
enum PropertyType : inline CInt {
|
||||||
|
PROPERTY_TYPE_INVALID,
|
||||||
|
PROPERTY_TYPE_POINTER,
|
||||||
|
PROPERTY_TYPE_STRING,
|
||||||
|
PROPERTY_TYPE_NUMBER,
|
||||||
|
PROPERTY_TYPE_FLOAT,
|
||||||
|
PROPERTY_TYPE_BOOLEAN
|
||||||
|
}
|
||||||
|
|
||||||
|
extern fn PropertiesID get_global_properties() @extern("SDL_GetGlobalProperties");
|
||||||
|
extern fn PropertiesID create_properties() @extern("SDL_CreateProperties");
|
||||||
|
extern fn bool copy_properties(PropertiesID src, PropertiesID dst) @extern("SDL_CopyProperties");
|
||||||
|
extern fn bool lock_properties(PropertiesID props) @extern("SDL_LockProperties");
|
||||||
|
extern fn void unlock_properties(PropertiesID props) @extern("SDL_UnlockProperties");
|
||||||
|
|
||||||
|
alias CleanupPropertyCallback = fn void(void* userdata, void* value);
|
||||||
|
|
||||||
|
extern fn bool set_pointer_property_with_cleanup(PropertiesID props, ZString name, void* value, CleanupPropertyCallback cleanup, void* userdata) @extern("SDL_SetPointerPropertyWithCleanup");
|
||||||
|
extern fn bool set_pointer_property(PropertiesID props, ZString name, void* value) @extern("SDL_SetPointerProperty");
|
||||||
|
extern fn bool set_string_property(PropertiesID props, ZString name, ZString value) @extern("SDL_SetStringProperty");
|
||||||
|
extern fn bool set_number_property(PropertiesID props, ZString name, long value) @extern("SDL_SetNumberProperty");
|
||||||
|
extern fn bool set_float_property(PropertiesID props, ZString name, float value) @extern("SDL_SetFloatProperty");
|
||||||
|
extern fn bool set_boolean_property(PropertiesID props, ZString name, bool value) @extern("SDL_SetBooleanProperty");
|
||||||
|
extern fn bool has_property(PropertiesID props, ZString name) @extern("SDL_HasProperty");
|
||||||
|
extern fn PropertyType get_property_type(PropertiesID props, ZString name) @extern("SDL_GetPropertyType");
|
||||||
|
extern fn void* get_pointer_property(PropertiesID props, ZString name, void* default_value) @extern("SDL_GetPointerProperty");
|
||||||
|
extern fn ZString get_string_property(PropertiesID props, ZString name, ZString default_value) @extern("SDL_GetStringProperty");
|
||||||
|
extern fn long get_number_property(PropertiesID props, ZString name, long default_value) @extern("SDL_GetNumberProperty");
|
||||||
|
extern fn float get_float_property(PropertiesID props, ZString name, float default_value) @extern("SDL_GetFloatProperty");
|
||||||
|
extern fn bool get_boolean_property(PropertiesID props, ZString name, bool default_value) @extern("SDL_GetBooleanProperty");
|
||||||
|
extern fn bool clear_property(PropertiesID props, ZString name) @extern("SDL_ClearProperty");
|
||||||
|
|
||||||
|
alias EnumeratePropertiesCallback = fn void(void* userdata, PropertiesID props, ZString name);
|
||||||
|
|
||||||
|
extern fn bool enumerate_properties(PropertiesID props, EnumeratePropertiesCallback callback, void* userdata) @extern("SDL_EnumerateProperties");
|
||||||
|
extern fn void destroy_properties(PropertiesID props) @extern("SDL_DestroyProperties");
|
86
sdl3.c3l/sdl3_rect.c3i
Normal file
86
sdl3.c3l/sdl3_rect.c3i
Normal file
@ -0,0 +1,86 @@
|
|||||||
|
module sdl3::sdl;
|
||||||
|
|
||||||
|
struct Point {
|
||||||
|
int x;
|
||||||
|
int y;
|
||||||
|
}
|
||||||
|
|
||||||
|
struct FPoint {
|
||||||
|
float x;
|
||||||
|
float y;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
struct Rect {
|
||||||
|
int x, y;
|
||||||
|
int w, h;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
struct FRect {
|
||||||
|
float x;
|
||||||
|
float y;
|
||||||
|
float w;
|
||||||
|
float h;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
macro void rect_to_f_rect(Rect* rect, FRect* frect)
|
||||||
|
{
|
||||||
|
frect.x = (float)rect.x;
|
||||||
|
frect.y = (float)rect.y;
|
||||||
|
frect.w = (float)rect.w;
|
||||||
|
frect.h = (float)rect.h;
|
||||||
|
}
|
||||||
|
|
||||||
|
macro bool point_in_rect(Point* p, Rect* r)
|
||||||
|
{
|
||||||
|
return ( p && r && (p.x >= r.x) && (p.x < (r.x + r.w)) &&
|
||||||
|
(p.y >= r.y) && (p.y < (r.y + r.h)) ) ? true : false;
|
||||||
|
}
|
||||||
|
|
||||||
|
macro bool rect_empty(Rect* r)
|
||||||
|
{
|
||||||
|
return ((!r) || (r.w <= 0) || (r.h <= 0)) ? true : false;
|
||||||
|
}
|
||||||
|
|
||||||
|
macro bool rects_equal(Rect* a, Rect* b)
|
||||||
|
{
|
||||||
|
return (a && b && (a.x == b.x) && (a.y == b.y) &&
|
||||||
|
(a.w == b.w) && (a.h == b.h)) ? true : false;
|
||||||
|
}
|
||||||
|
|
||||||
|
extern fn bool has_rect_intersection(Rect* a , Rect* b) @extern("SDL_HasRectIntersection");
|
||||||
|
extern fn bool get_rect_intersection(Rect* a , Rect* b, Rect* result) @extern("SDL_GetRectIntersection");
|
||||||
|
extern fn bool get_rect_union(Rect* a , Rect* b, Rect* result) @extern("SDL_GetRectUnion");
|
||||||
|
extern fn bool get_rect_enclosing_points(Point* points, int count, Rect* clip, Rect* result) @extern("SDL_GetRectEnclosingPoints");
|
||||||
|
extern fn bool get_rect_and_line_intersection(Rect* rect, int* x1, int* y1, int* x2, int* y2) @extern("SDL_GetRectAndLineIntersection");
|
||||||
|
|
||||||
|
macro bool point_in_rect_float(FPoint* p, FRect *r)
|
||||||
|
{
|
||||||
|
return ( p && r && (p.x >= r.x) && (p.x <= (r.x + r.w)) &&
|
||||||
|
(p.y >= r.y) && (p.y <= (r.y + r.h)) ) ? true : false;
|
||||||
|
}
|
||||||
|
|
||||||
|
macro bool rect_empty_float(FRect* r)
|
||||||
|
{
|
||||||
|
return ((!r) || (r.w < 0.0f) || (r.h < 0.0f)) ? true : false;
|
||||||
|
}
|
||||||
|
|
||||||
|
macro bool rects_equal_epsilon(FRect* a, FRect* b, float epsilon)
|
||||||
|
{
|
||||||
|
return (a && b && ((a == b) ||
|
||||||
|
((fabsf(a.x - b.x) <= epsilon) &&
|
||||||
|
(fabsf(a.y - b.y) <= epsilon) &&
|
||||||
|
(fabsf(a.w - b.w) <= epsilon) &&
|
||||||
|
(fabsf(a.h - b.h) <= epsilon))))
|
||||||
|
? true : false;
|
||||||
|
}
|
||||||
|
|
||||||
|
macro bool rects_equal_float(FRect* a, FRect* b) => rects_equal_epsilon(a, b, FLT_EPSILON);
|
||||||
|
|
||||||
|
extern fn bool has_rect_intersection_float(FRect* a , FRect* b) @extern("SDL_HasRectIntersectionFloat");
|
||||||
|
extern fn bool get_rect_intersection_float(FRect* a , FRect* b, FRect* result) @extern("SDL_GetRectIntersectionFloat");
|
||||||
|
extern fn bool get_rect_union_float(FRect* a , FRect* b, FRect* result) @extern("SDL_GetRectUnionFloat");
|
||||||
|
extern fn bool get_rect_enclosing_points_float(FPoint* points, int count, FRect* clip, FRect* result) @extern("SDL_GetRectEnclosingPointsFloat");
|
||||||
|
extern fn bool get_rect_and_line_intersection_float(FRect* rect, float* x1, float* y1, float* x2, float* y2) @extern("SDL_GetRectAndLineIntersectionFloat");
|
216
sdl3.c3l/sdl3_renderer.c3i
Normal file
216
sdl3.c3l/sdl3_renderer.c3i
Normal file
@ -0,0 +1,216 @@
|
|||||||
|
module sdl3::sdl;
|
||||||
|
|
||||||
|
const ZString SOFTWARE_RENDERER = "software";
|
||||||
|
|
||||||
|
struct Vertex {
|
||||||
|
FPoint position;
|
||||||
|
FColor color;
|
||||||
|
FPoint tex_coord;
|
||||||
|
}
|
||||||
|
|
||||||
|
enum TextureAccess : inline CInt {
|
||||||
|
TEXTUREACCESS_STATIC,
|
||||||
|
TEXTUREACCESS_STREAMING,
|
||||||
|
TEXTUREACCESS_TARGET
|
||||||
|
}
|
||||||
|
|
||||||
|
enum RendererLogicalPresentation {
|
||||||
|
LOGICAL_PRESENTATION_DISABLED,
|
||||||
|
LOGICAL_PRESENTATION_STRETCH,
|
||||||
|
LOGICAL_PRESENTATION_LETTERBOX,
|
||||||
|
LOGICAL_PRESENTATION_OVERSCAN,
|
||||||
|
LOGICAL_PRESENTATION_INTEGER_SCALE
|
||||||
|
}
|
||||||
|
|
||||||
|
typedef Renderer = void;
|
||||||
|
typedef Texture = void;
|
||||||
|
|
||||||
|
extern fn int get_num_render_drivers() @extern("SDL_GetNumRenderDrivers");
|
||||||
|
extern fn ZString get_render_driver(int index) @extern("SDL_GetRenderDriver");
|
||||||
|
extern fn bool create_window_and_renderer(ZString title, int width, int height, WindowFlags window_flags, Window **window, Renderer **renderer) @extern("SDL_CreateWindowAndRenderer");
|
||||||
|
extern fn Renderer* create_renderer(Window* window, ZString name) @extern("SDL_CreateRenderer");
|
||||||
|
extern fn Renderer* create_renderer_with_properties(PropertiesID props) @extern("SDL_CreateRendererWithProperties");
|
||||||
|
|
||||||
|
const ZString PROP_RENDERER_CREATE_NAME_STRING = "SDL.renderer.create.name";
|
||||||
|
const ZString PROP_RENDERER_CREATE_WINDOW_POINTER = "SDL.renderer.create.window";
|
||||||
|
const ZString PROP_RENDERER_CREATE_SURFACE_POINTER = "SDL.renderer.create.surface";
|
||||||
|
const ZString PROP_RENDERER_CREATE_OUTPUT_COLORSPACE_NUMBER = "SDL.renderer.create.output_colorspace";
|
||||||
|
const ZString PROP_RENDERER_CREATE_PRESENT_VSYNC_NUMBER = "SDL.renderer.create.present_vsync";
|
||||||
|
const ZString PROP_RENDERER_CREATE_VULKAN_INSTANCE_POINTER = "SDL.renderer.create.vulkan.instance";
|
||||||
|
const ZString PROP_RENDERER_CREATE_VULKAN_SURFACE_NUMBER = "SDL.renderer.create.vulkan.surface";
|
||||||
|
const ZString PROP_RENDERER_CREATE_VULKAN_PHYSICAL_DEVICE_POINTER = "SDL.renderer.create.vulkan.physical_device";
|
||||||
|
const ZString PROP_RENDERER_CREATE_VULKAN_DEVICE_POINTER = "SDL.renderer.create.vulkan.device";
|
||||||
|
const ZString PROP_RENDERER_CREATE_VULKAN_GRAPHICS_QUEUE_FAMILY_INDEX_NUMBER = "SDL.renderer.create.vulkan.graphics_queue_family_index";
|
||||||
|
const ZString PROP_RENDERER_CREATE_VULKAN_PRESENT_QUEUE_FAMILY_INDEX_NUMBER = "SDL.renderer.create.vulkan.present_queue_family_index";
|
||||||
|
|
||||||
|
extern fn Renderer* create_software_renderer(Surface *surface) @extern("SDL_CreateSoftwareRenderer");
|
||||||
|
extern fn Renderer* get_renderer(Window* window) @extern("SDL_GetRenderer");
|
||||||
|
extern fn Window* get_render_window(Renderer* renderer) @extern("SDL_GetRenderWindow");
|
||||||
|
extern fn ZString get_renderer_name(Renderer* renderer) @extern("SDL_GetRendererName");
|
||||||
|
extern fn PropertiesID get_renderer_properties(Renderer* renderer) @extern("SDL_GetRendererProperties");
|
||||||
|
|
||||||
|
const ZString PROP_RENDERER_NAME_STRING = "SDL.renderer.name";
|
||||||
|
const ZString PROP_RENDERER_WINDOW_POINTER = "SDL.renderer.window";
|
||||||
|
const ZString PROP_RENDERER_SURFACE_POINTER = "SDL.renderer.surface";
|
||||||
|
const ZString PROP_RENDERER_VSYNC_NUMBER = "SDL.renderer.vsync";
|
||||||
|
const ZString PROP_RENDERER_MAX_TEXTURE_SIZE_NUMBER = "SDL.renderer.max_texture_size";
|
||||||
|
const ZString PROP_RENDERER_TEXTURE_FORMATS_POINTER = "SDL.renderer.texture_formats";
|
||||||
|
const ZString PROP_RENDERER_OUTPUT_COLORSPACE_NUMBER = "SDL.renderer.output_colorspace";
|
||||||
|
const ZString PROP_RENDERER_HDR_ENABLED_BOOLEAN = "SDL.renderer.HDR_enabled";
|
||||||
|
const ZString PROP_RENDERER_SDR_WHITE_POINT_FLOAT = "SDL.renderer.SDR_white_point";
|
||||||
|
const ZString PROP_RENDERER_HDR_HEADROOM_FLOAT = "SDL.renderer.HDR_headroom";
|
||||||
|
const ZString PROP_RENDERER_D3D9_DEVICE_POINTER = "SDL.renderer.d3d9.device";
|
||||||
|
const ZString PROP_RENDERER_D3D11_DEVICE_POINTER = "SDL.renderer.d3d11.device";
|
||||||
|
const ZString PROP_RENDERER_D3D11_SWAPCHAIN_POINTER = "SDL.renderer.d3d11.swap_chain";
|
||||||
|
const ZString PROP_RENDERER_D3D12_DEVICE_POINTER = "SDL.renderer.d3d12.device";
|
||||||
|
const ZString PROP_RENDERER_D3D12_SWAPCHAIN_POINTER = "SDL.renderer.d3d12.swap_chain";
|
||||||
|
const ZString PROP_RENDERER_D3D12_COMMAND_QUEUE_POINTER = "SDL.renderer.d3d12.command_queue";
|
||||||
|
const ZString PROP_RENDERER_VULKAN_INSTANCE_POINTER = "SDL.renderer.vulkan.instance";
|
||||||
|
const ZString PROP_RENDERER_VULKAN_SURFACE_NUMBER = "SDL.renderer.vulkan.surface";
|
||||||
|
const ZString PROP_RENDERER_VULKAN_PHYSICAL_DEVICE_POINTER = "SDL.renderer.vulkan.physical_device";
|
||||||
|
const ZString PROP_RENDERER_VULKAN_DEVICE_POINTER = "SDL.renderer.vulkan.device";
|
||||||
|
const ZString PROP_RENDERER_VULKAN_GRAPHICS_QUEUE_FAMILY_INDEX_NUMBER = "SDL.renderer.vulkan.graphics_queue_family_index";
|
||||||
|
const ZString PROP_RENDERER_VULKAN_PRESENT_QUEUE_FAMILY_INDEX_NUMBER = "SDL.renderer.vulkan.present_queue_family_index";
|
||||||
|
const ZString PROP_RENDERER_VULKAN_SWAPCHAIN_IMAGE_COUNT_NUMBER = "SDL.renderer.vulkan.swapchain_image_count";
|
||||||
|
const ZString PROP_RENDERER_GPU_DEVICE_POINTER = "SDL.renderer.gpu.device";
|
||||||
|
|
||||||
|
extern fn bool get_render_output_size(Renderer* renderer, int *w, int *h) @extern("SDL_GetRenderOutputSize");
|
||||||
|
extern fn bool get_current_render_output_size(Renderer* renderer, int *w, int *h) @extern("SDL_GetCurrentRenderOutputSize");
|
||||||
|
extern fn Texture* create_texture(Renderer* renderer, PixelFormat format, TextureAccess access, int w, int h) @extern("SDL_CreateTexture");
|
||||||
|
extern fn Texture* create_texture_from_surface(Renderer* renderer, Surface *surface) @extern("SDL_CreateTextureFromSurface");
|
||||||
|
extern fn Texture* create_texture_with_properties(Renderer* renderer, PropertiesID props) @extern("SDL_CreateTextureWithProperties");
|
||||||
|
|
||||||
|
const ZString PROP_TEXTURE_CREATE_COLORSPACE_NUMBER = "SDL.texture.create.colorspace";
|
||||||
|
const ZString PROP_TEXTURE_CREATE_FORMAT_NUMBER = "SDL.texture.create.format";
|
||||||
|
const ZString PROP_TEXTURE_CREATE_ACCESS_NUMBER = "SDL.texture.create.access";
|
||||||
|
const ZString PROP_TEXTURE_CREATE_WIDTH_NUMBER = "SDL.texture.create.width";
|
||||||
|
const ZString PROP_TEXTURE_CREATE_HEIGHT_NUMBER = "SDL.texture.create.height";
|
||||||
|
const ZString PROP_TEXTURE_CREATE_SDR_WHITE_POINT_FLOAT = "SDL.texture.create.SDR_white_point";
|
||||||
|
const ZString PROP_TEXTURE_CREATE_HDR_HEADROOM_FLOAT = "SDL.texture.create.HDR_headroom";
|
||||||
|
const ZString PROP_TEXTURE_CREATE_D3D11_TEXTURE_POINTER = "SDL.texture.create.d3d11.texture";
|
||||||
|
const ZString PROP_TEXTURE_CREATE_D3D11_TEXTURE_U_POINTER = "SDL.texture.create.d3d11.texture_u";
|
||||||
|
const ZString PROP_TEXTURE_CREATE_D3D11_TEXTURE_V_POINTER = "SDL.texture.create.d3d11.texture_v";
|
||||||
|
const ZString PROP_TEXTURE_CREATE_D3D12_TEXTURE_POINTER = "SDL.texture.create.d3d12.texture";
|
||||||
|
const ZString PROP_TEXTURE_CREATE_D3D12_TEXTURE_U_POINTER = "SDL.texture.create.d3d12.texture_u";
|
||||||
|
const ZString PROP_TEXTURE_CREATE_D3D12_TEXTURE_V_POINTER = "SDL.texture.create.d3d12.texture_v";
|
||||||
|
const ZString PROP_TEXTURE_CREATE_METAL_PIXELBUFFER_POINTER = "SDL.texture.create.metal.pixelbuffer";
|
||||||
|
const ZString PROP_TEXTURE_CREATE_OPENGL_TEXTURE_NUMBER = "SDL.texture.create.opengl.texture";
|
||||||
|
const ZString PROP_TEXTURE_CREATE_OPENGL_TEXTURE_UV_NUMBER = "SDL.texture.create.opengl.texture_uv";
|
||||||
|
const ZString PROP_TEXTURE_CREATE_OPENGL_TEXTURE_U_NUMBER = "SDL.texture.create.opengl.texture_u";
|
||||||
|
const ZString PROP_TEXTURE_CREATE_OPENGL_TEXTURE_V_NUMBER = "SDL.texture.create.opengl.texture_v";
|
||||||
|
const ZString PROP_TEXTURE_CREATE_OPENGLES2_TEXTURE_NUMBER = "SDL.texture.create.opengles2.texture";
|
||||||
|
const ZString PROP_TEXTURE_CREATE_OPENGLES2_TEXTURE_UV_NUMBER = "SDL.texture.create.opengles2.texture_uv";
|
||||||
|
const ZString PROP_TEXTURE_CREATE_OPENGLES2_TEXTURE_U_NUMBER = "SDL.texture.create.opengles2.texture_u";
|
||||||
|
const ZString PROP_TEXTURE_CREATE_OPENGLES2_TEXTURE_V_NUMBER = "SDL.texture.create.opengles2.texture_v";
|
||||||
|
const ZString PROP_TEXTURE_CREATE_VULKAN_TEXTURE_NUMBER = "SDL.texture.create.vulkan.texture";
|
||||||
|
|
||||||
|
extern fn PropertiesID get_texture_properties(Texture* texture) @extern("SDL_GetTextureProperties");
|
||||||
|
|
||||||
|
const ZString PROP_TEXTURE_COLORSPACE_NUMBER = "SDL.texture.colorspace";
|
||||||
|
const ZString PROP_TEXTURE_FORMAT_NUMBER = "SDL.texture.format";
|
||||||
|
const ZString PROP_TEXTURE_ACCESS_NUMBER = "SDL.texture.access";
|
||||||
|
const ZString PROP_TEXTURE_WIDTH_NUMBER = "SDL.texture.width";
|
||||||
|
const ZString PROP_TEXTURE_HEIGHT_NUMBER = "SDL.texture.height";
|
||||||
|
const ZString PROP_TEXTURE_SDR_WHITE_POINT_FLOAT = "SDL.texture.SDR_white_point";
|
||||||
|
const ZString PROP_TEXTURE_HDR_HEADROOM_FLOAT = "SDL.texture.HDR_headroom";
|
||||||
|
const ZString PROP_TEXTURE_D3D11_TEXTURE_POINTER = "SDL.texture.d3d11.texture";
|
||||||
|
const ZString PROP_TEXTURE_D3D11_TEXTURE_U_POINTER = "SDL.texture.d3d11.texture_u";
|
||||||
|
const ZString PROP_TEXTURE_D3D11_TEXTURE_V_POINTER = "SDL.texture.d3d11.texture_v";
|
||||||
|
const ZString PROP_TEXTURE_D3D12_TEXTURE_POINTER = "SDL.texture.d3d12.texture";
|
||||||
|
const ZString PROP_TEXTURE_D3D12_TEXTURE_U_POINTER = "SDL.texture.d3d12.texture_u";
|
||||||
|
const ZString PROP_TEXTURE_D3D12_TEXTURE_V_POINTER = "SDL.texture.d3d12.texture_v";
|
||||||
|
const ZString PROP_TEXTURE_OPENGL_TEXTURE_NUMBER = "SDL.texture.opengl.texture";
|
||||||
|
const ZString PROP_TEXTURE_OPENGL_TEXTURE_UV_NUMBER = "SDL.texture.opengl.texture_uv";
|
||||||
|
const ZString PROP_TEXTURE_OPENGL_TEXTURE_U_NUMBER = "SDL.texture.opengl.texture_u";
|
||||||
|
const ZString PROP_TEXTURE_OPENGL_TEXTURE_V_NUMBER = "SDL.texture.opengl.texture_v";
|
||||||
|
const ZString PROP_TEXTURE_OPENGL_TEXTURE_TARGET_NUMBER = "SDL.texture.opengl.target";
|
||||||
|
const ZString PROP_TEXTURE_OPENGL_TEX_W_FLOAT = "SDL.texture.opengl.tex_w";
|
||||||
|
const ZString PROP_TEXTURE_OPENGL_TEX_H_FLOAT = "SDL.texture.opengl.tex_h";
|
||||||
|
const ZString PROP_TEXTURE_OPENGLES2_TEXTURE_NUMBER = "SDL.texture.opengles2.texture";
|
||||||
|
const ZString PROP_TEXTURE_OPENGLES2_TEXTURE_UV_NUMBER = "SDL.texture.opengles2.texture_uv";
|
||||||
|
const ZString PROP_TEXTURE_OPENGLES2_TEXTURE_U_NUMBER = "SDL.texture.opengles2.texture_u";
|
||||||
|
const ZString PROP_TEXTURE_OPENGLES2_TEXTURE_V_NUMBER = "SDL.texture.opengles2.texture_v";
|
||||||
|
const ZString PROP_TEXTURE_OPENGLES2_TEXTURE_TARGET_NUMBER = "SDL.texture.opengles2.target";
|
||||||
|
const ZString PROP_TEXTURE_VULKAN_TEXTURE_NUMBER = "SDL.texture.vulkan.texture";
|
||||||
|
|
||||||
|
extern fn Renderer* get_renderer_from_texture(Texture* texture) @extern("SDL_GetRendererFromTexture");
|
||||||
|
extern fn bool get_texture_size(Texture* texture, float *w, float *h) @extern("SDL_GetTextureSize");
|
||||||
|
extern fn bool set_texture_color_mod(Texture* texture, char r, char g, char b) @extern("SDL_SetTextureColorMod");
|
||||||
|
extern fn bool set_texture_color_mod_float(Texture* texture, float r, float g, float b) @extern("SDL_SetTextureColorModFloat");
|
||||||
|
extern fn bool get_texture_color_mod(Texture* texture, char* r, char* g, char* b) @extern("SDL_GetTextureColorMod");
|
||||||
|
extern fn bool get_texture_color_mod_float(Texture* texture, float *r, float *g, float *b) @extern("SDL_GetTextureColorModFloat");
|
||||||
|
extern fn bool set_texture_alpha_mod(Texture* texture, char alpha) @extern("SDL_SetTextureAlphaMod");
|
||||||
|
extern fn bool set_texture_alpha_mod_float(Texture* texture, float alpha) @extern("SDL_SetTextureAlphaModFloat");
|
||||||
|
extern fn bool get_texture_alpha_mod(Texture* texture, char* alpha) @extern("SDL_GetTextureAlphaMod");
|
||||||
|
extern fn bool get_texture_alpha_mod_float(Texture* texture, float *alpha) @extern("SDL_GetTextureAlphaModFloat");
|
||||||
|
extern fn bool set_texture_blend_mode(Texture* texture, BlendMode blendMode) @extern("SDL_SetTextureBlendMode");
|
||||||
|
extern fn bool get_texture_blend_mode(Texture* texture, BlendMode *blendMode) @extern("SDL_GetTextureBlendMode");
|
||||||
|
extern fn bool set_texture_scale_mode(Texture* texture, ScaleMode scaleMode) @extern("SDL_SetTextureScaleMode");
|
||||||
|
extern fn bool get_texture_scale_mode(Texture* texture, ScaleMode *scaleMode) @extern("SDL_GetTextureScaleMode");
|
||||||
|
extern fn bool update_texture(Texture* texture, Rect* rect, void* pixels, int pitch) @extern("SDL_UpdateTexture");
|
||||||
|
extern fn bool update_yuv_texture(Texture* texture, Rect* rect, char* yplane, int ypitch, char* uplane, int upitch, char* vplane, int vpitch) @extern("SDL_UpdateYUVTexture");
|
||||||
|
extern fn bool update_nv_texture(Texture* texture, Rect* rect, char* yplane, int ypitch, char* u_vplane, int u_vpitch) @extern("SDL_UpdateNVTexture");
|
||||||
|
extern fn bool lock_texture(Texture* texture, Rect* rect, void **pixels, int *pitch) @extern("SDL_LockTexture");
|
||||||
|
extern fn bool lock_texture_to_surface(Texture* texture, Rect* rect, Surface **surface) @extern("SDL_LockTextureToSurface");
|
||||||
|
extern fn void unlock_texture(Texture* texture) @extern("SDL_UnlockTexture");
|
||||||
|
extern fn bool set_render_target(Renderer* renderer, Texture* texture) @extern("SDL_SetRenderTarget");
|
||||||
|
extern fn Texture* get_render_target(Renderer* renderer) @extern("SDL_GetRenderTarget");
|
||||||
|
extern fn bool set_render_logical_presentation(Renderer* renderer, int w, int h, RendererLogicalPresentation mode) @extern("SDL_SetRenderLogicalPresentation");
|
||||||
|
extern fn bool get_render_logical_presentation(Renderer* renderer, int *w, int *h, RendererLogicalPresentation *mode) @extern("SDL_GetRenderLogicalPresentation");
|
||||||
|
extern fn bool get_render_logical_presentation_rect(Renderer* renderer, FRect *rect) @extern("SDL_GetRenderLogicalPresentationRect");
|
||||||
|
extern fn bool render_coordinates_from_window(Renderer* renderer, float window_x, float window_y, float *x, float *y) @extern("SDL_RenderCoordinatesFromWindow");
|
||||||
|
extern fn bool render_coordinates_to_window(Renderer* renderer, float x, float y, float *window_x, float *window_y) @extern("SDL_RenderCoordinatesToWindow");
|
||||||
|
extern fn bool convert_event_to_render_coordinates(Renderer* renderer, Event *event) @extern("SDL_ConvertEventToRenderCoordinates");
|
||||||
|
extern fn bool set_render_viewport(Renderer* renderer, Rect* rect) @extern("SDL_SetRenderViewport");
|
||||||
|
extern fn bool get_render_viewport(Renderer* renderer, Rect* rect) @extern("SDL_GetRenderViewport");
|
||||||
|
extern fn bool render_viewport_set(Renderer* renderer) @extern("SDL_RenderViewportSet");
|
||||||
|
extern fn bool get_render_safe_area(Renderer* renderer, Rect* rect) @extern("SDL_GetRenderSafeArea");
|
||||||
|
extern fn bool set_render_clip_rect(Renderer* renderer, Rect* rect) @extern("SDL_SetRenderClipRect");
|
||||||
|
extern fn bool get_render_clip_rect(Renderer* renderer, Rect* rect) @extern("SDL_GetRenderClipRect");
|
||||||
|
extern fn bool render_clip_enabled(Renderer* renderer) @extern("SDL_RenderClipEnabled");
|
||||||
|
extern fn bool set_render_scale(Renderer* renderer, float scaleX, float scaleY) @extern("SDL_SetRenderScale");
|
||||||
|
extern fn bool get_render_scale(Renderer* renderer, float *scaleX, float *scaleY) @extern("SDL_GetRenderScale");
|
||||||
|
extern fn bool set_render_draw_color(Renderer* renderer, char r, char g, char b, char a) @extern("SDL_SetRenderDrawColor");
|
||||||
|
extern fn bool set_render_draw_color_float(Renderer* renderer, float r, float g, float b, float a) @extern("SDL_SetRenderDrawColorFloat");
|
||||||
|
extern fn bool get_render_draw_color(Renderer* renderer, char* r, char* g, char* b, char* a) @extern("SDL_GetRenderDrawColor");
|
||||||
|
extern fn bool get_render_draw_color_float(Renderer* renderer, float *r, float *g, float *b, float *a) @extern("SDL_GetRenderDrawColorFloat");
|
||||||
|
extern fn bool set_render_color_scale(Renderer* renderer, float scale) @extern("SDL_SetRenderColorScale");
|
||||||
|
extern fn bool get_render_color_scale(Renderer* renderer, float *scale) @extern("SDL_GetRenderColorScale");
|
||||||
|
extern fn bool set_render_draw_blend_mode(Renderer* renderer, BlendMode blendMode) @extern("SDL_SetRenderDrawBlendMode");
|
||||||
|
extern fn bool get_render_draw_blend_mode(Renderer* renderer, BlendMode *blendMode) @extern("SDL_GetRenderDrawBlendMode");
|
||||||
|
extern fn bool render_clear(Renderer* renderer) @extern("SDL_RenderClear");
|
||||||
|
extern fn bool render_point(Renderer* renderer, float x, float y) @extern("SDL_RenderPoint");
|
||||||
|
extern fn bool render_points(Renderer* renderer, FPoint* points, int count) @extern("SDL_RenderPoints");
|
||||||
|
extern fn bool render_line(Renderer* renderer, float x1, float y1, float x2, float y2) @extern("SDL_RenderLine");
|
||||||
|
extern fn bool render_lines(Renderer* renderer, FPoint* points, int count) @extern("SDL_RenderLines");
|
||||||
|
extern fn bool render_rect(Renderer* renderer, FRect* rect) @extern("SDL_RenderRect");
|
||||||
|
extern fn bool render_rects(Renderer* renderer, FRect* rects, int count) @extern("SDL_RenderRects");
|
||||||
|
extern fn bool render_fill_rect(Renderer* renderer, FRect* rect) @extern("SDL_RenderFillRect");
|
||||||
|
extern fn bool render_fill_rects(Renderer* renderer, FRect* rects, int count) @extern("SDL_RenderFillRects");
|
||||||
|
extern fn bool render_texture(Renderer* renderer, Texture* texture, FRect* srcrect, FRect* dstrect) @extern("SDL_RenderTexture");
|
||||||
|
extern fn bool render_texture_rotated(Renderer* renderer, Texture* texture, FRect* srcrect, FRect* dstrect, double angle, FPoint* center, FlipMode flip) @extern("SDL_RenderTextureRotated");
|
||||||
|
extern fn bool render_texture_affine(Renderer* renderer, Texture* texture, FRect* srcrect, FPoint* origin, FPoint* right, FPoint* down) @extern("SDL_RenderTextureAffine");
|
||||||
|
extern fn bool render_texture_tiled(Renderer* renderer, Texture* texture, FRect* srcrect, float scale, FRect* dstrect) @extern("SDL_RenderTextureTiled");
|
||||||
|
extern fn bool render_texture9_grid(Renderer* renderer, Texture* texture, FRect* srcrect, float left_width, float right_width, float top_height, float bottom_height, float scale, FRect* dstrect) @extern("SDL_RenderTexture9Grid");
|
||||||
|
extern fn bool render_geometry(Renderer* renderer, Texture* texture, Vertex* vertices, int num_vertices, int* indices, int num_indices) @extern("SDL_RenderGeometry");
|
||||||
|
extern fn bool render_geometry_raw(Renderer* renderer, Texture* texture, float* xy, int xy_stride, FColor* color, int color_stride, float* uv, int uv_stride, int num_vertices, void* indices, int num_indices, int size_indices) @extern("SDL_RenderGeometryRaw");
|
||||||
|
extern fn Surface* render_read_pixels(Renderer* renderer, Rect* rect) @extern("SDL_RenderReadPixels");
|
||||||
|
extern fn bool render_present(Renderer* renderer) @extern("SDL_RenderPresent");
|
||||||
|
extern fn void destroy_texture(Texture* texture) @extern("SDL_DestroyTexture");
|
||||||
|
extern fn void destroy_renderer(Renderer* renderer) @extern("SDL_DestroyRenderer");
|
||||||
|
extern fn bool flush_renderer(Renderer* renderer) @extern("SDL_FlushRenderer");
|
||||||
|
extern fn void* get_render_metal_layer(Renderer* renderer) @extern("SDL_GetRenderMetalLayer");
|
||||||
|
extern fn void* get_render_metal_command_encoder(Renderer* renderer) @extern("SDL_GetRenderMetalCommandEncoder");
|
||||||
|
extern fn bool add_vulkan_render_semaphores(Renderer* renderer, uint wait_stage_mask, long wait_semaphore, long signal_semaphore) @extern("SDL_AddVulkanRenderSemaphores");
|
||||||
|
extern fn bool set_render_v_sync(Renderer* renderer, int vsync) @extern("SDL_SetRenderVSync");
|
||||||
|
|
||||||
|
const int RENDERER_VSYNC_DISABLED = 0;
|
||||||
|
const int RENDERER_VSYNC_ADAPTIVE = -1;
|
||||||
|
|
||||||
|
extern fn bool get_render_v_sync(Renderer* renderer, int* vsync) @extern("SDL_GetRenderVSync");
|
||||||
|
|
||||||
|
const int DEBUG_TEXT_FONT_CHARACTER_SIZE = 8;
|
||||||
|
|
||||||
|
extern fn bool render_debug_text(Renderer* renderer, float x, float y, ZString str) @extern("SDL_RenderDebugText");
|
||||||
|
extern fn bool render_debug_text_format(Renderer* renderer, float x, float y, ZString fmt, ...) @extern("SDL_RenderDebugTextFormat");
|
||||||
|
|
253
sdl3.c3l/sdl3_scancode.c3i
Normal file
253
sdl3.c3l/sdl3_scancode.c3i
Normal file
@ -0,0 +1,253 @@
|
|||||||
|
module sdl3::sdl;
|
||||||
|
|
||||||
|
typedef Scancode = CInt;
|
||||||
|
|
||||||
|
const Scancode SCANCODE_UNKNOWN = 0;
|
||||||
|
const Scancode SCANCODE_A = 4;
|
||||||
|
const Scancode SCANCODE_B = 5;
|
||||||
|
const Scancode SCANCODE_C = 6;
|
||||||
|
const Scancode SCANCODE_D = 7;
|
||||||
|
const Scancode SCANCODE_E = 8;
|
||||||
|
const Scancode SCANCODE_F = 9;
|
||||||
|
const Scancode SCANCODE_G = 10;
|
||||||
|
const Scancode SCANCODE_H = 11;
|
||||||
|
const Scancode SCANCODE_I = 12;
|
||||||
|
const Scancode SCANCODE_J = 13;
|
||||||
|
const Scancode SCANCODE_K = 14;
|
||||||
|
const Scancode SCANCODE_L = 15;
|
||||||
|
const Scancode SCANCODE_M = 16;
|
||||||
|
const Scancode SCANCODE_N = 17;
|
||||||
|
const Scancode SCANCODE_O = 18;
|
||||||
|
const Scancode SCANCODE_P = 19;
|
||||||
|
const Scancode SCANCODE_Q = 20;
|
||||||
|
const Scancode SCANCODE_R = 21;
|
||||||
|
const Scancode SCANCODE_S = 22;
|
||||||
|
const Scancode SCANCODE_T = 23;
|
||||||
|
const Scancode SCANCODE_U = 24;
|
||||||
|
const Scancode SCANCODE_V = 25;
|
||||||
|
const Scancode SCANCODE_W = 26;
|
||||||
|
const Scancode SCANCODE_X = 27;
|
||||||
|
const Scancode SCANCODE_Y = 28;
|
||||||
|
const Scancode SCANCODE_Z = 29;
|
||||||
|
const Scancode SCANCODE_1 = 30;
|
||||||
|
const Scancode SCANCODE_2 = 31;
|
||||||
|
const Scancode SCANCODE_3 = 32;
|
||||||
|
const Scancode SCANCODE_4 = 33;
|
||||||
|
const Scancode SCANCODE_5 = 34;
|
||||||
|
const Scancode SCANCODE_6 = 35;
|
||||||
|
const Scancode SCANCODE_7 = 36;
|
||||||
|
const Scancode SCANCODE_8 = 37;
|
||||||
|
const Scancode SCANCODE_9 = 38;
|
||||||
|
const Scancode SCANCODE_0 = 39;
|
||||||
|
const Scancode SCANCODE_RETURN = 40;
|
||||||
|
const Scancode SCANCODE_ESCAPE = 41;
|
||||||
|
const Scancode SCANCODE_BACKSPACE = 42;
|
||||||
|
const Scancode SCANCODE_TAB = 43;
|
||||||
|
const Scancode SCANCODE_SPACE = 44;
|
||||||
|
const Scancode SCANCODE_MINUS = 45;
|
||||||
|
const Scancode SCANCODE_EQUALS = 46;
|
||||||
|
const Scancode SCANCODE_LEFTBRACKET = 47;
|
||||||
|
const Scancode SCANCODE_RIGHTBRACKET = 48;
|
||||||
|
const Scancode SCANCODE_BACKSLASH = 49;
|
||||||
|
const Scancode SCANCODE_NONUSHASH = 50;
|
||||||
|
const Scancode SCANCODE_SEMICOLON = 51;
|
||||||
|
const Scancode SCANCODE_APOSTROPHE = 52;
|
||||||
|
const Scancode SCANCODE_GRAVE = 53;
|
||||||
|
const Scancode SCANCODE_COMMA = 54;
|
||||||
|
const Scancode SCANCODE_PERIOD = 55;
|
||||||
|
const Scancode SCANCODE_SLASH = 56;
|
||||||
|
const Scancode SCANCODE_CAPSLOCK = 57;
|
||||||
|
const Scancode SCANCODE_F1 = 58;
|
||||||
|
const Scancode SCANCODE_F2 = 59;
|
||||||
|
const Scancode SCANCODE_F3 = 60;
|
||||||
|
const Scancode SCANCODE_F4 = 61;
|
||||||
|
const Scancode SCANCODE_F5 = 62;
|
||||||
|
const Scancode SCANCODE_F6 = 63;
|
||||||
|
const Scancode SCANCODE_F7 = 64;
|
||||||
|
const Scancode SCANCODE_F8 = 65;
|
||||||
|
const Scancode SCANCODE_F9 = 66;
|
||||||
|
const Scancode SCANCODE_F10 = 67;
|
||||||
|
const Scancode SCANCODE_F11 = 68;
|
||||||
|
const Scancode SCANCODE_F12 = 69;
|
||||||
|
const Scancode SCANCODE_PRINTSCREEN = 70;
|
||||||
|
const Scancode SCANCODE_SCROLLLOCK = 71;
|
||||||
|
const Scancode SCANCODE_PAUSE = 72;
|
||||||
|
const Scancode SCANCODE_INSERT = 73;
|
||||||
|
const Scancode SCANCODE_HOME = 74;
|
||||||
|
const Scancode SCANCODE_PAGEUP = 75;
|
||||||
|
const Scancode SCANCODE_DELETE = 76;
|
||||||
|
const Scancode SCANCODE_END = 77;
|
||||||
|
const Scancode SCANCODE_PAGEDOWN = 78;
|
||||||
|
const Scancode SCANCODE_RIGHT = 79;
|
||||||
|
const Scancode SCANCODE_LEFT = 80;
|
||||||
|
const Scancode SCANCODE_DOWN = 81;
|
||||||
|
const Scancode SCANCODE_UP = 82;
|
||||||
|
const Scancode SCANCODE_NUMLOCKCLEAR = 83;
|
||||||
|
const Scancode SCANCODE_KP_DIVIDE = 84;
|
||||||
|
const Scancode SCANCODE_KP_MULTIPLY = 85;
|
||||||
|
const Scancode SCANCODE_KP_MINUS = 86;
|
||||||
|
const Scancode SCANCODE_KP_PLUS = 87;
|
||||||
|
const Scancode SCANCODE_KP_ENTER = 88;
|
||||||
|
const Scancode SCANCODE_KP_1 = 89;
|
||||||
|
const Scancode SCANCODE_KP_2 = 90;
|
||||||
|
const Scancode SCANCODE_KP_3 = 91;
|
||||||
|
const Scancode SCANCODE_KP_4 = 92;
|
||||||
|
const Scancode SCANCODE_KP_5 = 93;
|
||||||
|
const Scancode SCANCODE_KP_6 = 94;
|
||||||
|
const Scancode SCANCODE_KP_7 = 95;
|
||||||
|
const Scancode SCANCODE_KP_8 = 96;
|
||||||
|
const Scancode SCANCODE_KP_9 = 97;
|
||||||
|
const Scancode SCANCODE_KP_0 = 98;
|
||||||
|
const Scancode SCANCODE_KP_PERIOD = 99;
|
||||||
|
const Scancode SCANCODE_NONUSBACKSLASH = 100;
|
||||||
|
const Scancode SCANCODE_APPLICATION = 101;
|
||||||
|
const Scancode SCANCODE_POWER = 102;
|
||||||
|
const Scancode SCANCODE_KP_EQUALS = 103;
|
||||||
|
const Scancode SCANCODE_F13 = 104;
|
||||||
|
const Scancode SCANCODE_F14 = 105;
|
||||||
|
const Scancode SCANCODE_F15 = 106;
|
||||||
|
const Scancode SCANCODE_F16 = 107;
|
||||||
|
const Scancode SCANCODE_F17 = 108;
|
||||||
|
const Scancode SCANCODE_F18 = 109;
|
||||||
|
const Scancode SCANCODE_F19 = 110;
|
||||||
|
const Scancode SCANCODE_F20 = 111;
|
||||||
|
const Scancode SCANCODE_F21 = 112;
|
||||||
|
const Scancode SCANCODE_F22 = 113;
|
||||||
|
const Scancode SCANCODE_F23 = 114;
|
||||||
|
const Scancode SCANCODE_F24 = 115;
|
||||||
|
const Scancode SCANCODE_EXECUTE = 116;
|
||||||
|
const Scancode SCANCODE_HELP = 117;
|
||||||
|
const Scancode SCANCODE_MENU = 118;
|
||||||
|
const Scancode SCANCODE_SELECT = 119;
|
||||||
|
const Scancode SCANCODE_STOP = 120;
|
||||||
|
const Scancode SCANCODE_AGAIN = 121;
|
||||||
|
const Scancode SCANCODE_UNDO = 122;
|
||||||
|
const Scancode SCANCODE_CUT = 123;
|
||||||
|
const Scancode SCANCODE_COPY = 124;
|
||||||
|
const Scancode SCANCODE_PASTE = 125;
|
||||||
|
const Scancode SCANCODE_FIND = 126;
|
||||||
|
const Scancode SCANCODE_MUTE = 127;
|
||||||
|
const Scancode SCANCODE_VOLUMEUP = 128;
|
||||||
|
const Scancode SCANCODE_VOLUMEDOWN = 129;
|
||||||
|
const Scancode SCANCODE_KP_COMMA = 133;
|
||||||
|
const Scancode SCANCODE_KP_EQUALSAS400 = 134;
|
||||||
|
const Scancode SCANCODE_INTERNATIONAL1 = 135;
|
||||||
|
const Scancode SCANCODE_INTERNATIONAL2 = 136;
|
||||||
|
const Scancode SCANCODE_INTERNATIONAL3 = 137;
|
||||||
|
const Scancode SCANCODE_INTERNATIONAL4 = 138;
|
||||||
|
const Scancode SCANCODE_INTERNATIONAL5 = 139;
|
||||||
|
const Scancode SCANCODE_INTERNATIONAL6 = 140;
|
||||||
|
const Scancode SCANCODE_INTERNATIONAL7 = 141;
|
||||||
|
const Scancode SCANCODE_INTERNATIONAL8 = 142;
|
||||||
|
const Scancode SCANCODE_INTERNATIONAL9 = 143;
|
||||||
|
const Scancode SCANCODE_LANG1 = 144;
|
||||||
|
const Scancode SCANCODE_LANG2 = 145;
|
||||||
|
const Scancode SCANCODE_LANG3 = 146;
|
||||||
|
const Scancode SCANCODE_LANG4 = 147;
|
||||||
|
const Scancode SCANCODE_LANG5 = 148;
|
||||||
|
const Scancode SCANCODE_LANG6 = 149;
|
||||||
|
const Scancode SCANCODE_LANG7 = 150;
|
||||||
|
const Scancode SCANCODE_LANG8 = 151;
|
||||||
|
const Scancode SCANCODE_LANG9 = 152;
|
||||||
|
const Scancode SCANCODE_ALTERASE = 153;
|
||||||
|
const Scancode SCANCODE_SYSREQ = 154;
|
||||||
|
const Scancode SCANCODE_CANCEL = 155;
|
||||||
|
const Scancode SCANCODE_CLEAR = 156;
|
||||||
|
const Scancode SCANCODE_PRIOR = 157;
|
||||||
|
const Scancode SCANCODE_RETURN2 = 158;
|
||||||
|
const Scancode SCANCODE_SEPARATOR = 159;
|
||||||
|
const Scancode SCANCODE_OUT = 160;
|
||||||
|
const Scancode SCANCODE_OPER = 161;
|
||||||
|
const Scancode SCANCODE_CLEARAGAIN = 162;
|
||||||
|
const Scancode SCANCODE_CRSEL = 163;
|
||||||
|
const Scancode SCANCODE_EXSEL = 164;
|
||||||
|
const Scancode SCANCODE_KP_00 = 176;
|
||||||
|
const Scancode SCANCODE_KP_000 = 177;
|
||||||
|
const Scancode SCANCODE_THOUSANDSSEPARATOR = 178;
|
||||||
|
const Scancode SCANCODE_DECIMALSEPARATOR = 179;
|
||||||
|
const Scancode SCANCODE_CURRENCYUNIT = 180;
|
||||||
|
const Scancode SCANCODE_CURRENCYSUBUNIT = 181;
|
||||||
|
const Scancode SCANCODE_KP_LEFTPAREN = 182;
|
||||||
|
const Scancode SCANCODE_KP_RIGHTPAREN = 183;
|
||||||
|
const Scancode SCANCODE_KP_LEFTBRACE = 184;
|
||||||
|
const Scancode SCANCODE_KP_RIGHTBRACE = 185;
|
||||||
|
const Scancode SCANCODE_KP_TAB = 186;
|
||||||
|
const Scancode SCANCODE_KP_BACKSPACE = 187;
|
||||||
|
const Scancode SCANCODE_KP_A = 188;
|
||||||
|
const Scancode SCANCODE_KP_B = 189;
|
||||||
|
const Scancode SCANCODE_KP_C = 190;
|
||||||
|
const Scancode SCANCODE_KP_D = 191;
|
||||||
|
const Scancode SCANCODE_KP_E = 192;
|
||||||
|
const Scancode SCANCODE_KP_F = 193;
|
||||||
|
const Scancode SCANCODE_KP_XOR = 194;
|
||||||
|
const Scancode SCANCODE_KP_POWER = 195;
|
||||||
|
const Scancode SCANCODE_KP_PERCENT = 196;
|
||||||
|
const Scancode SCANCODE_KP_LESS = 197;
|
||||||
|
const Scancode SCANCODE_KP_GREATER = 198;
|
||||||
|
const Scancode SCANCODE_KP_AMPERSAND = 199;
|
||||||
|
const Scancode SCANCODE_KP_DBLAMPERSAND = 200;
|
||||||
|
const Scancode SCANCODE_KP_VERTICALBAR = 201;
|
||||||
|
const Scancode SCANCODE_KP_DBLVERTICALBAR = 202;
|
||||||
|
const Scancode SCANCODE_KP_COLON = 203;
|
||||||
|
const Scancode SCANCODE_KP_HASH = 204;
|
||||||
|
const Scancode SCANCODE_KP_SPACE = 205;
|
||||||
|
const Scancode SCANCODE_KP_AT = 206;
|
||||||
|
const Scancode SCANCODE_KP_EXCLAM = 207;
|
||||||
|
const Scancode SCANCODE_KP_MEMSTORE = 208;
|
||||||
|
const Scancode SCANCODE_KP_MEMRECALL = 209;
|
||||||
|
const Scancode SCANCODE_KP_MEMCLEAR = 210;
|
||||||
|
const Scancode SCANCODE_KP_MEMADD = 211;
|
||||||
|
const Scancode SCANCODE_KP_MEMSUBTRACT = 212;
|
||||||
|
const Scancode SCANCODE_KP_MEMMULTIPLY = 213;
|
||||||
|
const Scancode SCANCODE_KP_MEMDIVIDE = 214;
|
||||||
|
const Scancode SCANCODE_KP_PLUSMINUS = 215;
|
||||||
|
const Scancode SCANCODE_KP_CLEAR = 216;
|
||||||
|
const Scancode SCANCODE_KP_CLEARENTRY = 217;
|
||||||
|
const Scancode SCANCODE_KP_BINARY = 218;
|
||||||
|
const Scancode SCANCODE_KP_OCTAL = 219;
|
||||||
|
const Scancode SCANCODE_KP_DECIMAL = 220;
|
||||||
|
const Scancode SCANCODE_KP_HEXADECIMAL = 221;
|
||||||
|
const Scancode SCANCODE_LCTRL = 224;
|
||||||
|
const Scancode SCANCODE_LSHIFT = 225;
|
||||||
|
const Scancode SCANCODE_LALT = 226;
|
||||||
|
const Scancode SCANCODE_LGUI = 227;
|
||||||
|
const Scancode SCANCODE_RCTRL = 228;
|
||||||
|
const Scancode SCANCODE_RSHIFT = 229;
|
||||||
|
const Scancode SCANCODE_RALT = 230;
|
||||||
|
const Scancode SCANCODE_RGUI = 231;
|
||||||
|
const Scancode SCANCODE_MODE = 257;
|
||||||
|
const Scancode SCANCODE_SLEEP = 258;
|
||||||
|
const Scancode SCANCODE_WAKE = 259;
|
||||||
|
const Scancode SCANCODE_CHANNEL_INCREMENT = 260;
|
||||||
|
const Scancode SCANCODE_CHANNEL_DECREMENT = 261;
|
||||||
|
const Scancode SCANCODE_MEDIA_PLAY = 262;
|
||||||
|
const Scancode SCANCODE_MEDIA_PAUSE = 263;
|
||||||
|
const Scancode SCANCODE_MEDIA_RECORD = 264;
|
||||||
|
const Scancode SCANCODE_MEDIA_FAST_FORWARD = 265;
|
||||||
|
const Scancode SCANCODE_MEDIA_REWIND = 266;
|
||||||
|
const Scancode SCANCODE_MEDIA_NEXT_TRACK = 267;
|
||||||
|
const Scancode SCANCODE_MEDIA_PREVIOUS_TRACK = 268;
|
||||||
|
const Scancode SCANCODE_MEDIA_STOP = 269;
|
||||||
|
const Scancode SCANCODE_MEDIA_EJECT = 270;
|
||||||
|
const Scancode SCANCODE_MEDIA_PLAY_PAUSE = 271;
|
||||||
|
const Scancode SCANCODE_MEDIA_SELECT = 272;
|
||||||
|
const Scancode SCANCODE_AC_NEW = 273;
|
||||||
|
const Scancode SCANCODE_AC_OPEN = 274;
|
||||||
|
const Scancode SCANCODE_AC_CLOSE = 275;
|
||||||
|
const Scancode SCANCODE_AC_EXIT = 276;
|
||||||
|
const Scancode SCANCODE_AC_SAVE = 277;
|
||||||
|
const Scancode SCANCODE_AC_PRINT = 278;
|
||||||
|
const Scancode SCANCODE_AC_PROPERTIES = 279;
|
||||||
|
const Scancode SCANCODE_AC_SEARCH = 280;
|
||||||
|
const Scancode SCANCODE_AC_HOME = 281;
|
||||||
|
const Scancode SCANCODE_AC_BACK = 282;
|
||||||
|
const Scancode SCANCODE_AC_FORWARD = 283;
|
||||||
|
const Scancode SCANCODE_AC_STOP = 284;
|
||||||
|
const Scancode SCANCODE_AC_REFRESH = 285;
|
||||||
|
const Scancode SCANCODE_AC_BOOKMARKS = 286;
|
||||||
|
const Scancode SCANCODE_SOFTLEFT = 287;
|
||||||
|
const Scancode SCANCODE_SOFTRIGHT = 288;
|
||||||
|
const Scancode SCANCODE_CALL = 289;
|
||||||
|
const Scancode SCANCODE_ENDCALL = 290;
|
||||||
|
const Scancode SCANCODE_RESERVED = 400;
|
||||||
|
const Scancode SCANCODE_COUNT = 512;
|
32
sdl3.c3l/sdl3_sensor.c3i
Normal file
32
sdl3.c3l/sdl3_sensor.c3i
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
module sdl3::sdl;
|
||||||
|
|
||||||
|
typedef Sensor = void;
|
||||||
|
typedef SensorID = uint;
|
||||||
|
|
||||||
|
const float STANDARD_GRAVITY = 9.80665;
|
||||||
|
|
||||||
|
typedef SensorType = CInt;
|
||||||
|
|
||||||
|
const SensorType SENSOR_INVALID = -1;
|
||||||
|
const SensorType SENSOR_UNKNOWN = 0;
|
||||||
|
const SensorType SENSOR_ACCEL = 1;
|
||||||
|
const SensorType SENSOR_GYRO = 2;
|
||||||
|
const SensorType SENSOR_ACCEL_L = 3;
|
||||||
|
const SensorType SENSOR_GYRO_L = 4;
|
||||||
|
const SensorType SENSOR_ACCEL_R = 5;
|
||||||
|
const SensorType SENSOR_GYRO_R = 6;
|
||||||
|
|
||||||
|
extern fn SensorID* get_sensors(int *count) @extern("SDL_GetSensors");
|
||||||
|
extern fn ZString get_sensor_name_for_id(SensorID instance_id) @extern("SDL_GetSensorNameForID");
|
||||||
|
extern fn SensorType get_sensor_type_for_id(SensorID instance_id) @extern("SDL_GetSensorTypeForID");
|
||||||
|
extern fn int get_sensor_non_portable_type_for_id(SensorID instance_id) @extern("SDL_GetSensorNonPortableTypeForID");
|
||||||
|
extern fn Sensor* open_sensor(SensorID instance_id) @extern("SDL_OpenSensor");
|
||||||
|
extern fn Sensor* get_sensor_from_id(SensorID instance_id) @extern("SDL_GetSensorFromID");
|
||||||
|
extern fn PropertiesID get_sensor_properties(Sensor* sensor) @extern("SDL_GetSensorProperties");
|
||||||
|
extern fn ZString get_sensor_name(Sensor* sensor) @extern("SDL_GetSensorName");
|
||||||
|
extern fn SensorType get_sensor_type(Sensor* sensor) @extern("SDL_GetSensorType");
|
||||||
|
extern fn int get_sensor_non_portable_type(Sensor* sensor) @extern("SDL_GetSensorNonPortableType");
|
||||||
|
extern fn SensorID get_sensor_id(Sensor* sensor) @extern("SDL_GetSensorID");
|
||||||
|
extern fn bool get_sensor_data(Sensor* sensor, float *data, int num_values) @extern("SDL_GetSensorData");
|
||||||
|
extern fn void close_sensor(Sensor* sensor) @extern("SDL_CloseSensor");
|
||||||
|
extern fn void update_sensors() @extern("SDL_UpdateSensors");
|
288
sdl3.c3l/sdl3_stdinc.c3i
Normal file
288
sdl3.c3l/sdl3_stdinc.c3i
Normal file
@ -0,0 +1,288 @@
|
|||||||
|
module sdl3::sdl;
|
||||||
|
|
||||||
|
// #include <SDL3/SDL_platform_defines.h>
|
||||||
|
|
||||||
|
//#define SDL_FOURCC(A, B, C, D) \
|
||||||
|
// ((SDL_static_cast(uint, SDL_static_cast(Uint8, (A))) << 0) | \
|
||||||
|
// (SDL_static_cast(uint, SDL_static_cast(Uint8, (B))) << 8) | \
|
||||||
|
// (SDL_static_cast(uint, SDL_static_cast(Uint8, (C))) << 16) | \
|
||||||
|
// (SDL_static_cast(uint, SDL_static_cast(Uint8, (D))) << 24))
|
||||||
|
|
||||||
|
|
||||||
|
const float FLT_EPSILON = 1.1920928955078125e-07;
|
||||||
|
|
||||||
|
|
||||||
|
//#define SDL_INIT_INTERFACE(iface) \
|
||||||
|
// do { \
|
||||||
|
// SDL_zerop(iface); \
|
||||||
|
// (iface)->version = sizeof(*(iface)); \
|
||||||
|
// } while (0)
|
||||||
|
|
||||||
|
alias FunctionPointer = fn void();
|
||||||
|
|
||||||
|
extern fn void* malloc(isz size) @extern("SDL_malloc");
|
||||||
|
extern fn void* calloc(isz nmemb, isz size) @extern("SDL_calloc");
|
||||||
|
extern fn void* realloc(void* mem, isz size) @extern("SDL_realloc");
|
||||||
|
extern fn void free(void* mem) @extern("SDL_free");
|
||||||
|
|
||||||
|
alias Malloc_func = fn void*(isz size);
|
||||||
|
alias Calloc_func = fn void*(isz nmemb, isz size);
|
||||||
|
alias Realloc_func = fn void*(void* mem, isz size);
|
||||||
|
alias Free_func = fn void(void* mem);
|
||||||
|
|
||||||
|
extern fn void get_original_memory_functions(Malloc_func* malloc_func, Calloc_func* calloc_func, Realloc_func* realloc_func, Free_func* free_func) @extern("SDL_GetOriginalMemoryFunctions");
|
||||||
|
extern fn void get_memory_functions(Malloc_func* malloc_func, Calloc_func* calloc_func, Realloc_func* realloc_func, Free_func* free_func) @extern("SDL_GetMemoryFunctions");
|
||||||
|
extern fn bool set_memory_functions(Malloc_func malloc_func, Calloc_func calloc_func, Realloc_func realloc_func, Free_func free_func) @extern("SDL_SetMemoryFunctions");
|
||||||
|
|
||||||
|
extern fn void* aligned_alloc(isz alignment, isz size) @extern("SDL_aligned_alloc");
|
||||||
|
extern fn void aligned_free(void* mem) @extern("SDL_aligned_free");
|
||||||
|
extern fn int get_num_allocations() @extern("SDL_GetNumAllocations");
|
||||||
|
|
||||||
|
typedef Environment = void;
|
||||||
|
|
||||||
|
extern fn Environment* get_environment() @extern("SDL_GetEnvironment");
|
||||||
|
extern fn Environment* create_environment(bool populated) @extern("SDL_CreateEnvironment");
|
||||||
|
extern fn ZString get_environment_variable(Environment* env, ZString name) @extern("SDL_GetEnvironmentVariable");
|
||||||
|
extern fn ZString* get_environment_variables(Environment* env) @extern("SDL_GetEnvironmentVariables");
|
||||||
|
extern fn bool set_environment_variable(Environment* env, ZString name, ZString value, bool overwrite) @extern("SDL_SetEnvironmentVariable");
|
||||||
|
extern fn bool unset_environment_variable(Environment* env, ZString name) @extern("SDL_UnsetEnvironmentVariable");
|
||||||
|
extern fn void destroy_environment(Environment* env) @extern("SDL_DestroyEnvironment");
|
||||||
|
extern fn ZString getenv(ZString name) @extern("SDL_getenv");
|
||||||
|
extern fn ZString getenv_unsafe(ZString name) @extern("SDL_getenv_unsafe");
|
||||||
|
extern fn int setenv_unsafe(ZString name, ZString value, int overwrite) @extern("SDL_setenv_unsafe");
|
||||||
|
extern fn int unsetenv_unsafe(ZString name) @extern("SDL_unsetenv_unsafe");
|
||||||
|
|
||||||
|
alias CompareCallback = fn int(void* a, void* b);
|
||||||
|
|
||||||
|
extern fn void qsort(void* base, isz nmemb, isz size, CompareCallback compare) @extern("SDL_qsort");
|
||||||
|
extern fn void* bsearch(void* key, void* base, isz nmemb, isz size, CompareCallback compare) @extern("SDL_bsearch");
|
||||||
|
|
||||||
|
alias CompareCallback_r = fn int(void* userdata, void* a, void* b);
|
||||||
|
|
||||||
|
extern fn void qsort_r(void* base, isz nmemb, isz size, CompareCallback_r compare, void* userdata) @extern("SDL_qsort_r");
|
||||||
|
extern fn void* bsearch_r(void* key, void* base, isz nmemb, isz size, CompareCallback_r compare, void* userdata) @extern("SDL_bsearch_r");
|
||||||
|
extern fn int abs(int x) @extern("SDL_abs");
|
||||||
|
|
||||||
|
macro min(x, y) => x < y ? x : y;
|
||||||
|
macro max(x, y) => x > y ? x : y;
|
||||||
|
macro clamp(x, a, b) => x < a ? a : (x > b ? b : x);
|
||||||
|
|
||||||
|
extern fn int isalpha(int x) @extern("SDL_isalpha");
|
||||||
|
extern fn int isalnum(int x) @extern("SDL_isalnum");
|
||||||
|
extern fn int isblank(int x) @extern("SDL_isblank");
|
||||||
|
extern fn int iscntrl(int x) @extern("SDL_iscntrl");
|
||||||
|
extern fn int isdigit(int x) @extern("SDL_isdigit");
|
||||||
|
extern fn int isxdigit(int x) @extern("SDL_isxdigit");
|
||||||
|
extern fn int ispunct(int x) @extern("SDL_ispunct");
|
||||||
|
extern fn int isspace(int x) @extern("SDL_isspace");
|
||||||
|
extern fn int isupper(int x) @extern("SDL_isupper");
|
||||||
|
extern fn int islower(int x) @extern("SDL_islower");
|
||||||
|
extern fn int isprint(int x) @extern("SDL_isprint");
|
||||||
|
extern fn int isgraph(int x) @extern("SDL_isgraph");
|
||||||
|
extern fn int toupper(int x) @extern("SDL_toupper");
|
||||||
|
extern fn int tolower(int x) @extern("SDL_tolower");
|
||||||
|
extern fn ushort crc16(ushort crc, void* data, isz len) @extern("SDL_crc16");
|
||||||
|
extern fn uint crc32(uint crc, void* data, isz len) @extern("SDL_crc32");
|
||||||
|
extern fn uint murmur3_32(void* data, isz len, uint seed) @extern("SDL_murmur3_32");
|
||||||
|
extern fn void* memcpy(void* dst, void* src, isz len) @extern("SDL_memcpy");
|
||||||
|
|
||||||
|
macro copyp(dst, src) => memcpy(dst, src, sizeof(*(src)));
|
||||||
|
|
||||||
|
extern fn void* memmove(void* dst,void* src, isz len) @extern("SDL_memmove");
|
||||||
|
extern fn void* memset(void* dst, int c, isz len) @extern("SDL_memset");
|
||||||
|
extern fn void* memset4(void* dst, uint val, isz dwords) @extern("SDL_memset4");
|
||||||
|
extern fn int memcmp(void* s1, void* s2, isz len) @extern("SDL_memcmp");
|
||||||
|
extern fn isz wcslen(WString wstr) @extern("SDL_wcslen");
|
||||||
|
extern fn isz wcsnlen(WString wstr, isz maxlen) @extern("SDL_wcsnlen");
|
||||||
|
extern fn isz wcslcpy(WString dst, WString src, isz maxlen) @extern("SDL_wcslcpy");
|
||||||
|
extern fn isz wcslcat(WString dst, WString src, isz maxlen) @extern("SDL_wcslcat");
|
||||||
|
extern fn WString wcsdup(WString wstr) @extern("SDL_wcsdup");
|
||||||
|
extern fn WString wcsstr(WString haystack, WString needle) @extern("SDL_wcsstr");
|
||||||
|
extern fn WString wcsnstr(WString haystack, WString needle, isz maxlen) @extern("SDL_wcsnstr");
|
||||||
|
extern fn int wcscmp(WString str1, WString str2) @extern("SDL_wcscmp");
|
||||||
|
extern fn int wcsncmp(WString str1, WString str2, isz maxlen) @extern("SDL_wcsncmp");
|
||||||
|
extern fn int wcscasecmp(WString str1, WString str2) @extern("SDL_wcscasecmp");
|
||||||
|
extern fn int wcsncasecmp(WString str1, WString str2, isz maxlen) @extern("SDL_wcsncasecmp");
|
||||||
|
extern fn long wcstol(WString str, WString *endp, int base) @extern("SDL_wcstol");
|
||||||
|
extern fn isz strlen(ZString str) @extern("SDL_strlen");
|
||||||
|
extern fn isz strnlen(ZString str, isz maxlen) @extern("SDL_strnlen");
|
||||||
|
extern fn isz strlcpy(ZString dst, ZString src, isz maxlen) @extern("SDL_strlcpy");
|
||||||
|
extern fn isz utf8strlcpy(ZString dst, ZString src, isz dst_bytes) @extern("SDL_utf8strlcpy");
|
||||||
|
extern fn isz strlcat(ZString dst, ZString src, isz maxlen) @extern("SDL_strlcat");
|
||||||
|
extern fn ZString strdup(ZString str) @extern("SDL_strdup");
|
||||||
|
extern fn ZString strndup(ZString str, isz maxlen) @extern("SDL_strndup");
|
||||||
|
extern fn ZString strrev(ZString str) @extern("SDL_strrev");
|
||||||
|
extern fn ZString strupr(ZString str) @extern("SDL_strupr");
|
||||||
|
extern fn ZString strlwr(ZString str) @extern("SDL_strlwr");
|
||||||
|
extern fn ZString strchr(ZString str, int c) @extern("SDL_strchr");
|
||||||
|
extern fn ZString strrchr(ZString str, int c) @extern("SDL_strrchr");
|
||||||
|
extern fn ZString strstr(ZString haystack, ZString needle) @extern("SDL_strstr");
|
||||||
|
extern fn ZString strnstr(ZString haystack, ZString needle, isz maxlen) @extern("SDL_strnstr");
|
||||||
|
extern fn ZString strcasestr(ZString haystack, ZString needle) @extern("SDL_strcasestr");
|
||||||
|
extern fn ZString strtok_r(ZString str, ZString delim, ZString* saveptr) @extern("SDL_strtok_r");
|
||||||
|
extern fn isz utf8strlen(ZString str) @extern("SDL_utf8strlen");
|
||||||
|
extern fn isz utf8strnlen(ZString str, isz bytes) @extern("SDL_utf8strnlen");
|
||||||
|
extern fn ZString itoa(int value, ZString str, int radix) @extern("SDL_itoa");
|
||||||
|
extern fn ZString uitoa(uint value, ZString str, int radix) @extern("SDL_uitoa");
|
||||||
|
extern fn ZString ltoa(long value, ZString str, int radix) @extern("SDL_ltoa");
|
||||||
|
extern fn ZString ultoa(ulong value, ZString str, int radix) @extern("SDL_ultoa");
|
||||||
|
extern fn int atoi(ZString str) @extern("SDL_atoi");
|
||||||
|
extern fn double atof(ZString str) @extern("SDL_atof");
|
||||||
|
extern fn long strtol(ZString str, ZString* endp, int base) @extern("SDL_strtol");
|
||||||
|
extern fn ulong strtoul(ZString str, ZString* endp, int base) @extern("SDL_strtoul");
|
||||||
|
extern fn double strtod(ZString str, ZString* endp) @extern("SDL_strtod");
|
||||||
|
extern fn int strcmp(ZString str1, ZString str2) @extern("SDL_strcmp");
|
||||||
|
extern fn int strncmp(ZString str1, ZString str2, isz maxlen) @extern("SDL_strncmp");
|
||||||
|
extern fn int strcasecmp(ZString str1, ZString str2) @extern("SDL_strcasecmp");
|
||||||
|
extern fn int strncasecmp(ZString str1, ZString str2, isz maxlen) @extern("SDL_strncasecmp");
|
||||||
|
extern fn ZString strpbrk(ZString str, ZString breakset) @extern("SDL_strpbrk");
|
||||||
|
|
||||||
|
const ushort INVALID_UNICODE_CODEPOINT = 0xFFFD;
|
||||||
|
|
||||||
|
extern fn uint step_utf8(ZString *pstr, isz *pslen) @extern("SDL_StepUTF8");
|
||||||
|
extern fn uint step_back_utf8(ZString start, ZString *pstr) @extern("SDL_StepBackUTF8");
|
||||||
|
extern fn ZString ucs4_to_utf8(uint codepoint, ZString dst) @extern("SDL_UCS4ToUTF8");
|
||||||
|
extern fn int sscanf(ZString text, ZString fmt, ...) @extern("SDL_sscanf");
|
||||||
|
// extern fn int SDLCALL SDL_vsscanf(ZString text, ZString fmt, va_list ap) SDL_SCANF_VARARG_FUNCV(2);
|
||||||
|
extern fn int snprintf(ZString text, isz maxlen, ZString fmt, ...) @extern("SDL_snprintf");
|
||||||
|
extern fn int swprintf(WString text, isz maxlen, WString fmt, ...) @extern("SDL_swprintf");
|
||||||
|
// extern fn int vsnprintf(ZString text, isz maxlen, ZString fmt, va_list ap) SDL_PRINTF_VARARG_FUNCV(3) @extern("SDL_vsnprintf");
|
||||||
|
// extern fn int vswprintf(WString text, isz maxlen, WString fmt, va_list ap) SDL_WPRINTF_VARARG_FUNCV(3) @extern("SDL_vswprintf");
|
||||||
|
extern fn int asprintf(ZString* strp, ZString fmt, ...) @extern("SDL_asprintf");
|
||||||
|
// extern fn int vasprintf(ZString* strp, ZString fmt, va_list ap) SDL_PRINTF_VARARG_FUNCV(2) @extern("SDL_vasprintf");
|
||||||
|
extern fn void srand(ulong seed) @extern("SDL_srand");
|
||||||
|
extern fn int rand(int n) @extern("SDL_rand");
|
||||||
|
extern fn float randf() @extern("SDL_randf");
|
||||||
|
extern fn uint rand_bits() @extern("SDL_rand_bits");
|
||||||
|
extern fn int rand_r(ulong *state, int n) @extern("SDL_rand_r");
|
||||||
|
extern fn float randf_r(ulong *state) @extern("SDL_randf_r");
|
||||||
|
extern fn uint rand_bits_r(ulong *state) @extern("SDL_rand_bits_r");
|
||||||
|
|
||||||
|
const double PI_D = 3.141592653589793238462643383279502884;
|
||||||
|
const float PI_F = 3.141592653589793238462643383279502884;
|
||||||
|
|
||||||
|
extern fn double acos(double x) @extern("SDL_acos");
|
||||||
|
extern fn float acosf(float x) @extern("SDL_acosf");
|
||||||
|
extern fn double asin(double x) @extern("SDL_asin");
|
||||||
|
extern fn float asinf(float x) @extern("SDL_asinf");
|
||||||
|
extern fn double atan(double x) @extern("SDL_atan");
|
||||||
|
extern fn float atanf(float x) @extern("SDL_atanf");
|
||||||
|
extern fn double atan2(double y, double x) @extern("SDL_atan2");
|
||||||
|
extern fn float atan2f(float y, float x) @extern("SDL_atan2f");
|
||||||
|
extern fn double ceil(double x) @extern("SDL_ceil");
|
||||||
|
extern fn float ceilf(float x) @extern("SDL_ceilf");
|
||||||
|
extern fn double copysign(double x, double y) @extern("SDL_copysign");
|
||||||
|
extern fn float copysignf(float x, float y) @extern("SDL_copysignf");
|
||||||
|
extern fn double cos(double x) @extern("SDL_cos");
|
||||||
|
extern fn float cosf(float x) @extern("SDL_cosf");
|
||||||
|
extern fn double exp(double x) @extern("SDL_exp");
|
||||||
|
extern fn float expf(float x) @extern("SDL_expf");
|
||||||
|
extern fn double fabs(double x) @extern("SDL_fabs");
|
||||||
|
extern fn float fabsf(float x) @extern("SDL_fabsf");
|
||||||
|
extern fn double floor(double x) @extern("SDL_floor");
|
||||||
|
extern fn float floorf(float x) @extern("SDL_floorf");
|
||||||
|
extern fn double trunc(double x) @extern("SDL_trunc");
|
||||||
|
extern fn float truncf(float x) @extern("SDL_truncf");
|
||||||
|
extern fn double fmod(double x, double y) @extern("SDL_fmod");
|
||||||
|
extern fn float fmodf(float x, float y) @extern("SDL_fmodf");
|
||||||
|
extern fn int isinf(double x) @extern("SDL_isinf");
|
||||||
|
extern fn int isinff(float x) @extern("SDL_isinff");
|
||||||
|
extern fn int isnan(double x) @extern("SDL_isnan");
|
||||||
|
extern fn int isnanf(float x) @extern("SDL_isnanf");
|
||||||
|
extern fn double log(double x) @extern("SDL_log");
|
||||||
|
extern fn float logf(float x) @extern("SDL_logf");
|
||||||
|
extern fn double log10(double x) @extern("SDL_log10");
|
||||||
|
extern fn float log10f(float x) @extern("SDL_log10f");
|
||||||
|
extern fn double modf(double x, double *y) @extern("SDL_modf");
|
||||||
|
extern fn float modff(float x, float *y) @extern("SDL_modff");
|
||||||
|
extern fn double pow(double x, double y) @extern("SDL_pow");
|
||||||
|
extern fn float powf(float x, float y) @extern("SDL_powf");
|
||||||
|
extern fn double round(double x) @extern("SDL_round");
|
||||||
|
extern fn float roundf(float x) @extern("SDL_roundf");
|
||||||
|
extern fn long lround(double x) @extern("SDL_lround");
|
||||||
|
extern fn long lroundf(float x) @extern("SDL_lroundf");
|
||||||
|
extern fn double scalbn(double x, int n) @extern("SDL_scalbn");
|
||||||
|
extern fn float scalbnf(float x, int n) @extern("SDL_scalbnf");
|
||||||
|
extern fn double sin(double x) @extern("SDL_sin");
|
||||||
|
extern fn float sinf(float x) @extern("SDL_sinf");
|
||||||
|
extern fn double sqrt(double x) @extern("SDL_sqrt");
|
||||||
|
extern fn float sqrtf(float x) @extern("SDL_sqrtf");
|
||||||
|
extern fn double tan(double x) @extern("SDL_tan");
|
||||||
|
extern fn float tanf(float x) @extern("SDL_tanf");
|
||||||
|
|
||||||
|
typedef Iconv = void*;
|
||||||
|
|
||||||
|
extern fn Iconv iconv_open(ZString tocode, ZString fromcode) @extern("SDL_iconv_open");
|
||||||
|
extern fn int iconv_close(Iconv cd) @extern("SDL_iconv_close");
|
||||||
|
extern fn isz iconv(Iconv cd, ZString *inbuf, isz *inbytesleft, ZString* outbuf, isz *outbytesleft) @extern("SDL_iconv");
|
||||||
|
|
||||||
|
const isz ICONV_ERROR = (isz)-1;
|
||||||
|
const isz ICONV_E2BIG = (isz)-2;
|
||||||
|
const isz ICONV_EILSEQ = (isz)-3;
|
||||||
|
const isz ICONV_EINVAL = (isz)-4;
|
||||||
|
|
||||||
|
extern fn ZString iconv_string(ZString tocode, ZString fromcode, ZString inbuf, isz inbytesleft) @extern("SDL_iconv_string");
|
||||||
|
|
||||||
|
macro iconv_utf8_locale(s) => iconv_string("", "UTF-8", s, strlen(s)+1);
|
||||||
|
macro iconv_utf8_ucs2(s) => (ushort *)iconv_string("UCS-2", "UTF-8", s, strlen(s)+1);
|
||||||
|
macro iconv_utf8_ucs4(s) => (uint *)iconv_string("UCS-4", "UTF-8", s, strlen(s)+1);
|
||||||
|
macro iconv_wchar_utf8(s) => iconv_string("UTF-8", "WCHAR_T", (ZString)s, (wcslen(s)+1)*sizeof(short));
|
||||||
|
|
||||||
|
// TODO: remove these from the pool
|
||||||
|
// #define SDL_malloc malloc
|
||||||
|
// #define SDL_calloc calloc
|
||||||
|
// #define SDL_realloc realloc
|
||||||
|
// #define SDL_free free
|
||||||
|
// #ifndef SDL_memcpy
|
||||||
|
// #define SDL_memcpy memcpy
|
||||||
|
// #endif
|
||||||
|
// #ifndef SDL_memmove
|
||||||
|
// #define SDL_memmove memmove
|
||||||
|
// #endif
|
||||||
|
// #ifndef SDL_memset
|
||||||
|
// #define SDL_memset memset
|
||||||
|
// #endif
|
||||||
|
// #define SDL_memcmp memcmp
|
||||||
|
// #define SDL_strlcpy strlcpy
|
||||||
|
// #define SDL_strlcat strlcat
|
||||||
|
// #define SDL_strlen strlen
|
||||||
|
// #define SDL_wcslen wcslen
|
||||||
|
// #define SDL_wcslcpy wcslcpy
|
||||||
|
// #define SDL_wcslcat wcslcat
|
||||||
|
// #define SDL_strdup strdup
|
||||||
|
// #define SDL_wcsdup wcsdup
|
||||||
|
// #define SDL_strchr strchr
|
||||||
|
// #define SDL_strrchr strrchr
|
||||||
|
// #define SDL_strstr strstr
|
||||||
|
// #define SDL_wcsstr wcsstr
|
||||||
|
// #define SDL_strtok_r strtok_r
|
||||||
|
// #define SDL_strcmp strcmp
|
||||||
|
// #define SDL_wcscmp wcscmp
|
||||||
|
// #define SDL_strncmp strncmp
|
||||||
|
// #define SDL_wcsncmp wcsncmp
|
||||||
|
// #define SDL_strcasecmp strcasecmp
|
||||||
|
// #define SDL_strncasecmp strncasecmp
|
||||||
|
// #define SDL_strpbrk strpbrk
|
||||||
|
// #define SDL_sscanf sscanf
|
||||||
|
// #define SDL_vsscanf vsscanf
|
||||||
|
// #define SDL_snprintf snprintf
|
||||||
|
// #define SDL_vsnprintf vsnprintf
|
||||||
|
// #endif
|
||||||
|
|
||||||
|
macro bool size_mul_check_overflow(isz a, isz b, isz *ret)
|
||||||
|
{
|
||||||
|
if (a != 0 && b > isz.max / a) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
*ret = a * b;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
macro bool size_add_check_overflow(isz a, isz b, isz *ret)
|
||||||
|
{
|
||||||
|
if (b > isz.max - a) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
*ret = a + b;
|
||||||
|
return true;
|
||||||
|
}
|
88
sdl3.c3l/sdl3_surface.c3i
Normal file
88
sdl3.c3l/sdl3_surface.c3i
Normal file
@ -0,0 +1,88 @@
|
|||||||
|
module sdl3::sdl;
|
||||||
|
|
||||||
|
typedef SurfaceFlags = uint;
|
||||||
|
|
||||||
|
const SurfaceFlags SURFACE_PREALLOCATED = 0x00000001;
|
||||||
|
const SurfaceFlags SURFACE_LOCK_NEEDED = 0x00000002;
|
||||||
|
const SurfaceFlags SURFACE_LOCKED = 0x00000004;
|
||||||
|
const SurfaceFlags SURFACE_SIMD_ALIGNED = 0x00000008;
|
||||||
|
|
||||||
|
typedef ScaleMode = CInt;
|
||||||
|
|
||||||
|
const ScaleMode SCALEMODE_INVALID = -1;
|
||||||
|
const ScaleMode SCALEMODE_NEAREST = 0;
|
||||||
|
const ScaleMode SCALEMODE_LINEAR = 0;
|
||||||
|
|
||||||
|
enum FlipMode : inline CInt {
|
||||||
|
FLIP_NONE,
|
||||||
|
FLIP_HORIZONTAL,
|
||||||
|
FLIP_VERTICAL
|
||||||
|
}
|
||||||
|
|
||||||
|
typedef Surface = void;
|
||||||
|
|
||||||
|
extern fn Surface* create_surface(int width, int height, PixelFormat format) @extern("SDL_CreateSurface");
|
||||||
|
extern fn Surface* create_surface_from(int width, int height, PixelFormat format, void *pixels, int pitch) @extern("SDL_CreateSurfaceFrom");
|
||||||
|
extern fn void destroy_surface(Surface* surface) @extern("SDL_DestroySurface");
|
||||||
|
extern fn PropertiesID get_surface_properties(Surface* surface) @extern("SDL_GetSurfaceProperties");
|
||||||
|
|
||||||
|
const ZString PROP_SURFACE_SDR_WHITE_POINT_FLOAT = "SDL.surface.SDR_white_point";
|
||||||
|
const ZString PROP_SURFACE_HDR_HEADROOM_FLOAT = "SDL.surface.HDR_headroom";
|
||||||
|
const ZString PROP_SURFACE_TONEMAP_OPERATOR_STRING = "SDL.surface.tonemap";
|
||||||
|
const ZString PROP_SURFACE_HOTSPOT_X_NUMBER = "SDL.surface.hotspot.x";
|
||||||
|
const ZString PROP_SURFACE_HOTSPOT_Y_NUMBER = "SDL.surface.hotspot.y";
|
||||||
|
|
||||||
|
extern fn bool set_surface_colorspace(Surface* surface, Colorspace colorspace) @extern("SDL_SetSurfaceColorspace");
|
||||||
|
extern fn Colorspace get_surface_colorspace(Surface* surface) @extern("SDL_GetSurfaceColorspace");
|
||||||
|
extern fn Palette* create_surface_palette(Surface* surface) @extern("SDL_CreateSurfacePalette");
|
||||||
|
extern fn bool set_surface_palette(Surface* surface, Palette* palette) @extern("SDL_SetSurfacePalette");
|
||||||
|
extern fn Palette* get_surface_palette(Surface* surface) @extern("SDL_GetSurfacePalette");
|
||||||
|
extern fn bool add_surface_alternate_image(Surface* surface, Surface* image) @extern("SDL_AddSurfaceAlternateImage");
|
||||||
|
extern fn bool surface_has_alternate_images(Surface* surface) @extern("SDL_SurfaceHasAlternateImages");
|
||||||
|
extern fn Surface* * get_surface_images(Surface* surface, int *count) @extern("SDL_GetSurfaceImages");
|
||||||
|
extern fn void remove_surface_alternate_images(Surface* surface) @extern("SDL_RemoveSurfaceAlternateImages");
|
||||||
|
extern fn bool lock_surface(Surface* surface) @extern("SDL_LockSurface");
|
||||||
|
extern fn void unlock_surface(Surface* surface) @extern("SDL_UnlockSurface");
|
||||||
|
extern fn Surface* load_bmp_io(IOStream *src, bool closeio) @extern("SDL_LoadBMP_IO");
|
||||||
|
extern fn Surface* load_bmp(ZString file) @extern("SDL_LoadBMP");
|
||||||
|
extern fn bool save_bmp_io(Surface* surface, IOStream *dst, bool closeio) @extern("SDL_SaveBMP_IO");
|
||||||
|
extern fn bool save_bmp(Surface* surface, ZString file) @extern("SDL_SaveBMP");
|
||||||
|
extern fn bool set_surface_rle(Surface* surface, bool enabled) @extern("SDL_SetSurfaceRLE");
|
||||||
|
extern fn bool surface_has_rle(Surface* surface) @extern("SDL_SurfaceHasRLE");
|
||||||
|
extern fn bool set_surface_color_key(Surface* surface, bool enabled, uint key) @extern("SDL_SetSurfaceColorKey");
|
||||||
|
extern fn bool surface_has_color_key(Surface* surface) @extern("SDL_SurfaceHasColorKey");
|
||||||
|
extern fn bool get_surface_color_key(Surface* surface, uint *key) @extern("SDL_GetSurfaceColorKey");
|
||||||
|
extern fn bool set_surface_color_mod(Surface* surface, char r, char g, char b) @extern("SDL_SetSurfaceColorMod");
|
||||||
|
extern fn bool get_surface_color_mod(Surface* surface, char *r, char *g, char *b) @extern("SDL_GetSurfaceColorMod");
|
||||||
|
extern fn bool set_surface_alpha_mod(Surface* surface, char alpha) @extern("SDL_SetSurfaceAlphaMod");
|
||||||
|
extern fn bool get_surface_alpha_mod(Surface* surface, char *alpha) @extern("SDL_GetSurfaceAlphaMod");
|
||||||
|
extern fn bool set_surface_blend_mode(Surface* surface, BlendMode blendMode) @extern("SDL_SetSurfaceBlendMode");
|
||||||
|
extern fn bool get_surface_blend_mode(Surface* surface, BlendMode *blendMode) @extern("SDL_GetSurfaceBlendMode");
|
||||||
|
extern fn bool set_surface_clip_rect(Surface* surface, Rect* rect) @extern("SDL_SetSurfaceClipRect");
|
||||||
|
extern fn bool get_surface_clip_rect(Surface* surface, Rect* rect) @extern("SDL_GetSurfaceClipRect");
|
||||||
|
extern fn bool flip_surface(Surface* surface, FlipMode flip) @extern("SDL_FlipSurface");
|
||||||
|
extern fn Surface* duplicate_surface(Surface* surface) @extern("SDL_DuplicateSurface");
|
||||||
|
extern fn Surface* scale_surface(Surface* surface, int width, int height, ScaleMode scaleMode) @extern("SDL_ScaleSurface");
|
||||||
|
extern fn Surface* convert_surface(Surface* surface, PixelFormat format) @extern("SDL_ConvertSurface");
|
||||||
|
extern fn Surface* convert_surface_and_colorspace(Surface* surface, PixelFormat format, Palette* palette, Colorspace colorspace, PropertiesID props) @extern("SDL_ConvertSurfaceAndColorspace");
|
||||||
|
extern fn bool convert_pixels(int width, int height, PixelFormat src_format, void* src, int src_pitch, PixelFormat dst_format, void *dst, int dst_pitch) @extern("SDL_ConvertPixels");
|
||||||
|
extern fn bool convert_pixels_and_colorspace(int width, int height, PixelFormat src_format, Colorspace src_colorspace, PropertiesID src_properties, void* src, int src_pitch, PixelFormat dst_format, Colorspace dst_colorspace, PropertiesID dst_properties, void *dst, int dst_pitch) @extern("SDL_ConvertPixelsAndColorspace");
|
||||||
|
extern fn bool premultiply_alpha(int width, int height, PixelFormat src_format, void* src, int src_pitch, PixelFormat dst_format, void *dst, int dst_pitch, bool linear) @extern("SDL_PremultiplyAlpha");
|
||||||
|
extern fn bool premultiply_surface_alpha(Surface* surface, bool linear) @extern("SDL_PremultiplySurfaceAlpha");
|
||||||
|
extern fn bool clear_surface(Surface* surface, float r, float g, float b, float a) @extern("SDL_ClearSurface");
|
||||||
|
extern fn bool fill_surface_rect(Surface* dst, Rect* rect, uint color) @extern("SDL_FillSurfaceRect");
|
||||||
|
extern fn bool fill_surface_rects(Surface* dst, Rect* rects, int count, uint color) @extern("SDL_FillSurfaceRects");
|
||||||
|
extern fn bool blit_surface(Surface* src, Rect* srcrect, Surface* dst, Rect* dstrect) @extern("SDL_BlitSurface");
|
||||||
|
extern fn bool blit_surface_unchecked(Surface* src, Rect* srcrect, Surface* dst, Rect* dstrect) @extern("SDL_BlitSurfaceUnchecked");
|
||||||
|
extern fn bool blit_surface_scaled(Surface* src, Rect* srcrect, Surface* dst, Rect* dstrect, ScaleMode scaleMode) @extern("SDL_BlitSurfaceScaled");
|
||||||
|
extern fn bool blit_surface_unchecked_scaled(Surface* src, Rect* srcrect, Surface* dst, Rect* dstrect, ScaleMode scaleMode) @extern("SDL_BlitSurfaceUncheckedScaled");
|
||||||
|
extern fn bool stretch_surface(Surface* src, Rect* srcrect, Surface* dst, Rect* dstrect, ScaleMode scaleMode) @extern("SDL_StretchSurface");
|
||||||
|
extern fn bool blit_surface_tiled(Surface* src, Rect* srcrect, Surface* dst, Rect* dstrect) @extern("SDL_BlitSurfaceTiled");
|
||||||
|
extern fn bool blit_surface_tiled_with_scale(Surface* src, Rect* srcrect, float scale, ScaleMode scaleMode, Surface* dst, Rect* dstrect) @extern("SDL_BlitSurfaceTiledWithScale");
|
||||||
|
extern fn bool blit_surface9_grid(Surface* src, Rect* srcrect, int left_width, int right_width, int top_height, int bottom_height, float scale, ScaleMode scaleMode, Surface* dst, Rect* dstrect) @extern("SDL_BlitSurface9Grid");
|
||||||
|
extern fn uint map_surface_rgb(Surface* surface, char r, char g, char b) @extern("SDL_MapSurfaceRGB");
|
||||||
|
extern fn uint map_surface_rgba(Surface* surface, char r, char g, char b, char a) @extern("SDL_MapSurfaceRGBA");
|
||||||
|
extern fn bool read_surface_pixel(Surface* surface, int x, int y, char *r, char *g, char *b, char *a) @extern("SDL_ReadSurfacePixel");
|
||||||
|
extern fn bool read_surface_pixel_float(Surface* surface, int x, int y, float *r, float *g, float *b, float *a) @extern("SDL_ReadSurfacePixelFloat");
|
||||||
|
extern fn bool write_surface_pixel(Surface* surface, int x, int y, char r, char g, char b, char a) @extern("SDL_WriteSurfacePixel");
|
||||||
|
extern fn bool write_surface_pixel_float(Surface* surface, int x, int y, float r, float g, float b, float a) @extern("SDL_WriteSurfacePixelFloat");
|
26
sdl3.c3l/sdl3_touch.c3i
Normal file
26
sdl3.c3l/sdl3_touch.c3i
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
module sdl3::sdl;
|
||||||
|
|
||||||
|
typedef TouchID = ulong;
|
||||||
|
typedef FingerID = ulong;
|
||||||
|
|
||||||
|
typedef TouchDeviceType = CInt;
|
||||||
|
|
||||||
|
const TouchDeviceType TOUCH_DEVICE_INVALID = -1;
|
||||||
|
const TouchDeviceType TOUCH_DEVICE_DIRECT = 0;
|
||||||
|
const TouchDeviceType TOUCH_DEVICE_INDIRECT_ABSOLUTE = 1;
|
||||||
|
const TouchDeviceType TOUCH_DEVICE_INDIRECT_RELATIVE = 2;
|
||||||
|
|
||||||
|
struct Finger {
|
||||||
|
FingerID id;
|
||||||
|
float x;
|
||||||
|
float y;
|
||||||
|
float pressure;
|
||||||
|
}
|
||||||
|
|
||||||
|
const MouseID TOUCH_MOUSEID = ((MouseID)-1);
|
||||||
|
const TouchID MOUSE_TOUCHID = ((TouchID)-1);
|
||||||
|
|
||||||
|
extern fn TouchID* get_touch_devices(int *count) @extern("SDL_GetTouchDevices");
|
||||||
|
extern fn ZString get_touch_device_name(TouchID touchID) @extern("SDL_GetTouchDeviceName");
|
||||||
|
extern fn TouchDeviceType get_touch_device_type(TouchID touchID) @extern("SDL_GetTouchDeviceType");
|
||||||
|
extern fn Finger** get_touch_fingers(TouchID touchID, int *count) @extern("SDL_GetTouchFingers");
|
357
sdl3.c3l/sdl3_video.c3i
Normal file
357
sdl3.c3l/sdl3_video.c3i
Normal file
@ -0,0 +1,357 @@
|
|||||||
|
module sdl3::sdl;
|
||||||
|
|
||||||
|
typedef DisplayID = uint;
|
||||||
|
typedef WindowID = uint;
|
||||||
|
|
||||||
|
|
||||||
|
const ZString PROP_GLOBAL_VIDEO_WAYLAND_WL_DISPLAY_POINTER = "SDL.video.wayland.wl_display";
|
||||||
|
|
||||||
|
enum SystemTheme : inline CInt {
|
||||||
|
SYSTEM_THEME_UNKNOWN,
|
||||||
|
SYSTEM_THEME_LIGHT,
|
||||||
|
SYSTEM_THEME_DARK
|
||||||
|
}
|
||||||
|
|
||||||
|
typedef DisplayModeData = void;
|
||||||
|
|
||||||
|
struct DisplayMode {
|
||||||
|
DisplayID displayID;
|
||||||
|
PixelFormat format;
|
||||||
|
int w;
|
||||||
|
int h;
|
||||||
|
float pixel_density;
|
||||||
|
float refresh_rate;
|
||||||
|
int refresh_rate_numerator;
|
||||||
|
int refresh_rate_denominator;
|
||||||
|
DisplayModeData *internal;
|
||||||
|
}
|
||||||
|
|
||||||
|
enum DisplayOrientation : inline CInt {
|
||||||
|
ORIENTATION_UNKNOWN,
|
||||||
|
ORIENTATION_LANDSCAPE,
|
||||||
|
ORIENTATION_LANDSCAPE_FLIPPED,
|
||||||
|
ORIENTATION_PORTRAIT,
|
||||||
|
ORIENTATION_PORTRAIT_FLIPPED
|
||||||
|
}
|
||||||
|
|
||||||
|
typedef Window = void;
|
||||||
|
typedef WindowFlags = ulong;
|
||||||
|
|
||||||
|
const WindowFlags WINDOW_FULLSCREEN = 0x0000000000000001;
|
||||||
|
const WindowFlags WINDOW_OPENGL = 0x0000000000000002;
|
||||||
|
const WindowFlags WINDOW_OCCLUDED = 0x0000000000000004;
|
||||||
|
const WindowFlags WINDOW_HIDDEN = 0x0000000000000008;
|
||||||
|
const WindowFlags WINDOW_BORDERLESS = 0x0000000000000010;
|
||||||
|
const WindowFlags WINDOW_RESIZABLE = 0x0000000000000020;
|
||||||
|
const WindowFlags WINDOW_MINIMIZED = 0x0000000000000040;
|
||||||
|
const WindowFlags WINDOW_MAXIMIZED = 0x0000000000000080;
|
||||||
|
const WindowFlags WINDOW_MOUSE_GRABBED = 0x0000000000000100;
|
||||||
|
const WindowFlags WINDOW_INPUT_FOCUS = 0x0000000000000200;
|
||||||
|
const WindowFlags WINDOW_MOUSE_FOCUS = 0x0000000000000400;
|
||||||
|
const WindowFlags WINDOW_EXTERNAL = 0x0000000000000800;
|
||||||
|
const WindowFlags WINDOW_MODAL = 0x0000000000001000;
|
||||||
|
const WindowFlags WINDOW_HIGH_PIXEL_DENSITY = 0x0000000000002000;
|
||||||
|
const WindowFlags WINDOW_MOUSE_CAPTURE = 0x0000000000004000;
|
||||||
|
const WindowFlags WINDOW_MOUSE_RELATIVE_MODE = 0x0000000000008000;
|
||||||
|
const WindowFlags WINDOW_ALWAYS_ON_TOP = 0x0000000000010000;
|
||||||
|
const WindowFlags WINDOW_UTILITY = 0x0000000000020000;
|
||||||
|
const WindowFlags WINDOW_TOOLTIP = 0x0000000000040000;
|
||||||
|
const WindowFlags WINDOW_POPUP_MENU = 0x0000000000080000;
|
||||||
|
const WindowFlags WINDOW_KEYBOARD_GRABBED = 0x0000000000100000;
|
||||||
|
const WindowFlags WINDOW_VULKAN = 0x0000000010000000;
|
||||||
|
const WindowFlags WINDOW_METAL = 0x0000000020000000;
|
||||||
|
const WindowFlags WINDOW_TRANSPARENT = 0x0000000040000000;
|
||||||
|
const WindowFlags WINDOW_NOT_FOCUSABLE = 0x0000000080000000;
|
||||||
|
|
||||||
|
|
||||||
|
const uint WINDOWPOS_UNDEFINED_MASK = 0x1FFF0000;
|
||||||
|
const uint WINDOWPOS_CENTERED_MASK = 0x2FFF0000;
|
||||||
|
|
||||||
|
macro uint @windowpos_undefined_display($x) => WINDOWPOS_UNDEFINED_MASK|$x;
|
||||||
|
macro bool @windowpos_isundefined($x) => ($x&0xFFFF0000) == WINDOWPOS_UNDEFINED_MASK;
|
||||||
|
macro uint @windowpos_centered_display($x) => WINDOWPOS_CENTERED_MASK|$x;
|
||||||
|
macro bool @windowpos_iscentered($x) => ($x&0xFFFF0000) == WINDOWPOS_CENTERED_MASK;
|
||||||
|
|
||||||
|
const uint WINDOWPOS_UNDEFINED = @windowpos_undefined_display(0);
|
||||||
|
const uint WINDOWPOS_CENTERED = @windowpos_centered_display(0);
|
||||||
|
|
||||||
|
|
||||||
|
enum FlashOperation : inline CInt {
|
||||||
|
FLASH_CANCEL,
|
||||||
|
FLASH_BRIEFLY,
|
||||||
|
FLASH_UNTIL_FOCUSED
|
||||||
|
}
|
||||||
|
|
||||||
|
typedef GLContext = void*;
|
||||||
|
typedef EGLDisplay = void*;
|
||||||
|
typedef EGLConfig = void*;
|
||||||
|
typedef EGLSurface = void*;
|
||||||
|
typedef EGLAttrib = ulong; // FIXME: this is not correct for all platforms
|
||||||
|
typedef EGLint = int;
|
||||||
|
|
||||||
|
//alias EGLAttribArrayCallback = fn SDL_EGLAttrib*(void* userdata);
|
||||||
|
//alias EGLIntArrayCallback = fn SDL_EGLint*(void* userdata, EGLDisplay display, EGLConfig config);
|
||||||
|
|
||||||
|
enum GLAttr : inline CInt {
|
||||||
|
GL_RED_SIZE,
|
||||||
|
GL_GREEN_SIZE,
|
||||||
|
GL_BLUE_SIZE,
|
||||||
|
GL_ALPHA_SIZE,
|
||||||
|
GL_BUFFER_SIZE,
|
||||||
|
GL_DOUBLEBUFFER,
|
||||||
|
GL_DEPTH_SIZE,
|
||||||
|
GL_STENCIL_SIZE,
|
||||||
|
GL_ACCUM_RED_SIZE,
|
||||||
|
GL_ACCUM_GREEN_SIZE,
|
||||||
|
GL_ACCUM_BLUE_SIZE,
|
||||||
|
GL_ACCUM_ALPHA_SIZE,
|
||||||
|
GL_STEREO,
|
||||||
|
GL_MULTISAMPLEBUFFERS,
|
||||||
|
GL_MULTISAMPLESAMPLES,
|
||||||
|
GL_ACCELERATED_VISUAL,
|
||||||
|
GL_RETAINED_BACKING,
|
||||||
|
GL_CONTEXT_MAJOR_VERSION,
|
||||||
|
GL_CONTEXT_MINOR_VERSION,
|
||||||
|
GL_CONTEXT_FLAGS,
|
||||||
|
GL_CONTEXT_PROFILE_MASK,
|
||||||
|
GL_SHARE_WITH_CURRENT_CONTEXT,
|
||||||
|
GL_FRAMEBUFFER_SRGB_CAPABLE,
|
||||||
|
GL_CONTEXT_RELEASE_BEHAVIOR,
|
||||||
|
GL_CONTEXT_RESET_NOTIFICATION,
|
||||||
|
GL_CONTEXT_NO_ERROR,
|
||||||
|
GL_FLOATBUFFERS,
|
||||||
|
GL_EGL_PLATFORM
|
||||||
|
}
|
||||||
|
|
||||||
|
typedef GLProfile = uint;
|
||||||
|
|
||||||
|
const GLProfile GL_CONTEXT_PROFILE_CORE = 0x0001;
|
||||||
|
const GLProfile GL_CONTEXT_PROFILE_COMPATIBILITY = 0x0002;
|
||||||
|
const GLProfile GL_CONTEXT_PROFILE_ES = 0x0004;
|
||||||
|
|
||||||
|
typedef GLContextFlag = uint;
|
||||||
|
|
||||||
|
const GLContextFlag GL_CONTEXT_DEBUG_FLAG = 0x0001;
|
||||||
|
const GLContextFlag GL_CONTEXT_FORWARD_COMPATIBLE_FLAG = 0x0002;
|
||||||
|
const GLContextFlag GL_CONTEXT_ROBUST_ACCESS_FLAG = 0x0004;
|
||||||
|
const GLContextFlag GL_CONTEXT_RESET_ISOLATION_FLAG = 0x0008;
|
||||||
|
|
||||||
|
typedef GLContextReleaseFlag = uint;
|
||||||
|
|
||||||
|
const GLContextReleaseFlag GL_CONTEXT_RELEASE_BEHAVIOR_NONE = 0x0000;
|
||||||
|
const GLContextReleaseFlag GL_CONTEXT_RELEASE_BEHAVIOR_FLUSH = 0x0001;
|
||||||
|
|
||||||
|
typedef GLContextResetNotification = uint;
|
||||||
|
|
||||||
|
const GLContextResetNotification GL_CONTEXT_RESET_NO_NOTIFICATION = 0x0000;
|
||||||
|
const GLContextResetNotification GL_CONTEXT_RESET_LOSE_CONTEXT = 0x0001;
|
||||||
|
|
||||||
|
extern fn int get_num_video_drivers() @extern("SDL_GetNumVideoDrivers");
|
||||||
|
extern fn ZString get_video_driver(int index) @extern("SDL_GetVideoDriver");
|
||||||
|
extern fn ZString get_current_video_driver() @extern("SDL_GetCurrentVideoDriver");
|
||||||
|
extern fn SystemTheme get_system_theme() @extern("SDL_GetSystemTheme");
|
||||||
|
extern fn DisplayID * get_displays(int *count) @extern("SDL_GetDisplays");
|
||||||
|
extern fn DisplayID get_primary_display() @extern("SDL_GetPrimaryDisplay");
|
||||||
|
extern fn PropertiesID get_display_properties(DisplayID displayID) @extern("SDL_GetDisplayProperties");
|
||||||
|
|
||||||
|
const ZString PROP_DISPLAY_HDR_ENABLED_BOOLEAN = "SDL.display.HDR_enabled";
|
||||||
|
const ZString PROP_DISPLAY_KMSDRM_PANEL_ORIENTATION_NUMBER = "SDL.display.KMSDRM.panel_orientation";
|
||||||
|
|
||||||
|
extern fn ZString get_display_name(DisplayID displayID) @extern("SDL_GetDisplayName");
|
||||||
|
extern fn bool get_display_bounds(DisplayID displayID, Rect* rect) @extern("SDL_GetDisplayBounds");
|
||||||
|
extern fn bool get_display_usable_bounds(DisplayID displayID, Rect* rect) @extern("SDL_GetDisplayUsableBounds");
|
||||||
|
extern fn DisplayOrientation get_natural_display_orientation(DisplayID displayID) @extern("SDL_GetNaturalDisplayOrientation");
|
||||||
|
extern fn DisplayOrientation get_current_display_orientation(DisplayID displayID) @extern("SDL_GetCurrentDisplayOrientation");
|
||||||
|
extern fn float get_display_content_scale(DisplayID displayID) @extern("SDL_GetDisplayContentScale");
|
||||||
|
extern fn DisplayMode** get_fullscreen_display_modes(DisplayID displayID, int *count) @extern("SDL_GetFullscreenDisplayModes");
|
||||||
|
extern fn bool get_closest_fullscreen_display_mode(DisplayID displayID, int w, int h, float refresh_rate, bool include_high_density_modes, DisplayMode*closest) @extern("SDL_GetClosestFullscreenDisplayMode");
|
||||||
|
extern fn DisplayMode* get_desktop_display_mode(DisplayID displayID) @extern("SDL_GetDesktopDisplayMode");
|
||||||
|
extern fn DisplayMode* get_current_display_mode(DisplayID displayID) @extern("SDL_GetCurrentDisplayMode");
|
||||||
|
extern fn DisplayID get_display_for_point(Point *point) @extern("SDL_GetDisplayForPoint");
|
||||||
|
extern fn DisplayID get_display_for_rect(Rect *rect) @extern("SDL_GetDisplayForRect");
|
||||||
|
extern fn DisplayID get_display_for_window(Window *window) @extern("SDL_GetDisplayForWindow");
|
||||||
|
extern fn float get_window_pixel_density(Window *window) @extern("SDL_GetWindowPixelDensity");
|
||||||
|
extern fn float get_window_display_scale(Window *window) @extern("SDL_GetWindowDisplayScale");
|
||||||
|
extern fn bool set_window_fullscreen_mode(Window *window, DisplayMode* mode) @extern("SDL_SetWindowFullscreenMode");
|
||||||
|
extern fn DisplayMode* get_window_fullscreen_mode(Window *window) @extern("SDL_GetWindowFullscreenMode");
|
||||||
|
extern fn void* get_window_icc_profile(Window *window, isz* size) @extern("SDL_GetWindowICCProfile");
|
||||||
|
extern fn PixelFormat get_window_pixel_format(Window *window) @extern("SDL_GetWindowPixelFormat");
|
||||||
|
extern fn Window** get_windows(int *count) @extern("SDL_GetWindows");
|
||||||
|
extern fn Window* create_window(ZString title, int w, int h, WindowFlags flags) @extern("SDL_CreateWindow");
|
||||||
|
extern fn Window* create_popup_window(Window *parent, int offset_x, int offset_y, int w, int h, WindowFlags flags) @extern("SDL_CreatePopupWindow");
|
||||||
|
extern fn Window* create_window_with_properties(PropertiesID props) @extern("SDL_CreateWindowWithProperties");
|
||||||
|
|
||||||
|
const ZString PROP_WINDOW_CREATE_ALWAYS_ON_TOP_BOOLEAN = "SDL.window.create.always_on_top";
|
||||||
|
const ZString PROP_WINDOW_CREATE_BORDERLESS_BOOLEAN = "SDL.window.create.borderless";
|
||||||
|
const ZString PROP_WINDOW_CREATE_FOCUSABLE_BOOLEAN = "SDL.window.create.focusable";
|
||||||
|
const ZString PROP_WINDOW_CREATE_EXTERNAL_GRAPHICS_CONTEXT_BOOLEAN = "SDL.window.create.external_graphics_context";
|
||||||
|
const ZString PROP_WINDOW_CREATE_FLAGS_NUMBER = "SDL.window.create.flags";
|
||||||
|
const ZString PROP_WINDOW_CREATE_FULLSCREEN_BOOLEAN = "SDL.window.create.fullscreen";
|
||||||
|
const ZString PROP_WINDOW_CREATE_HEIGHT_NUMBER = "SDL.window.create.height";
|
||||||
|
const ZString PROP_WINDOW_CREATE_HIDDEN_BOOLEAN = "SDL.window.create.hidden";
|
||||||
|
const ZString PROP_WINDOW_CREATE_HIGH_PIXEL_DENSITY_BOOLEAN = "SDL.window.create.high_pixel_density";
|
||||||
|
const ZString PROP_WINDOW_CREATE_MAXIMIZED_BOOLEAN = "SDL.window.create.maximized";
|
||||||
|
const ZString PROP_WINDOW_CREATE_MENU_BOOLEAN = "SDL.window.create.menu";
|
||||||
|
const ZString PROP_WINDOW_CREATE_METAL_BOOLEAN = "SDL.window.create.metal";
|
||||||
|
const ZString PROP_WINDOW_CREATE_MINIMIZED_BOOLEAN = "SDL.window.create.minimized";
|
||||||
|
const ZString PROP_WINDOW_CREATE_MODAL_BOOLEAN = "SDL.window.create.modal";
|
||||||
|
const ZString PROP_WINDOW_CREATE_MOUSE_GRABBED_BOOLEAN = "SDL.window.create.mouse_grabbed";
|
||||||
|
const ZString PROP_WINDOW_CREATE_OPENGL_BOOLEAN = "SDL.window.create.opengl";
|
||||||
|
const ZString PROP_WINDOW_CREATE_PARENT_POINTER = "SDL.window.create.parent";
|
||||||
|
const ZString PROP_WINDOW_CREATE_RESIZABLE_BOOLEAN = "SDL.window.create.resizable";
|
||||||
|
const ZString PROP_WINDOW_CREATE_TITLE_STRING = "SDL.window.create.title";
|
||||||
|
const ZString PROP_WINDOW_CREATE_TRANSPARENT_BOOLEAN = "SDL.window.create.transparent";
|
||||||
|
const ZString PROP_WINDOW_CREATE_TOOLTIP_BOOLEAN = "SDL.window.create.tooltip";
|
||||||
|
const ZString PROP_WINDOW_CREATE_UTILITY_BOOLEAN = "SDL.window.create.utility";
|
||||||
|
const ZString PROP_WINDOW_CREATE_VULKAN_BOOLEAN = "SDL.window.create.vulkan";
|
||||||
|
const ZString PROP_WINDOW_CREATE_WIDTH_NUMBER = "SDL.window.create.width";
|
||||||
|
const ZString PROP_WINDOW_CREATE_X_NUMBER = "SDL.window.create.x";
|
||||||
|
const ZString PROP_WINDOW_CREATE_Y_NUMBER = "SDL.window.create.y";
|
||||||
|
const ZString PROP_WINDOW_CREATE_COCOA_WINDOW_POINTER = "SDL.window.create.cocoa.window";
|
||||||
|
const ZString PROP_WINDOW_CREATE_COCOA_VIEW_POINTER = "SDL.window.create.cocoa.view";
|
||||||
|
const ZString PROP_WINDOW_CREATE_WAYLAND_SURFACE_ROLE_CUSTOM_BOOLEAN = "SDL.window.create.wayland.surface_role_custom";
|
||||||
|
const ZString PROP_WINDOW_CREATE_WAYLAND_CREATE_EGL_WINDOW_BOOLEAN = "SDL.window.create.wayland.create_egl_window";
|
||||||
|
const ZString PROP_WINDOW_CREATE_WAYLAND_WL_SURFACE_POINTER = "SDL.window.create.wayland.wl_surface";
|
||||||
|
const ZString PROP_WINDOW_CREATE_WIN32_HWND_POINTER = "SDL.window.create.win32.hwnd";
|
||||||
|
const ZString PROP_WINDOW_CREATE_WIN32_PIXEL_FORMAT_HWND_POINTER = "SDL.window.create.win32.pixel_format_hwnd";
|
||||||
|
const ZString PROP_WINDOW_CREATE_X11_WINDOW_NUMBER = "SDL.window.create.x11.window";
|
||||||
|
|
||||||
|
extern fn WindowID get_window_id(Window* window) @extern("SDL_GetWindowID");
|
||||||
|
extern fn Window* get_window_from_id(WindowID id) @extern("SDL_GetWindowFromID");
|
||||||
|
extern fn Window* get_window_parent(Window* window) @extern("SDL_GetWindowParent");
|
||||||
|
extern fn PropertiesID get_window_properties(Window* window) @extern("SDL_GetWindowProperties");
|
||||||
|
|
||||||
|
const ZString PROP_WINDOW_SHAPE_POINTER = "SDL.window.shape";
|
||||||
|
const ZString PROP_WINDOW_HDR_ENABLED_BOOLEAN = "SDL.window.HDR_enabled";
|
||||||
|
const ZString PROP_WINDOW_SDR_WHITE_LEVEL_FLOAT = "SDL.window.SDR_white_level";
|
||||||
|
const ZString PROP_WINDOW_HDR_HEADROOM_FLOAT = "SDL.window.HDR_headroom";
|
||||||
|
const ZString PROP_WINDOW_ANDROID_WINDOW_POINTER = "SDL.window.android.window";
|
||||||
|
const ZString PROP_WINDOW_ANDROID_SURFACE_POINTER = "SDL.window.android.surface";
|
||||||
|
const ZString PROP_WINDOW_UIKIT_WINDOW_POINTER = "SDL.window.uikit.window";
|
||||||
|
const ZString PROP_WINDOW_UIKIT_METAL_VIEW_TAG_NUMBER = "SDL.window.uikit.metal_view_tag";
|
||||||
|
const ZString PROP_WINDOW_UIKIT_OPENGL_FRAMEBUFFER_NUMBER = "SDL.window.uikit.opengl.framebuffer";
|
||||||
|
const ZString PROP_WINDOW_UIKIT_OPENGL_RENDERBUFFER_NUMBER = "SDL.window.uikit.opengl.renderbuffer";
|
||||||
|
const ZString PROP_WINDOW_UIKIT_OPENGL_RESOLVE_FRAMEBUFFER_NUMBER = "SDL.window.uikit.opengl.resolve_framebuffer";
|
||||||
|
const ZString PROP_WINDOW_KMSDRM_DEVICE_INDEX_NUMBER = "SDL.window.kmsdrm.dev_index";
|
||||||
|
const ZString PROP_WINDOW_KMSDRM_DRM_FD_NUMBER = "SDL.window.kmsdrm.drm_fd";
|
||||||
|
const ZString PROP_WINDOW_KMSDRM_GBM_DEVICE_POINTER = "SDL.window.kmsdrm.gbm_dev";
|
||||||
|
const ZString PROP_WINDOW_COCOA_WINDOW_POINTER = "SDL.window.cocoa.window";
|
||||||
|
const ZString PROP_WINDOW_COCOA_METAL_VIEW_TAG_NUMBER = "SDL.window.cocoa.metal_view_tag";
|
||||||
|
const ZString PROP_WINDOW_OPENVR_OVERLAY_ID = "SDL.window.openvr.overlay_id";
|
||||||
|
const ZString PROP_WINDOW_VIVANTE_DISPLAY_POINTER = "SDL.window.vivante.display";
|
||||||
|
const ZString PROP_WINDOW_VIVANTE_WINDOW_POINTER = "SDL.window.vivante.window";
|
||||||
|
const ZString PROP_WINDOW_VIVANTE_SURFACE_POINTER = "SDL.window.vivante.surface";
|
||||||
|
const ZString PROP_WINDOW_WIN32_HWND_POINTER = "SDL.window.win32.hwnd";
|
||||||
|
const ZString PROP_WINDOW_WIN32_HDC_POINTER = "SDL.window.win32.hdc";
|
||||||
|
const ZString PROP_WINDOW_WIN32_INSTANCE_POINTER = "SDL.window.win32.instance";
|
||||||
|
const ZString PROP_WINDOW_WAYLAND_DISPLAY_POINTER = "SDL.window.wayland.display";
|
||||||
|
const ZString PROP_WINDOW_WAYLAND_SURFACE_POINTER = "SDL.window.wayland.surface";
|
||||||
|
const ZString PROP_WINDOW_WAYLAND_VIEWPORT_POINTER = "SDL.window.wayland.viewport";
|
||||||
|
const ZString PROP_WINDOW_WAYLAND_EGL_WINDOW_POINTER = "SDL.window.wayland.egl_window";
|
||||||
|
const ZString PROP_WINDOW_WAYLAND_XDG_SURFACE_POINTER = "SDL.window.wayland.xdg_surface";
|
||||||
|
const ZString PROP_WINDOW_WAYLAND_XDG_TOPLEVEL_POINTER = "SDL.window.wayland.xdg_toplevel";
|
||||||
|
const ZString PROP_WINDOW_WAYLAND_XDG_TOPLEVEL_EXPORT_HANDLE_STRING = "SDL.window.wayland.xdg_toplevel_export_handle";
|
||||||
|
const ZString PROP_WINDOW_WAYLAND_XDG_POPUP_POINTER = "SDL.window.wayland.xdg_popup";
|
||||||
|
const ZString PROP_WINDOW_WAYLAND_XDG_POSITIONER_POINTER = "SDL.window.wayland.xdg_positioner";
|
||||||
|
const ZString PROP_WINDOW_X11_DISPLAY_POINTER = "SDL.window.x11.display";
|
||||||
|
const ZString PROP_WINDOW_X11_SCREEN_NUMBER = "SDL.window.x11.screen";
|
||||||
|
const ZString PROP_WINDOW_X11_WINDOW_NUMBER = "SDL.window.x11.window";
|
||||||
|
|
||||||
|
extern fn WindowFlags get_window_flags(Window* window) @extern("SDL_GetWindowFlags");
|
||||||
|
extern fn bool set_window_title(Window* window, ZString title) @extern("SDL_SetWindowTitle");
|
||||||
|
extern fn ZString get_window_title(Window* window) @extern("SDL_GetWindowTitle");
|
||||||
|
extern fn bool set_window_icon(Window* window, Surface *icon) @extern("SDL_SetWindowIcon");
|
||||||
|
extern fn bool set_window_position(Window* window, int x, int y) @extern("SDL_SetWindowPosition");
|
||||||
|
extern fn bool get_window_position(Window* window, int *x, int *y) @extern("SDL_GetWindowPosition");
|
||||||
|
extern fn bool set_window_size(Window* window, int w, int h) @extern("SDL_SetWindowSize");
|
||||||
|
extern fn bool get_window_size(Window* window, int *w, int *h) @extern("SDL_GetWindowSize");
|
||||||
|
extern fn bool get_window_safe_area(Window* window, Rect *rect) @extern("SDL_GetWindowSafeArea");
|
||||||
|
extern fn bool set_window_aspect_ratio(Window* window, float min_aspect, float max_aspect) @extern("SDL_SetWindowAspectRatio");
|
||||||
|
extern fn bool get_window_aspect_ratio(Window* window, float *min_aspect, float *max_aspect) @extern("SDL_GetWindowAspectRatio");
|
||||||
|
extern fn bool get_window_borders_size(Window* window, int *top, int *left, int *bottom, int *right) @extern("SDL_GetWindowBordersSize");
|
||||||
|
extern fn bool get_window_size_in_pixels(Window* window, int *w, int *h) @extern("SDL_GetWindowSizeInPixels");
|
||||||
|
extern fn bool set_window_minimum_size(Window* window, int min_w, int min_h) @extern("SDL_SetWindowMinimumSize");
|
||||||
|
extern fn bool get_window_minimum_size(Window* window, int *w, int *h) @extern("SDL_GetWindowMinimumSize");
|
||||||
|
extern fn bool set_window_maximum_size(Window* window, int max_w, int max_h) @extern("SDL_SetWindowMaximumSize");
|
||||||
|
extern fn bool get_window_maximum_size(Window* window, int *w, int *h) @extern("SDL_GetWindowMaximumSize");
|
||||||
|
extern fn bool set_window_bordered(Window* window, bool bordered) @extern("SDL_SetWindowBordered");
|
||||||
|
extern fn bool set_window_resizable(Window* window, bool resizable) @extern("SDL_SetWindowResizable");
|
||||||
|
extern fn bool set_window_always_on_top(Window* window, bool on_top) @extern("SDL_SetWindowAlwaysOnTop");
|
||||||
|
extern fn bool show_window(Window* window) @extern("SDL_ShowWindow");
|
||||||
|
extern fn bool hide_window(Window* window) @extern("SDL_HideWindow");
|
||||||
|
extern fn bool raise_window(Window* window) @extern("SDL_RaiseWindow");
|
||||||
|
extern fn bool maximize_window(Window* window) @extern("SDL_MaximizeWindow");
|
||||||
|
extern fn bool minimize_window(Window* window) @extern("SDL_MinimizeWindow");
|
||||||
|
extern fn bool restore_window(Window* window) @extern("SDL_RestoreWindow");
|
||||||
|
extern fn bool set_window_fullscreen(Window* window, bool fullscreen) @extern("SDL_SetWindowFullscreen");
|
||||||
|
extern fn bool sync_window(Window* window) @extern("SDL_SyncWindow");
|
||||||
|
extern fn bool window_has_surface(Window* window) @extern("SDL_WindowHasSurface");
|
||||||
|
extern fn Surface* get_window_surface(Window* window) @extern("SDL_GetWindowSurface");
|
||||||
|
extern fn bool set_window_surface_v_sync(Window* window, int vsync) @extern("SDL_SetWindowSurfaceVSync");
|
||||||
|
|
||||||
|
const int WINDOW_SURFACE_VSYNC_DISABLED = 0;
|
||||||
|
const int WINDOW_SURFACE_VSYNC_ADAPTIVE = -1;
|
||||||
|
|
||||||
|
extern fn bool get_window_surface_v_sync(Window* window, int *vsync) @extern("SDL_GetWindowSurfaceVSync");
|
||||||
|
extern fn bool update_window_surface(Window* window) @extern("SDL_UpdateWindowSurface");
|
||||||
|
extern fn bool update_window_surface_rects(Window* window, Rect* rects, int numrects) @extern("SDL_UpdateWindowSurfaceRects");
|
||||||
|
extern fn bool destroy_window_surface(Window* window) @extern("SDL_DestroyWindowSurface");
|
||||||
|
extern fn bool set_window_keyboard_grab(Window* window, bool grabbed) @extern("SDL_SetWindowKeyboardGrab");
|
||||||
|
extern fn bool set_window_mouse_grab(Window* window, bool grabbed) @extern("SDL_SetWindowMouseGrab");
|
||||||
|
extern fn bool get_window_keyboard_grab(Window* window) @extern("SDL_GetWindowKeyboardGrab");
|
||||||
|
extern fn bool get_window_mouse_grab(Window* window) @extern("SDL_GetWindowMouseGrab");
|
||||||
|
extern fn Window* get_grabbed_window() @extern("SDL_GetGrabbedWindow");
|
||||||
|
extern fn bool set_window_mouse_rect(Window* window, Rect* rect) @extern("SDL_SetWindowMouseRect");
|
||||||
|
extern fn Rect* get_window_mouse_rect(Window* window) @extern("SDL_GetWindowMouseRect");
|
||||||
|
extern fn bool set_window_opacity(Window* window, float opacity) @extern("SDL_SetWindowOpacity");
|
||||||
|
extern fn float get_window_opacity(Window* window) @extern("SDL_GetWindowOpacity");
|
||||||
|
extern fn bool set_window_parent(Window* window, Window* parent) @extern("SDL_SetWindowParent");
|
||||||
|
extern fn bool set_window_modal(Window* window, bool modal) @extern("SDL_SetWindowModal");
|
||||||
|
extern fn bool set_window_focusable(Window* window, bool focusable) @extern("SDL_SetWindowFocusable");
|
||||||
|
extern fn bool show_window_system_menu(Window* window, int x, int y) @extern("SDL_ShowWindowSystemMenu");
|
||||||
|
|
||||||
|
enum HitTestResult : inline CInt{
|
||||||
|
HITTEST_NORMAL,
|
||||||
|
HITTEST_DRAGGABLE,
|
||||||
|
HITTEST_RESIZE_TOPLEFT,
|
||||||
|
HITTEST_RESIZE_TOP,
|
||||||
|
HITTEST_RESIZE_TOPRIGHT,
|
||||||
|
HITTEST_RESIZE_RIGHT,
|
||||||
|
HITTEST_RESIZE_BOTTOMRIGHT,
|
||||||
|
HITTEST_RESIZE_BOTTOM,
|
||||||
|
HITTEST_RESIZE_BOTTOMLEFT,
|
||||||
|
HITTEST_RESIZE_LEFT
|
||||||
|
}
|
||||||
|
|
||||||
|
alias HitTest = fn HitTestResult(Window *win, Point *area, void *data);
|
||||||
|
|
||||||
|
extern fn bool set_window_hit_test(Window *window, HitTest callback, void *callback_data) @extern("SDL_SetWindowHitTest");
|
||||||
|
extern fn bool set_window_shape(Window *window, Surface *shape) @extern("SDL_SetWindowShape");
|
||||||
|
extern fn bool flash_window(Window *window, FlashOperation operation) @extern("SDL_FlashWindow");
|
||||||
|
extern fn void destroy_window(Window *window) @extern("SDL_DestroyWindow");
|
||||||
|
|
||||||
|
extern fn bool screen_saver_enabled() @extern("SDL_ScreenSaverEnabled");
|
||||||
|
extern fn bool enable_screen_saver() @extern("SDL_EnableScreenSaver");
|
||||||
|
extern fn bool disable_screen_saver() @extern("SDL_DisableScreenSaver");
|
||||||
|
|
||||||
|
extern fn bool gl_load_library(ZString path) @extern("SDL_GL_LoadLibrary");
|
||||||
|
extern fn FunctionPointer gl_get_proc_address(ZString proc) @extern("SDL_GL_GetProcAddress");
|
||||||
|
extern fn FunctionPointer egl_get_proc_address(ZString proc) @extern("SDL_EGL_GetProcAddress");
|
||||||
|
extern fn void gl_unload_library() @extern("SDL_GL_UnloadLibrary");
|
||||||
|
extern fn bool gl_extension_supported(ZString extension) @extern("SDL_GL_ExtensionSupported");
|
||||||
|
extern fn void gl_reset_attributes() @extern("SDL_GL_ResetAttributes");
|
||||||
|
extern fn bool gl_set_attribute(GLAttr attr, int value) @extern("SDL_GL_SetAttribute");
|
||||||
|
extern fn bool gl_get_attribute(GLAttr attr, int *value) @extern("SDL_GL_GetAttribute");
|
||||||
|
extern fn GLContext gl_create_context(Window* window) @extern("SDL_GL_CreateContext");
|
||||||
|
extern fn bool gl_make_current(Window* window, GLContext context) @extern("SDL_GL_MakeCurrent");
|
||||||
|
extern fn Window* gl_get_current_window() @extern("SDL_GL_GetCurrentWindow");
|
||||||
|
extern fn GLContext gl_get_current_context() @extern("SDL_GL_GetCurrentContext");
|
||||||
|
extern fn EGLDisplay egl_get_current_display() @extern("SDL_EGL_GetCurrentDisplay");
|
||||||
|
extern fn EGLConfig egl_get_current_config() @extern("SDL_EGL_GetCurrentConfig");
|
||||||
|
extern fn EGLSurface egl_get_window_surface(Window* window) @extern("SDL_EGL_GetWindowSurface");
|
||||||
|
//extern fn void EGL_SetAttributeCallbacks(EGLAttribArrayCallback platformAttribCallback, EGLIntArrayCallback surfaceAttribCallback, EGLIntArrayCallback contextAttribCallback, void *userdata) @extern("SDL_EGL_SetAttributeCallbacks");
|
||||||
|
|
||||||
|
extern fn bool gl_set_swap_interval(int interval) @extern("SDL_GL_SetSwapInterval");
|
||||||
|
extern fn bool gl_get_swap_interval(int *interval) @extern("SDL_GL_GetSwapInterval");
|
||||||
|
extern fn bool gl_swap_window(Window *window) @extern("SDL_GL_SwapWindow");
|
||||||
|
extern fn bool gl_destroy_context(GLContext context) @extern("SDL_GL_DestroyContext");
|
29
shaders/source/RawTriangle.vert.glsl
Normal file
29
shaders/source/RawTriangle.vert.glsl
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
#version 450 core
|
||||||
|
|
||||||
|
// Explicitly set the output location for Vulkan
|
||||||
|
layout(location = 0) out vec4 vColor;
|
||||||
|
|
||||||
|
void main() {
|
||||||
|
// Initialize with default values
|
||||||
|
vec2 pos = vec2(0.0);
|
||||||
|
vec4 color = vec4(0.0);
|
||||||
|
|
||||||
|
// Use Vulkan's gl_VertexIndex instead of gl_VertexID
|
||||||
|
switch(gl_VertexIndex) {
|
||||||
|
case 0:
|
||||||
|
pos = vec2(-1.0, -1.0);
|
||||||
|
color = vec4(1.0, 0.0, 0.0, 1.0);
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
pos = vec2(1.0, -1.0);
|
||||||
|
color = vec4(0.0, 1.0, 0.0, 1.0);
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
pos = vec2(0.0, 1.0);
|
||||||
|
color = vec4(0.0, 0.0, 1.0, 1.0);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
gl_Position = vec4(pos, 0.0, 1.0);
|
||||||
|
vColor = color;
|
||||||
|
}
|
9
shaders/source/SolidColor.frag.glsl
Normal file
9
shaders/source/SolidColor.frag.glsl
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
#version 450 core
|
||||||
|
|
||||||
|
layout(location = 0) in vec4 Color; // Explicit location for fragment input
|
||||||
|
layout(location = 0) out vec4 FragColor; // Explicit location for fragment output
|
||||||
|
|
||||||
|
void main()
|
||||||
|
{
|
||||||
|
FragColor = Color;
|
||||||
|
}
|
240
test/gpu_triangle.c3
Normal file
240
test/gpu_triangle.c3
Normal file
@ -0,0 +1,240 @@
|
|||||||
|
import std::io;
|
||||||
|
import sdl3::sdl;
|
||||||
|
import std::io::file;
|
||||||
|
import std::core::mem;
|
||||||
|
|
||||||
|
const int WINDOW_WIDTH = 1200;
|
||||||
|
const int WINDOW_HEIGHT = 800;
|
||||||
|
const ZString WINDOW_TITLE = "Basic Triangle";
|
||||||
|
|
||||||
|
|
||||||
|
fn GPUShader* load_shader(GPUDevice* device, ZString filename, GPUShaderStage stage, uint sampler_count, uint uniform_buffer_count, uint storage_buffer_count, uint storage_texture_count)
|
||||||
|
{
|
||||||
|
//if(!SDL_GetPathInfo(filename, null)) {
|
||||||
|
// io::eprintf("File (%s) does not exist.\n", filename);
|
||||||
|
// return null;
|
||||||
|
//}
|
||||||
|
|
||||||
|
if (!file::is_file(filename.str_view())) {
|
||||||
|
io::eprintf("File %s is not a file\n", filename);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
ZString entrypoint;
|
||||||
|
GPUShaderFormat backend_formats = sdl::get_gpu_shader_formats(device);
|
||||||
|
GPUShaderFormat format = sdl::GPU_SHADERFORMAT_INVALID;
|
||||||
|
if (backend_formats & sdl::GPU_SHADERFORMAT_SPIRV) {
|
||||||
|
format = sdl::GPU_SHADERFORMAT_SPIRV;
|
||||||
|
entrypoint = "main";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
usz code_size = file::get_size(filename.str_view())!!;
|
||||||
|
char[] code = mem::new_array(char, code_size+1);
|
||||||
|
file::load_buffer(filename.str_view(), code)!!;
|
||||||
|
|
||||||
|
GPUShaderCreateInfo shader_info = {
|
||||||
|
.code = code.ptr,
|
||||||
|
.code_size = code.len,
|
||||||
|
.entrypoint = entrypoint,
|
||||||
|
.format = format,
|
||||||
|
.stage = stage,
|
||||||
|
.num_samplers = sampler_count,
|
||||||
|
.num_uniform_buffers = uniform_buffer_count,
|
||||||
|
.num_storage_buffers = storage_buffer_count,
|
||||||
|
.num_storage_textures = storage_texture_count
|
||||||
|
};
|
||||||
|
|
||||||
|
GPUShader* shader = sdl::create_gpu_shader(device, &shader_info);
|
||||||
|
|
||||||
|
if (shader == null) {
|
||||||
|
io::eprintf("ERROR: SDL_CreateGPUShader failed: %s\n", sdl::get_error());
|
||||||
|
sdl::free(code);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
sdl::free(code);
|
||||||
|
return shader;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
fn void print_info()
|
||||||
|
{
|
||||||
|
int render_drivers = sdl::get_num_render_drivers();
|
||||||
|
io::printf("Number of render drivers: %d\n", render_drivers)!!;
|
||||||
|
|
||||||
|
for (int i = 0; i < render_drivers; i++) {
|
||||||
|
io::printf("Render driver #%d: %s\n", i, sdl::get_render_driver(i))!!;
|
||||||
|
}
|
||||||
|
|
||||||
|
int video_drivers = sdl::get_num_video_drivers();
|
||||||
|
io::printf("Number of video drivers: %d\n", video_drivers)!!;
|
||||||
|
|
||||||
|
for (int i = 0; i < video_drivers; i++) {
|
||||||
|
io::printf("Video driver #%d: %s\n", i, sdl::get_video_driver(i))!!;
|
||||||
|
}
|
||||||
|
|
||||||
|
io::printf("Current video driver: %s\n", sdl::get_current_video_driver())!!;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
fn void handle_event(Event event, bool* quit) {
|
||||||
|
switch (event.type) {
|
||||||
|
case sdl::EVENT_QUIT: {
|
||||||
|
*quit = true;
|
||||||
|
} break;
|
||||||
|
case sdl::EVENT_KEY_DOWN: {
|
||||||
|
switch (event.key.key) {
|
||||||
|
case sdl::K_Q: {
|
||||||
|
*quit = true;
|
||||||
|
} break;
|
||||||
|
case sdl::K_W: {
|
||||||
|
|
||||||
|
} break;
|
||||||
|
case sdl::K_S: {
|
||||||
|
|
||||||
|
} break;
|
||||||
|
case sdl::K_D: {
|
||||||
|
|
||||||
|
} break;
|
||||||
|
}
|
||||||
|
} break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
fn int main() {
|
||||||
|
sdl::set_hint(sdl::HINT_VIDEO_DRIVER, "wayland");
|
||||||
|
|
||||||
|
if (!sdl::init(sdl::INIT_VIDEO)) {
|
||||||
|
io::eprintf("ERROR: SDL_Init failed: %s\n", sdl::get_error());
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
Window* window;
|
||||||
|
window = sdl::create_window(WINDOW_TITLE, WINDOW_WIDTH, WINDOW_HEIGHT, sdl::WINDOW_VULKAN);
|
||||||
|
|
||||||
|
if (window == null) {
|
||||||
|
io::eprintf("ERROR: SDL_CreateWindow failed: %s\n", sdl::get_error());
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
sdl::set_window_position(window, sdl::WINDOWPOS_CENTERED, sdl::WINDOWPOS_CENTERED);
|
||||||
|
|
||||||
|
GPUDevice* device = sdl::create_gpu_device(sdl::GPU_SHADERFORMAT_SPIRV, true, null);
|
||||||
|
|
||||||
|
if (device == null) {
|
||||||
|
io::eprintf("ERROR: SDL_CreateGPUDevice failed: %s\n", sdl::get_error());
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
ZString device_driver = sdl::get_gpu_device_driver(device);
|
||||||
|
io::printf("OK: Created device with driver %s\n", device_driver)!!;
|
||||||
|
|
||||||
|
if (!sdl::claim_window_for_gpu_device(device, window)) {
|
||||||
|
io::eprintf("ERROR: SDL_ClaimWindowForGPUDevice failed: %s\n", sdl::get_error());
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Load shaders + create fill/line pipeline
|
||||||
|
GPUShader* shader_vert = load_shader(device, "shaders/compiled/RawTriangle.vert.spv", GPU_SHADERSTAGE_VERTEX, 0, 0, 0, 0);
|
||||||
|
if (shader_vert == null) {
|
||||||
|
io::eprintf("ERROR: LoadShader failed \n");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
GPUShader* shader_frag = load_shader(device, "shaders/compiled/SolidColor.frag.spv", GPU_SHADERSTAGE_FRAGMENT, 0, 0, 0, 0);
|
||||||
|
if (shader_vert == null) {
|
||||||
|
io::eprintf("ERROR: LoadShader failed \n");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
GPUGraphicsPipelineCreateInfo pipeline_info = {
|
||||||
|
.target_info = {
|
||||||
|
.num_color_targets = 1,
|
||||||
|
.color_target_descriptions = (GPUColorTargetDescription[]){{
|
||||||
|
.format = sdl::get_gpu_swapchain_texture_format(device, window)
|
||||||
|
}},
|
||||||
|
},
|
||||||
|
.primitive_type = GPUPrimitiveType.GPU_PRIMITIVETYPE_TRIANGLELIST,
|
||||||
|
.vertex_shader = shader_vert,
|
||||||
|
.fragment_shader = shader_frag,
|
||||||
|
};
|
||||||
|
|
||||||
|
GPUGraphicsPipeline* pipeline_fill;
|
||||||
|
GPUGraphicsPipeline* pipeline_line;
|
||||||
|
|
||||||
|
pipeline_info.rasterizer_state.fill_mode = GPU_FILLMODE_FILL;
|
||||||
|
pipeline_fill = sdl::create_gpu_graphics_pipeline(device, &pipeline_info);
|
||||||
|
if (pipeline_fill == null) {
|
||||||
|
io::eprintf("ERROR: SDL_CreateGPUGraphicsPipeline failed: %s\n", sdl::get_error());
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
pipeline_info.rasterizer_state.fill_mode = GPU_FILLMODE_LINE;
|
||||||
|
pipeline_line = sdl::create_gpu_graphics_pipeline(device, &pipeline_info);
|
||||||
|
if (pipeline_line == null) {
|
||||||
|
io::eprintf("ERROR: SDL_CreateGPUGraphicsPipeline failed: %s\n", sdl::get_error());
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
sdl::release_gpu_shader(device, shader_vert);
|
||||||
|
sdl::release_gpu_shader(device, shader_frag);
|
||||||
|
|
||||||
|
const FColor COLOR_WHITE = (FColor) { 1.0f, 1.0f, 1.0f, 1.0f };
|
||||||
|
const FColor COLOR_BLACK = (FColor) { 0.0f, 0.0f, 0.0f, 1.0f };
|
||||||
|
const FColor COLOR_RED = (FColor) { 1.0f, 0.0f, 0.0f, 1.0f };
|
||||||
|
const FColor COLOR_GREEN = (FColor) { 0.0f, 1.0f, 0.0f, 1.0f };
|
||||||
|
const FColor COLOR_BLUE = (FColor) { 0.0f, 0.0f, 1.0f, 1.0f };
|
||||||
|
const FColor COLOR_CYAN = (FColor) { 0.0f, 1.0f, 1.0f, 1.0f };
|
||||||
|
const FColor COLOR_YELLOW = (FColor) { 1.0f, 1.0f, 0.0f, 1.0f };
|
||||||
|
const FColor COLOR_PINK = (FColor) { 1.0f, 0.0f, 1.0f, 1.0f };
|
||||||
|
|
||||||
|
print_info();
|
||||||
|
|
||||||
|
bool quit = false;
|
||||||
|
while (!quit) {
|
||||||
|
Event event;
|
||||||
|
if (sdl::poll_event(&event)) handle_event(event, &quit);
|
||||||
|
GPUCommandBuffer* cmdbuf = sdl::acquire_gpu_command_buffer(device);
|
||||||
|
if (cmdbuf == null) {
|
||||||
|
io::eprintf("ERROR: SDL_AcquireGPUCommandBuffer failed: %s\n", sdl::get_error());
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
GPUTexture* swapchain_texture;
|
||||||
|
if (!sdl::wait_and_acquire_gpu_swapchain_texture(cmdbuf, window, &swapchain_texture, null, null)) {
|
||||||
|
io::eprintf("ERROR: SDL_WaitAndAcquireGPUSwapchainTexture failed: %s\n", sdl::get_error());
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (swapchain_texture == null) {
|
||||||
|
io::eprintf("ERROR: swapchain_texture is null\n");
|
||||||
|
sdl::submit_gpu_command_buffer(cmdbuf);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
GPUColorTargetInfo color_target_info;
|
||||||
|
color_target_info.texture = swapchain_texture;
|
||||||
|
color_target_info.clear_color = COLOR_BLACK;
|
||||||
|
color_target_info.load_op = GPULoadOp.GPU_LOADOP_CLEAR;
|
||||||
|
color_target_info.store_op = GPUStoreOp.GPU_STOREOP_STORE;
|
||||||
|
|
||||||
|
GPURenderPass* render_pass = sdl::begin_gpu_render_pass(cmdbuf, &color_target_info, 1, null);
|
||||||
|
sdl::bind_gpu_graphics_pipeline(render_pass, pipeline_fill);
|
||||||
|
sdl::draw_gpu_primitives(render_pass, 3, 1, 0, 0);
|
||||||
|
sdl::end_gpu_render_pass(render_pass);
|
||||||
|
|
||||||
|
sdl::submit_gpu_command_buffer(cmdbuf);
|
||||||
|
}
|
||||||
|
|
||||||
|
sdl::release_gpu_graphics_pipeline(device, pipeline_fill);
|
||||||
|
sdl::release_gpu_graphics_pipeline(device, pipeline_line);
|
||||||
|
|
||||||
|
sdl::release_window_from_gpu_device(device, window);
|
||||||
|
sdl::destroy_window(window);
|
||||||
|
sdl::destroy_gpu_device(device);
|
||||||
|
sdl::quit();
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
63
test/lettuce.c3
Normal file
63
test/lettuce.c3
Normal file
@ -0,0 +1,63 @@
|
|||||||
|
import std::io;
|
||||||
|
import sdl3::sdl;
|
||||||
|
|
||||||
|
fn int main() {
|
||||||
|
sdl::init(sdl::INIT_VIDEO);
|
||||||
|
|
||||||
|
Window* win = sdl::create_window("SDL3 Image", 640, 480, 0);
|
||||||
|
if (win == null) {
|
||||||
|
io::eprintfn("SDL_CreateWindow Error: %s", sdl::get_error());
|
||||||
|
sdl::quit();
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
Renderer* ren = sdl::create_renderer(win, null);
|
||||||
|
if (ren == null) {
|
||||||
|
io::eprintfn("SDL_CreateRenderer Error: %s", sdl::get_error());
|
||||||
|
sdl::destroy_window(win);
|
||||||
|
sdl::quit();
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
Surface* bmp = sdl::load_bmp("lettuce.bmp");
|
||||||
|
if (bmp == null) {
|
||||||
|
io::eprintfn("SDL_LoadBMP Error: %s", sdl::get_error());
|
||||||
|
sdl::destroy_renderer(ren);
|
||||||
|
sdl::destroy_window(win);
|
||||||
|
sdl::quit();
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
Texture* tex = sdl::create_texture_from_surface(ren, bmp);
|
||||||
|
sdl::destroy_surface(bmp);
|
||||||
|
|
||||||
|
if (tex == null) {
|
||||||
|
io::eprintfn("SDL_CreateTextureFromSurface Error: %s", sdl::get_error());
|
||||||
|
sdl::destroy_renderer(ren);
|
||||||
|
sdl::destroy_window(win);
|
||||||
|
sdl::quit();
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
Event e;
|
||||||
|
bool quit = false;
|
||||||
|
|
||||||
|
while (!quit) {
|
||||||
|
while (sdl::poll_event(&e)) {
|
||||||
|
if (e.type == sdl::EVENT_QUIT) {
|
||||||
|
quit = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
sdl::render_clear(ren);
|
||||||
|
sdl::render_texture(ren, tex, null, null);
|
||||||
|
sdl::render_present(ren);
|
||||||
|
}
|
||||||
|
|
||||||
|
sdl::destroy_texture(tex);
|
||||||
|
sdl::destroy_renderer(ren);
|
||||||
|
sdl::destroy_window(win);
|
||||||
|
sdl::quit();
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
162
test/test_enum.c3
Normal file
162
test/test_enum.c3
Normal file
@ -0,0 +1,162 @@
|
|||||||
|
enum OtherEnum : int
|
||||||
|
{
|
||||||
|
ABC,
|
||||||
|
DEF,
|
||||||
|
GHI
|
||||||
|
}
|
||||||
|
|
||||||
|
enum EventType : (inline int val)
|
||||||
|
{
|
||||||
|
SDL_EVENT_FIRST = 0,
|
||||||
|
|
||||||
|
SDL_EVENT_QUIT = 0x100,
|
||||||
|
|
||||||
|
SDL_EVENT_TERMINATING,
|
||||||
|
SDL_EVENT_LOW_MEMORY,
|
||||||
|
SDL_EVENT_WILL_ENTER_BACKGROUND,
|
||||||
|
SDL_EVENT_DID_ENTER_BACKGROUND,
|
||||||
|
SDL_EVENT_WILL_ENTER_FOREGROUND,
|
||||||
|
SDL_EVENT_DID_ENTER_FOREGROUND,
|
||||||
|
|
||||||
|
SDL_EVENT_LOCALE_CHANGED,
|
||||||
|
|
||||||
|
SDL_EVENT_SYSTEM_THEME_CHANGED,
|
||||||
|
|
||||||
|
SDL_EVENT_DISPLAY_ORIENTATION = 0x151,
|
||||||
|
SDL_EVENT_DISPLAY_ADDED,
|
||||||
|
SDL_EVENT_DISPLAY_REMOVED,
|
||||||
|
SDL_EVENT_DISPLAY_MOVED,
|
||||||
|
SDL_EVENT_DISPLAY_DESKTOP_MODE_CHANGED,
|
||||||
|
SDL_EVENT_DISPLAY_CURRENT_MODE_CHANGED,
|
||||||
|
SDL_EVENT_DISPLAY_CONTENT_SCALE_CHANGED,
|
||||||
|
SDL_EVENT_DISPLAY_FIRST = SDL_EVENT_DISPLAY_ORIENTATION,
|
||||||
|
SDL_EVENT_DISPLAY_LAST = SDL_EVENT_DISPLAY_CONTENT_SCALE_CHANGED,
|
||||||
|
|
||||||
|
SDL_EVENT_WINDOW_SHOWN = 0x202,
|
||||||
|
SDL_EVENT_WINDOW_HIDDEN,
|
||||||
|
SDL_EVENT_WINDOW_EXPOSED,
|
||||||
|
SDL_EVENT_WINDOW_MOVED,
|
||||||
|
SDL_EVENT_WINDOW_RESIZED,
|
||||||
|
SDL_EVENT_WINDOW_PIXEL_SIZE_CHANGED,
|
||||||
|
SDL_EVENT_WINDOW_METAL_VIEW_RESIZED,
|
||||||
|
SDL_EVENT_WINDOW_MINIMIZED,
|
||||||
|
SDL_EVENT_WINDOW_MAXIMIZED,
|
||||||
|
SDL_EVENT_WINDOW_RESTORED,
|
||||||
|
SDL_EVENT_WINDOW_MOUSE_ENTER,
|
||||||
|
SDL_EVENT_WINDOW_MOUSE_LEAVE,
|
||||||
|
SDL_EVENT_WINDOW_FOCUS_GAINED,
|
||||||
|
SDL_EVENT_WINDOW_FOCUS_LOST,
|
||||||
|
SDL_EVENT_WINDOW_CLOSE_REQUESTED,
|
||||||
|
SDL_EVENT_WINDOW_HIT_TEST,
|
||||||
|
SDL_EVENT_WINDOW_ICCPROF_CHANGED,
|
||||||
|
SDL_EVENT_WINDOW_DISPLAY_CHANGED,
|
||||||
|
SDL_EVENT_WINDOW_DISPLAY_SCALE_CHANGED,
|
||||||
|
SDL_EVENT_WINDOW_SAFE_AREA_CHANGED,
|
||||||
|
SDL_EVENT_WINDOW_OCCLUDED,
|
||||||
|
SDL_EVENT_WINDOW_ENTER_FULLSCREEN,
|
||||||
|
SDL_EVENT_WINDOW_LEAVE_FULLSCREEN,
|
||||||
|
SDL_EVENT_WINDOW_DESTROYED,
|
||||||
|
SDL_EVENT_WINDOW_HDR_STATE_CHANGED,
|
||||||
|
SDL_EVENT_WINDOW_FIRST = SDL_EVENT_WINDOW_SHOWN,
|
||||||
|
SDL_EVENT_WINDOW_LAST = SDL_EVENT_WINDOW_HDR_STATE_CHANGED,
|
||||||
|
|
||||||
|
SDL_EVENT_KEY_DOWN = 0x300,
|
||||||
|
SDL_EVENT_KEY_UP,
|
||||||
|
SDL_EVENT_TEXT_EDITING,
|
||||||
|
SDL_EVENT_TEXT_INPUT,
|
||||||
|
SDL_EVENT_KEYMAP_CHANGED,
|
||||||
|
SDL_EVENT_KEYBOARD_ADDED,
|
||||||
|
SDL_EVENT_KEYBOARD_REMOVED,
|
||||||
|
SDL_EVENT_TEXT_EDITING_CANDIDATES,
|
||||||
|
|
||||||
|
SDL_EVENT_MOUSE_MOTION = 0x400,
|
||||||
|
SDL_EVENT_MOUSE_BUTTON_DOWN,
|
||||||
|
SDL_EVENT_MOUSE_BUTTON_UP,
|
||||||
|
SDL_EVENT_MOUSE_WHEEL,
|
||||||
|
SDL_EVENT_MOUSE_ADDED,
|
||||||
|
SDL_EVENT_MOUSE_REMOVED,
|
||||||
|
|
||||||
|
SDL_EVENT_JOYSTICK_AXIS_MOTION = 0x600,
|
||||||
|
SDL_EVENT_JOYSTICK_BALL_MOTION,
|
||||||
|
SDL_EVENT_JOYSTICK_HAT_MOTION,
|
||||||
|
SDL_EVENT_JOYSTICK_BUTTON_DOWN,
|
||||||
|
SDL_EVENT_JOYSTICK_BUTTON_UP,
|
||||||
|
SDL_EVENT_JOYSTICK_ADDED,
|
||||||
|
SDL_EVENT_JOYSTICK_REMOVED,
|
||||||
|
SDL_EVENT_JOYSTICK_BATTERY_UPDATED,
|
||||||
|
SDL_EVENT_JOYSTICK_UPDATE_COMPLETE,
|
||||||
|
|
||||||
|
SDL_EVENT_GAMEPAD_AXIS_MOTION = 0x650,
|
||||||
|
SDL_EVENT_GAMEPAD_BUTTON_DOWN,
|
||||||
|
SDL_EVENT_GAMEPAD_BUTTON_UP,
|
||||||
|
SDL_EVENT_GAMEPAD_ADDED,
|
||||||
|
SDL_EVENT_GAMEPAD_REMOVED,
|
||||||
|
SDL_EVENT_GAMEPAD_REMAPPED,
|
||||||
|
SDL_EVENT_GAMEPAD_TOUCHPAD_DOWN,
|
||||||
|
SDL_EVENT_GAMEPAD_TOUCHPAD_MOTION,
|
||||||
|
SDL_EVENT_GAMEPAD_TOUCHPAD_UP,
|
||||||
|
SDL_EVENT_GAMEPAD_SENSOR_UPDATE,
|
||||||
|
SDL_EVENT_GAMEPAD_UPDATE_COMPLETE,
|
||||||
|
SDL_EVENT_GAMEPAD_STEAM_HANDLE_UPDATED,
|
||||||
|
|
||||||
|
SDL_EVENT_FINGER_DOWN = 0x700,
|
||||||
|
SDL_EVENT_FINGER_UP,
|
||||||
|
SDL_EVENT_FINGER_MOTION,
|
||||||
|
SDL_EVENT_FINGER_CANCELED,
|
||||||
|
|
||||||
|
|
||||||
|
SDL_EVENT_CLIPBOARD_UPDATE = 0x900,
|
||||||
|
|
||||||
|
SDL_EVENT_DROP_FILE = 0x1000,
|
||||||
|
SDL_EVENT_DROP_TEXT,
|
||||||
|
SDL_EVENT_DROP_BEGIN,
|
||||||
|
SDL_EVENT_DROP_COMPLETE,
|
||||||
|
SDL_EVENT_DROP_POSITION,
|
||||||
|
|
||||||
|
SDL_EVENT_AUDIO_DEVICE_ADDED = 0x1100,
|
||||||
|
SDL_EVENT_AUDIO_DEVICE_REMOVED,
|
||||||
|
SDL_EVENT_AUDIO_DEVICE_FORMAT_CHANGED,
|
||||||
|
|
||||||
|
SDL_EVENT_SENSOR_UPDATE = 0x1200,
|
||||||
|
|
||||||
|
SDL_EVENT_PEN_PROXIMITY_IN = 0x1300,
|
||||||
|
SDL_EVENT_PEN_PROXIMITY_OUT,
|
||||||
|
SDL_EVENT_PEN_DOWN,
|
||||||
|
SDL_EVENT_PEN_UP,
|
||||||
|
SDL_EVENT_PEN_BUTTON_DOWN,
|
||||||
|
SDL_EVENT_PEN_BUTTON_UP,
|
||||||
|
SDL_EVENT_PEN_MOTION,
|
||||||
|
SDL_EVENT_PEN_AXIS,
|
||||||
|
|
||||||
|
SDL_EVENT_CAMERA_DEVICE_ADDED = 0x1400,
|
||||||
|
SDL_EVENT_CAMERA_DEVICE_REMOVED,
|
||||||
|
SDL_EVENT_CAMERA_DEVICE_APPROVED,
|
||||||
|
SDL_EVENT_CAMERA_DEVICE_DENIED,
|
||||||
|
|
||||||
|
SDL_EVENT_RENDER_TARGETS_RESET = 0x2000,
|
||||||
|
SDL_EVENT_RENDER_DEVICE_RESET,
|
||||||
|
SDL_EVENT_RENDER_DEVICE_LOST,
|
||||||
|
|
||||||
|
SDL_EVENT_PRIVATE0 = 0x4000,
|
||||||
|
SDL_EVENT_PRIVATE1,
|
||||||
|
SDL_EVENT_PRIVATE2,
|
||||||
|
SDL_EVENT_PRIVATE3,
|
||||||
|
|
||||||
|
SDL_EVENT_POLL_SENTINEL = 0x7F00,
|
||||||
|
|
||||||
|
SDL_EVENT_USER = 0x8000,
|
||||||
|
|
||||||
|
SDL_EVENT_LAST = 0xFFFF,
|
||||||
|
|
||||||
|
SDL_EVENT_ENUM_PADDING = 0x7FFFFFFF
|
||||||
|
}
|
||||||
|
|
||||||
|
import std::io;
|
||||||
|
|
||||||
|
|
||||||
|
fn int main()
|
||||||
|
{
|
||||||
|
EventType ev = SDL_EVENT_WINDOW_RESIZED;
|
||||||
|
io::printfn("%d == %d", SDL_EVENT_WINDOW_RESIZED, ev);
|
||||||
|
return 0;
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user