PostProcessingServiceCollectionExtensions.AddLetterbox(this IServiceCollection, int, int, Nullable) Method
Definition
Namespace: Brine2D.Rendering.SDL
Adds a fixed-aspect-ratio/letterbox effect to the pipeline. The main render target \(and all game\-world rendering\) is fixed at designWidth x designHeight regardless of window size; this effect scales that output to fit the actual window, centered, filling the remainder with barColor. Always runs last in the pipeline.
public static Microsoft.Extensions.DependencyInjection.IServiceCollection AddLetterbox(this Microsoft.Extensions.DependencyInjection.IServiceCollection services, int designWidth, int designHeight, System.Nullable<Brine2D.Core.Color> barColor=null);
Parameters
services Microsoft.Extensions.DependencyInjection.IServiceCollection
designWidth System.Int32
designHeight System.Int32
barColor System.Nullable<Color>
Returns
Microsoft.Extensions.DependencyInjection.IServiceCollection
Remarks
Requires AddPostProcessing\(this IServiceCollection, Action<PostProcessingOptions>\) to have been called first. When this effect is registered, the render target manager sizes the main/ping-pong render targets to the design resolution instead of the live viewport, so window resizes no longer recreate them.