Luanti 5.15.0-dev
 
Loading...
Searching...
No Matches
ButtonLayout Struct Reference

#include <touchscreenlayout.h>

+ Collaboration diagram for ButtonLayout:

Public Types

using ButtonMap = std::unordered_map<touch_gui_button_id, ButtonMeta>
 

Public Member Functions

core::recti getRect (touch_gui_button_id btn, v2u32 screensize, s32 button_size, ISimpleTextureSource *tsrc)
 
std::vector< touch_gui_button_idgetMissingButtons ()
 
void serializeJson (std::ostream &os) const
 

Static Public Member Functions

static bool isButtonValid (touch_gui_button_id id)
 
static bool isButtonAllowed (touch_gui_button_id id)
 
static bool isButtonRequired (touch_gui_button_id id)
 
static s32 getButtonSize (v2u32 screensize)
 
static ButtonLayout loadDefault ()
 
static ButtonLayout loadFromSettings ()
 
static video::ITexture * getTexture (touch_gui_button_id btn, ISimpleTextureSource *tsrc)
 
static void clearTextureCache ()
 

Public Attributes

ButtonMap layout
 
ButtonMap preserved_disallowed
 

Static Private Member Functions

static ButtonMap deserializeJson (std::istream &is)
 
static ButtonLayout postProcessLoaded (const ButtonMap &map)
 

Static Private Attributes

static const ButtonMap default_data
 
static std::unordered_map< touch_gui_button_id, irr_ptr< video::ITexture > > texture_cache
 

Member Typedef Documentation

◆ ButtonMap

Member Function Documentation

◆ clearTextureCache()

void ButtonLayout::clearTextureCache ( )
static

References texture_cache.

Referenced by GUITouchscreenLayout::~GUITouchscreenLayout().

+ Here is the caller graph for this function:

◆ deserializeJson()

ButtonLayout::ButtonMap ButtonLayout::deserializeJson ( std::istream & is)
staticprivate

References button_name_to_id(), default_data, dig_id, isButtonValid(), ButtonMeta::offset, place_id, and ButtonMeta::position.

Referenced by loadFromSettings().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getButtonSize()

s32 ButtonLayout::getButtonSize ( v2u32 screensize)
static

References g_settings, RenderingEngine::getDisplayDensity(), and Settings::getFloat().

Referenced by TouchControls::TouchControls(), layout_button_grid(), GUITouchscreenLayout::regenerateGui(), and TouchControls::step().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getMissingButtons()

std::vector< touch_gui_button_id > ButtonLayout::getMissingButtons ( )

References isButtonAllowed(), isButtonValid(), layout, and touch_gui_button_id_END.

Referenced by TouchControls::applyLayout(), GUITouchscreenLayout::regenerateGUIImagesAddMode(), and GUITouchscreenLayout::regenerateMenu().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getRect()

core::recti ButtonLayout::getRect ( touch_gui_button_id btn,
v2u32 screensize,
s32 button_size,
ISimpleTextureSource * tsrc )

References ButtonMeta::getPos(), getTexture(), and layout.

Referenced by TouchControls::applyLayout(), GUITouchscreenLayout::regenerateGUIImagesRegular(), and GUITouchscreenLayout::updateDragState().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getTexture()

video::ITexture * ButtonLayout::getTexture ( touch_gui_button_id btn,
ISimpleTextureSource * tsrc )
static

References button_image_names, ISimpleTextureSource::getTexture(), porting::path_share, and texture_cache.

Referenced by getRect(), layout_button_grid(), GUITouchscreenLayout::regenerateGUIImagesAddMode(), and GUITouchscreenLayout::regenerateGUIImagesRegular().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isButtonAllowed()

bool ButtonLayout::isButtonAllowed ( touch_gui_button_id id)
static

References aux1_id, buttons_crosshair, dig_id, g_settings, Settings::get(), Settings::getBool(), and place_id.

Referenced by getMissingButtons(), TouchControls::mayAddButton(), and postProcessLoaded().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isButtonRequired()

bool ButtonLayout::isButtonRequired ( touch_gui_button_id id)
static

References overflow_id.

Referenced by GUITouchscreenLayout::regenerateMenu().

+ Here is the caller graph for this function:

◆ isButtonValid()

bool ButtonLayout::isButtonValid ( touch_gui_button_id id)
static

References joystick_bg_id, joystick_center_id, joystick_off_id, and touch_gui_button_id_END.

Referenced by deserializeJson(), getMissingButtons(), TouchControls::mayAddButton(), and postProcessLoaded().

+ Here is the caller graph for this function:

◆ loadDefault()

ButtonLayout ButtonLayout::loadDefault ( )
static

References default_data, and postProcessLoaded().

Referenced by loadFromSettings(), and GUITouchscreenLayout::OnEvent().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ loadFromSettings()

ButtonLayout ButtonLayout::loadFromSettings ( )
static

References deserializeJson(), g_settings, Settings::get(), loadDefault(), postProcessLoaded(), and warningstream.

Referenced by GUITouchscreenLayout::GUITouchscreenLayout(), and TouchControls::readSettings().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ postProcessLoaded()

ButtonLayout ButtonLayout::postProcessLoaded ( const ButtonMap & map)
staticprivate

References isButtonAllowed(), isButtonValid(), and layout.

Referenced by loadDefault(), and loadFromSettings().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ serializeJson()

void ButtonLayout::serializeJson ( std::ostream & os) const

References button_names, fastWriteJson(), layout, and preserved_disallowed.

Referenced by GUITouchscreenLayout::OnEvent().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Data Documentation

◆ default_data

const ButtonLayout::ButtonMap ButtonLayout::default_data
staticprivate
Initial value:
{
{dig_id, {
v2f(1.0f, 1.0f),
v2f(-2.0f, -2.75f),
}},
v2f(1.0f, 1.0f),
v2f(-2.0f, -4.25f),
}},
{jump_id, {
v2f(1.0f, 1.0f),
v2f(-1.0f, -0.5f),
}},
v2f(1.0f, 1.0f),
v2f(-2.5f, -0.5f),
}},
{zoom_id, {
v2f(1.0f, 1.0f),
v2f(-0.75f, -3.5f),
}},
{aux1_id, {
v2f(1.0f, 1.0f),
v2f(-0.75f, -2.0f),
}},
v2f(1.0f, 1.0f),
v2f(-0.75f, -5.0f),
}},
}
core::vector2d< f32 > v2f
Definition irr_v2d.h:11
@ place_id
Definition touchscreenlayout.h:35
@ zoom_id
Definition touchscreenlayout.h:39
@ aux1_id
Definition touchscreenlayout.h:40
@ jump_id
Definition touchscreenlayout.h:37
@ dig_id
Definition touchscreenlayout.h:34
@ sneak_id
Definition touchscreenlayout.h:38
@ overflow_id
Definition touchscreenlayout.h:41

Referenced by deserializeJson(), and loadDefault().

◆ layout

◆ preserved_disallowed

ButtonMap ButtonLayout::preserved_disallowed

Referenced by serializeJson().

◆ texture_cache

std::unordered_map< touch_gui_button_id, irr_ptr< video::ITexture > > ButtonLayout::texture_cache
staticprivate

Referenced by clearTextureCache(), and getTexture().


The documentation for this struct was generated from the following files: