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

#include <touchscreenlayout.h>

+ Collaboration diagram for ButtonLayout:

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
 
void deserializeJson (std::istream &is)
 

Static Public Member Functions

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

Public Attributes

std::unordered_map< touch_gui_button_id, ButtonMetalayout
 

Static Public Attributes

static const ButtonLayout predefined
 

Static Private Attributes

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

Member Function Documentation

◆ clearTextureCache()

void ButtonLayout::clearTextureCache ( )
static

References texture_cache.

Referenced by GUITouchscreenLayout::~GUITouchscreenLayout().

+ Here is the caller graph for this function:

◆ deserializeJson()

void ButtonLayout::deserializeJson ( std::istream & is)

References button_name_to_id(), isButtonAllowed(), layout, ButtonMeta::offset, and ButtonMeta::position.

+ Here is the call 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(), 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 joystick_bg_id, joystick_center_id, joystick_off_id, and touch_gui_button_id_END.

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

+ 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:

◆ loadFromSettings()

ButtonLayout ButtonLayout::loadFromSettings ( )
static

References g_settings, Settings::get(), layout, predefined, and warningstream.

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

+ 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(), and layout.

Referenced by GUITouchscreenLayout::OnEvent().

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

Member Data Documentation

◆ layout

◆ predefined

const ButtonLayout ButtonLayout::predefined
static
Initial value:
{{
{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
@ zoom_id
Definition touchscreenlayout.h:27
@ aux1_id
Definition touchscreenlayout.h:28
@ jump_id
Definition touchscreenlayout.h:25
@ sneak_id
Definition touchscreenlayout.h:26
@ overflow_id
Definition touchscreenlayout.h:29

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

◆ 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: