Skip to content

Commit 33b01e2

Browse files
committed
[Breaking] sdl2.zig strict C compatibilty
1 parent 655dd81 commit 33b01e2

File tree

1 file changed

+16
-16
lines changed

1 file changed

+16
-16
lines changed

src/sdl2.zig

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -201,11 +201,11 @@ pub fn createWindow(
201201
title: ?[*:0]const u8,
202202
x: c_int,
203203
y: c_int,
204-
w: c_int,
205-
h: c_int,
204+
w: u16,
205+
h: u16,
206206
flags: Window.Flags,
207207
) Error!*Window {
208-
return SDL_CreateWindow(title, x, y, w, h, flags) orelse return makeError();
208+
return SDL_CreateWindow(title, x, y, @intCast(w), @intCast(h), flags) orelse return makeError();
209209
}
210210
extern fn SDL_CreateWindow(
211211
title: ?[*:0]const u8,
@@ -1524,8 +1524,8 @@ pub const WindowEvent = extern struct {
15241524
padding1: u8,
15251525
padding2: u8,
15261526
padding3: u8,
1527-
data1: i32,
1528-
data2: i32,
1527+
data1: c_int,
1528+
data2: c_int,
15291529
};
15301530

15311531
pub const KeyboardEvent = extern struct {
@@ -1544,8 +1544,8 @@ pub const TextEditingEvent = extern struct {
15441544
timestamp: u32,
15451545
window_id: WindowID,
15461546
text: [text_size]u8,
1547-
start: i32,
1548-
length: i32,
1547+
start: c_int,
1548+
length: c_int,
15491549

15501550
const text_size = 32;
15511551
};
@@ -1555,8 +1555,8 @@ pub const TextEditingExtEvent = extern struct {
15551555
timestamp: u32,
15561556
window_id: WindowID,
15571557
text: [*:0]u8,
1558-
start: i32,
1559-
length: i32,
1558+
start: c_int,
1559+
length: c_int,
15601560
};
15611561

15621562
pub const TextInputEvent = extern struct {
@@ -1574,10 +1574,10 @@ pub const MouseMotionEvent = extern struct {
15741574
window_id: WindowID,
15751575
which: MouseID,
15761576
state: u32,
1577-
x: i32,
1578-
y: i32,
1579-
xrel: i32,
1580-
yrel: i32,
1577+
x: c_int,
1578+
y: c_int,
1579+
xrel: c_int,
1580+
yrel: c_int,
15811581
};
15821582

15831583
pub const MouseButtonEvent = extern struct {
@@ -1589,8 +1589,8 @@ pub const MouseButtonEvent = extern struct {
15891589
state: ReleasedOrPressed,
15901590
clicks: u8,
15911591
padding1: u8,
1592-
x: i32,
1593-
y: i32,
1592+
x: c_int,
1593+
y: c_int,
15941594
};
15951595

15961596
pub const MouseWheelEvent = extern struct {
@@ -2215,7 +2215,7 @@ pub const getMouseFocus = SDL_GetMouseFocus;
22152215
extern fn SDL_GetMouseFocus() ?*Window;
22162216

22172217
pub const getMouseState = SDL_GetMouseState;
2218-
extern fn SDL_GetMouseState(x: ?*i32, y: ?*i32) u32;
2218+
extern fn SDL_GetMouseState(x: ?*c_int, y: ?*c_int) u32;
22192219

22202220
const ShowCursorToggleOption = enum(c_int) { enable, disable, query };
22212221
pub fn showCursor(toggle: ShowCursorToggleOption) Error!void {

0 commit comments

Comments
 (0)