mirror of
https://github.com/odin-lang/Odin.git
synced 2026-06-08 11:34:20 +00:00
Add struct field tag fmt formatting
This commit is contained in:
16
vendor/sdl3/sdl3_endian.odin
vendored
16
vendor/sdl3/sdl3_endian.odin
vendored
@@ -13,12 +13,12 @@ BYTEORDER :: LIL_ENDIAN when ODIN_ENDIAN == .Little else BIG_ENDIAN
|
||||
@(require_results) SwapFloat :: #force_inline proc "c" (x: f32) -> f32 { return intrinsics.byte_swap(x) }
|
||||
|
||||
|
||||
@(require_results) Swap16LE :: #force_inline proc "c" (x: Uint16) -> Uint16 { x := x; return Uint16((^u16le)(&x)^) }
|
||||
@(require_results) Swap32LE :: #force_inline proc "c" (x: Uint32) -> Uint32 { x := x; return Uint32((^u32le)(&x)^) }
|
||||
@(require_results) Swap64LE :: #force_inline proc "c" (x: Uint64) -> Uint64 { x := x; return Uint64((^u64le)(&x)^) }
|
||||
@(require_results) SwapFloatLE :: #force_inline proc "c" (x: f32) -> f32 { x := x; return f32 ((^f32le)(&x)^) }
|
||||
@(require_results) Swap16LE :: #force_inline proc "c" (x: Uint16) -> Uint16 { return Uint16(transmute(u16le)x) }
|
||||
@(require_results) Swap32LE :: #force_inline proc "c" (x: Uint32) -> Uint32 { return Uint32(transmute(u32le)x) }
|
||||
@(require_results) Swap64LE :: #force_inline proc "c" (x: Uint64) -> Uint64 { return Uint64(transmute(u64le)x) }
|
||||
@(require_results) SwapFloatLE :: #force_inline proc "c" (x: f32) -> f32 { return f32 (transmute(f32le)x) }
|
||||
|
||||
@(require_results) Swap16BE :: #force_inline proc "c" (x: Uint16) -> Uint16 { x := x; return Uint16((^u16be)(&x)^) }
|
||||
@(require_results) Swap32BE :: #force_inline proc "c" (x: Uint32) -> Uint32 { x := x; return Uint32((^u32be)(&x)^) }
|
||||
@(require_results) Swap64BE :: #force_inline proc "c" (x: Uint64) -> Uint64 { x := x; return Uint64((^u64be)(&x)^) }
|
||||
@(require_results) SwapFloatBE :: #force_inline proc "c" (x: f32) -> f32 { x := x; return f32 ((^f32be)(&x)^) }
|
||||
@(require_results) Swap16BE :: #force_inline proc "c" (x: Uint16) -> Uint16 { return Uint16(transmute(u16be)x) }
|
||||
@(require_results) Swap32BE :: #force_inline proc "c" (x: Uint32) -> Uint32 { return Uint32(transmute(u32be)x) }
|
||||
@(require_results) Swap64BE :: #force_inline proc "c" (x: Uint64) -> Uint64 { return Uint64(transmute(u64be)x) }
|
||||
@(require_results) SwapFloatBE :: #force_inline proc "c" (x: f32) -> f32 { return f32 (transmute(f32be)x) }
|
||||
8
vendor/sdl3/sdl3_hidapi.odin
vendored
8
vendor/sdl3/sdl3_hidapi.odin
vendored
@@ -34,20 +34,20 @@ hid_bus_type :: enum c.int {
|
||||
|
||||
hid_device_info :: struct {
|
||||
/** Platform-specific device path */
|
||||
path: [^]c.char,
|
||||
path: [^]c.char `fmt:"q,0"`,
|
||||
/** Device Vendor ID */
|
||||
vendor_id: c.ushort,
|
||||
/** Device Product ID */
|
||||
product_id: c.ushort,
|
||||
/** Serial Number */
|
||||
serial_number: [^]c.wchar_t,
|
||||
serial_number: [^]c.wchar_t `fmt:"q,0"`,
|
||||
/** Device Release Number in binary-coded decimal,
|
||||
also known as Device Version Number */
|
||||
release_number: c.ushort,
|
||||
/** Manufacturer String */
|
||||
manufacturer_string: [^]c.wchar_t,
|
||||
manufacturer_string: [^]c.wchar_t `fmt:"q,0"`,
|
||||
/** Product string */
|
||||
product_string: [^]c.wchar_t,
|
||||
product_string: [^]c.wchar_t `fmt:"q,0"`,
|
||||
/** Usage Page for this Device/Interface
|
||||
(Windows/Mac/hidraw only) */
|
||||
usage_page: c.ushort,
|
||||
|
||||
4
vendor/sdl3/sdl3_joystick.odin
vendored
4
vendor/sdl3/sdl3_joystick.odin
vendored
@@ -85,8 +85,8 @@ VirtualJoystickDesc :: struct {
|
||||
e.g. (1 << SDL_GAMEPAD_AXIS_LEFTX) */
|
||||
|
||||
name: cstring, /**< the name of the joystick */
|
||||
touchpads: [^]VirtualJoystickTouchpadDesc, /**< A pointer to an array of touchpad descriptions, required if `ntouchpads` is > 0 */
|
||||
sensors: [^]VirtualJoystickSensorDesc, /**< A pointer to an array of sensor descriptions, required if `nsensors` is > 0 */
|
||||
touchpads: [^]VirtualJoystickTouchpadDesc `fmt:"v,ntouchpads"`, /**< A pointer to an array of touchpad descriptions, required if `ntouchpads` is > 0 */
|
||||
sensors: [^]VirtualJoystickSensorDesc `fmt:"v,nsensors"`, /**< A pointer to an array of sensor descriptions, required if `nsensors` is > 0 */
|
||||
|
||||
userdata: rawptr, /**< User data pointer passed to callbacks */
|
||||
Update: proc "c" (userdata: rawptr), /**< Called when the joystick state should be updated */
|
||||
|
||||
10
vendor/sdl3/sdl3_pixels.odin
vendored
10
vendor/sdl3/sdl3_pixels.odin
vendored
@@ -523,17 +523,17 @@ Color :: distinct [4]Uint8
|
||||
FColor :: distinct [4]f32
|
||||
|
||||
Palette :: struct {
|
||||
ncolors: c.int, /**< number of elements in `colors`. */
|
||||
colors: [^]Color, /**< an array of colors, `ncolors` long. */
|
||||
version: Uint32, /**< internal use only, do not touch. */
|
||||
refcount: c.int, /**< internal use only, do not touch. */
|
||||
ncolors: c.int, /**< number of elements in `colors`. */
|
||||
colors: [^]Color `fmt:"v,ncolors"`, /**< an array of colors, `ncolors` long. */
|
||||
version: Uint32, /**< internal use only, do not touch. */
|
||||
refcount: c.int, /**< internal use only, do not touch. */
|
||||
}
|
||||
|
||||
PixelFormatDetails :: struct {
|
||||
format: PixelFormat,
|
||||
bits_per_pixel: Uint8,
|
||||
bytes_per_pixel: Uint8,
|
||||
padding: [2]Uint8,
|
||||
_: [2]Uint8,
|
||||
Rmask: Uint32,
|
||||
Gmask: Uint32,
|
||||
Bmask: Uint32,
|
||||
|
||||
Reference in New Issue
Block a user