Skip to content

Commit

Permalink
all: update to new attribute syntax [attr] -> @[attr]
Browse files Browse the repository at this point in the history
  • Loading branch information
larpon committed Nov 18, 2023
1 parent 454185d commit 4a37b10
Show file tree
Hide file tree
Showing 31 changed files with 95 additions and 95 deletions.
2 changes: 1 addition & 1 deletion a_types.c.v
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module sdl

// va_list
[typedef]
@[typedef]
pub struct C.va_list {}
2 changes: 1 addition & 1 deletion atomic.c.v
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ pub fn memory_barrier_acquire_function() {

// AtomicT is a type representing an atomic integer value. It is a struct
// so people don't accidentally use numeric operations on it.
[typedef]
@[typedef]
pub struct C.SDL_atomic_t {
pub:
value int
Expand Down
6 changes: 3 additions & 3 deletions audio.c.v
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ pub type AudioCallback = fn (userdata voidptr, stream &u8, len int)
// 7: FL FR FC LFE BC SL SR (6.1 surround)
// 8: FL FR FC LFE BL BR SL SR (7.1 surround)

[typedef]
@[typedef]
pub struct C.SDL_AudioSpec {
pub:
freq int // DSP frequency -- samples per second
Expand Down Expand Up @@ -204,7 +204,7 @@ pub type AudioCVTPackedSDLAudioCVT = C.SDL_AUDIOCVT_PACKEDSDL_AudioCVT
// you to pass it aligned data, but can possibly run much faster if you
// set both its (buf) field to a pointer that is aligned to 16 bytes, and its
// (len) field to something that's a multiple of 16, if possible.
[typedef]
@[typedef]
pub struct C.SDL_AudioCVT {
pub:
needed int // Set to 1 if conversion possible
Expand Down Expand Up @@ -941,7 +941,7 @@ pub fn convert_audio(cvt &AudioCVT) int {
// - You push data as you have it, and pull it when you need it
//
// this is opaque to the outside world.
[typedef]
@[typedef]
pub struct C.SDL_AudioStream {
}

Expand Down
62 changes: 31 additions & 31 deletions events.c.v
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ pub enum EventType {
}

// CommonEvent is fields shared by every event
[typedef]
@[typedef]
pub struct C.SDL_CommonEvent {
pub:
@type EventType
Expand All @@ -147,7 +147,7 @@ pub type CommonEvent = C.SDL_CommonEvent

// DisplayEvent is display state change event data (event.display.*)
// DisplayEvent is C.SDL_DisplayEvent
[typedef]
@[typedef]
pub struct C.SDL_DisplayEvent {
pub:
@type u32 // ::SDL_DISPLAYEVENT
Expand All @@ -163,7 +163,7 @@ pub:
pub type DisplayEvent = C.SDL_DisplayEvent

// WindowEvent is window state change event data (event.window.*)
[typedef]
@[typedef]
pub struct C.SDL_WindowEvent {
pub:
@type EventType // ::SDL_WINDOWEVENT
Expand All @@ -180,7 +180,7 @@ pub:
pub type WindowEvent = C.SDL_WindowEvent

// KeyboardEvent is Keyboard button event structure (event.key.*)
[typedef]
@[typedef]
pub struct C.SDL_KeyboardEvent {
pub:
@type EventType // ::SDL_KEYDOWN or ::SDL_KEYUP
Expand All @@ -196,7 +196,7 @@ pub:
pub type KeyboardEvent = C.SDL_KeyboardEvent

// TextEditingEvent is keyboard text editing event structure (event.edit.*)
[typedef]
@[typedef]
pub struct C.SDL_TextEditingEvent {
pub:
@type EventType // ::SDL_TEXTEDITING
Expand All @@ -210,7 +210,7 @@ pub:
pub type TextEditingEvent = C.SDL_TextEditingEvent

// TextInputEvent is keyboard text input event structure (event.text.*)
[typedef]
@[typedef]
pub struct C.SDL_TextInputEvent {
pub:
@type EventType // ::SDL_TEXTINPUT
Expand All @@ -222,7 +222,7 @@ pub:
pub type TextInputEvent = C.SDL_TextInputEvent

// MouseMotionEvent is mouse motion event structure (event.motion.*)
[typedef]
@[typedef]
pub struct C.SDL_MouseMotionEvent {
pub:
@type EventType // ::SDL_MOUSEMOTION
Expand All @@ -239,7 +239,7 @@ pub:
pub type MouseMotionEvent = C.SDL_MouseMotionEvent

// MouseButtonEvent is mouse button event structure (event.button.*)
[typedef]
@[typedef]
pub struct C.SDL_MouseButtonEvent {
pub:
@type EventType // ::SDL_MOUSEBUTTONDOWN or ::SDL_MOUSEBUTTONUP
Expand All @@ -257,7 +257,7 @@ pub:
pub type MouseButtonEvent = C.SDL_MouseButtonEvent

// MouseWheelEvent is mouse wheel event structure (event.wheel.*)
[typedef]
@[typedef]
pub struct C.SDL_MouseWheelEvent {
pub:
@type EventType // ::SDL_MOUSEWHEEL
Expand All @@ -274,7 +274,7 @@ pub:
pub type MouseWheelEvent = C.SDL_MouseWheelEvent

// JoyAxisEvent is joystick axis motion event structure (event.jaxis.*)
[typedef]
@[typedef]
pub struct C.SDL_JoyAxisEvent {
pub:
@type EventType // ::SDL_JOYAXISMOTION
Expand All @@ -291,7 +291,7 @@ pub:
pub type JoyAxisEvent = C.SDL_JoyAxisEvent

// JoyBallEvent is joystick trackball motion event structure (event.jball.*)
[typedef]
@[typedef]
pub struct C.SDL_JoyBallEvent {
pub:
@type EventType // ::SDL_JOYBALLMOTION
Expand All @@ -308,7 +308,7 @@ pub:
pub type JoyBallEvent = C.SDL_JoyBallEvent

// JoyHatEvent is joystick hat position change event structure (event.jhat.*)
[typedef]
@[typedef]
pub struct C.SDL_JoyHatEvent {
pub:
@type EventType // ::SDL_JOYHATMOTION
Expand All @@ -327,7 +327,7 @@ pub:
pub type JoyHatEvent = C.SDL_JoyHatEvent

// JoyButtonEvent is joystick button event structure (event.jbutton.*)
[typedef]
@[typedef]
pub struct C.SDL_JoyButtonEvent {
pub:
@type EventType // ::SDL_JOYBUTTONDOWN or ::SDL_JOYBUTTONUP
Expand All @@ -342,7 +342,7 @@ pub:
pub type JoyButtonEvent = C.SDL_JoyButtonEvent

// JoyDeviceEvent is joystick device event structure (event.jdevice.*)
[typedef]
@[typedef]
pub struct C.SDL_JoyDeviceEvent {
pub:
@type EventType // ::SDL_JOYDEVICEADDED or ::SDL_JOYDEVICEREMOVED
Expand All @@ -353,7 +353,7 @@ pub:
pub type JoyDeviceEvent = C.SDL_JoyDeviceEvent

// ControllerAxisEvent is game controller axis motion event structure (event.caxis.*)
[typedef]
@[typedef]
pub struct C.SDL_ControllerAxisEvent {
pub:
@type EventType // ::SDL_CONTROLLERAXISMOTION
Expand All @@ -370,7 +370,7 @@ pub:
pub type ControllerAxisEvent = C.SDL_ControllerAxisEvent

// ControllerButtonEvent is game controller button event structure (event.cbutton.*)
[typedef]
@[typedef]
pub struct C.SDL_ControllerButtonEvent {
pub:
@type EventType // ::SDL_CONTROLLERBUTTONDOWN or ::SDL_CONTROLLERBUTTONUP
Expand All @@ -385,7 +385,7 @@ pub:
pub type ControllerButtonEvent = C.SDL_ControllerButtonEvent

// ControllerDeviceEvent is controller device event structure (event.cdevice.*)
[typedef]
@[typedef]
pub struct C.SDL_ControllerDeviceEvent {
pub:
@type EventType // ::SDL_CONTROLLERDEVICEADDED, ::SDL_CONTROLLERDEVICEREMOVED, or ::SDL_CONTROLLERDEVICEREMAPPED
Expand All @@ -396,7 +396,7 @@ pub:
pub type ControllerDeviceEvent = C.SDL_ControllerDeviceEvent

// ControllerTouchpadEvent is game controller touchpad event structure (event.ctouchpad.*)
[typedef]
@[typedef]
pub struct C.SDL_ControllerTouchpadEvent {
pub:
@type u32 // ::SDL_CONTROLLERTOUCHPADDOWN or ::SDL_CONTROLLERTOUCHPADMOTION or ::SDL_CONTROLLERTOUCHPADUP
Expand All @@ -411,7 +411,7 @@ pub:

pub type ControllerTouchpadEvent = C.SDL_ControllerTouchpadEvent

[typedef]
@[typedef]
pub struct C.SDL_ControllerSensorEvent {
pub:
@type u32 // ::SDL_CONTROLLERSENSORUPDATE
Expand All @@ -424,7 +424,7 @@ pub:
pub type ControllerSensorEvent = C.SDL_ControllerSensorEvent

// AudioDeviceEvent is audio device event structure (event.adevice.*)
[typedef]
@[typedef]
pub struct C.SDL_AudioDeviceEvent {
pub:
@type EventType // ::SDL_AUDIODEVICEADDED, or ::SDL_AUDIODEVICEREMOVED
Expand All @@ -439,7 +439,7 @@ pub:
pub type AudioDeviceEvent = C.SDL_AudioDeviceEvent

// TouchFingerEvent is touch finger event structure (event.tfinger.*)
[typedef]
@[typedef]
pub struct C.SDL_TouchFingerEvent {
pub:
@type EventType // ::SDL_FINGERMOTION or ::SDL_FINGERDOWN or ::SDL_FINGERUP
Expand All @@ -457,7 +457,7 @@ pub:
pub type TouchFingerEvent = C.SDL_TouchFingerEvent

// MultiGestureEvent is Multiple Finger Gesture Event (event.mgesture.*)
[typedef]
@[typedef]
pub struct C.SDL_MultiGestureEvent {
pub:
@type EventType // ::SDL_MULTIGESTURE
Expand All @@ -474,7 +474,7 @@ pub:
pub type MultiGestureEvent = C.SDL_MultiGestureEvent

// DollarGestureEvent is Dollar Gesture Event (event.dgesture.*)
[typedef]
@[typedef]
pub struct C.SDL_DollarGestureEvent {
pub:
@type EventType // ::SDL_DOLLARGESTURE or ::SDL_DOLLARRECORD
Expand All @@ -493,7 +493,7 @@ pub type DollarGestureEvent = C.SDL_DollarGestureEvent
// This event is enabled by default, you can disable it with SDL_EventState().
// NOTE If this event is enabled, you must free the filename in the event.

[typedef]
@[typedef]
pub struct C.SDL_DropEvent {
pub:
@type EventType // ::SDL_DROPBEGIN or ::SDL_DROPFILE or ::SDL_DROPTEXT or ::SDL_DROPCOMPLETE
Expand All @@ -506,7 +506,7 @@ pub type DropEvent = C.SDL_DropEvent

// SensorEvent is sensor event structure (event.sensor.*)
// SensorEvent is C.SDL_SensorEvent
[typedef]
@[typedef]
pub struct C.SDL_SensorEvent {
pub:
@type u32 // ::SDL_SENSORUPDATE
Expand All @@ -518,7 +518,7 @@ pub:
pub type SensorEvent = C.SDL_SensorEvent

// QuitEvent is the "quit requested" event
[typedef]
@[typedef]
pub struct C.SDL_QuitEvent {
pub:
@type EventType // ::SDL_QUIT
Expand All @@ -528,7 +528,7 @@ pub:
pub type QuitEvent = C.SDL_QuitEvent

// OSEvent is an OS Specific event
[typedef]
@[typedef]
pub struct C.SDL_OSEvent {
pub:
@type EventType // ::SDL_QUIT
Expand All @@ -538,7 +538,7 @@ pub:
pub type OSEvent = C.SDL_OSEvent

// UserEvent is an user-defined event type (event.user.*)
[typedef]
@[typedef]
pub struct C.SDL_UserEvent {
pub:
@type EventType // ::SDL_USEREVENT through ::SDL_LASTEVENT-1
Expand All @@ -555,13 +555,13 @@ pub type UserEvent = C.SDL_UserEvent
// This event is disabled by default, you can enable it with SDL_EventState()
//
// NOTE If you want to use this event, you should include SDL_syswm.h.
[typedef]
@[typedef]
pub struct C.SDL_SysWMmsg {
}

pub type SysWMmsg = C.SDL_SysWMmsg

[typedef]
@[typedef]
pub struct C.SDL_SysWMEvent {
pub:
@type EventType // ::SDL_SYSWMEVENT
Expand All @@ -586,7 +586,7 @@ fn v_get_event_padding_size() int {
*/

// Event is a general event structure.
[typedef]
@[typedef]
pub union C.SDL_Event {
pub:
@type EventType // Event type, shared with all events
Expand Down
2 changes: 1 addition & 1 deletion examples/basic_mixer/basic_mixer.v
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ fn load_mus(path string) !&mixer.Music {
// We output to terminal to prevent depending on e.g. sdl.tff, in case
// it doesn't work or is broken - it then become easier to
// diagnose any potential library problems a setup might have.
[console]
@[console]
fn main() {
println('Const version ${mixer.major_version}.${mixer.minor_version}.${mixer.patchlevel}')
mut compiled_version := sdl.Version{}
Expand Down
2 changes: 1 addition & 1 deletion examples/sdl_opengl_and_sokol/main.v
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ struct Vertex_t {
a f32
}

[console]
@[console]
fn main() {
sdl.init(sdl.init_video)

Expand Down
6 changes: 3 additions & 3 deletions examples/tvintris/tvintris.v
Original file line number Diff line number Diff line change
Expand Up @@ -451,7 +451,7 @@ enum Action {
fire
}

[inline]
@[inline]
fn (game &Game) fill_rect(s &sdl.Surface, r &sdl.Rect, c &sdl.Color) {
sdl.fill_rect(s, r, sdl.map_rgba(game.sdl.screen.format, c.r, c.g, c.b, c.a))
}
Expand Down Expand Up @@ -767,12 +767,12 @@ fn (g &Game) draw_text(x int, y int, text string, tcol sdl.Color) {
sdl.free_surface(tsurf)
}

[inline]
@[inline]
fn (g &Game) draw_ptext(x int, y int, text string, tcol sdl.Color) {
g.draw_text(g.ofs_x + x, y, text, tcol)
}

[live]
@[live]
fn (g &Game) draw_begin() {
// println('about to clear')
sdl.render_clear(g.sdl.renderer)
Expand Down
4 changes: 2 additions & 2 deletions gamecontroller.c.v
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ module sdl
//

// GameController is the gamecontroller structure used to identify an SDL game controller
[typedef]
@[typedef]
pub struct C.SDL_GameController {
}

Expand Down Expand Up @@ -57,7 +57,7 @@ pub:
hat_mask int
}

[typedef]
@[typedef]
pub struct C.SDL_GameControllerButtonBind {
pub:
bindType GameControllerBindType // C.SDL_GameControllerBindType
Expand Down
Loading

0 comments on commit 4a37b10

Please sign in to comment.