Gondwana Game Engine
Gondwana is a cross-platform 2.5D game and rendering engine written in C#/.NET 8. It provides fine-grained control over rendering, timing, and scene composition, with built-in support for parallax, z-ordering, pixel overhang, collision detection, and particle effects. Gondwana targets desktop, mobile, and web platforms using SkiaSharp for graphics and NAudio for sound.
Loading...
Searching...
No Matches
Gondwana.Timers Namespace Reference

Classes

class  HighResTimer
 Provides utility methods for working with the system's high-resolution timer.
class  Timer
 Represents a high-resolution timer that can trigger events at specified intervals and supports various timer types and cycles. This class is designed to be used within the Gondwana engine. More...

Enumerations

enum  TimerCycles { Once , Repeating }
 Specifies the cycle behavior of a Timer, determining whether it executes once or repeatedly at its configured interval. More...
enum  TimerType { PreCycle , PostCycle }
 Specifies when a Timer should have its Timer.Tick event raised relative to the engine's main update and render cycle. This controls the execution timing of timer events within each engine cycle. More...

Enumeration Type Documentation

◆ TimerCycles

Specifies the cycle behavior of a Timer, determining whether it executes once or repeatedly at its configured interval.

This enumeration is used when creating timers to control their lifecycle behavior. A Once timer will automatically be removed after its first execution, while a Repeating timer will continue to raise events until explicitly removed or disposed.

Enumerator
Once 

The timer executes only once. After the first Timer.Tick event is raised, the timer is automatically disposed and removed from the active timer collection. This is useful for delayed one-time actions or deferred execution scenarios.

Repeating 

The timer executes repeatedly at its configured interval. The Timer.Tick event is raised each time the interval elapses, and the timer continues executing until it is explicitly removed via Timer.Remove or Timer.Dispose. This is useful for periodic updates, polling operations, or recurring game logic.

◆ TimerType

Specifies when a Timer should have its Timer.Tick event raised relative to the engine's main update and render cycle. This controls the execution timing of timer events within each engine cycle.

The engine's cycle is divided into two main phases: background tasks (which include input polling, animation updates, and movement processing) and foreground tasks (which include rendering and presentation). Timers can be configured to execute during either phase.

PreCycle timers are raised during the background task phase before any rendering occurs, making them suitable for game logic, state updates, and input processing. PostCycle timers are raised after the foreground render phase completes, making them suitable for post-render operations, diagnostics, and deferred cleanup tasks.

Enumerator
PreCycle 

The timer's Timer.Tick event is raised during the background task phase, before the engine performs its foreground rendering operations.

PreCycle timers execute during the engine's background task phase, which includes:

  • Input polling (keyboard, mouse, gamepad)
  • Tile animation cycling
  • Sprite movement processing
  • Collision detection and resolution
  • Camera updates

This timing is appropriate for game logic updates, AI processing, state changes, and any operations that need to complete before the current frame is rendered. PreCycle timers run at the engine's full update rate, which may be higher than the render frame rate depending on configuration.

PostCycle 

The timer's Timer.Tick event is raised after the foreground rendering and presentation phase completes.

PostCycle timers execute after the engine has completed all foreground tasks, including:

  • Direct drawing updates
  • Render surface backbuffer rendering
  • Backbuffer presentation to display adapters
  • Gamepad state updates

This timing is appropriate for post-render operations such as performance monitoring, screenshot capture, frame statistics collection, deferred resource cleanup, or any operations that should occur after a complete frame has been rendered and presented. PostCycle timers run at the effective render frame rate (FPS), which may be throttled by the engine's target FPS setting.