Skip to content

Commit

Permalink
bugfix icon layout main screen
Browse files Browse the repository at this point in the history
  • Loading branch information
beaumanvienna committed Oct 6, 2024
1 parent 8c3357b commit 4322e0d
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 48 deletions.
8 changes: 4 additions & 4 deletions application/lucre/UI/common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ namespace LucreApp

m_ScaleAll = m_AvailableHeight / 1080.0f;

m_IconWidth = 128.0f * m_ScaleAll;
m_IconHeight = 128.0f * m_ScaleAll;
m_IconWidth = 64.0f * m_ScaleAll;
m_IconHeight = 64.0f * m_ScaleAll;
m_IconSpacer = 64.0f * m_ScaleAll;

m_StripSize = 150.0f * m_ScaleAll;
Expand All @@ -50,8 +50,8 @@ namespace LucreApp
m_ControllerScale = 1.0f * m_ScaleAll;

m_TabIconScaleRetro = 1.5 * m_ScaleAll;
m_IconScaleRetro = 1.0 * m_ScaleAll;
m_IconScale = 2.0 * m_ScaleAll;
m_IconScaleRetro = 0.5 * m_ScaleAll;
m_IconScale = 1.0 * m_ScaleAll;
}

void Common::OnResize() { Init(); }
Expand Down
48 changes: 24 additions & 24 deletions application/lucre/UI/mainScreen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,8 @@ namespace LucreApp
verticalLayout->Add(topline);

topline->Add(new SCREEN_UI::Spacer(UI::g_Common->m_MarginLeftRight, 0.0f));
float horizontalSpacerTopline = UI::g_Common->m_AvailableWidth - 6 * UI::g_Common->m_IconWidth -
4 * UI::g_Common->m_IconSpacer - 2 * UI::g_Common->m_MarginLeftRight;
float horizontalSpacerTopline = UI::g_Common->m_AvailableWidth - 7 * UI::g_Common->m_IconWidth -
5 * UI::g_Common->m_IconSpacer - 2 * UI::g_Common->m_MarginLeftRight;

Sprite2D icon;
Sprite2D icon_active;
Expand All @@ -124,11 +124,11 @@ namespace LucreApp
if (CoreSettings::m_UITheme == THEME_RETRO)
{
icon = Sprite2D(m_SpritesheetScene1Button.GetSprite(BUTTON_4_STATES_NOT_FOCUSED));
icon.SetScale(UI::g_Common->m_IconScaleRetro * 0.5f);
icon.SetScale(UI::g_Common->m_IconScaleRetro);
icon_active = Sprite2D(m_SpritesheetScene1Button.GetSprite(BUTTON_4_STATES_FOCUSED));
icon_active.SetScale(UI::g_Common->m_IconScaleRetro * 0.5f);
icon_active.SetScale(UI::g_Common->m_IconScaleRetro);
icon_depressed = Sprite2D(m_SpritesheetScene1Button.GetSprite(BUTTON_4_STATES_FOCUSED_DEPRESSED));
icon_depressed.SetScale(UI::g_Common->m_IconScaleRetro * 0.5f);
icon_depressed.SetScale(UI::g_Common->m_IconScaleRetro);

m_Scene1Button = new SCREEN_UI::Choice(icon, icon_active, icon_depressed,
new SCREEN_UI::LayoutParams(icon.GetWidth(), icon.GetHeight()));
Expand All @@ -147,11 +147,11 @@ namespace LucreApp
if (CoreSettings::m_UITheme == THEME_RETRO)
{
icon = Sprite2D(m_SpritesheetScene2Button.GetSprite(BUTTON_4_STATES_NOT_FOCUSED));
icon.SetScale(UI::g_Common->m_IconScaleRetro * 0.5f);
icon.SetScale(UI::g_Common->m_IconScaleRetro);
icon_active = Sprite2D(m_SpritesheetScene2Button.GetSprite(BUTTON_4_STATES_FOCUSED));
icon_active.SetScale(UI::g_Common->m_IconScaleRetro * 0.5f);
icon_active.SetScale(UI::g_Common->m_IconScaleRetro);
icon_depressed = Sprite2D(m_SpritesheetScene2Button.GetSprite(BUTTON_4_STATES_FOCUSED_DEPRESSED));
icon_depressed.SetScale(UI::g_Common->m_IconScaleRetro * 0.5f);
icon_depressed.SetScale(UI::g_Common->m_IconScaleRetro);

m_Scene2Button = new SCREEN_UI::Choice(icon, icon_active, icon_depressed,
new SCREEN_UI::LayoutParams(icon.GetWidth(), icon.GetHeight()));
Expand All @@ -170,11 +170,11 @@ namespace LucreApp
if (CoreSettings::m_UITheme == THEME_RETRO)
{
icon = Sprite2D(m_SpritesheetScene3Button.GetSprite(BUTTON_4_STATES_NOT_FOCUSED));
icon.SetScale(UI::g_Common->m_IconScaleRetro * 0.5f);
icon.SetScale(UI::g_Common->m_IconScaleRetro);
icon_active = Sprite2D(m_SpritesheetScene3Button.GetSprite(BUTTON_4_STATES_FOCUSED));
icon_active.SetScale(UI::g_Common->m_IconScaleRetro * 0.5f);
icon_active.SetScale(UI::g_Common->m_IconScaleRetro);
icon_depressed = Sprite2D(m_SpritesheetScene3Button.GetSprite(BUTTON_4_STATES_FOCUSED_DEPRESSED));
icon_depressed.SetScale(UI::g_Common->m_IconScaleRetro * 0.5f);
icon_depressed.SetScale(UI::g_Common->m_IconScaleRetro);

m_Scene3Button = new SCREEN_UI::Choice(icon, icon_active, icon_depressed,
new SCREEN_UI::LayoutParams(icon.GetWidth(), icon.GetHeight()));
Expand All @@ -183,7 +183,7 @@ namespace LucreApp
{
icon = Sprite2D(m_Spritesheet->GetSprite(I_GEAR));
icon.SetScale(UI::g_Common->m_IconScale);
m_Scene2Button = new SCREEN_UI::Choice(icon, new SCREEN_UI::LayoutParams(icon.GetWidth(), icon.GetHeight()));
m_Scene3Button = new SCREEN_UI::Choice(icon, new SCREEN_UI::LayoutParams(icon.GetWidth(), icon.GetHeight()));
}
m_Scene3Button->OnClick.Handle(this, &MainScreen::Scene3Click);
topline->Add(m_Scene3Button);
Expand All @@ -193,11 +193,11 @@ namespace LucreApp
if (CoreSettings::m_UITheme == THEME_RETRO)
{
icon = Sprite2D(m_SpritesheetScene4Button.GetSprite(BUTTON_4_STATES_NOT_FOCUSED));
icon.SetScale(UI::g_Common->m_IconScaleRetro * 0.5f);
icon.SetScale(UI::g_Common->m_IconScaleRetro);
icon_active = Sprite2D(m_SpritesheetScene4Button.GetSprite(BUTTON_4_STATES_FOCUSED));
icon_active.SetScale(UI::g_Common->m_IconScaleRetro * 0.5f);
icon_active.SetScale(UI::g_Common->m_IconScaleRetro);
icon_depressed = Sprite2D(m_SpritesheetScene4Button.GetSprite(BUTTON_4_STATES_FOCUSED_DEPRESSED));
icon_depressed.SetScale(UI::g_Common->m_IconScaleRetro * 0.5f);
icon_depressed.SetScale(UI::g_Common->m_IconScaleRetro);

m_Scene4Button = new SCREEN_UI::Choice(icon, icon_active, icon_depressed,
new SCREEN_UI::LayoutParams(icon.GetWidth(), icon.GetHeight()));
Expand All @@ -206,7 +206,7 @@ namespace LucreApp
{
icon = Sprite2D(m_Spritesheet->GetSprite(I_GEAR));
icon.SetScale(UI::g_Common->m_IconScale);
m_Scene2Button = new SCREEN_UI::Choice(icon, new SCREEN_UI::LayoutParams(icon.GetWidth(), icon.GetHeight()));
m_Scene4Button = new SCREEN_UI::Choice(icon, new SCREEN_UI::LayoutParams(icon.GetWidth(), icon.GetHeight()));
}
m_Scene4Button->OnClick.Handle(this, &MainScreen::Scene4Click);
topline->Add(m_Scene4Button);
Expand All @@ -216,11 +216,11 @@ namespace LucreApp
if (CoreSettings::m_UITheme == THEME_RETRO)
{
icon = Sprite2D(m_SpritesheetScene5Button.GetSprite(BUTTON_4_STATES_NOT_FOCUSED));
icon.SetScale(UI::g_Common->m_IconScaleRetro * 0.5f);
icon.SetScale(UI::g_Common->m_IconScaleRetro);
icon_active = Sprite2D(m_SpritesheetScene5Button.GetSprite(BUTTON_4_STATES_FOCUSED));
icon_active.SetScale(UI::g_Common->m_IconScaleRetro * 0.5f);
icon_active.SetScale(UI::g_Common->m_IconScaleRetro);
icon_depressed = Sprite2D(m_SpritesheetScene5Button.GetSprite(BUTTON_4_STATES_FOCUSED_DEPRESSED));
icon_depressed.SetScale(UI::g_Common->m_IconScaleRetro * 0.5f);
icon_depressed.SetScale(UI::g_Common->m_IconScaleRetro);

m_Scene5Button = new SCREEN_UI::Choice(icon, icon_active, icon_depressed,
new SCREEN_UI::LayoutParams(icon.GetWidth(), icon.GetHeight()));
Expand All @@ -238,11 +238,11 @@ namespace LucreApp
if (CoreSettings::m_UITheme == THEME_RETRO)
{
icon = Sprite2D(m_SpritesheetSettings.GetSprite(BUTTON_4_STATES_NOT_FOCUSED));
icon.SetScale(UI::g_Common->m_IconScaleRetro * 0.5f);
icon.SetScale(UI::g_Common->m_IconScaleRetro);
icon_active = Sprite2D(m_SpritesheetSettings.GetSprite(BUTTON_4_STATES_FOCUSED));
icon_active.SetScale(UI::g_Common->m_IconScaleRetro * 0.5f);
icon_active.SetScale(UI::g_Common->m_IconScaleRetro);
icon_depressed = Sprite2D(m_SpritesheetSettings.GetSprite(BUTTON_4_STATES_FOCUSED_DEPRESSED));
icon_depressed.SetScale(UI::g_Common->m_IconScaleRetro * 0.5f);
icon_depressed.SetScale(UI::g_Common->m_IconScaleRetro);

m_SettingsButton = new SCREEN_UI::Choice(icon, icon_active, icon_depressed,
new SCREEN_UI::LayoutParams(icon.GetWidth(), icon.GetHeight()));
Expand Down Expand Up @@ -276,9 +276,9 @@ namespace LucreApp
if (CoreSettings::m_UITheme == THEME_RETRO)
{
icon = Sprite2D(m_SpritesheetOff.GetSprite(BUTTON_4_STATES_NOT_FOCUSED));
icon.SetScale(UI::g_Common->m_IconScaleRetro * 0.5f);
icon.SetScale(UI::g_Common->m_IconScaleRetro);
icon_active = Sprite2D(m_SpritesheetOff.GetSprite(BUTTON_4_STATES_FOCUSED));
icon_active.SetScale(UI::g_Common->m_IconScaleRetro * 0.5f);
icon_active.SetScale(UI::g_Common->m_IconScaleRetro);
icon_depressed = Sprite2D(m_SpritesheetOff.GetSprite(BUTTON_4_STATES_FOCUSED_DEPRESSED));
icon_depressed.SetScale(UI::g_Common->m_IconScaleRetro);
m_OffButton = new SCREEN_UI::Choice(icon, icon_active, icon_depressed,
Expand Down
40 changes: 20 additions & 20 deletions engine/gui/Common/UI/viewGroup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ namespace GfxRenderEngine
void ViewGroup::RemoveSubview(View* view)
{
std::lock_guard<std::mutex> guard(modifyLock_);
for (size_t i = 0; i < views_.size(); i++)
for (size_t i = 0; i < views_.size(); ++i)
{
if (views_[i] == view)
{
Expand All @@ -94,7 +94,7 @@ namespace GfxRenderEngine
void ViewGroup::Clear()
{
std::lock_guard<std::mutex> guard(modifyLock_);
for (size_t i = 0; i < views_.size(); i++)
for (size_t i = 0; i < views_.size(); ++i)
{
delete views_[i];
views_[i] = nullptr;
Expand All @@ -112,7 +112,7 @@ namespace GfxRenderEngine
tag = anonId;
}

for (size_t i = 0; i < views_.size(); i++)
for (size_t i = 0; i < views_.size(); ++i)
{
views_[i]->PersistData(status, tag + "/" + SCREEN_StringFromInt((int)i), storage);
}
Expand Down Expand Up @@ -242,7 +242,7 @@ namespace GfxRenderEngine
std::lock_guard<std::mutex> guard(modifyLock_);
if (!CanBeFocused() && !views_.empty())
{
for (size_t i = 0; i < views_.size(); i++)
for (size_t i = 0; i < views_.size(); ++i)
{
if (views_[i]->SetFocus())
return true;
Expand All @@ -253,7 +253,7 @@ namespace GfxRenderEngine

bool ViewGroup::SubviewFocused(View* view)
{
for (size_t i = 0; i < views_.size(); i++)
for (size_t i = 0; i < views_.size(); ++i)
{
if (views_[i] == view)
return true;
Expand Down Expand Up @@ -425,7 +425,7 @@ namespace GfxRenderEngine
}

int num = -1;
for (size_t i = 0; i < views_.size(); i++)
for (size_t i = 0; i < views_.size(); ++i)
{
if (views_[i] == view)
{
Expand Down Expand Up @@ -455,7 +455,7 @@ namespace GfxRenderEngine
case FOCUS_RIGHT:
case FOCUS_DOWN:
{
for (size_t i = 0; i < views_.size(); i++)
for (size_t i = 0; i < views_.size(); ++i)
{
if (views_[i] == view)
{
Expand Down Expand Up @@ -510,7 +510,7 @@ namespace GfxRenderEngine
{
continue;
}
numVisible++;
++numVisible;

const LinearLayoutParams* linLayoutParams = view->GetLayoutParams()->As<LinearLayoutParams>();

Expand Down Expand Up @@ -703,7 +703,7 @@ namespace GfxRenderEngine
itemBounds.w = measuredWidth_;
}

for (size_t i = 0; i < views_.size(); i++)
for (size_t i = 0; i < views_.size(); ++i)
{
if (views_[i]->GetVisibility() == V_GONE)
{
Expand Down Expand Up @@ -1155,7 +1155,7 @@ namespace GfxRenderEngine

void AnchorLayout::MeasureViews(const SCREEN_UIContext& dc, MeasureSpec horiz, MeasureSpec vert)
{
for (size_t i = 0; i < views_.size(); i++)
for (size_t i = 0; i < views_.size(); ++i)
{
Size width = WRAP_CONTENT;
Size height = WRAP_CONTENT;
Expand Down Expand Up @@ -1217,7 +1217,7 @@ namespace GfxRenderEngine

void AnchorLayout::Layout()
{
for (size_t i = 0; i < views_.size(); i++)
for (size_t i = 0; i < views_.size(); ++i)
{
const AnchorLayoutParams* params = views_[i]->GetLayoutParams()->As<AnchorLayoutParams>();

Expand Down Expand Up @@ -1287,7 +1287,7 @@ namespace GfxRenderEngine
{
MeasureSpecType measureType = settings_.fillCells ? EXACTLY : AT_MOST;

for (size_t i = 0; i < views_.size(); i++)
for (size_t i = 0; i < views_.size(); ++i)
{
views_[i]->Measure(dc, MeasureSpec(measureType, settings_.columnWidth),
MeasureSpec(measureType, settings_.rowHeight));
Expand All @@ -1310,7 +1310,7 @@ namespace GfxRenderEngine
int y = 0;
int x = 0;
int count = 0;
for (size_t i = 0; i < views_.size(); i++)
for (size_t i = 0; i < views_.size(); ++i)
{
Bounds itemBounds, innerBounds;

Expand All @@ -1325,7 +1325,7 @@ namespace GfxRenderEngine
views_[i]->SetBounds(innerBounds);
views_[i]->Layout();

count++;
++count;
if (count == numColumns_)
{
count = 0;
Expand Down Expand Up @@ -1522,15 +1522,15 @@ namespace GfxRenderEngine

void ChoiceStrip::enableAllTabs()
{
for (unsigned int choice = 0; choice < (unsigned int)views_.size(); choice++)
for (unsigned int choice = 0; choice < (unsigned int)views_.size(); ++choice)
{
Choice(choice)->SetEnabled(true);
}
}

void ChoiceStrip::disableAllTabs()
{
for (unsigned int choice = 0; choice < (unsigned int)views_.size(); choice++)
for (unsigned int choice = 0; choice < (unsigned int)views_.size(); ++choice)
{
Choice(choice)->SetEnabled(false);
}
Expand All @@ -1541,7 +1541,7 @@ namespace GfxRenderEngine
bool ChoiceStrip::AnyTabHasFocus(int& tab)
{
bool anyTabHasFocus = false;
for (unsigned int choice = 0; choice < (unsigned int)views_.size(); choice++)
for (unsigned int choice = 0; choice < (unsigned int)views_.size(); ++choice)
{
if (Choice(choice)->HasFocus())
{
Expand Down Expand Up @@ -1582,7 +1582,7 @@ namespace GfxRenderEngine
bool ChoiceStrip::Touch(const SCREEN_TouchInput& input)
{
bool clicked = false;
for (unsigned int choice = 0; choice < (unsigned int)views_.size(); choice++)
for (unsigned int choice = 0; choice < (unsigned int)views_.size(); ++choice)
{
bool isEnabled = Choice(choice)->IsEnabled();
Choice(choice)->SetEnabled(true);
Expand All @@ -1594,7 +1594,7 @@ namespace GfxRenderEngine

EventReturn ChoiceStrip::OnChoiceClick(EventParams& e)
{
for (int i = 0; i < (int)views_.size(); i++)
for (int i = 0; i < (int)views_.size(); ++i)
{
if (views_[i] != e.v)
{
Expand Down Expand Up @@ -1711,7 +1711,7 @@ namespace GfxRenderEngine
void ListView::CreateAllItems()
{
linLayout_->Clear();
for (int i = 0; i < adaptor_->GetNumItems(); i++)
for (int i = 0; i < adaptor_->GetNumItems(); ++i)
{
if (hidden_.find(i) == hidden_.end())
{
Expand Down

0 comments on commit 4322e0d

Please sign in to comment.