Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/levelz-file/kotlin-bindings

Kotlin Multiplatform Parser & API for LevelZ File Format
https://github.com/levelz-file/kotlin-bindings

kotlin kotlin-multiplatform levelz

Last synced: 3 months ago
JSON representation

Kotlin Multiplatform Parser & API for LevelZ File Format

Awesome Lists containing this project

README

        

# levelz-kt

> Alternative Kotlin Bindings designed for Kotlin Multiplatform

[![JitPack](https://jitpack.io/v/LevelZ-File/kotlin-bindings.svg)](https://jitpack.io/#LevelZ-File/kotlin-bindings)
![GitHub Release](https://img.shields.io/github/v/release/LevelZ-File/kotlin-bindings)

## Why?

The official [java-bindings](https://github.com/LevelZ-File/java-bindings) are designed to be implemented on
the JVM. This project is designed to be implemented on Kotlin Multiplatform.

**They are intended to be functionally the same, and to not be used together.**

### Download

```xml


calculus-releases
https://repo.calcugames.xyz/repository/maven-releases/


calculus-snapshots
https://repo.calcugames.xyz/repository/maven-snapshots/


xyz.calcugames
levelz-kt
[VERSION]

```

Gradle (Groovy)
```groovy
// Add Calculus Games Repositories
repositories {
maven { url 'https://repo.calcugames.xyz/repository/maven-releases/' }
maven { url 'https://repo.calcugames.xyz/repository/maven-snapshots/' }
}

dependencies {
implementation 'xyz.calcugames:levelz-kt:[VERSION]'
}
```

Gradle (Kotlin DSL)
```kts
// Add Calculus Games Repository
repositories {
maven("https://repo.calcugames.xyz/repository/maven-releases/")
maven("https://repo.calcugames.xyz/repository/maven-snapshots/")
}

dependencies {
implementation("xyz.calcugames:levelz-kt:[VERSION]")
}
```

## Usage
```kotlin
val (x, y) = Coordinate2D(1, 2)
val (x, y, z) = Coordinate3D(1, 2, 3)

println(x) // 1
println(y) // 2
```

```kotlin
val levelString = """
@type 2\n
@spawn [0, 1]\n
@scroll none\n
---
grass: [0, 0]*[0, 1]
"""

val level = parseLevel(levelString) as Level2D

println(level.scroll) // Scroll.NONE
```