Skip to content

Commit

Permalink
[BOX32][WRAPPER] More work on SDL2 Wrapping(but TheStanleyParable sti…
Browse files Browse the repository at this point in the history
…ll don't have mouse input working)
  • Loading branch information
ptitSeb committed Sep 30, 2024
1 parent f7c93b6 commit 0980c44
Show file tree
Hide file tree
Showing 3 changed files with 173 additions and 113 deletions.
68 changes: 35 additions & 33 deletions src/include/sdl2align32.h
Original file line number Diff line number Diff line change
Expand Up @@ -358,12 +358,12 @@ typedef union my_SDL2_Event_s {
my_SDL2_DropEvent_t drop;
} my_SDL2_Event_t;

typedef struct __attribute__((packed)) SDL2_CommonEvent_32_s {
typedef struct SDL2_CommonEvent_32_s {
uint32_t type;
uint32_t timestamp;
} my_SDL2_CommonEvent_32_t;

typedef struct __attribute__((packed)) SDL2_DisplayEvent_32_s {
typedef struct SDL2_DisplayEvent_32_s {
uint32_t type;
uint32_t timestamp;
uint32_t display;
Expand All @@ -374,7 +374,7 @@ typedef struct __attribute__((packed)) SDL2_DisplayEvent_32_s {
int32_t data1;
} my_SDL2_DisplayEvent_32_t;

typedef struct __attribute__((packed)) SDL2_WindowEvent_32_s {
typedef struct SDL2_WindowEvent_32_s {
uint32_t type;
uint32_t timestamp;
uint32_t windowID;
Expand All @@ -386,14 +386,14 @@ typedef struct __attribute__((packed)) SDL2_WindowEvent_32_s {
int32_t data2;
} my_SDL2_WindowEvent_32_t;

typedef struct __attribute__((packed)) SDL2_Keysym_32_s {
typedef struct SDL2_Keysym_32_s {
int32_t scancode;
int32_t sym;
uint16_t mod;
uint32_t unused;
} my_SDL2_Keysym_32_t;

typedef struct __attribute__((packed)) SDL2_KeyboardEvent_32_s {
typedef struct SDL2_KeyboardEvent_32_s {
uint32_t type;
uint32_t timestamp;
uint32_t windowID;
Expand All @@ -404,7 +404,7 @@ typedef struct __attribute__((packed)) SDL2_KeyboardEvent_32_s {
my_SDL2_Keysym_32_t keysym;
} my_SDL2_KeyboardEvent_32_t;

typedef struct __attribute__((packed)) SDL2_TextEditingEvent_32_s {
typedef struct SDL2_TextEditingEvent_32_s {
uint32_t type;
uint32_t timestamp;
uint32_t windowID;
Expand All @@ -414,23 +414,23 @@ typedef struct __attribute__((packed)) SDL2_TextEditingEvent_32_s {
} my_SDL2_TextEditingEvent_32_t;


typedef struct __attribute__((packed)) SDL2_TextEditingExtEvent_32_s {
typedef struct SDL2_TextEditingExtEvent_32_s {
uint32_t type;
uint32_t timestamp;
uint32_t windowID;
char* text;
ptr_t text; //char*
int32_t start;
int32_t length;
} my_SDL2_TextEditingExtEvent_32_t;

typedef struct __attribute__((packed)) SDL2_TextInputEvent_32_s {
typedef struct SDL2_TextInputEvent_32_s {
uint32_t type;
uint32_t timestamp;
uint32_t windowID;
char text[32];
} my_SDL2_TextInputEvent_32_t;

typedef struct __attribute__((packed)) SDL2_MouseMotionEvent_32_s {
typedef struct SDL2_MouseMotionEvent_32_s {
uint32_t type;
uint32_t timestamp;
uint32_t windowID;
Expand All @@ -442,7 +442,7 @@ typedef struct __attribute__((packed)) SDL2_MouseMotionEvent_32_s {
int32_t yrel;
} my_SDL2_MouseMotionEvent_32_t;

typedef struct __attribute__((packed)) SDL2_MouseButtonEvent_32_s {
typedef struct SDL2_MouseButtonEvent_32_s {
uint32_t type;
uint32_t timestamp;
uint32_t windowID;
Expand All @@ -455,7 +455,7 @@ typedef struct __attribute__((packed)) SDL2_MouseButtonEvent_32_s {
int32_t y;
} my_SDL2_MouseButtonEvent_32_t;

typedef struct __attribute__((packed)) SDL2_MouseWheelEvent_32_s {
typedef struct SDL2_MouseWheelEvent_32_s {
uint32_t type;
uint32_t timestamp;
uint32_t windowID;
Expand All @@ -469,7 +469,7 @@ typedef struct __attribute__((packed)) SDL2_MouseWheelEvent_32_s {
int32_t mouseY;
} my_SDL2_MouseWheelEvent_32_t;

typedef struct __attribute__((packed)) SDL2_JoyAxisEvent_32_s {
typedef struct SDL2_JoyAxisEvent_32_s {
uint32_t type;
uint32_t timestamp;
int32_t which;
Expand All @@ -482,7 +482,7 @@ typedef struct __attribute__((packed)) SDL2_JoyAxisEvent_32_s {
} my_SDL2_JoyAxisEvent_32_t;


typedef struct __attribute__((packed)) SDL2_JoyBallEvent_32_s {
typedef struct SDL2_JoyBallEvent_32_s {
uint32_t type;
uint32_t timestamp;
int32_t which;
Expand All @@ -494,7 +494,7 @@ typedef struct __attribute__((packed)) SDL2_JoyBallEvent_32_s {
int16_t yrel;
} my_SDL2_JoyBallEvent_32_t;

typedef struct __attribute__((packed)) SDL2_JoyHatEvent_32_s {
typedef struct SDL2_JoyHatEvent_32_s {
uint32_t type;
uint32_t timestamp;
int32_t which;
Expand All @@ -504,7 +504,7 @@ typedef struct __attribute__((packed)) SDL2_JoyHatEvent_32_s {
uint8_t padding2;
} my_SDL2_JoyHatEvent_32_t;

typedef struct __attribute__((packed)) SDL2_JoyButtonEvent_32_s {
typedef struct SDL2_JoyButtonEvent_32_s {
uint32_t type;
uint32_t timestamp;
int32_t which;
Expand All @@ -514,21 +514,21 @@ typedef struct __attribute__((packed)) SDL2_JoyButtonEvent_32_s {
uint8_t padding2;
} my_SDL2_JoyButtonEvent_32_t;

typedef struct __attribute__((packed)) SDL2_JoyDeviceEvent_32_s {
typedef struct SDL2_JoyDeviceEvent_32_s {
uint32_t type;
uint32_t timestamp;
int32_t which;
} my_SDL2_JoyDeviceEvent_32_t;


typedef struct __attribute__((packed)) SDL2_JoyBatteryEvent_32_s {
typedef struct SDL2_JoyBatteryEvent_32_s {
uint32_t type;
uint32_t timestamp;
int32_t which;
int32_t level;
} my_SDL2_JoyBatteryEvent_32_t;

typedef struct __attribute__((packed)) SDL2_ControllerAxisEvent_32_s {
typedef struct SDL2_ControllerAxisEvent_32_s {
uint32_t type;
uint32_t timestamp;
int32_t which;
Expand All @@ -541,7 +541,7 @@ typedef struct __attribute__((packed)) SDL2_ControllerAxisEvent_32_s {
} my_SDL2_ControllerAxisEvent_32_t;


typedef struct __attribute__((packed)) SDL2_ControllerButtonEvent_32_s {
typedef struct SDL2_ControllerButtonEvent_32_s {
uint32_t type;
uint32_t timestamp;
int32_t which;
Expand All @@ -552,13 +552,13 @@ typedef struct __attribute__((packed)) SDL2_ControllerButtonEvent_32_s {
} my_SDL2_ControllerButtonEvent_32_t;


typedef struct __attribute__((packed)) SDL2_ControllerDeviceEvent_32_s {
typedef struct SDL2_ControllerDeviceEvent_32_s {
uint32_t type;
uint32_t timestamp;
int32_t which;
} my_SDL2_ControllerDeviceEvent_32_t;

typedef struct __attribute__((packed)) SDL2_ControllerTouchpadEvent_32_s {
typedef struct SDL2_ControllerTouchpadEvent_32_s {
uint32_t type;
uint32_t timestamp;
int32_t which;
Expand All @@ -569,7 +569,7 @@ typedef struct __attribute__((packed)) SDL2_ControllerTouchpadEvent_32_s {
float pressure;
} my_SDL2_ControllerTouchpadEvent_32_t;

typedef struct __attribute__((packed)) SDL2_ControllerSensorEvent_32_s {
typedef struct SDL2_ControllerSensorEvent_32_s {
uint32_t type;
uint32_t timestamp;
int32_t which;
Expand All @@ -578,7 +578,7 @@ typedef struct __attribute__((packed)) SDL2_ControllerSensorEvent_32_s {
uint64_t timestamp_us;
} my_SDL2_ControllerSensorEvent_32_t;

typedef struct __attribute__((packed)) SDL2_AudioDeviceEvent_32_s {
typedef struct SDL2_AudioDeviceEvent_32_s {
uint32_t type;
uint32_t timestamp;
uint32_t which;
Expand All @@ -588,7 +588,7 @@ typedef struct __attribute__((packed)) SDL2_AudioDeviceEvent_32_s {
uint8_t padding3;
} my_SDL2_AudioDeviceEvent_32_t;

typedef struct __attribute__((packed)) SDL2_TouchFingerEvent_32_s {
typedef struct SDL2_TouchFingerEvent_32_s {
uint32_t type;
uint32_t timestamp;
int64_t touchId;
Expand All @@ -601,7 +601,7 @@ typedef struct __attribute__((packed)) SDL2_TouchFingerEvent_32_s {
uint32_t windowID;
} my_SDL2_TouchFingerEvent_32_t;

typedef struct __attribute__((packed)) SDL2_MultiGestureEvent_32_s {
typedef struct SDL2_MultiGestureEvent_32_s {
uint32_t type;
uint32_t timestamp;
int64_t touchId;
Expand All @@ -614,7 +614,7 @@ typedef struct __attribute__((packed)) SDL2_MultiGestureEvent_32_s {
} my_SDL2_MultiGestureEvent_32_t;


typedef struct __attribute__((packed)) SDL2_DollarGestureEvent_32_s {
typedef struct SDL2_DollarGestureEvent_32_s {
uint32_t type;
uint32_t timestamp;
int64_t touchId;
Expand All @@ -625,14 +625,14 @@ typedef struct __attribute__((packed)) SDL2_DollarGestureEvent_32_s {
float y;
} my_SDL2_DollarGestureEvent_32_t;

typedef struct __attribute__((packed)) SDL2_DropEvent_32_s {
typedef struct SDL2_DropEvent_32_s {
uint32_t type;
uint32_t timestamp;
ptr_t file;
uint32_t windowID;
} my_SDL2_DropEvent_32_t;

typedef struct __attribute__((packed)) SDL2_SensorEvent_32_s {
typedef struct SDL2_SensorEvent_32_s {
uint32_t type;
uint32_t timestamp;
int32_t which;
Expand All @@ -641,13 +641,13 @@ typedef struct __attribute__((packed)) SDL2_SensorEvent_32_s {
} my_SDL2_SensorEvent_32_t;


typedef struct __attribute__((packed)) SDL2_QuitEvent_32_s {
typedef struct SDL2_QuitEvent_32_s {
uint32_t type;
uint32_t timestamp;
} my_SDL2_QuitEvent_32_t;


typedef struct __attribute__((packed)) SDL2_UserEvent_32_s {
typedef struct SDL2_UserEvent_32_s {
uint32_t type;
uint32_t timestamp;
uint32_t windowID;
Expand All @@ -656,14 +656,14 @@ typedef struct __attribute__((packed)) SDL2_UserEvent_32_s {
ptr_t data2;
} my_SDL2_UserEvent_32_t;

typedef struct __attribute__((packed)) SDL2_SysWMEvent_32_s {
typedef struct SDL2_SysWMEvent_32_s {
uint32_t type;
uint32_t timestamp;
ptr_t msg;
} my_SDL2_SysWMEvent_32_t;


typedef union __attribute__((packed)) my_SDL2_Event_32_s {
typedef union my_SDL2_Event_32_s {
uint32_t type;
my_SDL2_CommonEvent_32_t common;
my_SDL2_DisplayEvent_32_t display;
Expand Down Expand Up @@ -885,6 +885,8 @@ void convert_SDL2_DisplayMode_to_32(void* dst_, void* src_);

void convert_SDL2_Event_to_64(void* dst_, const void* src_);
void convert_SDL2_Event_to_32(void* dst_, const void* src_);
void inplace_SDL2_Event_shrink(void* e);
void inplace_SDL2_Event_enlarge(void* e);

void inplace_SDL2_Palette_to_32(void* a);
void inplace_SDL2_PixelFormat_to_32(void* a);
Expand Down
Loading

0 comments on commit 0980c44

Please sign in to comment.