mirror of
https://github.com/Ed94/Cog.git
synced 2026-08-01 12:18:15 +00:00
Cog Sample: Adding more gameplay
Cog Sample: Make Area a component instead of an actor Cog Sample: Add Basic actor for Projectiles, Areas, etc... Cog Sample: Start to add Projectile Cog Sample: Start to add SpawnPrediction
This commit is contained in:
@@ -384,21 +384,55 @@ void UCogWindowManager::RenderMainMenu()
|
||||
|
||||
for (UCogWindow* Window : MainMenuWidgets)
|
||||
{
|
||||
float Width = 0.0f;
|
||||
Window->RenderMainMenuWidget(false, Width);
|
||||
TArray<float> SubWidgetsWidths;
|
||||
float SimCursorX = CursorX;
|
||||
for (int32 SubWidgetIndex = 0; ; ++SubWidgetIndex)
|
||||
{
|
||||
const float MaxWidth = SimCursorX - MinCursorX;
|
||||
float SubWidgetWidth = Window->GetMainMenuWidgetWidth(SubWidgetIndex, MaxWidth);
|
||||
if (SubWidgetWidth == -1)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
//-------------------------------------------
|
||||
// Stop drawing if there is not enough room
|
||||
//-------------------------------------------
|
||||
if (CursorX - Width < MinCursorX)
|
||||
SimCursorX -= SubWidgetWidth;
|
||||
SubWidgetsWidths.Add(SubWidgetWidth);
|
||||
}
|
||||
|
||||
bool Stop = false;
|
||||
for (int32 SubWidgetIndex = SubWidgetsWidths.Num() - 1; SubWidgetIndex >= 0; SubWidgetIndex--)
|
||||
{
|
||||
const float SubWidgetWidth = SubWidgetsWidths[SubWidgetIndex];
|
||||
const float MaxWidth = CursorX - MinCursorX;
|
||||
|
||||
//-------------------------------------------
|
||||
// Bypass this subwidget if its width is 0
|
||||
//-------------------------------------------
|
||||
if (SubWidgetWidth == 0)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
//-------------------------------------------
|
||||
// Stop drawing if there is not enough room
|
||||
//-------------------------------------------
|
||||
if (SubWidgetWidth > MaxWidth)
|
||||
{
|
||||
Stop = true;
|
||||
break;
|
||||
}
|
||||
|
||||
CursorX -= SubWidgetWidth;
|
||||
ImGui::SetCursorPosX(CursorX);
|
||||
|
||||
Window->RenderMainMenuWidget(SubWidgetIndex, SubWidgetWidth);
|
||||
}
|
||||
|
||||
if (Stop)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
CursorX -= Width;
|
||||
ImGui::SetCursorPosX(CursorX);
|
||||
Window->RenderMainMenuWidget(true, Width);
|
||||
|
||||
CursorX -= ImGui::GetStyle().ItemSpacing.x;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user