From 726759e2327aee386bd9c2e7c31e5206d3fe9587 Mon Sep 17 00:00:00 2001 From: soywiz Date: Tue, 4 Jul 2023 20:58:08 +0200 Subject: [PATCH] Propagates GameWindow.Quality to RenderContext --- .../commonMain/kotlin/korlibs/korge/render/RenderContext.kt | 5 ++++- korge/src/commonMain/kotlin/korlibs/korge/view/Views.kt | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/korge/src/commonMain/kotlin/korlibs/korge/render/RenderContext.kt b/korge/src/commonMain/kotlin/korlibs/korge/render/RenderContext.kt index 5a267afb61..cef4ba7fa7 100644 --- a/korge/src/commonMain/kotlin/korlibs/korge/render/RenderContext.kt +++ b/korge/src/commonMain/kotlin/korlibs/korge/render/RenderContext.kt @@ -44,7 +44,8 @@ class RenderContext( /** Object storing all the rendering [Stats] like number of batches, number of vertices etc. */ val stats: Stats = Stats(), val coroutineContext: CoroutineContext = EmptyCoroutineContext, - val batchMaxQuads: Int = BatchBuilder2D.DEFAULT_BATCH_QUADS + val batchMaxQuads: Int = BatchBuilder2D.DEFAULT_BATCH_QUADS, + val windowConfig: GameWindowConfig = GameWindowConfig.Impl() ) : Extra by Extra.Mixin(), BoundsProvider by bp, @@ -52,6 +53,8 @@ class RenderContext( DeviceDimensionsProvider by deviceDimensionsProvider, Closeable { + val quality: GameWindow.Quality get() = windowConfig.quality + @PublishedApi internal val _buffers = AGProgramWithUniforms.BufferCache() private val _programs = FastIdentityMap() diff --git a/korge/src/commonMain/kotlin/korlibs/korge/view/Views.kt b/korge/src/commonMain/kotlin/korlibs/korge/view/Views.kt index 0c8c91ad4d..e8ddb328e8 100644 --- a/korge/src/commonMain/kotlin/korlibs/korge/view/Views.kt +++ b/korge/src/commonMain/kotlin/korlibs/korge/view/Views.kt @@ -95,7 +95,7 @@ class Views( var name: String? = null var currentVfs: VfsFile = resourcesVfs var imageFormats = RegisteredImageFormats - val renderContext = RenderContext(ag, this, gameWindow, stats, coroutineContext, batchMaxQuads) + val renderContext = RenderContext(ag, this, gameWindow, stats, coroutineContext, batchMaxQuads, gameWindow) @Deprecated("") val agBitmapTextureManager get() = renderContext.agBitmapTextureManager @Deprecated("") val agBufferManager get() = renderContext.agBufferManager var clearEachFrame = true