Skip to content

Commit

Permalink
Show Loading when world is built
Browse files Browse the repository at this point in the history
  • Loading branch information
PaulKsr committed Jul 10, 2020
1 parent a84630b commit e2400df
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 7 deletions.
1 change: 1 addition & 0 deletions include/game/components/ui_context.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ struct UIContext
// Menu Control flow
bool bMenuActive = true;
bool bGameConfigActive = false;
bool bShowLoading = false;

// Game config
int worldSize = 0; // 0 = Small, 1 = Medium, 2 = Large
Expand Down
6 changes: 4 additions & 2 deletions include/game/systems/menu_system.h
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ void updateMenuSystem(entt::registry& mainRegistry)

if (app->getWorldName() == uiContext.editorWorldName)
{

}

// Update world state with ui state
Expand Down Expand Up @@ -128,6 +128,7 @@ void updateMenuSystem(entt::registry& mainRegistry)
{
uiContext.bShouldGenerateTerrain = false;

uiContext.bShowLoading = true;
if (uiContext.selectedBiomeType == 0)
{
VSTerrainGeneration::buildStandard(world);
Expand All @@ -140,6 +141,7 @@ void updateMenuSystem(entt::registry& mainRegistry)
{
VSTerrainGeneration::buildDesert(world);
}
uiContext.bShowLoading = false;

if (!uiContext.bEditorActive)
{
Expand All @@ -149,7 +151,7 @@ void updateMenuSystem(entt::registry& mainRegistry)

if (uiContext.bShouldResetEditor && !world->getChunkManager()->shouldReinitializeChunks())
{
uiContext.bShouldResetEditor = false;
VSTerrainGeneration::buildEditorPlane(world);
uiContext.bShouldResetEditor = false;
}
}
2 changes: 1 addition & 1 deletion source/core/vs_rtscameracontroller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ VSRTSCameraController::VSRTSCameraController(
targetPosition = cam->getPosition();
cam->setPitchYaw(targetPitch, targetYaw);
movementSpeed = 100.F;
lastYScrollOffset = radius;
lastYScrollOffset = 0.F;
}

void VSRTSCameraController::updateCamera(bool handleMouseEvents)
Expand Down
8 changes: 4 additions & 4 deletions source/game/voxelscape.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,10 @@ void Voxelscape::renderUI()
{
renderEditorGUI(uiContext);
}
else if (uiContext.bShowLoading)
{
renderLoading(uiContext);
}
else if (uiContext.bMenuActive)
{
renderMainMenu(uiContext);
Expand All @@ -136,10 +140,6 @@ void Voxelscape::renderUI()
{
renderGameConfigGUI(uiContext);
}
else if (uiContext.bShouldUpdateChunks)
{
renderLoading(uiContext);
}
else
{
renderGameGUI(uiContext);
Expand Down

0 comments on commit e2400df

Please sign in to comment.