Files
sbox-public/engine/Sandbox.Menu/MenuScene.cs
s&box team 71f266059a Open source release
This commit imports the C# engine code and game files, excluding C++ source code.

[Source-Commit: ceb3d758046e50faa6258bc3b658a30c97743268]
2025-11-24 09:05:18 +00:00

52 lines
935 B
C#

namespace Sandbox;
public static class MenuScene
{
public static Scene Scene;
public static void Startup( string sceneName )
{
Log.Info( $"Loading startup scene: {sceneName}" );
Scene = new Scene();
using ( Scene.Push() )
{
Scene.LoadFromFile( sceneName );
LoadingScreen.IsVisible = false;
}
}
/// <summary>
/// Tick the scene. This only happens when the menu is visible
/// </summary>
public static void Tick()
{
if ( Scene is null ) return;
if ( !Game.IsMainMenuVisible ) return;
using ( Scene.Push() )
{
Scene.GameTick( RealTime.Delta );
}
}
internal static void Render( SwapChainHandle_t swapChain )
{
if ( Scene is null ) return;
if ( !Game.IsMainMenuVisible ) return;
if ( Scene.IsLoading )
{
Scene.RenderEnvmaps();
return;
}
Scene.Camera?.SceneCamera.EnableEngineOverlays = true;
using ( Scene.Push() )
{
Scene.Render( swapChain, default );
}
}
}