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