Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/ProwlEngine/Prowl/llms.txt

Use this file to discover all available pages before exploring further.

The Application class is the static entry point for every Prowl runtime session. It owns the primary event loop, coordinates initialization of the graphics, audio, and scene subsystems, and exposes the four main lifecycle events — Initialize, Update, Render, and Quitting — that the rest of the engine and your game code hook into. Because it is a static class, every member is accessed directly without instantiation; a single call to Application.Run(...) launches the window, drives the per-frame loop, and tears everything down cleanly when the window closes or Quit() is called.
Application is not thread-safe. All lifecycle events fire on the main thread. Avoid modifying IsRunning or IsPlaying from worker threads.

Properties

IsRunning
bool
true from the moment Run(...) is called until AppClose fires. Set to false as the first action of the shutdown sequence, before Quitting is invoked. Read this field to detect whether the engine loop is still active.
public static bool IsRunning;
IsPlaying
bool
true when the game simulation is running. In a standalone build this is set to true immediately inside Run(...) and stays true for the entire session. In the Prowl Editor it is false while in edit mode and true while the Play button is active.
public static bool IsPlaying = false;
IsEditor
bool
true when the current host is the Prowl Editor, false in standalone builds. Set once by Run(...) and read-only thereafter (private setter).
public static bool IsEditor { get; private set; }
DataPath
string?
Optional root path for application data. Defaults to null; the asset pipeline may populate this before calling Run(...) so that file-relative asset loading resolves correctly.
public static string? DataPath = null;
AssetProvider
IAssetProvider
The active asset provider injected by the host (editor or game launcher) via Run(...). All asset loading throughout the engine routes through this interface.
public static IAssetProvider AssetProvider;

Events

All four events follow the Action delegate (no parameters, no return value). Subscribe with += and unsubscribe with -=.
Initialize
event Action
Fires once after the window, graphics device, scene manager, and audio system have all been created. Use this to load your first scene or register global services.
public static event Action Initialize;
Application.Initialize += () =>
{
    SceneManager.LoadScene(myScene);
};
Update
event Action
Fires once per frame. The engine’s internal AppUpdate method updates the time data, pushes a TimeData stack frame, invokes audio pooling, then raises Update followed immediately by Render within the same frame. Scene update logic and input polling belong here.
public static event Action Update;
Render
event Action
Fires once per frame after Update, still within the same AppUpdate call and the same TimeData scope. Camera rendering, post-processing, and UI drawing should subscribe here.
public static event Action Render;
Quitting
event Action
Fires when the application is closing, after IsRunning is set to false and before graphics and audio are disposed. Use this to flush save data, release unmanaged handles, or log shutdown telemetry.
public static event Action Quitting;

Methods

Run

Starts the full engine loop. This call blocks until the window is closed. For standalone (non-editor) builds, IsPlaying is set to true immediately inside this method.
public static void Run(string title, int width, int height, IAssetProvider assetProvider, bool editor)
title
string
required
The base window title. The active graphics backend name is appended automatically, e.g. "My Game - OpenGL".
width
int
required
Initial client-area width in pixels. The window opens in Maximized state, so this value acts as a minimum hint.
height
int
required
Initial client-area height in pixels.
assetProvider
IAssetProvider
required
The asset provider implementation to use for the lifetime of this session. Stored in Application.AssetProvider.
editor
bool
required
Pass true when the host is the Prowl Editor. Stored in Application.IsEditor and influences Quit() behavior.
Application.Initialize += OnInit;
Application.Update     += OnUpdate;
Application.Render     += OnRender;

Application.Run("Dungeon Crawler", 1920, 1080, new FileAssetProvider("Assets"), editor: false);

Quit

Requests the application window to close. Has no effect when running inside the editor while in play mode; in that case use the editor’s Stop button instead.
public static void Quit()
When Application.IsEditor is true and Application.IsPlaying is true, Quit() is a no-op. This prevents scripts from accidentally closing the editor during a play session.
// In a game script:
if (Input.GetKeyDown(Key.Escape))
    Application.Quit();

GetBackend

Returns the preferred GraphicsBackend for the current operating system. The selection order is:
PlatformPriority order
WindowsOpenGL → Vulkan → Direct3D 11 → OpenGLES
macOSMetal → OpenGL → OpenGLES
Linux / UnixOpenGL → Vulkan → OpenGLES
public static GraphicsBackend GetBackend()
returns
GraphicsBackend
The first backend in the platform’s preferred list (index [0]).
GraphicsBackend backend = Application.GetBackend();
Console.WriteLine($"Using backend: {backend}");

Lifecycle Sequence

Application.Run(...)

  ├─► Screen.Start(...)           // Opens the OS window
  │     │
  │     └─► AppInitialize()
  │           ├─ Graphics.Initialize(...)
  │           ├─ SceneManager.Initialize()
  │           ├─ AudioSystem.Initialize()
  │           ├─ AssemblyManager.Initialize()
  │           └─ Application.Initialize?.Invoke()   ← your code

  └─► [per-frame loop]
        └─► AppUpdate()
              ├─ s_appTime.Update()
              ├─ Time.TimeStack.Push(s_appTime)
              ├─ AudioSystem.UpdatePool()
              ├─ Application.Update?.Invoke()        ← your code
              ├─ Application.Render?.Invoke()        ← your code
              └─ Time.TimeStack.Pop()

  [window closes]
  └─► AppClose()
        ├─ IsRunning = false
        ├─ Application.Quitting?.Invoke()            ← your code
        ├─ Graphics.Dispose()
        ├─ Physics.World.Clear()
        ├─ AudioSystem.Dispose()
        └─ AssemblyManager.Dispose()

Tips

Subscribe to Application.Initialize rather than running setup code before Application.Run(...). The graphics device and scene manager are not ready until Initialize fires.
Application.IsRunning is a field, not a property — reads and writes are not guaranteed to be atomic on all architectures. Do not use it as a cross-thread synchronization primitive.

Build docs developers (and LLMs) love