kitgit

tirbofish/dropbear · diff

5ada4cc · tk

merge fixes

Unverified

diff --git a/.gitignore b/.gitignore
index ffc1a5a..5fa94d2 100644
--- a/.gitignore
+++ b/.gitignore
@@ -53,6 +53,8 @@ Cargo.lock
 
 .idea/
 
+.env
+
 libs/
 
 .env
\ No newline at end of file
diff --git a/build.gradle.kts b/build.gradle.kts
index 46e7c09..a1e83d8 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -53,7 +53,7 @@ kotlin {
         println("Local library exists")
 //        "${project.rootDir}/libs/$libName"
     } else {
-        throw GradleException("libeucalyptus_core.so does not exist. This is a local build, so most likely you haven't built the rust library yet. \n" +
+        println("libeucalyptus_core.so does not exist. This is a local build, so most likely you haven't built the rust library yet. \n" +
                 "Try running cargo build")
     }
 
diff --git a/src/commonMain/kotlin/com/dropbear/Example.kt b/src/commonMain/kotlin/com/dropbear/Example.kt
deleted file mode 100644
index 1c84b73..0000000
--- a/src/commonMain/kotlin/com/dropbear/Example.kt
+++ /dev/null
@@ -1,21 +0,0 @@
-import com.dropbear.DropbearEngine
-import com.dropbear.EntityId
-import com.dropbear.System
-import com.dropbear.ProjectScriptingMetadata
-import com.dropbear.Runnable
-import com.dropbear.ScriptRegistration
-
-@Runnable(["player"])
-class Player: System {
-    override fun load(engine: DropbearEngine) {
-        TODO("Not yet implemented")
-    }
-
-    override fun update(engine: DropbearEngine, deltaTime: Float) {
-        TODO("Not yet implemented")
-    }
-
-    override fun destroy(engine: DropbearEngine) {
-        TODO("Not yet implemented")
-    }
-}
\ No newline at end of file
diff --git a/src/main/kotlin/com/dropbear/input/Input.kt b/src/main/kotlin/com/dropbear/input/Input.kt
deleted file mode 100644
index 46a6e24..0000000
--- a/src/main/kotlin/com/dropbear/input/Input.kt
+++ /dev/null
@@ -1,47 +0,0 @@
-package com.dropbear.input
-
-import com.dropbear.ffi.NativeEngine
-
-/**
- * High-level input management wrapper for accessing input state
- * from Kotlin scripts.
- */
-object Input {
-    /**
-     * Check if a specific key is currently pressed
-     * 
-     * @param keyCode The key to check (use KeyCode constants)
-     * @return true if the key is pressed, false otherwise
-     * 
-     * @example
-     * ```kotlin
-     * if (Input.isKeyPressed(KeyCode.W)) {
-     *     // Move forward
-     * }
-     * ```
-     */
-    fun isKeyPressed(keyCode: Long): Boolean {
-        return NativeEngine.isKeyPressed(keyCode)
-    }
-    
-    /**
-     * Get the current mouse X position
-     */
-    fun getMouseX(): Double {
-        return NativeEngine.getMouseX()
-    }
-    
-    /**
-     * Get the current mouse Y position
-     */
-    fun getMouseY(): Double {
-        return NativeEngine.getMouseY()
-    }
-    
-    /**
-     * Get the mouse position as a pair
-     */
-    fun getMousePosition(): Pair<Double, Double> {
-        return Pair(getMouseX(), getMouseY())
-    }
-}
diff --git a/src/main/kotlin/com/dropbear/input/KeyCode.kt b/src/main/kotlin/com/dropbear/input/KeyCode.kt
deleted file mode 100644
index ca8f9f4..0000000
--- a/src/main/kotlin/com/dropbear/input/KeyCode.kt
+++ /dev/null
@@ -1,47 +0,0 @@
-package com.dropbear.input
-
-/**
- * Key codes that match the Rust KeyCode enum.
- * These are used with NativeEngine.isKeyPressed()
- */
-object KeyCode {
-    // Letters
-    const val A = 65L
-    const val B = 66L
-    const val C = 67L
-    const val D = 68L
-    const val E = 69L
-    const val F = 70L
-    const val G = 71L
-    const val H = 72L
-    const val I = 73L
-    const val J = 74L
-    const val K = 75L
-    const val L = 76L
-    const val M = 77L
-    const val N = 78L
-    const val O = 79L
-    const val P = 80L
-    const val Q = 81L
-    const val R = 82L
-    const val S = 83L
-    const val T = 84L
-    const val U = 85L
-    const val V = 86L
-    const val W = 87L
-    const val X = 88L
-    const val Y = 89L
-    const val Z = 90L
-    
-    // Arrow keys
-    const val ARROW_LEFT = 37L
-    const val ARROW_UP = 38L
-    const val ARROW_RIGHT = 39L
-    const val ARROW_DOWN = 40L
-    
-    // Special keys
-    const val SPACE = 32L
-    const val SHIFT = 16L
-    const val CONTROL = 17L
-    const val ESCAPE = 27L
-}
diff --git a/src/nativeMain/kotlin/com/dropbear/ffi/Generated.kt b/src/nativeMain/kotlin/com/dropbear/ffi/Generated.kt
deleted file mode 100644
index 8fcfdc4..0000000
--- a/src/nativeMain/kotlin/com/dropbear/ffi/Generated.kt
+++ /dev/null
@@ -1,72 +0,0 @@
-// File to get an idea of what is generated
-@file:OptIn(ExperimentalForeignApi::class, ExperimentalNativeApi::class)
-import com.dropbear.DropbearEngine
-import com.dropbear.EntityId
-import com.dropbear.EntityRef
-import com.dropbear.ProjectScriptingMetadata
-import com.dropbear.ScriptRegistration
-import com.dropbear.ffi.NativeEngine
-import kotlinx.cinterop.COpaquePointer
-import kotlinx.cinterop.ExperimentalForeignApi
-import kotlin.experimental.ExperimentalNativeApi
-import kotlin.native.CName
-
-// import /* CLASS */
-
-private val scriptInstances: List<ScriptRegistration> by lazy {
-    Metadata().getScripts()
-}
-
-class Metadata: ProjectScriptingMetadata {
-    override fun getScripts(): List<ScriptRegistration> {
-        return listOf(
-            ScriptRegistration(
-                tags = listOf("player"),
-                script = Player()
-            ),
-
-//            ScriptRegistration(
-//                tags = /* TAGS */,
-//                script = /* CLASS NAME */
-//            ),
-
-        )
-    }
-}
-
-fun getDropbearEngine(worldPointer: COpaquePointer?, currentEntity: Long?): DropbearEngine {
-    val nativeEngine = NativeEngine()
-    nativeEngine.init(worldPointer)
-    val dropbearEngine = DropbearEngine(nativeEngine, if (currentEntity == null) null else EntityRef(EntityId(currentEntity.toULong())))
-    return dropbearEngine
-}
-
-@CName("dropbear_load")
-fun loadScriptByTag(worldPointer: COpaquePointer?, currentEntity: Long?, tag: String?) {
-    if (tag == null) return
-    val scripts = scriptInstances.filter { it.tags.contains(tag) }
-    val engine = getDropbearEngine(worldPointer, currentEntity)
-    for (script in scripts) {
-        script.script.load(engine)
-    }
-}
-
-@CName("dropbear_update")
-fun updateScriptByTag(worldPointer: COpaquePointer?, currentEntity: Long?, tag: String?, deltaTime: Double) {
-    if (tag == null) return
-    val scripts = scriptInstances.filter { it.tags.contains(tag) }
-    val engine = getDropbearEngine(worldPointer, currentEntity)
-    for (script in scripts) {
-        script.script.update(engine, deltaTime.toFloat())
-    }
-}
-
-@CName("dropbear_destroy")
-fun destroyScriptByTag(worldPointer: COpaquePointer?, currentEntity: Long?, tag: String?) {
-    if (tag == null) return
-    val scripts = scriptInstances.filter { it.tags.contains(tag) }
-    val engine = getDropbearEngine(worldPointer, currentEntity)
-    for (script in scripts) {
-        script.script.destroy(engine)
-    }
-}