Skip to content

Commit

Permalink
tvintris: add needed type cast (propagate #489) (#494)
Browse files Browse the repository at this point in the history
  • Loading branch information
larpon authored Jun 4, 2023
1 parent eb4116a commit 3b96fdd
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 5 deletions.
2 changes: 1 addition & 1 deletion examples/tvintris/tvintris.v
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ fn (mut sdlc SdlContext) set_sdl_context(w int, h int, titl string) {
njoy := sdl.num_joysticks()
for i in 0 .. njoy {
sdl.joystick_open(i)
jn := unsafe { tos_clone(sdl.joystick_name_for_index(i)) }
jn := unsafe { tos_clone(&u8(sdl.joystick_name_for_index(i))) }
println('JOY NAME ${jn}')
for j in 0 .. n_joy_max {
if sdlc.jnames[j] == jn {
Expand Down
3 changes: 2 additions & 1 deletion joystick.c.v
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ pub enum JoystickType {
throttle
}

pub type JoystickID = int // C.SDL_JoystickID // Sint32 / int
// C.SDL_JoystickID // Sint32 / int
pub type JoystickID = int

// JoystickPowerLevel is C.SDL_JoystickPowerLevel
pub enum JoystickPowerLevel {
Expand Down
4 changes: 3 additions & 1 deletion keycode.c.v
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ module sdl
//
// A special exception is the number keys at the top of the keyboard which
// always map to SDLK_0...SDLK_9, regardless of layout.
pub type Keycode = int // Sint32 C.SDL_Keycode;

// Sint32 C.SDL_Keycode;
pub type Keycode = int

pub const (
sdlk_scancode_mask = C.SDLK_SCANCODE_MASK // (1<<30)
Expand Down
3 changes: 2 additions & 1 deletion metal.c.v
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ module sdl
// NOTE This can be cast directly to an NSView or UIView.
//
// `typedef void *SDL_MetalView;`
pub type MetalView = voidptr // C.SDL_MetalView
// C.SDL_MetalView
pub type MetalView = voidptr

// Metal support functions
fn C.SDL_Metal_CreateView(window &C.SDL_Window) C.SDL_MetalView
Expand Down
3 changes: 2 additions & 1 deletion timer.c.v
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ pub type TimerCallback = fn (interval u32, param voidptr) u32
fn C.SDL_TimerCallback(interval u32, param voidptr) u32

// Definition of the timer ID type.
pub type TimerID = int // typedef int SDL_TimerID;
// typedef int SDL_TimerID;
pub type TimerID = int

fn C.SDL_GetTicks() u32

Expand Down

0 comments on commit 3b96fdd

Please sign in to comment.