mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-12-08 06:09:58 +00:00
LibWeb/Gamepad: Forward declare SDL components to fix Windows build
We have to prevent from including any SDL headers in LibWeb headers. Otherwise there will be transitive Windows.h includes that will re-declare some of our existing forward decls/defines in LibCore/SocketAddressWindows.h
This commit is contained in:
parent
5ce518f493
commit
454e6a6f7f
Notes:
github-actions[bot]
2025-09-02 10:12:35 +00:00
Author: https://github.com/ayeteadoe
Commit: 454e6a6f7f
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/6046
Reviewed-by: https://github.com/Lubrsi ✅
11 changed files with 39 additions and 17 deletions
|
|
@ -8,11 +8,14 @@
|
|||
#include <LibWeb/Bindings/Intrinsics.h>
|
||||
#include <LibWeb/Internals/InternalGamepad.h>
|
||||
|
||||
#include <SDL3/SDL_gamepad.h>
|
||||
#include <SDL3/SDL_joystick.h>
|
||||
|
||||
namespace Web::Internals {
|
||||
|
||||
GC_DEFINE_ALLOCATOR(InternalGamepad);
|
||||
|
||||
static constexpr Array<SDL_GamepadButton, 15> BUTTONS = {
|
||||
static constexpr Array<i32, 15> BUTTONS = {
|
||||
SDL_GAMEPAD_BUTTON_SOUTH,
|
||||
SDL_GAMEPAD_BUTTON_EAST,
|
||||
SDL_GAMEPAD_BUTTON_WEST,
|
||||
|
|
@ -30,14 +33,14 @@ static constexpr Array<SDL_GamepadButton, 15> BUTTONS = {
|
|||
SDL_GAMEPAD_BUTTON_GUIDE,
|
||||
};
|
||||
|
||||
static constexpr Array<SDL_GamepadAxis, 4> AXES {
|
||||
static constexpr Array<i32, 4> AXES {
|
||||
SDL_GAMEPAD_AXIS_LEFTX,
|
||||
SDL_GAMEPAD_AXIS_LEFTY,
|
||||
SDL_GAMEPAD_AXIS_RIGHTX,
|
||||
SDL_GAMEPAD_AXIS_RIGHTY,
|
||||
};
|
||||
|
||||
static constexpr Array<SDL_GamepadAxis, 2> TRIGGERS {
|
||||
static constexpr Array<i32, 2> TRIGGERS {
|
||||
SDL_GAMEPAD_AXIS_LEFT_TRIGGER,
|
||||
SDL_GAMEPAD_AXIS_RIGHT_TRIGGER,
|
||||
};
|
||||
|
|
@ -112,17 +115,17 @@ void InternalGamepad::finalize()
|
|||
disconnect();
|
||||
}
|
||||
|
||||
Array<SDL_GamepadButton, 15> const& InternalGamepad::buttons()
|
||||
Array<i32, 15> const& InternalGamepad::buttons()
|
||||
{
|
||||
return BUTTONS;
|
||||
}
|
||||
|
||||
Array<SDL_GamepadAxis, 4> const& InternalGamepad::axes()
|
||||
Array<i32, 4> const& InternalGamepad::axes()
|
||||
{
|
||||
return AXES;
|
||||
}
|
||||
|
||||
Array<SDL_GamepadAxis, 2> const& InternalGamepad::triggers()
|
||||
Array<i32, 2> const& InternalGamepad::triggers()
|
||||
{
|
||||
return TRIGGERS;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,8 +7,7 @@
|
|||
#pragma once
|
||||
|
||||
#include <LibWeb/Bindings/PlatformObject.h>
|
||||
#include <SDL3/SDL_gamepad.h>
|
||||
#include <SDL3/SDL_joystick.h>
|
||||
#include <LibWeb/Gamepad/SDLGamepadForward.h>
|
||||
|
||||
namespace Web::Internals {
|
||||
|
||||
|
|
@ -21,9 +20,9 @@ public:
|
|||
|
||||
virtual ~InternalGamepad() override;
|
||||
|
||||
Array<SDL_GamepadButton, 15> const& buttons();
|
||||
Array<SDL_GamepadAxis, 4> const& axes();
|
||||
Array<SDL_GamepadAxis, 2> const& triggers();
|
||||
Array<i32, 15> const& buttons();
|
||||
Array<i32, 4> const& axes();
|
||||
Array<i32, 2> const& triggers();
|
||||
|
||||
void set_button(int button, bool down);
|
||||
void set_axis(int axis, short value);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue