### Shader AST + DSL Example Source: https://github.com/korlibs/korge/blob/main/korge/README.md Example of defining a shader program using the Shader AST and DSL. ```APIDOC ## Shader AST + DSL Example ### Description Demonstrates how to define a custom shader program using the Shader AST and DSL. ### PROGRAM_DEBUG_WITH_PROJ ```kotlin val PROGRAM_DEBUG_WITH_PROJ = Program( vertex = VertexShader { SET(out, u_ProjMat * vec4(a_Pos, 0f.lit, 1f.lit)) }, fragment = FragmentShader { SET(out, vec4(1f.lit, 0f.lit, 0f.lit, 1f.lit)) } ) ``` This program defines a vertex shader that transforms vertex positions using a projection matrix and a fragment shader that outputs a solid red color. ``` -------------------------------- ### Korge Shader AST + DSL Example Source: https://github.com/korlibs/korge/blob/main/korge/README.md An example of defining a shader program using Korge's Shader AST and DSL. This specific program uses a vertex shader for projection and a fragment shader for solid color output. ```kotlin val PROGRAM_DEBUG_WITH_PROJ = Program( vertex = VertexShader { SET(out, u_ProjMat * vec4(a_Pos, 0f.lit, 1f.lit)) }, fragment = FragmentShader { SET(out, vec4(1f.lit, 0f.lit, 0f.lit, 1f.lit)) } ) ``` -------------------------------- ### Build Gradle Configuration Source: https://github.com/korlibs/korge/blob/main/korge-gradle-plugins/korge-gradle-plugin-common/src/test/resources/NewKProjectGradleGeneratorTest_test.txt Configures buildscript repositories, plugins, and dependencies for a Korge project. ```gradle buildscript { repositories { mavenLocal() maven { url = uri("https://central.sonatype.com/repository/maven-snapshots") } mavenCentral() google() gradlePluginPortal() maven { url = uri("https://maven.pkg.jetbrains.space/kotlin/p/kotlin/dev") } maven { url = uri("https://maven.pkg.jetbrains.space/kotlin/p/wasm/experimental") } } } plugins { id("org.korge.kproject") id("org.jetbrains.kotlin.plugin.serialization") } dependencies { add("commonMainApi", "org.jetbrains.kotlinx:kotlinx-serialization-json:1.11.0") add("commonMainApi", project(":mymodule")) } [file("build.extra.gradle"), file("build.extra.gradle.kts")].each { extraGradle -> if (extraGradle.exists()) apply from: extraGradle } ``` ```gradle buildscript { repositories { mavenLocal() maven { url = uri("https://central.sonatype.com/repository/maven-snapshots") } mavenCentral() google() gradlePluginPortal() maven { url = uri("https://maven.pkg.jetbrains.space/kotlin/p/kotlin/dev") } maven { url = uri("https://maven.pkg.jetbrains.space/kotlin/p/wasm/experimental") } } } plugins { id("org.korge.kproject") } dependencies { add("commonMainApi", project(":Ademo2")) add("jvmTestApi", "org.mockito:mockito-core:5.3.1") add("jvmTestApi", "io.mockk:mockk-android:1.13.5") } [file("build.extra.gradle"), file("build.extra.gradle.kts")].each { extraGradle -> if (extraGradle.exists()) apply from: extraGradle } ``` ```gradle buildscript { repositories { mavenLocal() maven { url = uri("https://central.sonatype.com/repository/maven-snapshots") } mavenCentral() google() gradlePluginPortal() maven { url = uri("https://maven.pkg.jetbrains.space/kotlin/p/kotlin/dev") } maven { url = uri("https://maven.pkg.jetbrains.space/kotlin/p/wasm/experimental") } } } plugins { id("org.korge.kproject") } dependencies { add("commonMainApi", project(":Ademo3")) } [file("build.extra.gradle"), file("build.extra.gradle.kts")].each { extraGradle -> if (extraGradle.exists()) apply from: extraGradle } ``` ```gradle buildscript { repositories { mavenLocal() maven { url = uri("https://central.sonatype.com/repository/maven-snapshots") } mavenCentral() google() gradlePluginPortal() maven { url = uri("https://maven.pkg.jetbrains.space/kotlin/p/kotlin/dev") } maven { url = uri("https://maven.pkg.jetbrains.space/kotlin/p/wasm/experimental") } } } plugins { id("org.korge.kproject") } dependencies { add("commonMainApi", "org.jetbrains.compose.runtime:runtime:1.4.1") } [file("build.extra.gradle"), file("build.extra.gradle.kts")].each { extraGradle -> if (extraGradle.exists()) apply from: extraGradle } ``` -------------------------------- ### Run KorGE Sandbox Module on JVM Source: https://github.com/korlibs/korge/blob/main/README.md Execute the korge-sandbox module on the JVM. This is useful for making experiments and testing changes. ```shell ./gradlew :korge-sandbox:runJvm ``` -------------------------------- ### Korge Project Configuration (kproject.yml) Source: https://github.com/korlibs/korge/blob/main/korge-gradle-plugins/korge-gradle-plugin-common/src/test/resources/NewKProjectGradleGeneratorTest_test.txt Defines project plugins and module dependencies. ```yaml plugins: - serialization dependencies: - ./mymodule ``` ```yaml src: "https://github.com/korlibs/kproject.git/samples/demo1/content#08f93c2e49b65d1d8258e4e1408580772558b038" dependencies: - "https://github.com/korlibs/kproject.git/samples/demo2#95696dd942ebc8db4ee9d9f4835ce12d853ff16f" testDependencies: - maven::jvm::org.mockito:mockito-core:5.3.1 - io.mockk:mockk-android:1.13.5::jvm ``` ```yaml name: Ademo2 dependencies: - ../demo3.kproject.yml ``` ```yaml name: demo1 dependencies: - ../demo2 ``` ```yaml name: Ademo2 dependencies: - ../demo3.kproject.yml ``` ```yaml name: Ademo3 dependencies: - maven::common::org.jetbrains.compose.runtime:runtime:1.4.1 ``` -------------------------------- ### Run KorGE Sandbox Module on JavaScript Source: https://github.com/korlibs/korge/blob/main/README.md Execute the korge-sandbox module for JavaScript targets. This allows testing web-based game functionality. ```shell ./gradlew :korge-sandbox:runJs ``` -------------------------------- ### Korge Lock File Source: https://github.com/korlibs/korge/blob/main/korge-gradle-plugins/korge-gradle-plugin-common/src/test/resources/NewKProjectGradleGeneratorTest_test.txt Records the exact versions and commit hashes of external dependencies. ```text https://github.com/korlibs/kproject.git/samples/demo1/content#08f93c2e49b65d1d8258e4e1408580772558b038 ::: 08f93c2e49b65d1d8258e4e1408580772558b038:0c0e030c04f1f9fafc0c08f5f006f4fe07fff30608fc07f2f10b03fc07030f05 https://github.com/korlibs/kproject.git/samples/demo2#95696dd942ebc8db4ee9d9f4835ce12d853ff16f ::: 95696dd942ebc8db4ee9d9f4835ce12d853ff16f:f10dfcf9f2f409050d060a0f00f00a0f0cf80b09fbfefa02fe05f70bf104f105 https://github.com/korlibs/kproject.git/samples/demo3.kproject.yml#95696dd942ebc8db4ee9d9f4835ce12d853ff16f ::: 95696dd942ebc8db4ee9d9f4835ce12d853ff16f:0e040e0a0ffaf602050d080501fd05f5f102f80afcfff60500ffff08f606fff6 ``` -------------------------------- ### KR Sub-objects and File Access Source: https://github.com/korlibs/korge/blob/main/korge-gradle-plugins/korge-gradle-plugin/src/test/resources/expected.KR.generated.txt Defines nested objects for resource directories and typed access to files within them. Use these to navigate and access specific resources. ```kotlin object __KR { interface KR { val __file get() = resourcesVfs[""] @ResourceVfsPath("0000") val `n0000` get() = __KR.KR0000 @ResourceVfsPath("fonts") val `fonts` get() = __KR.KRFonts @ResourceVfsPath("gfx") val `gfx` get() = __KR.KRGfx @ResourceVfsPath("hello.png") val `hello` get() = TypedVfsFileBitmap(resourcesVfs["hello.png"]) @ResourceVfsPath("images") val `images` get() = __KR.KRImages @ResourceVfsPath("other") val `other` get() = __KR.KROther @ResourceVfsPath("sfx") val `sfx` get() = __KR.KRSfx } object KR0000 { val __file get() = resourcesVfs["0000"] @ResourceVfsPath("0000/1111") val `n1111` get() = __KR.KR00001111 } object KRFonts { val __file get() = resourcesVfs["fonts"] @ResourceVfsPath("fonts/hello.ttf") val `hello` get() = TypedVfsFileTTF(resourcesVfs["fonts/hello.ttf"]) } object KRGfx { val __file get() = resourcesVfs["gfx"] @ResourceVfsPath("gfx/demo.atlas.json") val `demo` get() = AtlasGfxDemoAtlas.TypedAtlas(resourcesVfs["gfx/demo.atlas.json"]) } object KRImages { val __file get() = resourcesVfs["images"] @ResourceVfsPath("images/image.ase") val `image` get() = AseImagesImageAse.TypedAse(resourcesVfs["images/image.ase"]) @ResourceVfsPath("images/image2.ase") val `image2` get() = AseImagesImage2Ase.TypedAse(resourcesVfs["images/image2.ase"]) } object KROther { val __file get() = resourcesVfs["other"] @ResourceVfsPath("other/file.raw") val `file` get() = TypedVfsFile(resourcesVfs["other/file.raw"]) } object KRSfx { val __file get() = resourcesVfs["sfx"] @ResourceVfsPath("sfx/sound.mp3") val `sound` get() = TypedVfsFileSound(resourcesVfs["sfx/sound.mp3"]) } object KR00001111 { val __file get() = resourcesVfs["0000/1111"] @ResourceVfsPath("0000/1111/222a.png") val `n222a` get() = TypedVfsFileBitmap(resourcesVfs["0000/1111/222a.png"]) } } ``` -------------------------------- ### Run KorGE Sandbox Module on Android Release Source: https://github.com/korlibs/korge/blob/main/README.md Build and run the korge-sandbox module for Android in release mode. This is for testing the game on an Android device or emulator. ```shell ./gradlew :korge-sandbox:runAndroidRelease ``` -------------------------------- ### Korag: Draw Red Triangle on Blue Background Source: https://github.com/korlibs/korge/blob/main/korge/README.md This snippet demonstrates clearing the screen to blue and drawing a red triangle using a predefined shader and vertex layout. It utilizes the AG (Accelerated Graphics) API for rendering and includes setting up vertex buffers and uniforms. ```kotlin ag.clear(Colors.BLUE) ag.createVertexBuffer(floatArrayOf( 0f, 0f, 640f, 0f, 640f, 480f )).use { vertices -> ag.draw( vertices, program = DefaultShaders.PROGRAM_DEBUG_WITH_PROJ, type = AGDrawType.TRIANGLES, vertexLayout = DefaultShaders.LAYOUT_DEBUG, vertexCount = 3, uniforms = mapOf( DefaultShaders.u_ProjMat to Matrix4().setToOrtho(0f, 0f, 640f, 480f, -1f, +1f) ) ) } ``` -------------------------------- ### Korge AG (Abstract Graphics) API Source: https://github.com/korlibs/korge/blob/main/korge/README.md Defines the interface for interacting with the underlying graphics hardware. Use this for low-level rendering operations, texture and buffer creation, and drawing commands. ```kotlin class AG { val nativeComponent: Any val backWidth: Int val backHeight: Int var onRender: (AG) -> Unit fun repaint() fun resized() fun createTexture(): Texture fun createTexture(bmp: Bitmap, mipmaps: Boolean = false): Texture fun createBuffer(kind: BufferKind): Buffer fun createIndexBuffer(): Buffer fun createVertexBuffer(): Buffer fun createIndexBuffer(data: ShortArray, offset: Int = 0, length: Int = data.size - offset): Buffer fun createVertexBuffer(data: FloatArray, offset: Int = 0, length: Int = data.size - offset): Buffer fun draw(vertices: Buffer, indices: Buffer, program: Program, type: DrawType, vertexLayout: VertexLayout, vertexCount: Int, offset: Int = 0, blending: BlendMode = BlendMode.OVERLAY, uniforms: Map = mapOf()): Unit fun draw(vertices: Buffer, program: Program, type: DrawType, vertexLayout: VertexLayout, vertexCount: Int, offset: Int = 0, blending: BlendMode = BlendMode.OVERLAY, uniforms: Map = mapOf()): Unit fun flip() fun clear(color: Int = RGBA(0, 0, 0, 0xFF), depth: Float = 0f, stencil: Int = 0, clearColor: Boolean = true, clearDepth: Boolean = true, clearStencil: Boolean = true) inline fun renderToTexture(width: Int, height: Int, callback: () -> Unit): RenderTexture inline fun renderToBitmap(bmp: Bitmap32, callback: () -> Unit) class Texture : Closeable { enum class Kind { RGBA, LUMINANCE } var mipmaps: Boolean fun upload(bmp: Bitmap, mipmaps: Boolean = false): Texture fun uploadBuffer(data: ByteBuffer, width: Int, height: Int, kind: Kind) fun uploadBitmap32(bmp: Bitmap32) fun uploadBitmap8(bmp: Bitmap8) fun close() } class TextureUnit { var texture: AG.Texture? = null var linear: Boolean = true } class Buffer : Closeable { enum class Kind { INDEX, VERTEX } var dirty = false fun upload(data: ByteBuffer, offset: Int = 0, length: Int = data.limit()): Buffer fun upload(data: ByteArray, offset: Int = 0, length: Int = data.size): Buffer fun upload(data: FloatArray, offset: Int = 0, length: Int = data.size): Buffer fun upload(data: IntArray, offset: Int = 0, length: Int = data.size): Buffer fun upload(data: ShortArray, offset: Int = 0, length: Int = data.size): Buffer fun upload(data: Buffer, offset: Int = 0, length: Int = data.length): Buffer fun close() } class RenderBuffer : Closeable { val tex: Texture fun start(width: Int, height: Int): Unit fun end(): Unit fun readBitmap(bmp: Bitmap32): Unit fun close(): Unit } class RenderTexture( val tex: Texture, val width: Int, val height: Int ) enum class DrawType { TRIANGLES } } ``` -------------------------------- ### Run KorGE Sandbox Module on iOS Device Release Source: https://github.com/korlibs/korge/blob/main/README.md Build and run the korge-sandbox module for iOS on a physical device in release mode. This requires a macOS environment with Xcode. ```shell ./gradlew :korge-sandbox:runIosDeviceRelease ``` -------------------------------- ### AG Class Methods Source: https://github.com/korlibs/korge/blob/main/korge/README.md Provides an overview of the methods available in the AG class for graphics operations. ```APIDOC ## AG Class ### Description Represents the Abstract Graphics interface for rendering operations. ### Methods - `repaint()`: Requests a repaint of the canvas. - `resized()`: Notifies the AG system that the canvas has been resized. - `createTexture()`: Creates a new texture. - `createTexture(bmp: Bitmap, mipmaps: Boolean = false)`: Creates a texture from a bitmap. - `createBuffer(kind: BufferKind)`: Creates a buffer of a specified kind (INDEX or VERTEX). - `createIndexBuffer()`: Creates an index buffer. - `createVertexBuffer()`: Creates a vertex buffer. - `createIndexBuffer(data: ShortArray, offset: Int = 0, length: Int = data.size - offset)`: Creates an index buffer from a short array. - `createVertexBuffer(data: FloatArray, offset: Int = 0, length: Int = data.size - offset)`: Creates a vertex buffer from a float array. - `draw(...)`: Overloaded methods for drawing primitives using vertices, indices, program, and layout. - `flip()`: Flips the buffers to display the rendered content. - `clear(...)`: Clears the canvas with a specified color and depth. - `renderToTexture(width: Int, height: Int, callback: () -> Unit)`: Renders content to a texture. - `renderToBitmap(bmp: Bitmap32, callback: () -> Unit)`: Renders content to a bitmap. ### Inner Classes and Enums - `Texture`: Represents a texture resource. - `TextureUnit`: Represents a texture unit for shader binding. - `Buffer`: Represents a vertex or index buffer. - `RenderBuffer`: Represents a render buffer for offscreen rendering. - `RenderTexture`: Represents a texture that is the result of rendering. - `DrawType`: Enum for specifying draw types (e.g., TRIANGLES). - `BufferKind`: Enum for buffer types (INDEX, VERTEX). - `Texture.Kind`: Enum for texture kinds (RGBA, LUMINANCE). ``` -------------------------------- ### Typed VFS Sound Access Source: https://github.com/korlibs/korge/blob/main/korge-gradle-plugins/korge-gradle-plugin/src/test/resources/expected.KR.generated.txt Provides type-safe access to sound files. Includes a suspend function to read the sound data. ```kotlin inline class TypedVfsFileSound(val __file: VfsFile) { suspend fun read(): korlibs.audio.sound.Sound = this.__file.readSound() } ``` -------------------------------- ### AseImagesImage2Ase Class Source: https://github.com/korlibs/korge/blob/main/korge-gradle-plugins/korge-gradle-plugin/src/test/resources/expected.KR.generated.txt Represents a second ASE (Aseprite) image resource. Similar to AseImagesImageAse, providing access to image data and animations. ```kotlin inline class AseImagesImage2Ase(val data: korlibs.image.format.ImageDataContainer) { inline class TypedAse(val __file: VfsFile) { suspend fun read(atlas: korlibs.image.atlas.MutableAtlasUnit? = null): AseImagesImage2Ase = AseImagesImage2Ase(this.__file.readImageDataContainer(korlibs.image.format.ASE.toProps(), atlas)) } enum class TypedAnimation(val animationName: String) { ; companion object { val list: List = values().toList() } } inline class TypedImageData(val data: ImageData) { val animations: TypedAnimation.Companion get() = TypedAnimation } val animations: TypedAnimation.Companion get() = TypedAnimation val default: TypedImageData get() = TypedImageData(data.default) } ``` -------------------------------- ### Publish KorGE Locally to Maven Local Source: https://github.com/korlibs/korge/blob/main/README.md Publish the KorGE project locally to your Maven repository. This allows you to use the latest snapshot version in other projects. ```shell ./gradlew publishToMavenLocal ``` -------------------------------- ### Korge Default Shaders Object Source: https://github.com/korlibs/korge/blob/main/korge/README.md Provides access to predefined shader uniforms, attributes, varyings, and programs. Use these for common rendering tasks without defining shaders from scratch. ```kotlin object DefaultShaders { val u_Tex: Uniform val u_ProjMat: Uniform val a_Pos: Attribute // float,float val a_Tex: Attribute // float,float val a_Col: Attribute // int val v_Tex: Varying val v_Col: Varying val t_Temp1: Temp val textureUnit: AG.TextureUnit val LAYOUT_DEFAULT: VertexFormat // a_Pos,a_Tex,a_Col val VERTEX_DEFAULT: VertexShader val FRAGMENT_DEFAULT: FragmentShader val FRAGMENT_SOLID_COLOR: FragmentShader val PROGRAM_TINTED_TEXTURE: Program val PROGRAM_SOLID_COLOR: Program val LAYOUT_DEBUG: VertexFormat // a_Pos val PROGRAM_DEBUG : Program val PROGRAM_DEBUG_WITH_PROJ: Program val PROGRAM_DEFAULT: Program } ``` -------------------------------- ### AseImagesImageAse Class Source: https://github.com/korlibs/korge/blob/main/korge-gradle-plugins/korge-gradle-plugin/src/test/resources/expected.KR.generated.txt Represents an ASE (Aseprite) image resource. Provides access to image data and animations. ```kotlin inline class AseImagesImageAse(val data: korlibs.image.format.ImageDataContainer) { inline class TypedAse(val __file: VfsFile) { suspend fun read(atlas: korlibs.image.atlas.MutableAtlasUnit? = null): AseImagesImageAse = AseImagesImageAse(this.__file.readImageDataContainer(korlibs.image.format.ASE.toProps(), atlas)) } enum class TypedAnimation(val animationName: String) { ; companion object { val list: List = values().toList() } } inline class TypedImageData(val data: ImageData) { val animations: TypedAnimation.Companion get() = TypedAnimation } val animations: TypedAnimation.Companion get() = TypedAnimation val default: TypedImageData get() = TypedImageData(data.default) } ``` -------------------------------- ### KR Resource Object Source: https://github.com/korlibs/korge/blob/main/korge-gradle-plugins/korge-gradle-plugin/src/test/resources/expected.KR.generated.txt The main object for accessing resources generated by Korge. It provides access to sub-directories and specific files. ```kotlin object KR : __KR.KR ``` -------------------------------- ### DefaultShaders Object Source: https://github.com/korlibs/korge/blob/main/korge/README.md Defines default uniforms, attributes, varyings, and shader programs. ```APIDOC ## DefaultShaders Object ### Description Provides pre-defined shader elements and programs for common rendering tasks. ### Shader Elements - `u_Tex`: Uniform for texture. - `u_ProjMat`: Uniform for projection matrix. - `a_Pos`: Attribute for vertex position. - `a_Tex`: Attribute for texture coordinates. - `a_Col`: Attribute for vertex color. - `v_Tex`: Varying for texture coordinates passed to fragment shader. - `v_Col`: Varying for vertex color passed to fragment shader. - `t_Temp1`: Temporary variable. - `textureUnit`: An instance of `AG.TextureUnit`. - `LAYOUT_DEFAULT`: Default vertex layout (`a_Pos`, `a_Tex`, `a_Col`). - `LAYOUT_DEBUG`: Debug vertex layout (`a_Pos`). ### Shader Programs - `VERTEX_DEFAULT`: Default vertex shader. - `FRAGMENT_DEFAULT`: Default fragment shader. - `FRAGMENT_SOLID_COLOR`: Fragment shader for solid colors. - `PROGRAM_TINTED_TEXTURE`: Program for rendering tinted textures. - `PROGRAM_SOLID_COLOR`: Program for rendering solid colors. - `PROGRAM_DEBUG`: Debug shader program. - `PROGRAM_DEBUG_WITH_PROJ`: Debug shader program with projection matrix. - `PROGRAM_DEFAULT`: The default shader program. ``` -------------------------------- ### Typed VFS File Access Source: https://github.com/korlibs/korge/blob/main/korge-gradle-plugins/korge-gradle-plugin/src/test/resources/expected.KR.generated.txt Provides type-safe access to VFS files. Use this for generic file access where specific type handling is not required. ```kotlin inline class TypedVfsFile(val __file: VfsFile) ``` -------------------------------- ### Update KorGE Gradle Plugin Namespace Source: https://github.com/korlibs/korge/blob/main/README.md Change your Gradle dependencies to use the new namespace 'org.korge.engine' for version 7.0.0-SNAPSHOT. This replaces the old 'com.soywiz.korge' namespace. ```toml [plugins] #korge = { id = "com.soywiz.korge", version = "6.0.0" } <-- Old namespace, latest official version korge = { id = "org.korge.engine", version = "7.0.0-SNAPSHOT" } # <-- New namespace, use latest snapshot version ``` -------------------------------- ### AtlasGfxDemoAtlas Class Source: https://github.com/korlibs/korge/blob/main/korge-gradle-plugins/korge-gradle-plugin/src/test/resources/expected.KR.generated.txt Represents an atlas resource. Provides typed access to individual images within the atlas. ```kotlin inline class AtlasGfxDemoAtlas(val __atlas: korlibs.image.atlas.Atlas) { inline class TypedAtlas(val __file: VfsFile) { suspend fun read(): AtlasGfxDemoAtlas = AtlasGfxDemoAtlas(this.__file.readAtlas()) } @ResourceVfsPath("gfx/demo.atlas/hello.png") val `hello` get() = __atlas["hello.png"] @ResourceVfsPath("gfx/demo.atlas/world.png") val `world` get() = __atlas["world.png"] } ``` -------------------------------- ### Git Ignore File Source: https://github.com/korlibs/korge/blob/main/korge-gradle-plugins/korge-gradle-plugin-common/src/test/resources/NewKProjectGradleGeneratorTest_test.txt Specifies files and directories to be ignored by Git. ```gitignore /.idea /.gradle /build /build.gradle ``` ```gitignore /src /.idea /.gradle /build /build.gradle ``` ```gitignore /.idea /.gradle /build /build.gradle ``` -------------------------------- ### Typed VFS Bitmap Image Access Source: https://github.com/korlibs/korge/blob/main/korge-gradle-plugins/korge-gradle-plugin/src/test/resources/expected.KR.generated.txt Provides type-safe access to bitmap image files. Offers suspend functions to read the bitmap data and its slices. ```kotlin inline class TypedVfsFileBitmap(val __file: VfsFile) { suspend fun read(): korlibs.image.bitmap.Bitmap = this.__file.readBitmap() suspend fun readSlice(atlas: MutableAtlasUnit? = null, name: String? = null): BmpSlice = this.__file.readBitmapSlice(name, atlas) } ``` -------------------------------- ### Korge Shader Element Definitions Source: https://github.com/korlibs/korge/blob/main/korge/README.md Defines uniforms, attributes, and varyings used in Korge shaders. These are building blocks for creating custom shader programs. ```kotlin val u_Tex = Uniform("u_Tex", VarType.TextureUnit) val u_ProjMat = Uniform("u_ProjMat", VarType.Mat4) val a_Pos = Attribute("a_Pos", VarType.Float2, normalized = false) val a_Tex = Attribute("a_Tex", VarType.Float2, normalized = false) val a_Col = Attribute("a_Col", VarType.Byte4, normalized = true) val v_Tex = Varying("v_Tex", VarType.Float2) val v_Col = Varying("v_Col", VarType.Byte4) val t_Temp1 = Temp(0, VarType.Float4) val textureUnit = AG.TextureUnit() val LAYOUT_DEFAULT = VertexLayout(a_Pos, a_Tex, a_Col) ``` -------------------------------- ### Typed VFS TTF Font Access Source: https://github.com/korlibs/korge/blob/main/korge-gradle-plugins/korge-gradle-plugin/src/test/resources/expected.KR.generated.txt Provides type-safe access to TTF font files. Includes a suspend function to read the font data. ```kotlin inline class TypedVfsFileTTF(val __file: VfsFile) { suspend fun read(): korlibs.image.font.TtfFont = this.__file.readTtfFont() } ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.