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 #580

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 @@ -666,7 +666,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
}

fn C.SDL_GetAudioStatus() C.SDL_AudioStatus
Expand Down
30 changes: 15 additions & 15 deletions blendmode.c.v
Original file line number Diff line number Diff line change
Expand Up @@ -10,36 +10,36 @@ 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
mul = C.SDL_BLENDMODE_MUL // 0x00000008, color multiply dstRGB = (srcRGB * dstRGB) + (dstRGB * (1-srcA)) dstA = (srcA * dstA) + (dstA * (1-srcA))
@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
mul = C.SDL_BLENDMODE_MUL // 0x00000008, color multiply dstRGB = (srcRGB * dstRGB) + (dstRGB * (1-srcA)) dstA = (srcA * dstA) + (dstA * (1-srcA))
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 D3D9, D3D11
maximum = C.SDL_BLENDOPERATION_MAXIMUM // 0x5 max(dst, src) : supported by D3D9, D3D11
minimum = C.SDL_BLENDOPERATION_MINIMUM // 0x4, min(dst, src) : supported by D3D9, D3D11
maximum = C.SDL_BLENDOPERATION_MAXIMUM // 0x5 max(dst, src) : supported by D3D9, 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 @@ -83,12 +83,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
118 changes: 59 additions & 59 deletions events.c.v
Original file line number Diff line number Diff line change
Expand Up @@ -41,100 +41,100 @@ 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
localechanged = C.SDL_LOCALECHANGED // The user's locale preferences have changed.
app_didenterforeground = C.SDL_APP_DIDENTERFOREGROUND
localechanged = C.SDL_LOCALECHANGED // The user's locale preferences have changed.
// 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.
textediting_ext = C.SDL_TEXTEDITING_EXT // Extended keyboard text editing (composition)
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.
textediting_ext = C.SDL_TEXTEDITING_EXT // Extended keyboard text editing (composition)
// 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
joybatteryupdated = C.SDL_JOYBATTERYUPDATED // Joystick battery level change
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
joybatteryupdated = C.SDL_JOYBATTERYUPDATED // Joystick battery level change
// 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
controllertouchpaddown = C.SDL_CONTROLLERTOUCHPADDOWN // Game controller touchpad was touched
controllertouchpaddown = C.SDL_CONTROLLERTOUCHPADDOWN // Game controller touchpad was touched
controllertouchpadmotion = C.SDL_CONTROLLERTOUCHPADMOTION // Game controller touchpad finger was moved
controllertouchpadup = C.SDL_CONTROLLERTOUCHPADUP // Game controller touchpad finger was lifted
controllersensorupdate = C.SDL_CONTROLLERSENSORUPDATE // Game controller sensor was updated
controllertouchpadup = C.SDL_CONTROLLERTOUCHPADUP // Game controller touchpad finger was lifted
controllersensorupdate = C.SDL_CONTROLLERSENSORUPDATE // Game controller sensor 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
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
// Internal events
pollsentinel = C.SDL_POLLSENTINEL // 0x7F00, Signals the end of an event poll cycle
pollsentinel = C.SDL_POLLSENTINEL // 0x7F00, Signals the end of an event poll cycle
// Events ::SDL_USEREVENT through ::SDL_LASTEVENT are for your use, and should be allocated with SDL_RegisterEvents()
userevent = C.SDL_USEREVENT
userevent = C.SDL_USEREVENT
// 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 @@ -696,9 +696,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
Loading
Loading