![]() |
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.
|
Renders a configurable rectangle with support for fill, border, rounded corners, dash patterns, color pulsing, and pattern fills. More...
Public Types | |
| enum | StrokeAlign { Inside , Outside , Center } |
| Defines how the stroke (outline) is positioned relative to the rectangle's boundary. More... | |
| Public Types inherited from Gondwana.Drawing.Direct.DirectDrawingBase | |
| enum | RevealDirection { LeftToRight , RightToLeft , TopToBottom , BottomToTop } |
| Defines the direction from which a reveal animation progressively displays the direct drawing. More... | |
Public Member Functions | |
| DirectRectangle (Color color, RenderSurfaceHostBase renderSurfaceHost, SceneLayer sceneLayer, Rectangle worldBounds, string? nickname=null) | |
| Initializes a new instance of the DirectRectangle class for scene-layer (world-space) rendering. | |
| DirectRectangle (Color color, RenderSurfaceHostBase renderSurfaceHost, View view, Rectangle screenBounds, string? nickname=null) | |
| Initializes a new instance of the DirectRectangle class for view (screen-space) rendering. | |
| DirectRectangle | SetColor (Color color) |
| Sets the base color used for both fill and stroke (unless a distinct border color is specified). | |
| DirectRectangle | SetBorderColor (Color color) |
| Sets a distinct border (stroke) color, independent of the fill color. | |
| DirectRectangle | SetAlpha (int alpha) |
| Sets the alpha (transparency) channel of the base color. | |
| DirectRectangle | SetFilled (bool isFilled) |
| Sets whether the rectangle interior is filled with the base color (or pattern). | |
| DirectRectangle | SetStrokeWidth (float width) |
| Sets the width (thickness) of the rectangle's stroke (outline) in pixels. | |
| DirectRectangle | SetCornerRadius (float radius) |
| Sets the radius for rounded corners in pixels. | |
| DirectRectangle | SetDashPattern (float dashLength, float gapLength) |
| Sets a simple repeating dash pattern using dash and gap lengths, in pixels. | |
| DirectRectangle | ClearDashPattern () |
| Removes any existing dash pattern, reverting to a solid stroke. | |
| DirectRectangle | SetBlendMode (SKBlendMode mode) |
| Sets the blend mode used when rendering this rectangle onto the canvas. | |
| DirectRectangle | SetStrokeAlign (StrokeAlign align) |
| Sets how the rectangle's stroke is positioned relative to its bounds. | |
| DirectRectangle | PulseFill (Color from, Color to, float periodSec, bool enabled=true, bool triangle=false) |
| Initiates an animated color transition (pulse) for the rectangle's fill between two colors. | |
| DirectRectangle | PulseBorder (Color from, Color to, float periodSec, bool enabled=true, bool triangle=false) |
| Initiates an animated color transition (pulse) for the rectangle's border between two colors. | |
| DirectRectangle | StopPulses () |
| Stops all active color pulsing animations (fill and border), reverting to static colors. | |
| DirectRectangle | SetFillPattern (SKBitmap bitmap, SKShaderTileMode tileX=SKShaderTileMode.Repeat, SKShaderTileMode tileY=SKShaderTileMode.Repeat, float scale=1f, SKPoint? offsetPx=null, SKFilterQuality filterQuality=SKFilterQuality.None) |
| Sets the rectangle's fill to use a tiled bitmap pattern instead of a solid color. | |
| DirectRectangle | ClearFillPattern () |
| Removes the current pattern fill and reverts to solid color rendering. | |
| override void | Update (long tick) |
| Performs per-frame update logic, including pulse animation advancement and physics integration. | |
| Public Member Functions inherited from Gondwana.Drawing.Direct.DirectDrawingMovableBase | |
| Vector2 | GetPosition () |
| Gets the current position of this direct drawing in pixel coordinates. | |
| void | SetPosition (Vector2 p) |
| Sets the position of this direct drawing to the specified pixel coordinates. | |
| Public Member Functions inherited from Gondwana.Drawing.Direct.DirectDrawingBase | |
| RectangleF | GetDrawLocationScreen (View view) |
| Gets the screen-space drawing location for this direct drawing as seen from the specified view. | |
| void | Draw (BackbufferBase backbuffer, RectangleF destRectScreen) |
| Renders this direct drawing to the backbuffer at the specified screen location. | |
| DirectDrawingBase | SetOpacity (float opacity) |
| Instantly sets the opacity to the specified value without animation. | |
| DirectDrawingBase | FadeTo (float targetOpacity, float durationSec) |
| Initiates a smooth fade transition to the specified target opacity over the given duration. | |
| DirectDrawingBase | FadeIn (float durationSec) |
| Fades this direct drawing from its current opacity to fully opaque over the specified duration. | |
| DirectDrawingBase | FadeOut (float durationSec) |
| Fades this direct drawing from its current opacity to fully transparent over the specified duration. | |
| DirectDrawingBase | CancelFade () |
| Cancels any active fade transition, leaving the opacity at its current value. | |
| DirectDrawingBase | SetReveal (float t01) |
| Instantly sets the reveal progress to the specified value without animation. | |
| DirectDrawingBase | SetRevealDirection (RevealDirection dir) |
| Sets the direction from which the reveal animation progresses. | |
| DirectDrawingBase | RevealTo (float t01, float durationSec, Func< float, float >? easing=null) |
| Initiates a smooth reveal animation to the specified target progress over the given duration, optionally using a custom easing function. | |
| int | CompareTo (DirectDrawingBase? other) |
| Compares this direct drawing to another for sorting by ZOrder. | |
| void | Dispose () |
| Releases all resources used by this DirectDrawingBase instance. | |
| override bool | Equals (object? obj) |
| Determines whether the specified object is equal to the current direct drawing. | |
| override int | GetHashCode () |
| Returns a hash code for this direct drawing. | |
Protected Member Functions | |
| override void | OnDraw (BackbufferBase backbuffer, RectangleF destRectScreen) |
| Renders the rectangle to the backbuffer with all configured properties and effects applied. | |
| Protected Member Functions inherited from Gondwana.Drawing.Direct.DirectDrawingMovableBase | |
| DirectDrawingMovableBase (RenderSurfaceHostBase renderSurfaceHost, DirectDrawingMode mode, SceneLayer? sceneLayer, View? view, Rectangle? screenBounds, Rectangle? worldBounds, string? name=null) | |
| Initializes a new instance of the DirectDrawingMovableBase class with integrated movement capabilities. | |
| Protected Member Functions inherited from Gondwana.Drawing.Direct.DirectDrawingBase | |
| void | OnDraw (BackbufferBase backbuffer, RectangleF destRectScreen) |
| Performs the concrete drawing for this direct drawing to the backbuffer. | |
| DirectDrawingBase (RenderSurfaceHostBase renderSurfaceHost, DirectDrawingMode mode, SceneLayer? sceneLayer, View? view, Rectangle? screenBounds, Rectangle? worldBounds, string? nickname=null) | |
| Initializes a new instance of the DirectDrawingBase class. | |
| virtual void | Dispose (bool disposing) |
| Releases resources used by this DirectDrawingBase instance. | |
Additional Inherited Members | |
| Static Public Member Functions inherited from Gondwana.Drawing.Direct.DirectDrawingBase | |
| static bool | operator== (DirectDrawingBase? left, DirectDrawingBase? right) |
| Determines whether two direct drawing instances are equal using reference equality. | |
| static bool | operator!= (DirectDrawingBase? left, DirectDrawingBase? right) |
| Determines whether two direct drawing instances are not equal using reference equality. | |
| static bool | operator< (DirectDrawingBase? left, DirectDrawingBase? right) |
| Determines whether the Z-order of the left direct drawing is less than the right. | |
| static bool | operator<= (DirectDrawingBase? left, DirectDrawingBase? right) |
| Determines whether the Z-order of the left direct drawing is less than or equal to the right. | |
| static bool | operator> (DirectDrawingBase? left, DirectDrawingBase? right) |
| Determines whether the Z-order of the left direct drawing is greater than the right. | |
| static bool | operator>= (DirectDrawingBase? left, DirectDrawingBase? right) |
| Determines whether the Z-order of the left direct drawing is greater than or equal to the right. | |
| Protected Attributes inherited from Gondwana.Drawing.Direct.DirectDrawingBase | |
| readonly RenderSurfaceHostBase | _renderSurfaceHost |
| The render surface host that manages this direct drawing's rendering pipeline. | |
| Rectangle | _screenBounds |
| The current screen-space bounds for view-mode direct drawings, in pixels. | |
| Rectangle | _worldBounds |
| The current world-space bounds for scene-layer-mode direct drawings, in pixels. | |
| int | _zOrder |
| The Z-order used for draw sorting. Higher values draw later (on top). | |
| bool | _visible |
| Indicates whether this direct drawing is currently visible and should be rendered. | |
| long | _lastTick = HighResTimer.GetCurrentTick() |
| The last engine tick value used for delta-time calculations in Update. | |
| Properties inherited from Gondwana.Drawing.Direct.DirectDrawingMovableBase | |
| MovementController | Movement [get] |
| Gets the movement controller that manages physics-based position, velocity, and forces for this direct drawing. | |
| MovementSpace | PositionSpace [get] |
| Gets the coordinate space in which this movable object's position is expressed. | |
| Properties inherited from Gondwana.Drawing.Direct.DirectDrawingBase | |
| bool | HideWhenFullyTransparent = true [get, set] |
| Gets or sets a value indicating whether this direct drawing should be automatically hidden when its opacity reaches zero during fade transitions. | |
| RenderSurfaceHostBase | RenderSurfaceHost [get] |
| Gets the render surface host that manages this direct drawing's rendering pipeline. | |
| DirectDrawingMode | Mode [get] |
| Gets the drawing mode that determines how this direct drawing is positioned and transformed. | |
| SceneLayer? | SceneLayer [get] |
Gets the scene layer to which this direct drawing is attached, or null if the drawing is in view mode. | |
| View? | View [get] |
Gets the view to which this direct drawing is attached, or null if the drawing is in scene-layer mode. | |
| Rectangle | ScreenBounds [get, set] |
| Gets or sets the screen-space bounds of this direct drawing in pixels. | |
| Rectangle | WorldBounds [get, set] |
| Gets or sets the world-space bounds of this direct drawing in pixels. | |
| TypedValueBag | ValueBag = new() [get] |
| Gets the extensible value bag for storing arbitrary key-value data associated with this direct drawing. | |
| Guid | Id = Guid.NewGuid() [get] |
| Gets the unique identifier for this direct drawing. | |
| string? | Nickname [get] |
| Gets the optional human-readable name for this direct drawing. | |
| int | ZOrder [get, set] |
| Gets or sets the Z-order (depth) used for sorting this direct drawing relative to other drawables. | |
| bool | Visible [get, set] |
| Gets or sets a value indicating whether this direct drawing is visible and should be rendered. | |
| float | Opacity [get, set] |
| Gets or sets the current opacity of this direct drawing. | |
| Events inherited from Gondwana.Drawing.Direct.DirectDrawingBase | |
| EventHandler< IDirectDrawable >? | Disposing |
| Occurs when this direct drawing is being disposed. | |
| EventHandler< DirectDrawingBase >? | FadeToCompleted |
| Occurs when a fade transition initiated by FadeTo, FadeIn, or FadeOut completes. | |
| Events inherited from Gondwana.Drawing.Direct.IDirectDrawable | |
| EventHandler< IDirectDrawable >? | Disposing |
| Occurs when the object is being disposed. | |
Renders a configurable rectangle with support for fill, border, rounded corners, dash patterns, color pulsing, and pattern fills.
DirectRectangle provides a high-performance, retained-mode rectangle rendering solution with extensive customization options. It supports both world-space (scene-layer mode) and screen-space (view mode) positioning, making it suitable for both in-game UI elements and world-space markers.
Key features:
Performance characteristics: DirectRectangle caches SKPaint instances and rebuilds them only when properties change, minimizing GC pressure and native interop overhead. Stroke alignment and dash patterns are computed per-frame but use efficient math operations.
All setter methods return this to enable fluent-style method chaining. Each setter automatically marks the affected screen regions as dirty to trigger rerendering on the next frame.
Thread safety: This class is not thread-safe. All operations should be performed on the UI thread.
Defines how the stroke (outline) is positioned relative to the rectangle's boundary.
Stroke alignment determines whether the stroke width expands inward, outward, or is centered on the rectangle's edge.
| Gondwana.Drawing.Direct.DirectRectangle.DirectRectangle | ( | Color | color, |
| RenderSurfaceHostBase | renderSurfaceHost, | ||
| SceneLayer | sceneLayer, | ||
| Rectangle | worldBounds, | ||
| string? | nickname = null ) |
Initializes a new instance of the DirectRectangle class for scene-layer (world-space) rendering.
| color | The base color used for fill and/or stroke (if no distinct border color is set). |
| renderSurfaceHost | The render surface host that manages rendering for this rectangle. Must not be null. |
| sceneLayer | The scene layer to which this rectangle is attached. The rectangle will be positioned in world coordinates relative to this layer. |
| worldBounds | The world-space bounds in pixels defining the rectangle's position and size. |
| nickname | An optional human-readable name for this rectangle, useful for debugging and identification. |
| ArgumentNullException | Thrown when renderSurfaceHost is null. |
This constructor creates a rectangle positioned in world coordinates that moves with the camera and is affected by the scene layer's parallax factor. Use this for in-game UI elements, selection markers, health bars, and other world-space visuals.
By default, the rectangle is created unfilled (outline only) with a 1-pixel stroke width. Use SetFilled and SetStrokeWidth to customize the appearance.
| Gondwana.Drawing.Direct.DirectRectangle.DirectRectangle | ( | Color | color, |
| RenderSurfaceHostBase | renderSurfaceHost, | ||
| View | view, | ||
| Rectangle | screenBounds, | ||
| string? | nickname = null ) |
Initializes a new instance of the DirectRectangle class for view (screen-space) rendering.
| color | The base color used for fill and/or stroke (if no distinct border color is set). |
| renderSurfaceHost | The render surface host that manages rendering for this rectangle. Must not be null. |
| view | The view to which this rectangle is attached. The rectangle will be positioned in screen coordinates relative to this view's viewport. |
| screenBounds | The screen-space bounds in pixels defining the rectangle's position and size within the viewport. |
| nickname | An optional human-readable name for this rectangle, useful for debugging and identification. |
| ArgumentNullException | Thrown when renderSurfaceHost is null. |
This constructor creates a rectangle positioned in screen coordinates that remains fixed on screen regardless of camera movement. Use this for HUD panels, buttons, borders, focus indicators, and other screen-space UI elements.
By default, the rectangle is created unfilled (outline only) with a 1-pixel stroke width. Use SetFilled and SetStrokeWidth to customize the appearance.
| DirectRectangle Gondwana.Drawing.Direct.DirectRectangle.ClearDashPattern | ( | ) |
Removes any existing dash pattern, reverting to a solid stroke.
After calling this method, the rectangle's stroke will be drawn as a solid, continuous line instead of a dashed pattern.
No dirty-rectangle marking is performed by this method alone; the effect becomes visible on the next render pass if the rectangle is already dirty from other property changes.
| DirectRectangle Gondwana.Drawing.Direct.DirectRectangle.ClearFillPattern | ( | ) |
Removes the current pattern fill and reverts to solid color rendering.
After calling this method, the rectangle's fill will use the solid color set by SetColor instead of the tiled bitmap pattern. The pattern shader is disposed to free resources.
The affected screen regions are automatically marked as dirty to trigger rerendering on the next frame.
|
protected |
Renders the rectangle to the backbuffer with all configured properties and effects applied.
| backbuffer | The backbuffer providing the canvas and rendering context. |
| destRectScreen | The destination rectangle in screen pixel coordinates where the rectangle should be rendered. |
This method is called automatically by the rendering pipeline. It performs the following operations:
The stroke is rendered using SKBlendMode.Src (source replace) mode with full opacity to ensure crisp borders without color blending artifacts, regardless of the configured blend mode. This is restored after the stroke is drawn.
Do not call this method directly from game code. To trigger a redraw, call DirectDrawingBase.ForceRefresh or modify properties that affect appearance.
| DirectRectangle Gondwana.Drawing.Direct.DirectRectangle.PulseBorder | ( | Color | from, |
| Color | to, | ||
| float | periodSec, | ||
| bool | enabled = true, | ||
| bool | triangle = false ) |
Initiates an animated color transition (pulse) for the rectangle's border between two colors.
| from | The starting color of the pulse animation. |
| to | The ending color of the pulse animation. |
| periodSec | The duration of one complete pulse cycle in seconds. Minimum value is 0.0001 seconds. |
| enabled | true to enable the pulse animation (default); false to disable it. |
| triangle | true to use a triangle wave (linear ramp up then down); false to use a sine wave (smooth ease in/out, default). |
The border pulse creates a smooth color transition that repeats continuously. The color interpolates from from to to and back, creating an attention-grabbing effect useful for selection indicators, focus outlines, or warning borders.
The animation is updated each frame via Update and uses high-resolution timing for smooth, consistent animation regardless of frame rate.
To stop all pulsing (fill and border), call StopPulses. Disabling via enabled = false stops the animation but preserves the settings for later re-enabling.
| DirectRectangle Gondwana.Drawing.Direct.DirectRectangle.PulseFill | ( | Color | from, |
| Color | to, | ||
| float | periodSec, | ||
| bool | enabled = true, | ||
| bool | triangle = false ) |
Initiates an animated color transition (pulse) for the rectangle's fill between two colors.
| from | The starting color of the pulse animation. |
| to | The ending color of the pulse animation. |
| periodSec | The duration of one complete pulse cycle in seconds. Minimum value is 0.0001 seconds. |
| enabled | true to enable the pulse animation (default); false to disable it. |
| triangle | true to use a triangle wave (linear ramp up then down); false to use a sine wave (smooth ease in/out, default). |
The fill pulse creates a smooth color transition that repeats continuously. The color interpolates from from to to and back, creating an attention-grabbing effect useful for alerts, health indicators, or animated UI elements.
The animation is updated each frame via Update and uses high-resolution timing for smooth, consistent animation regardless of frame rate.
To stop all pulsing (fill and border), call StopPulses. Disabling via enabled = false stops the animation but preserves the settings for later re-enabling.
| DirectRectangle Gondwana.Drawing.Direct.DirectRectangle.SetAlpha | ( | int | alpha | ) |
Sets the alpha (transparency) channel of the base color.
| alpha | The alpha value from 0 (fully transparent) to 255 (fully opaque). |
This method modifies only the alpha channel of the base color, preserving the RGB components. It affects the fill transparency and, if no distinct border color is set, also affects the stroke transparency.
If a distinct border color has been set via SetBorderColor, its alpha remains unchanged by this method. To modify the border alpha independently, call SetBorderColor with a color containing the desired alpha value.
The affected screen regions are automatically marked as dirty to trigger rerendering on the next frame.
| DirectRectangle Gondwana.Drawing.Direct.DirectRectangle.SetBlendMode | ( | SKBlendMode | mode | ) |
Sets the blend mode used when rendering this rectangle onto the canvas.
| mode | The blend mode to apply. See SKBlendMode for available options. |
Blend modes determine how the rectangle's pixels combine with the existing pixels on the render surface. For example:
This mode applies to both the fill and stroke paints. Changing it affects how the rectangle visually interacts with whatever was previously drawn.
No dirty-rectangle marking is performed by this method alone; the effect becomes visible on the next render pass if the rectangle is already dirty from other property changes.
| DirectRectangle Gondwana.Drawing.Direct.DirectRectangle.SetBorderColor | ( | Color | color | ) |
Sets a distinct border (stroke) color, independent of the fill color.
| color | The border color to apply. |
When a border color is set, the stroke uses this color instead of the base color set by SetColor. This allows for rectangles with different fill and outline colors, such as a white panel with a dark border.
The border color has its own alpha channel, independent of the fill's alpha. To remove the distinct border color and revert to using the base color, call SetColor again without setting a border color, or set the border color to match the base color.
The affected screen regions are automatically marked as dirty to trigger rerendering on the next frame. If border pulsing is active, calling this method will not affect the pulsing animation until StopPulses is called.
| DirectRectangle Gondwana.Drawing.Direct.DirectRectangle.SetColor | ( | Color | color | ) |
Sets the base color used for both fill and stroke (unless a distinct border color is specified).
| color | The new base color. |
This color is used for the fill when SetFilled is true, and for the stroke (border) unless a distinct border color has been set via SetBorderColor.
The affected screen regions are automatically marked as dirty to trigger rerendering on the next frame. If color pulsing is active, calling this method will not affect the pulsing animation until StopPulses is called.
| DirectRectangle Gondwana.Drawing.Direct.DirectRectangle.SetCornerRadius | ( | float | radius | ) |
Sets the radius for rounded corners in pixels.
| radius | The corner radius in pixels. A value of 0 produces sharp (90-degree) corners. Larger values create more rounded corners. |
Rounded corners are applied uniformly to all four corners of the rectangle. The radius specifies how far from the corner the curve begins. If the radius is larger than half the rectangle's width or height, the corners may overlap, producing unexpected results.
Rounded corners work with both filled and outlined rectangles, as well as with stroke alignment modes. The corner radius is adjusted internally based on stroke alignment to maintain visual consistency.
No dirty-rectangle marking is performed by this method alone; the effect becomes visible on the next render pass if the rectangle is already dirty from other property changes.
| DirectRectangle Gondwana.Drawing.Direct.DirectRectangle.SetDashPattern | ( | float | dashLength, |
| float | gapLength ) |
Sets a simple repeating dash pattern using dash and gap lengths, in pixels.
| dashLength | Length of each visible dash, in pixels. |
| gapLength | Length of the transparent gap between dashes, in pixels. |
This is a shorthand for creating a repeating [dash, gap] pattern (e.g., (8, 4) for 8 px dash, 4 px gap). The pattern is applied to the stroke (outline) only and has no effect on filled rectangles without a stroke.
Dash patterns are useful for creating dashed borders, focus indicators, or selection outlines. The pattern repeats continuously around the rectangle's perimeter.
To remove the dash pattern and revert to a solid stroke, call ClearDashPattern.
No dirty-rectangle marking is performed by this method alone; the effect becomes visible on the next render pass if the rectangle is already dirty from other property changes.
| DirectRectangle Gondwana.Drawing.Direct.DirectRectangle.SetFilled | ( | bool | isFilled | ) |
Sets whether the rectangle interior is filled with the base color (or pattern).
| isFilled | true to fill the rectangle interior; false to draw only the outline (stroke). |
When filled, the rectangle's interior is drawn using the fill paint (base color or pattern). When not filled, only the stroke (outline) is visible if SetStrokeWidth is greater than zero.
You can combine fill and stroke to create rectangles with both a filled interior and a visible border, which is common for UI panels and buttons.
The affected screen regions are automatically marked as dirty to trigger rerendering on the next frame.
| DirectRectangle Gondwana.Drawing.Direct.DirectRectangle.SetFillPattern | ( | SKBitmap | bitmap, |
| SKShaderTileMode | tileX = SKShaderTileMode::Repeat, | ||
| SKShaderTileMode | tileY = SKShaderTileMode::Repeat, | ||
| float | scale = 1f, | ||
| SKPoint? | offsetPx = null, | ||
| SKFilterQuality | filterQuality = SKFilterQuality::None ) |
Sets the rectangle's fill to use a tiled bitmap pattern instead of a solid color.
| bitmap | The source bitmap to tile across the rectangle's interior. |
| tileX | The horizontal tiling mode (Repeat, Mirror, or Clamp). Default is Repeat. |
| tileY | The vertical tiling mode (Repeat, Mirror, or Clamp). Default is Repeat. |
| scale | Optional uniform scale factor applied to the bitmap. 1.0 = native size (default). |
| offsetPx | Optional offset in pixels to shift the pattern origin. Null = no offset (default). |
| filterQuality | The filter quality to use when scaling the pattern. Default is None (nearest-neighbor). |
Pattern fills replace the solid color fill with a repeating texture. The bitmap is tiled according to the specified tile modes and scaled/offset as configured. This is useful for textured panels, patterned backgrounds, or decorative UI elements.
The base color set by SetColor tints the pattern multiplicatively. Set it to white to preserve the pattern's original colors, or use another color to apply a tint.
The pattern uses the rectangle's current coordinate space (world or screen). The scale parameter affects the pattern's size, while offsetPx shifts the pattern's origin, allowing for animated or scrolling textures.
The bitmap is not owned by this DirectRectangle; the caller must manage its lifetime and ensure it remains valid while in use.
This method automatically enables filled mode (SetFilled(true)) to make the pattern visible. The affected screen regions are automatically marked as dirty to trigger rerendering on the next frame.
To remove the pattern and return to solid color fill, call ClearFillPattern.
| DirectRectangle Gondwana.Drawing.Direct.DirectRectangle.SetStrokeAlign | ( | StrokeAlign | align | ) |
Sets how the rectangle's stroke is positioned relative to its bounds.
| align | The stroke alignment mode. See StrokeAlign for available options. |
Determines whether the stroke (outline) is drawn inside, outside, or centered on the rectangle's boundary:
This only affects visible strokes (outlined or bordered rectangles). Filled rectangles are not impacted by stroke alignment.
No dirty-rectangle marking is performed by this method alone; the effect becomes visible on the next render pass if the rectangle is already dirty from other property changes.
| DirectRectangle Gondwana.Drawing.Direct.DirectRectangle.SetStrokeWidth | ( | float | width | ) |
Sets the width (thickness) of the rectangle's stroke (outline) in pixels.
| width | The stroke width in pixels. A value of 0 results in no visible stroke. |
The stroke width determines how thick the rectangle's outline appears. Combined with SetStrokeAlign, you can control whether the stroke is drawn inside, outside, or centered on the rectangle boundary.
For pixel-perfect rendering at 1-pixel width, consider disabling antialiasing or using integer coordinates for the rectangle bounds.
The affected screen regions are automatically marked as dirty to trigger rerendering on the next frame.
| DirectRectangle Gondwana.Drawing.Direct.DirectRectangle.StopPulses | ( | ) |
Stops all active color pulsing animations (fill and border), reverting to static colors.
After calling this method, the rectangle's fill and border colors are restored to the values set by SetColor and SetBorderColor. The pulse animation state (period, wave type, colors) is preserved but disabled, so you can re-enable it later by calling PulseFill or PulseBorder again.
The affected screen regions are automatically marked as dirty to trigger rerendering on the next frame.
|
virtual |
Performs per-frame update logic, including pulse animation advancement and physics integration.
| tick | The current engine tick value from HighResTimer. |
This method overrides DirectDrawingMovableBase.Update to add color pulsing animation support. It performs the following operations:
base.Update(tick) to perform physics integration and fade/reveal animations. The pulse animation uses a continuous time accumulator that wraps around the specified period, ensuring smooth, consistent animation. Color interpolation is performed in RGB space with linear blending (including alpha channel).
Override this method in derived classes to add custom per-frame logic. Always call base.Update(tick) to preserve pulsing, movement, and fade/reveal functionality.
Reimplemented from Gondwana.Drawing.Direct.DirectDrawingMovableBase.