1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-07-27 17:28:41 +00:00

Add setting callbacks for Camera and TouchControls (#15700)

This commit is contained in:
grorp 2025-01-24 10:50:51 -05:00 committed by GitHub
parent b5e084c9a5
commit 41dfac96c1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 71 additions and 25 deletions

View file

@ -120,19 +120,31 @@ public:
bool isStatusTextOverriden() { return m_overflow_open; }
IGUIStaticText *getStatusText() { return m_status_text.get(); }
ButtonLayout getLayout() { return m_layout; }
void applyLayout(const ButtonLayout &layout);
private:
IrrlichtDevice *m_device = nullptr;
IGUIEnvironment *m_guienv = nullptr;
IEventReceiver *m_receiver = nullptr;
ISimpleTextureSource *m_texturesource = nullptr;
bool m_visible = true;
// changes to these two values are handled in TouchControls::step
v2u32 m_screensize;
s32 m_button_size;
// cached settings
double m_touchscreen_threshold;
u16 m_long_tap_delay;
bool m_visible = true;
bool m_fixed_joystick;
bool m_joystick_triggers_aux1;
static void settingChangedCallback(const std::string &name, void *data);
void readSettings();
ButtonLayout m_layout;
void applyLayout(const ButtonLayout &layout);
// not read from a setting, but set by Game via setUseCrosshair
bool m_draw_crosshair = false;
std::unordered_map<u16, recti> m_hotbar_rects;
std::optional<u16> m_hotbar_selection = std::nullopt;
@ -165,9 +177,6 @@ private:
float m_joystick_direction = 0.0f; // assume forward
float m_joystick_speed = 0.0f; // no movement
bool m_joystick_status_aux1 = false;
bool m_fixed_joystick = false;
bool m_joystick_triggers_aux1 = false;
bool m_draw_crosshair = false;
std::shared_ptr<IGUIImage> m_joystick_btn_off;
std::shared_ptr<IGUIImage> m_joystick_btn_bg;
std::shared_ptr<IGUIImage> m_joystick_btn_center;
@ -237,8 +246,6 @@ private:
bool m_place_pressed = false;
u64 m_place_pressed_until = 0;
ButtonLayout m_layout;
};
extern TouchControls *g_touchcontrols;