pushing untested code is always bad

This commit is contained in:
2024-08-14 15:22:53 +02:00
parent 35d9e9a7e5
commit e2740d76a5
2 changed files with 29 additions and 20 deletions
+1
View File
@@ -176,6 +176,7 @@ android_app :: struct {
// This is non-zero when the application's NativeActivity is being // This is non-zero when the application's NativeActivity is being
// destroyed and waiting for the app thread to complete. // destroyed and waiting for the app thread to complete.
// The android_main function must return to its caller if this is non-zero.
destroyRequested: c.int, destroyRequested: c.int,
// ------------------------------------------------- // -------------------------------------------------
+28 -20
View File
@@ -247,10 +247,15 @@ MotionEventActionEnum :: enum u8 {
BUTTON_RELEASE = 12, BUTTON_RELEASE = 12,
} }
// 0xRRRRIIAA
// R = reserved
// I = pointer index
// A = action
// Odin parses the bit_fields as LSB
MotionEventAction :: bit_field i32 { MotionEventAction :: bit_field i32 {
reserved: i16 | 16,
pointer_index: u8 | 8,
action: MotionEventActionEnum | 8, action: MotionEventActionEnum | 8,
pointer_index: u8 | 8,
reserved: i16 | 16,
} }
/** /**
@@ -730,30 +735,33 @@ InputSourceClass :: bit_set[InputSourceClassBits; i32]
* Input sources. * Input sources.
*/ */
InputSourceDeviceBits :: enum i32 { InputSourceDeviceBits :: enum i32 {
KEYBOARD = 8, // BUTTON KEYBOARD = 0, // BUTTON
DPAD = 9, // BUTTON DPAD = 1, // BUTTON
GAMEPAD = 10, // BUTTON GAMEPAD = 2, // BUTTON
TOUCHSCREEN = 12, // POINTER TOUCHSCREEN = 4, // POINTER
MOUSE = 13, // POINTER MOUSE = 5, // POINTER
STYLUS = 14, // POINTER STYLUS = 6, // POINTER
// This activates both bit 14 and 15 but doing 15 only is fine too. // This activates both bit 6 and 7 but doing 7 only is fine too.
BLUETOOTH_STYLUS = 15, // POINTER BLUETOOTH_STYLUS = 7, // POINTER
TRACKBALL = 16, // NAVIGATION TRACKBALL = 8, // NAVIGATION
MOUSE_RELATIVE = 17, // NAVIGATION MOUSE_RELATIVE = 9, // NAVIGATION
TOUCHPAD = 20, // POSITION TOUCHPAD = 12, // POSITION
TOUCH_NAVIGATION = 21, // NONE TOUCH_NAVIGATION = 13, // NONE
ROTARY_ENCODER = 22, // NONE ROTARY_ENCODER = 14, // NONE
JOYSTICK = 24, // JOYSTICK JOYSTICK = 16, // JOYSTICK
HDMI = 25, // BUTTON HDMI = 17, // BUTTON
SENSOR = 26, // NONE SENSOR = 18, // NONE
} }
InputSourceDevice :: bit_set[InputSourceDeviceBits; i32] InputSourceDevice :: bit_set[InputSourceDeviceBits; i32]
// 0xDDDDDDCC
// D = Device
// C = Class
InputSource :: bit_field i32 { InputSource :: bit_field i32 {
// Transmute to InputSourceDevice
device: i32 | 24,
// Transmute to InputSourceClass // Transmute to InputSourceClass
class: i32 | 8, class: i32 | 8,
// Transmute to InputSourceDevice
device: i32 | 24,
} }
ANY_INPUT_SOURCE :: InputSourceDevice{ // -256 or 0xffffff00 ANY_INPUT_SOURCE :: InputSourceDevice{ // -256 or 0xffffff00