mirror of
https://github.com/Facepunch/sbox-public.git
synced 2026-01-03 11:58:24 -05:00
This commit imports the C# engine code and game files, excluding C++ source code. [Source-Commit: ceb3d758046e50faa6258bc3b658a30c97743268]
52 lines
935 B
C#
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 );
|
|
}
|
|
}
|
|
}
|