Application
Static class managing application state and configuration.
using Xengine.Core;
Properties
| Property | Type | Description |
|---|---|---|
Name | string | Application name |
Version | string | Application version |
IsInitialized | bool | True after Initialize() called |
IsRunning | bool | True while engine is running |
IsEditor | bool | True if running in editor |
IsHeadless | bool | True if running without display |
IsDebug | bool | True if debug mode enabled |
IsFocused | bool | True if window has focus |
WantsExit | bool | True if exit requested |
DataPath | string | Path to data directory |
ConfigPath | string | Path to config directory |
Events
| Event | Description |
|---|---|
OnInitialize | Fired after initialization |
OnShutdown | Fired before shutdown |
OnFocusChanged | Fired when window focus changes |
Methods
Initialize
public static void Initialize(ApplicationConfig config)
Initialize the application with the given configuration.
RequestExit
public static void RequestExit()
Request application to exit gracefully.
if (RaylibInput.IsKeyPressed(KeyCode.Escape))
Application.RequestExit();
Shutdown
public static void Shutdown()
Shutdown the application immediately.
ApplicationConfig
Configuration class for initializing the application:
| Property | Type | Default | Description |
|---|---|---|---|
Name | string? | null | Application name |
DataPath | string? | null | Custom data directory |
ConfigPath | string? | null | Custom config directory |
IsEditor | bool | false | Running in editor mode |
IsHeadless | bool | false | No display mode |
IsDebug | bool | false | Enable debug features |
TargetFrameRate | int | 60 | Target FPS |
VSync | bool | true | Enable V-Sync |
WindowWidth | int | 1280 | Window width in pixels |
WindowHeight | int | 720 | Window height in pixels |
WindowTitle | string | "Xengine" | Window title |
Fullscreen | bool | false | Fullscreen mode |
Example
var config = new ApplicationConfig
{
Name = "My Game",
WindowWidth = 1920,
WindowHeight = 1080,
WindowTitle = "My Awesome Game",
IsDebug = true
};
using var engine = new Engine(config);
engine.Initialize();
// Application is now initialized
Log.Info($"Running: {Application.Name}");
Log.Info($"Data path: {Application.DataPath}");
engine.Run();