mirror of
https://github.com/GayPizzaSpecifications/voxelotl-engine.git
synced 2025-08-02 21:00:57 +00:00
Fix build errors against release SDL 3.2.0 ABI
This commit is contained in:
parent
31ef295f52
commit
a40686a87c
@ -132,7 +132,7 @@ public class Application {
|
|||||||
case SDLK_ESCAPE:
|
case SDLK_ESCAPE:
|
||||||
return .exitSuccess
|
return .exitSuccess
|
||||||
default:
|
default:
|
||||||
Keyboard.instance.keyDownEvent(scan: event.key.scancode, repeat: event.key.repeat != 0)
|
Keyboard.instance.keyDownEvent(scan: event.key.scancode, repeat: event.key.repeat)
|
||||||
}
|
}
|
||||||
return .running
|
return .running
|
||||||
|
|
||||||
@ -154,13 +154,13 @@ public class Application {
|
|||||||
return .running
|
return .running
|
||||||
case SDL_EVENT_GAMEPAD_BUTTON_DOWN, SDL_EVENT_GAMEPAD_BUTTON_UP:
|
case SDL_EVENT_GAMEPAD_BUTTON_DOWN, SDL_EVENT_GAMEPAD_BUTTON_UP:
|
||||||
GameController.instance.buttonEvent(id: event.gbutton.which,
|
GameController.instance.buttonEvent(id: event.gbutton.which,
|
||||||
btn: SDL_GamepadButton(Int32(event.gbutton.button)), state: event.gbutton.state)
|
btn: SDL_GamepadButton(Int32(event.gbutton.button)), state: event.gbutton.down)
|
||||||
return .running
|
return .running
|
||||||
|
|
||||||
case SDL_EVENT_MOUSE_BUTTON_DOWN, SDL_EVENT_MOUSE_BUTTON_UP:
|
case SDL_EVENT_MOUSE_BUTTON_DOWN, SDL_EVENT_MOUSE_BUTTON_UP:
|
||||||
Mouse.instance.buttonEvent(
|
Mouse.instance.buttonEvent(
|
||||||
btn: UInt32(event.button.button),
|
btn: UInt32(event.button.button),
|
||||||
state: event.button.state)
|
state: event.button.down)
|
||||||
return .running
|
return .running
|
||||||
case SDL_EVENT_MOUSE_MOTION:
|
case SDL_EVENT_MOUSE_MOTION:
|
||||||
Mouse.instance.motionEvent(
|
Mouse.instance.motionEvent(
|
||||||
|
@ -92,7 +92,7 @@ public class GameController {
|
|||||||
//MARK: - Private
|
//MARK: - Private
|
||||||
|
|
||||||
private var _joyInstance: SDL_JoystickID, _sdlPad: OpaquePointer
|
private var _joyInstance: SDL_JoystickID, _sdlPad: OpaquePointer
|
||||||
private var _axes = [Int16](repeating: 0, count: Int(SDL_GAMEPAD_AXIS_MAX.rawValue))
|
private var _axes = [Int16](repeating: 0, count: Int(SDL_GAMEPAD_AXIS_COUNT.rawValue))
|
||||||
private var _btnCur: Buttons = [], _btnPrv: Buttons = []
|
private var _btnCur: Buttons = [], _btnPrv: Buttons = []
|
||||||
|
|
||||||
internal var instanceID: SDL_JoystickID { _joyInstance }
|
internal var instanceID: SDL_JoystickID { _joyInstance }
|
||||||
@ -167,8 +167,8 @@ public class GameController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
internal func buttonEvent(id: SDL_JoystickID, btn: SDL_GamepadButton, state: UInt8) {
|
internal func buttonEvent(id: SDL_JoystickID, btn: SDL_GamepadButton, state: Bool) {
|
||||||
_pads[id]?.buttonEvent(btn, state == SDL_PRESSED)
|
_pads[id]?.buttonEvent(btn, state)
|
||||||
}
|
}
|
||||||
|
|
||||||
internal func axisEvent(id: SDL_JoystickID, axis: SDL_GamepadAxis, value: Int16) {
|
internal func axisEvent(id: SDL_JoystickID, axis: SDL_GamepadAxis, value: Int16) {
|
||||||
|
@ -38,7 +38,7 @@ public class Keyboard {
|
|||||||
private static let _PRESS: UInt8 = _DOWN | _IMPULSE
|
private static let _PRESS: UInt8 = _DOWN | _IMPULSE
|
||||||
private static let _RELEASE: UInt8 = _UP | _IMPULSE
|
private static let _RELEASE: UInt8 = _UP | _IMPULSE
|
||||||
|
|
||||||
private var _state = [UInt8](repeating: _UP, count: Int(SDL_NUM_SCANCODES.rawValue))
|
private var _state = [UInt8](repeating: _UP, count: Int(SDL_SCANCODE_COUNT.rawValue))
|
||||||
|
|
||||||
internal func keyDownEvent(scan: SDL_Scancode, repeat rep: Bool) {
|
internal func keyDownEvent(scan: SDL_Scancode, repeat rep: Bool) {
|
||||||
var newState = Self._PRESS
|
var newState = Self._PRESS
|
||||||
|
@ -53,8 +53,8 @@ public class Mouse {
|
|||||||
private func getAbsolute() -> SIMD2<Float> { self._abs * self._dpiScale }
|
private func getAbsolute() -> SIMD2<Float> { self._abs * self._dpiScale }
|
||||||
private func getDelta() -> SIMD2<Float> { self._delta }
|
private func getDelta() -> SIMD2<Float> { self._delta }
|
||||||
|
|
||||||
internal func buttonEvent(btn: UInt32, state: UInt8) {
|
internal func buttonEvent(btn: UInt32, state: Bool) {
|
||||||
if state == SDL_PRESSED {
|
if state {
|
||||||
self._btns.formUnion(.init(rawValue: btn.buttonMask))
|
self._btns.formUnion(.init(rawValue: btn.buttonMask))
|
||||||
} else {
|
} else {
|
||||||
self._btns.subtract(.init(rawValue: btn.buttonMask))
|
self._btns.subtract(.init(rawValue: btn.buttonMask))
|
||||||
|
Loading…
Reference in New Issue
Block a user