From f29fcd25d836a6548bc03505711ea448aefb0278 Mon Sep 17 00:00:00 2001 From: Elias Batek Date: Fri, 22 Dec 2023 03:29:17 +0100 Subject: [PATCH] Add convenience constructors to PixelPresenter --- pixelpresenter.d | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/pixelpresenter.d b/pixelpresenter.d index 949dee4..e36e1b4 100644 --- a/pixelpresenter.d +++ b/pixelpresenter.d @@ -609,6 +609,39 @@ final class PixelPresenter { } } + // additional convience ctors + public { + + /// + this( + string title, + const Size resolution, + const Size initialWindowSize, + Scaling scaling = Scaling.contain, + ScalingFilter filter = ScalingFilter.nearest, + ) { + auto cfg = PresenterConfig(); + + cfg.window.title = title; + cfg.renderer.resolution = resolution; + cfg.window.size = initialWindowSize; + cfg.renderer.scaling = scaling; + cfg.renderer.filter = filter; + + this(cfg); + } + + /// + this( + string title, + const Size resolution, + Scaling scaling = Scaling.contain, + ScalingFilter filter = ScalingFilter.nearest, + ) { + this(title, resolution, resolution, scaling, filter,); + } + } + // public functions public {