You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-07 12:30:27 +00:00
Use BitField<> in core type masks
* All core types masks are now correctly marked as bitfields. * The enum hacks in MouseButtonMask and many other types are gone. This ensures that binders to other languages non C++ can actually implement type safe bitmasks. * Most bitmask operations replaced by functions in BitField<> * Key is still a problem because its enum and mask at the same time. While it kind of works in C++, this most likely can't be implemented safely in other languages and will have to be changed at some point. Mostly left as-is. * Documentation and API dump updated to reflect bitfields in core types.
This commit is contained in:
@@ -353,19 +353,19 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_joyhat(JNIEnv *env, j
|
||||
AndroidInputHandler::JoypadEvent jevent;
|
||||
jevent.device = p_device;
|
||||
jevent.type = AndroidInputHandler::JOY_EVENT_HAT;
|
||||
HatMask hat = HatMask::CENTER;
|
||||
BitField<HatMask> hat;
|
||||
if (p_hat_x != 0) {
|
||||
if (p_hat_x < 0) {
|
||||
hat |= HatMask::LEFT;
|
||||
hat.set_flag(HatMask::LEFT);
|
||||
} else {
|
||||
hat |= HatMask::RIGHT;
|
||||
hat.set_flag(HatMask::RIGHT);
|
||||
}
|
||||
}
|
||||
if (p_hat_y != 0) {
|
||||
if (p_hat_y < 0) {
|
||||
hat |= HatMask::UP;
|
||||
hat.set_flag(HatMask::UP);
|
||||
} else {
|
||||
hat |= HatMask::DOWN;
|
||||
hat.set_flag(HatMask::DOWN);
|
||||
}
|
||||
}
|
||||
jevent.hat = hat;
|
||||
|
||||
Reference in New Issue
Block a user