Add missing funcs to MultiList

This commit is contained in:
GabsPuNs
2026-05-16 14:25:28 -04:00
parent 496addb9fd
commit 6a2aa370f0
5 changed files with 104 additions and 19 deletions

View File

@@ -4,6 +4,9 @@
class UIControl_List : public UIControl_Base
{
private:
std::vector<int> m_list;
protected:
IggyName m_removeAllItemsFunc, m_funcHighlightItem, m_funcRemoveItem, m_funcCanTouchFocus, m_funcSetTouchFocus, m_funcCanTouchTrigger, m_funcEnableItem, m_funcSetItemLabel, m_funcGetItemLabel;
@@ -37,4 +40,6 @@ public:
bool CanTouchTrigger(S32 iX, S32 iY);
void addElement(eUIControlType type, int index);
int getListIndex(int id);
};

View File

@@ -31,7 +31,6 @@ void UIControl_MultiList::AddNewLabel(UIString label)
m_label = label;
IggyDataValue result;
IggyDataValue value[1];
IggyStringUTF16 stringVal;
stringVal.string = (IggyUTF16*)label.c_str();
@@ -47,7 +46,6 @@ void UIControl_MultiList::AddNewLabel(UIString label)
void UIControl_MultiList::AddNewButton(UIString label, int id)
{
IggyDataValue result;
IggyDataValue value[2];
IggyStringUTF16 stringVal;
stringVal.string = (IggyUTF16*)label.c_str();
@@ -94,7 +92,6 @@ void UIControl_MultiList::AddNewSlider(UIString label, int id, int min, int max,
m_current = current;
IggyDataValue result;
IggyDataValue value[5];
value[0].type = IGGY_DATATYPE_string_UTF16;
@@ -142,23 +139,95 @@ void UIControl_MultiList::AddNewTextInput(UIString label, int id)
}
void UIControl_MultiList::IsCheckbox(UIString label, int id, bool checked)
{
}
void UIControl_MultiList::SetCheckbox(UIString label, int id, bool checked)
{
//return UIControl_List::istype(a1, 2, a2);
}
void UIControl_MultiList::GetCheckbox(UIString label, int id, bool checked)
void UIControl_MultiList::SetCheckboxValue(int id, bool checked, bool applyImmediately)
{
/*
if (applyImmediately)
{
*/
int listIndex = UIControl_List::getListIndex(id);
IggyDataValue result;
IggyDataValue value[2];
value[0].type = IGGY_DATATYPE_number;
value[0].number = listIndex;
value[1].type = IGGY_DATATYPE_boolean;
value[1].boolval = checked;
IggyResult out = IggyPlayerCallMethodRS(m_parentScene->getMovie(), &result, getIggyValuePath(), m_funcSetCheckBox, 2, value);
/*
}
else
{
UIControl_List::GenericPendingUpdate* update = new UIControl_List::GenericPendingUpdate();
update->id = id;
update->control = this;
update->checked = checked;
m_pendingUpdates.push_back(update);
}
*/
}
void UIControl_MultiList::SetSliderValue(UIString label, int id, bool checked)
bool UIControl_MultiList::GetCheckboxValue(int index)
{
IggyDataValue result;
IggyDataValue value[1];
value[0].type = IGGY_DATATYPE_number;
value[0].number = UIControl_List::getListIndex(index);
IggyPlayerCallMethodRS(m_parentScene->getMovie(), &result, getIggyValuePath(), m_funcGetCheckBox, 1, value);
return result.boolval == 1;
}
void UIControl_MultiList::GetSliderValue(UIString label, int id, bool checked)
void UIControl_MultiList::SetSliderValue(int index, int value2, bool applyImmediately)
{
/*
if (applyImmediately)
{
*/
int listIndex = UIControl_List::getListIndex(index);
IggyDataValue result;
IggyDataValue value[2];
value[0].type = IGGY_DATATYPE_number;
value[0].number = listIndex;
value[1].type = IGGY_DATATYPE_number;
value[1].number = value2;
IggyResult out = IggyPlayerCallMethodRS(m_parentScene->getMovie(), &result, getIggyValuePath(), m_funcSetSliderValue, 2, value);
/*
}
else
{
UIControl_List::GenericPendingUpdate* update = new UIControl_List::GenericPendingUpdate();
update->itemIndex = index;
update->control = this;
update->value2 = value2;
m_pendingUpdates.push_back(update);
}
*/
}
int UIControl_MultiList::GetSliderValue(int index)
{
IggyDataValue result;
IggyDataValue value[1];
value[0].type = IGGY_DATATYPE_number;
value[0].number = UIControl_List::getListIndex(index);
IggyPlayerCallMethodRS(m_parentScene->getMovie(), &result, getIggyValuePath(), m_funcGetSliderValue, 1, value);
return result.number;
}

View File

@@ -25,8 +25,8 @@ public:
void AddNewSlider(UIString label, int id, int min, int max, int current);
void AddNewTextInput(UIString label, int id);
void IsCheckbox(UIString label, int id, bool checked);
void SetCheckbox(UIString label, int id, bool checked);
void GetCheckbox(UIString label, int id, bool checked);
void SetSliderValue(UIString label, int id, bool checked);
void GetSliderValue(UIString label, int id, bool checked);
void SetCheckboxValue(int id, bool checked, bool applyImmediately);
bool GetCheckboxValue(int index);
void SetSliderValue(int index, int value2, bool applyImmediately);
int GetSliderValue(int index);
};

View File

@@ -135,6 +135,17 @@ void UIControl_List::addElement(eUIControlType type, int index)
//m_elementCount++;
UIControl::setControlType(type);
//UIControl::setControlType(type);
//m_elements.push_back(index);
}
int UIControl_List::getListIndex(int id)
{
for (auto it = m_list.begin(); it != m_list.end(); ++it)
{
if (*it == id)
return std::distance(m_list.begin(), it);
}
return -1;
}

View File

@@ -43,7 +43,7 @@ int UIScene_SettingsGraphicsMenu::m_iGraphicsModeTitleSettingA[4]=
int UIScene_SettingsGraphicsMenu::LevelToDistance(int level)
{
static const int table[5] = {2,4,8,16,32};
static const int table[4] = {2,4,8,16};
if(level < 0) level = 0;
if(level > 4) level = 4;
return table[level];
@@ -51,7 +51,7 @@ int UIScene_SettingsGraphicsMenu::LevelToDistance(int level)
int UIScene_SettingsGraphicsMenu::DistanceToLevel(int dist)
{
static const int table[5] = {2,4,8,16,32};
static const int table[4] = {2,4,8,16};
for(int i = 0; i < 5; i++){
if(table[i] == dist)
return i;
@@ -99,7 +99,7 @@ UIScene_SettingsGraphicsMenu::UIScene_SettingsGraphicsMenu(int iPad, void *initD
m_qualityOptionsList.AddNewCheckbox(app.GetString(IDS_CHECKBOX_RENDER_BEDROCKFOG),eControl_BedrockFog,(app.GetGameSettings(m_iPad,eGameSetting_BedrockFog)!=0));
int currentGraphics = app.GetGameSettings(m_iPad, eGameSetting_GraphicsMode);
swprintf(TempString, 256, L"%ls %ls", app.GetString( IDS_GRAPHICS ),app.GetString(m_iGraphicsModeTitleSettingA[app.GetGameSettings(m_iPad,eGameSetting_GraphicsMode)]));
swprintf(TempString, 256, L"%ls: %ls", app.GetString( IDS_GRAPHICS ),app.GetString(m_iGraphicsModeTitleSettingA[app.GetGameSettings(m_iPad,eGameSetting_GraphicsMode)]));
m_qualityOptionsList.AddNewSlider(TempString, eControl_GraphicsMode, 0, 3, currentGraphics);
/*
@@ -318,7 +318,7 @@ void UIScene_SettingsGraphicsMenu::handleSliderMove(F64 sliderId, F64 currentVal
app.SetGameSettings(m_iPad, eGameSetting_GraphicsMode, value);
swprintf(TempString, 256, L"%ls %ls", app.GetString( IDS_GRAPHICS ),app.GetString(m_iGraphicsModeTitleSettingA[value]));
swprintf(TempString, 256, L"%ls: %ls", app.GetString( IDS_GRAPHICS ),app.GetString(m_iGraphicsModeTitleSettingA[value]));
m_sliderGraphicsMode.setLabel(TempString);
}