-
Notifications
You must be signed in to change notification settings - Fork 0
The Application class
NebulaDev edited this page Jan 23, 2025
·
1 revision
In Natsu, nearly all components used to build a piece of software are stored within an instance of the Application class.
This class glues together all the pieces of an app to help them interact with one another.
The Application class is abstract, meaning that you can't create an instance of it directly. Instead, you can inherit from it to create your application.
Here's an example of how you can create your own Application instance:
using Natsu.Core;
public class MyApplication : Application {
public MyApplication() {
// You can initialize any components here, but it's
// not the best place to do so.
}
protected override void OnLoad() {
// This is where you should initialize your components.
// The reason is that at this point, the application's
// ResourceLoader, Platform, and Renderer are all
// initialized at this point.
// That means you can load images, call platform-specific
// functions, eg.
}
}Here are a list of components within the Application class that you can use to do specific things:
-
ResourceLoader: Load local/packaged resources such as images, sounds, etc. -
Platform: Access platform-specific functions and properties. -
Renderer: You probably won't need to use this directly, but it's there if you need it. -
Scheduler: Schedule tasks to run at a specific time. -
Time: Change the time scale of the application, access delta time, runtime, etc.
Each of these classes are pretty self-explanatory, and include XML documentation to help you understand what each method does.