-
Notifications
You must be signed in to change notification settings - Fork 47
Basic Concepts
Every application which uses the Ultraviolet Framework must create an Ultraviolet context which represents the Framework’s overall state. The context is responsible for initializing, updating, and providing access to all of the Framework’s subsystems.
The Ultraviolet Framework also classifies certain objects as Ultraviolet resources. These objects are tightly bound to the lifetime of the context which created them. The vast majority of classes defined within the Ultraviolet namespace are context-bound resources; they all inherit from a single class called UltravioletResource
.
Using an Ultraviolet resource after its context has been destroyed is invalid, and will produce undefined behavior—an exception, if you’re lucky. This shouldn’t be an issue in most cases, though, because most of the time your application will create an Ultraviolet context during startup and hold onto it until the application terminates.
Generally speaking, Ultraviolet resources are not instantiated using the new
operator. Instead, each such class has a static method called Create()
which retrieves the appropriate factory method from the current Ultraviolet context and invokes it for you. This is necessary because the classes which are exposed to your application through the Ultraviolet
namespace are part of an abstraction layer; the actual implementation of each class can vary depending on a number of factors.
An Ultraviolet context is divided into multiple subsystems. Each Ultraviolet subsystem represents one broad functional area of the Framework. Once the Ultraviolet context has been initialized, you can access each subsystem by calling the appropriate method on the context.
The following is a list of all of the subsystems which are currently defined by Ultraviolet.
-
Platform (
IUltravioletPlatform
viaUltravioletContext.GetPlatform()
)Exposes underlying platform functionality, such as window and display management.
-
Graphics (
IUltravioletGraphics
viaUltravioletContext.GetGraphics()
)Provides access to the graphics device, allowing the application to render images to the screen.
-
Audio (
IUltravioletAudio
viaUltravioletContext.GetAudio()
)Provides access to any audio devices, allowing the application to play music and sound effects.
-
Input (
IUltravioletInput
viaUltravioletContext.GetInput()
)Provides access to any input devices, including mice, keyboards, game controllers, and touch devices.
-
Content (
IUltravioletContent
viaUltravioletContext.GetContent()
)Allows an application to load content assets such as textures, sound effects, data files, etc.
-
UI (
IUltravioletUI
viaUltravioletContext.GetUI()
)Provides basic user interface functionality, allowing an application to define and transition between screens and views.
Though most of Ultraviolet's codebase is shared between all of its supported platforms, there are certain pieces of functionality which must be implemented on a platform-specific basis. To enable this, Ultraviolet provides several platform compatibility shims. These shims are .NET assemblies which are dynamically loaded at runtime as required, and which must be present in order for Ultraviolet to function on the corresponding platform.
The following shims are currently available.
-
Ultraviolet.Shims.Android
Supports Android when running via Xamarin.Android.
-
Ultraviolet.Shims.NETCore
Supports .NET 6 applications.
- Contributing
- Dependencies
- Basic Concepts
- First Look- Platform
- First Look- Graphics
- First Look- Audio
- First Look- Input
- First Look- Content
- First Look- UI
- sRGB Color
- Customizing SpriteBatch
- Creating Fonts
- Creating Effects
- Creating Glyph Shaders
- FreeType2 Fonts
- Rendering 3D Models