Skip to content

Commit

Permalink
all: run vfmt over files (#763)
Browse files Browse the repository at this point in the history
  • Loading branch information
larpon authored Aug 10, 2024
1 parent fbbfabc commit 4ab3734
Show file tree
Hide file tree
Showing 21 changed files with 729 additions and 729 deletions.
34 changes: 17 additions & 17 deletions audio.c.v
Original file line number Diff line number Diff line change
Expand Up @@ -153,13 +153,13 @@ pub type AudioCallback = fn (userdata voidptr, stream &u8, len int)
@[typedef]
pub struct C.SDL_AudioSpec {
pub:
freq int // DSP frequency -- samples per second
format AudioFormat // C.SDL_AudioFormat Audio data format
channels u8 // Number of channels: 1 mono, 2 stereo
silence u8 // Audio buffer silence value (calculated)
samples u16 // Audio buffer size in sample FRAMES (total samples divided by channel count)
padding u16 // Necessary for some compile environments
size u32 // Audio buffer size in bytes (calculated)
freq int // DSP frequency -- samples per second
format AudioFormat // C.SDL_AudioFormat Audio data format
channels u8 // Number of channels: 1 mono, 2 stereo
silence u8 // Audio buffer silence value (calculated)
samples u16 // Audio buffer size in sample FRAMES (total samples divided by channel count)
padding u16 // Necessary for some compile environments
size u32 // Audio buffer size in bytes (calculated)
callback AudioCallback // C.SDL_AudioCallback // Callback that feeds the audio device (NULL to use SDL_QueueAudio()).
userdata voidptr // Userdata passed to callback (ignored for NULL callbacks).
}
Expand Down Expand Up @@ -210,17 +210,17 @@ pub type AudioCVTPackedSDLAudioCVT = C.SDL_AUDIOCVT_PACKEDSDL_AudioCVT
@[typedef]
pub struct C.SDL_AudioCVT {
pub:
needed int // Set to 1 if conversion possible
src_format AudioFormat // C.SDL_AudioFormat, Source audio format
dst_format AudioFormat // C.SDL_AudioFormat, Target audio format
rate_incr f64 // Rate conversion increment
buf &u8 // Buffer to hold entire audio data
len int // Length of original audio buffer
len_cvt int // Length of converted audio buffer
len_mult int // buffer must be len*len_mult big
len_ratio f64 // Given len, final size is len*len_ratio
needed int // Set to 1 if conversion possible
src_format AudioFormat // C.SDL_AudioFormat, Source audio format
dst_format AudioFormat // C.SDL_AudioFormat, Target audio format
rate_incr f64 // Rate conversion increment
buf &u8 // Buffer to hold entire audio data
len int // Length of original audio buffer
len_cvt int // Length of converted audio buffer
len_mult int // buffer must be len*len_mult big
len_ratio f64 // Given len, final size is len*len_ratio
filters [10]AudioFilter // C.SDL_AudioFilter NULL-terminated list of filter functions
filter_index int // Current audio conversion function
filter_index int // Current audio conversion function
}

pub type AudioCVT = C.SDL_AudioCVT
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 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
Loading

0 comments on commit 4ab3734

Please sign in to comment.