Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

all: run v fmt -w . to fix enum alignment #573

Merged
merged 1 commit into from
Sep 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion audio.c.v
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,7 @@ fn C.SDL_OpenAudioDevice(const_device &char, iscapture int, const_desired &C.SDL
pub enum AudioStatus {
audio_stopped = C.SDL_AUDIO_STOPPED // 0
audio_playing = C.SDL_AUDIO_PLAYING
audio_paused = C.SDL_AUDIO_PAUSED
audio_paused = C.SDL_AUDIO_PAUSED
}

pub fn get_audio_status() AudioStatus {
Expand Down
28 changes: 14 additions & 14 deletions blendmode.c.v
Original file line number Diff line number Diff line change
Expand Up @@ -10,35 +10,35 @@ module sdl
// BlendMode is the blend mode used in SDL_RenderCopy() and drawing operations.
// BlendMode is SDL_BlendMode
pub enum BlendMode {
@none = C.SDL_BLENDMODE_NONE // 0x00000000, no blending dstRGBA = srcRGBA
blend = C.SDL_BLENDMODE_BLEND // 0x00000001, alpha blending dstRGB = (srcRGB * srcA) + (dstRGB * (1-srcA)) dstA = srcA + (dstA * (1-srcA))
add = C.SDL_BLENDMODE_ADD // 0x00000002, additive blending dstRGB = (srcRGB * srcA) + dstRGB dstA = dstA
mod = C.SDL_BLENDMODE_MOD // 0x00000004, color modulate dstRGB = srcRGB * dstRGB dstA = dstA
@none = C.SDL_BLENDMODE_NONE // 0x00000000, no blending dstRGBA = srcRGBA
blend = C.SDL_BLENDMODE_BLEND // 0x00000001, alpha blending dstRGB = (srcRGB * srcA) + (dstRGB * (1-srcA)) dstA = srcA + (dstA * (1-srcA))
add = C.SDL_BLENDMODE_ADD // 0x00000002, additive blending dstRGB = (srcRGB * srcA) + dstRGB dstA = dstA
mod = C.SDL_BLENDMODE_MOD // 0x00000004, color modulate dstRGB = srcRGB * dstRGB dstA = dstA
invalid = C.SDL_BLENDMODE_INVALID // 0x7FFFFFFF
}

// BlendOperation is the blend operation used when combining source and destination pixel components
// BlendOperation is C.SDL_BlendOperation
pub enum BlendOperation {
add = C.SDL_BLENDOPERATION_ADD // 0x1, dst + src: supported by all renderers
subtract = C.SDL_BLENDOPERATION_SUBTRACT // 0x2, dst - src : supported by D3D9, D3D11, OpenGL, OpenGLES
add = C.SDL_BLENDOPERATION_ADD // 0x1, dst + src: supported by all renderers
subtract = C.SDL_BLENDOPERATION_SUBTRACT // 0x2, dst - src : supported by D3D9, D3D11, OpenGL, OpenGLES
rev_subtract = C.SDL_BLENDOPERATION_REV_SUBTRACT // 0x3, src - dst : supported by D3D9, D3D11, OpenGL, OpenGLES
minimum = C.SDL_BLENDOPERATION_MINIMUM // 0x4, min(dst, src) : supported by D3D11
maximum = C.SDL_BLENDOPERATION_MAXIMUM // 0x5 max(dst, src) : supported by D3D11
minimum = C.SDL_BLENDOPERATION_MINIMUM // 0x4, min(dst, src) : supported by D3D11
maximum = C.SDL_BLENDOPERATION_MAXIMUM // 0x5 max(dst, src) : supported by D3D11
}

// BlendFactor is the normalized factor used to multiply pixel components
// BlendFactor is C.SDL_BlendFactor
pub enum BlendFactor {
zero = C.SDL_BLENDFACTOR_ZERO // 0x1, 0, 0, 0, 0
one = C.SDL_BLENDFACTOR_ONE // 0x2, 1, 1, 1, 1
src_color = C.SDL_BLENDFACTOR_SRC_COLOR // 0x3, srcR, srcG, srcB, srcA
zero = C.SDL_BLENDFACTOR_ZERO // 0x1, 0, 0, 0, 0
one = C.SDL_BLENDFACTOR_ONE // 0x2, 1, 1, 1, 1
src_color = C.SDL_BLENDFACTOR_SRC_COLOR // 0x3, srcR, srcG, srcB, srcA
one_minus_src_color = C.SDL_BLENDFACTOR_ONE_MINUS_SRC_COLOR // 0x4, 1-srcR, 1-srcG, 1-srcB, 1-srcA
src_alpha = C.SDL_BLENDFACTOR_SRC_ALPHA // 0x5, srcA, srcA, srcA, srcA
src_alpha = C.SDL_BLENDFACTOR_SRC_ALPHA // 0x5, srcA, srcA, srcA, srcA
one_minus_src_alpha = C.SDL_BLENDFACTOR_ONE_MINUS_SRC_ALPHA // 0x6, 1-srcA, 1-srcA, 1-srcA, 1-srcA
dst_color = C.SDL_BLENDFACTOR_DST_COLOR // 0x7, dstR, dstG, dstB, dstA
dst_color = C.SDL_BLENDFACTOR_DST_COLOR // 0x7, dstR, dstG, dstB, dstA
one_minus_dst_color = C.SDL_BLENDFACTOR_ONE_MINUS_DST_COLOR // 0x8, 1-dstR, 1-dstG, 1-dstB, 1-dstA
dst_alpha = C.SDL_BLENDFACTOR_DST_ALPHA // 0x9, dstA, dstA, dstA, dstA
dst_alpha = C.SDL_BLENDFACTOR_DST_ALPHA // 0x9, dstA, dstA, dstA, dstA
one_minus_dst_alpha = C.SDL_BLENDFACTOR_ONE_MINUS_DST_ALPHA // 0xA, 1-dstA, 1-dstA, 1-dstA, 1-dstA
}

Expand Down
10 changes: 5 additions & 5 deletions error.c.v
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@ pub fn clear_error() {

// ErrorCode is C.SDL_errorcode
pub enum ErrorCode {
enomem = C.SDL_ENOMEM
efread = C.SDL_EFREAD
efwrite = C.SDL_EFWRITE
efseek = C.SDL_EFSEEK
enomem = C.SDL_ENOMEM
efread = C.SDL_EFREAD
efwrite = C.SDL_EFWRITE
efseek = C.SDL_EFSEEK
unsupported = C.SDL_UNSUPPORTED
lasterror = C.SDL_LASTERROR
lasterror = C.SDL_LASTERROR
}

fn C.SDL_Error(code C.SDL_errorcode) int
Expand Down
104 changes: 52 additions & 52 deletions events.c.v
Original file line number Diff line number Diff line change
Expand Up @@ -30,90 +30,90 @@ pub type EventFilter = fn (userdata voidptr, event &Event)

// EventType is C.SDL_EventType
pub enum EventType {
firstevent = C.SDL_FIRSTEVENT // Unused (do not remove)
quit = C.SDL_QUIT // 0x100 User-requested quit
firstevent = C.SDL_FIRSTEVENT // Unused (do not remove)
quit = C.SDL_QUIT // 0x100 User-requested quit
// These application events have special meaning on iOS, see README-ios.md in SDL for details
// The application is being terminated by the OS
// Called on iOS in applicationWillTerminate()
// Called on Android in onDestroy()
app_terminating = C.SDL_APP_TERMINATING
app_terminating = C.SDL_APP_TERMINATING
// The application is low on memory, free memory if possible.
// Called on iOS in applicationDidReceiveMemoryWarning()
// Called on Android in onLowMemory()
app_lowmemory = C.SDL_APP_LOWMEMORY
app_lowmemory = C.SDL_APP_LOWMEMORY
// The application is about to enter the background
// Called on iOS in applicationWillResignActive()
// Called on Android in onPause()
app_willenterbackground = C.SDL_APP_WILLENTERBACKGROUND
app_willenterbackground = C.SDL_APP_WILLENTERBACKGROUND
// The application did enter the background and may not get CPU for some time
// Called on iOS in applicationDidEnterBackground()
// Called on Android in onPause()
app_didenterbackground = C.SDL_APP_DIDENTERBACKGROUND
app_didenterbackground = C.SDL_APP_DIDENTERBACKGROUND
// The application is about to enter the foreground
// Called on iOS in applicationWillEnterForeground()
// Called on Android in onResume()
app_willenterforeground = C.SDL_APP_WILLENTERFOREGROUND
app_willenterforeground = C.SDL_APP_WILLENTERFOREGROUND
// The application is now interactive
// Called on iOS in applicationDidBecomeActive()
// Called on Android in onResume()
app_didenterforeground = C.SDL_APP_DIDENTERFOREGROUND
app_didenterforeground = C.SDL_APP_DIDENTERFOREGROUND
// Display events
displayevent = C.SDL_DISPLAYEVENT // 0x150 Display state change
displayevent = C.SDL_DISPLAYEVENT // 0x150 Display state change
// Window events
windowevent = C.SDL_WINDOWEVENT // 0x200 Window state change
syswmevent = C.SDL_SYSWMEVENT
windowevent = C.SDL_WINDOWEVENT // 0x200 Window state change
syswmevent = C.SDL_SYSWMEVENT
// Keyboard events
keydown = C.SDL_KEYDOWN // 0x300, Key pressed
keyup = C.SDL_KEYUP // Key released
textediting = C.SDL_TEXTEDITING // Keyboard text editing (composition)
textinput = C.SDL_TEXTINPUT // Keyboard text input
keymapchanged = C.SDL_KEYMAPCHANGED // Keymap changed due to a system event such as an input language or keyboard layout change.
keydown = C.SDL_KEYDOWN // 0x300, Key pressed
keyup = C.SDL_KEYUP // Key released
textediting = C.SDL_TEXTEDITING // Keyboard text editing (composition)
textinput = C.SDL_TEXTINPUT // Keyboard text input
keymapchanged = C.SDL_KEYMAPCHANGED // Keymap changed due to a system event such as an input language or keyboard layout change.
// Mouse events
mousemotion = C.SDL_MOUSEMOTION // 0x400, Mouse moved
mousebuttondown = C.SDL_MOUSEBUTTONDOWN // Mouse button pressed
mousebuttonup = C.SDL_MOUSEBUTTONUP // Mouse button released
mousewheel = C.SDL_MOUSEWHEEL // Mouse wheel motion
mousemotion = C.SDL_MOUSEMOTION // 0x400, Mouse moved
mousebuttondown = C.SDL_MOUSEBUTTONDOWN // Mouse button pressed
mousebuttonup = C.SDL_MOUSEBUTTONUP // Mouse button released
mousewheel = C.SDL_MOUSEWHEEL // Mouse wheel motion
// Joystick events
joyaxismotion = C.SDL_JOYAXISMOTION // 0x600, Joystick axis motion
joyballmotion = C.SDL_JOYBALLMOTION // Joystick trackball motion
joyhatmotion = C.SDL_JOYHATMOTION // Joystick hat position change
joybuttondown = C.SDL_JOYBUTTONDOWN // Joystick button pressed
joybuttonup = C.SDL_JOYBUTTONUP // Joystick button released
joydeviceadded = C.SDL_JOYDEVICEADDED // A new joystick has been inserted into the system
joydeviceremoved = C.SDL_JOYDEVICEREMOVED // An opened joystick has been removed
joyaxismotion = C.SDL_JOYAXISMOTION // 0x600, Joystick axis motion
joyballmotion = C.SDL_JOYBALLMOTION // Joystick trackball motion
joyhatmotion = C.SDL_JOYHATMOTION // Joystick hat position change
joybuttondown = C.SDL_JOYBUTTONDOWN // Joystick button pressed
joybuttonup = C.SDL_JOYBUTTONUP // Joystick button released
joydeviceadded = C.SDL_JOYDEVICEADDED // A new joystick has been inserted into the system
joydeviceremoved = C.SDL_JOYDEVICEREMOVED // An opened joystick has been removed
// Game controller events
controlleraxismotion = C.SDL_CONTROLLERAXISMOTION // 0x650, Game controller axis motion
controllerbuttondown = C.SDL_CONTROLLERBUTTONDOWN // Game controller button pressed
controllerbuttonup = C.SDL_CONTROLLERBUTTONUP // Game controller button released
controllerdeviceadded = C.SDL_CONTROLLERDEVICEADDED // A new Game controller has been inserted into the system
controllerdeviceremoved = C.SDL_CONTROLLERDEVICEREMOVED // An opened Game controller has been removed
controlleraxismotion = C.SDL_CONTROLLERAXISMOTION // 0x650, Game controller axis motion
controllerbuttondown = C.SDL_CONTROLLERBUTTONDOWN // Game controller button pressed
controllerbuttonup = C.SDL_CONTROLLERBUTTONUP // Game controller button released
controllerdeviceadded = C.SDL_CONTROLLERDEVICEADDED // A new Game controller has been inserted into the system
controllerdeviceremoved = C.SDL_CONTROLLERDEVICEREMOVED // An opened Game controller has been removed
controllerdeviceremapped = C.SDL_CONTROLLERDEVICEREMAPPED // The controller mapping was updated
// Touch events
fingerdown = C.SDL_FINGERDOWN // 0x700
fingerup = C.SDL_FINGERUP
fingermotion = C.SDL_FINGERMOTION
fingerdown = C.SDL_FINGERDOWN // 0x700
fingerup = C.SDL_FINGERUP
fingermotion = C.SDL_FINGERMOTION
// Gesture events
dollargesture = C.SDL_DOLLARGESTURE // 0x800
dollarrecord = C.SDL_DOLLARRECORD
multigesture = C.SDL_MULTIGESTURE
dollargesture = C.SDL_DOLLARGESTURE // 0x800
dollarrecord = C.SDL_DOLLARRECORD
multigesture = C.SDL_MULTIGESTURE
// Clipboard events
clipboardupdate = C.SDL_CLIPBOARDUPDATE // 0x900 The clipboard changed
clipboardupdate = C.SDL_CLIPBOARDUPDATE // 0x900 The clipboard changed
// Drag and drop events
dropfile = C.SDL_DROPFILE // 0x1000 The system requests a file open
droptext = C.SDL_DROPTEXT // text/plain drag-and-drop event
dropbegin = C.SDL_DROPBEGIN // A new set of drops is beginning (NULL filename)
dropcomplete = C.SDL_DROPCOMPLETE // Current set of drops is now complete (NULL filename)
dropfile = C.SDL_DROPFILE // 0x1000 The system requests a file open
droptext = C.SDL_DROPTEXT // text/plain drag-and-drop event
dropbegin = C.SDL_DROPBEGIN // A new set of drops is beginning (NULL filename)
dropcomplete = C.SDL_DROPCOMPLETE // Current set of drops is now complete (NULL filename)
// Audio hotplug events
audiodeviceadded = C.SDL_AUDIODEVICEADDED // 0x1100 A new audio device is available
audiodeviceremoved = C.SDL_AUDIODEVICEREMOVED // An audio device has been removed.
audiodeviceadded = C.SDL_AUDIODEVICEADDED // 0x1100 A new audio device is available
audiodeviceremoved = C.SDL_AUDIODEVICEREMOVED // An audio device has been removed.
// Sensor events
sensorupdate = C.SDL_SENSORUPDATE // 0x1200 A sensor was updated
sensorupdate = C.SDL_SENSORUPDATE // 0x1200 A sensor was updated
// Render events
render_targets_reset = C.SDL_RENDER_TARGETS_RESET // 0x2000 The render targets have been reset and their contents need to be updated
render_device_reset = C.SDL_RENDER_DEVICE_RESET /// The device has been reset and all textures need to be recreated
userevent = C.SDL_USEREVENT // Events ::SDL_USEREVENT through ::SDL_LASTEVENT are for your use, and should be allocated with SDL_RegisterEvents()
render_targets_reset = C.SDL_RENDER_TARGETS_RESET // 0x2000 The render targets have been reset and their contents need to be updated
render_device_reset = C.SDL_RENDER_DEVICE_RESET /// The device has been reset and all textures need to be recreated
userevent = C.SDL_USEREVENT // Events ::SDL_USEREVENT through ::SDL_LASTEVENT are for your use, and should be allocated with SDL_RegisterEvents()
// This last event is only for bounding internal arrays
lastevent = C.SDL_LASTEVENT // 0xFFFF
lastevent = C.SDL_LASTEVENT // 0xFFFF
}

// CommonEvent is fields shared by every event
Expand Down Expand Up @@ -578,9 +578,9 @@ pub fn pump_events() {

// EventAction is C.SDL_eventaction
pub enum EventAction {
addevent = C.SDL_ADDEVENT
addevent = C.SDL_ADDEVENT
peekevent = C.SDL_PEEKEVENT
getevent = C.SDL_GETEVENT
getevent = C.SDL_GETEVENT
}

fn C.SDL_PeepEvents(events &C.SDL_Event, numevents int, action C.SDL_eventaction, min_type u32, max_type u32) int
Expand Down
52 changes: 26 additions & 26 deletions gamecontroller.c.v
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ pub type GameController = C.SDL_GameController

// GameControllerBindType is C.SDL_GameControllerBindType
pub enum GameControllerBindType {
@none = C.SDL_CONTROLLER_BINDTYPE_NONE // 0
@none = C.SDL_CONTROLLER_BINDTYPE_NONE // 0
button = C.SDL_CONTROLLER_BINDTYPE_BUTTON
axis = C.SDL_CONTROLLER_BINDTYPE_AXIS
hat = C.SDL_CONTROLLER_BINDTYPE_HAT
axis = C.SDL_CONTROLLER_BINDTYPE_AXIS
hat = C.SDL_CONTROLLER_BINDTYPE_HAT
}

pub union Value {
Expand Down Expand Up @@ -278,14 +278,14 @@ pub fn game_controller_update() {
//
// GameControllerAxis is C.SDL_GameControllerAxis
pub enum GameControllerAxis {
invalid = C.SDL_CONTROLLER_AXIS_INVALID // -1
leftx = C.SDL_CONTROLLER_AXIS_LEFTX
lefty = C.SDL_CONTROLLER_AXIS_LEFTY
rightx = C.SDL_CONTROLLER_AXIS_RIGHTX
righty = C.SDL_CONTROLLER_AXIS_RIGHTY
triggerleft = C.SDL_CONTROLLER_AXIS_TRIGGERLEFT
invalid = C.SDL_CONTROLLER_AXIS_INVALID // -1
leftx = C.SDL_CONTROLLER_AXIS_LEFTX
lefty = C.SDL_CONTROLLER_AXIS_LEFTY
rightx = C.SDL_CONTROLLER_AXIS_RIGHTX
righty = C.SDL_CONTROLLER_AXIS_RIGHTY
triggerleft = C.SDL_CONTROLLER_AXIS_TRIGGERLEFT
triggerright = C.SDL_CONTROLLER_AXIS_TRIGGERRIGHT
max = C.SDL_CONTROLLER_AXIS_MAX
max = C.SDL_CONTROLLER_AXIS_MAX
}

fn C.SDL_GameControllerGetAxisFromString(pch_string &char) C.SDL_GameControllerAxis
Expand Down Expand Up @@ -324,23 +324,23 @@ pub fn game_controller_get_axis(gamecontroller &GameController, axis GameControl
// GameControllerButton is the list of buttons available from a controller
// GameControllerButton is C.SDL_GameControllerButton
pub enum GameControllerButton {
invalid = C.SDL_CONTROLLER_BUTTON_INVALID // -1
a = C.SDL_CONTROLLER_BUTTON_A
b = C.SDL_CONTROLLER_BUTTON_B
x = C.SDL_CONTROLLER_BUTTON_X
y = C.SDL_CONTROLLER_BUTTON_Y
back = C.SDL_CONTROLLER_BUTTON_BACK
guide = C.SDL_CONTROLLER_BUTTON_GUIDE
start = C.SDL_CONTROLLER_BUTTON_START
leftstick = C.SDL_CONTROLLER_BUTTON_LEFTSTICK
rightstick = C.SDL_CONTROLLER_BUTTON_RIGHTSTICK
leftshoulder = C.SDL_CONTROLLER_BUTTON_LEFTSHOULDER
invalid = C.SDL_CONTROLLER_BUTTON_INVALID // -1
a = C.SDL_CONTROLLER_BUTTON_A
b = C.SDL_CONTROLLER_BUTTON_B
x = C.SDL_CONTROLLER_BUTTON_X
y = C.SDL_CONTROLLER_BUTTON_Y
back = C.SDL_CONTROLLER_BUTTON_BACK
guide = C.SDL_CONTROLLER_BUTTON_GUIDE
start = C.SDL_CONTROLLER_BUTTON_START
leftstick = C.SDL_CONTROLLER_BUTTON_LEFTSTICK
rightstick = C.SDL_CONTROLLER_BUTTON_RIGHTSTICK
leftshoulder = C.SDL_CONTROLLER_BUTTON_LEFTSHOULDER
rightshoulder = C.SDL_CONTROLLER_BUTTON_RIGHTSHOULDER
dpad_up = C.SDL_CONTROLLER_BUTTON_DPAD_UP
dpad_down = C.SDL_CONTROLLER_BUTTON_DPAD_DOWN
dpad_left = C.SDL_CONTROLLER_BUTTON_DPAD_LEFT
dpad_right = C.SDL_CONTROLLER_BUTTON_DPAD_RIGHT
max = C.SDL_CONTROLLER_BUTTON_MAX
dpad_up = C.SDL_CONTROLLER_BUTTON_DPAD_UP
dpad_down = C.SDL_CONTROLLER_BUTTON_DPAD_DOWN
dpad_left = C.SDL_CONTROLLER_BUTTON_DPAD_LEFT
dpad_right = C.SDL_CONTROLLER_BUTTON_DPAD_RIGHT
max = C.SDL_CONTROLLER_BUTTON_MAX
}

fn C.SDL_GameControllerGetButtonFromString(pch_string &char) C.SDL_GameControllerButton
Expand Down
4 changes: 2 additions & 2 deletions hints.c.v
Original file line number Diff line number Diff line change
Expand Up @@ -975,8 +975,8 @@ pub const (

// HintPriority is C.SDL_HintPriority
pub enum HintPriority {
default = C.SDL_HINT_DEFAULT
normal = C.SDL_HINT_NORMAL
default = C.SDL_HINT_DEFAULT
normal = C.SDL_HINT_NORMAL
override = C.SDL_HINT_OVERRIDE
}

Expand Down
6 changes: 3 additions & 3 deletions image/image.c.v
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ pub fn linked_version() &sdl.Version {

// InitFlags isC.IMG_InitFlags
pub enum InitFlags {
jpg = C.IMG_INIT_JPG // 0x00000001
png = C.IMG_INIT_PNG // 0x00000002
tif = C.IMG_INIT_TIF // 0x00000004
jpg = C.IMG_INIT_JPG // 0x00000001
png = C.IMG_INIT_PNG // 0x00000002
tif = C.IMG_INIT_TIF // 0x00000004
webp = C.IMG_INIT_WEBP // 0x00000008
}

Expand Down
Loading
Loading