diff --git a/.idea/modules/kotlin-webgl-test.iml b/.idea/modules/kotlin-webgl-test.iml
new file mode 100644
index 0000000..3bc84ee
--- /dev/null
+++ b/.idea/modules/kotlin-webgl-test.iml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/modules/kotlin-webgl-test.iml b/.idea/modules/kotlin-webgl-test.iml
new file mode 100644
index 0000000..3bc84ee
--- /dev/null
+++ b/.idea/modules/kotlin-webgl-test.iml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/modules/kotlin-webgl-test_main.iml b/.idea/modules/kotlin-webgl-test_main.iml
new file mode 100644
index 0000000..110e964
--- /dev/null
+++ b/.idea/modules/kotlin-webgl-test_main.iml
@@ -0,0 +1,21 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/modules/kotlin-webgl-test.iml b/.idea/modules/kotlin-webgl-test.iml
new file mode 100644
index 0000000..3bc84ee
--- /dev/null
+++ b/.idea/modules/kotlin-webgl-test.iml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/modules/kotlin-webgl-test_main.iml b/.idea/modules/kotlin-webgl-test_main.iml
new file mode 100644
index 0000000..110e964
--- /dev/null
+++ b/.idea/modules/kotlin-webgl-test_main.iml
@@ -0,0 +1,21 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/modules/kotlin-webgl-test_test.iml b/.idea/modules/kotlin-webgl-test_test.iml
new file mode 100644
index 0000000..c9a195f
--- /dev/null
+++ b/.idea/modules/kotlin-webgl-test_test.iml
@@ -0,0 +1,19 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/modules/kotlin-webgl-test.iml b/.idea/modules/kotlin-webgl-test.iml
new file mode 100644
index 0000000..3bc84ee
--- /dev/null
+++ b/.idea/modules/kotlin-webgl-test.iml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/modules/kotlin-webgl-test_main.iml b/.idea/modules/kotlin-webgl-test_main.iml
new file mode 100644
index 0000000..110e964
--- /dev/null
+++ b/.idea/modules/kotlin-webgl-test_main.iml
@@ -0,0 +1,21 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/modules/kotlin-webgl-test_test.iml b/.idea/modules/kotlin-webgl-test_test.iml
new file mode 100644
index 0000000..c9a195f
--- /dev/null
+++ b/.idea/modules/kotlin-webgl-test_test.iml
@@ -0,0 +1,19 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/KotlinTest.ipr b/KotlinTest.ipr
index b8e3748..a15861c 100644
--- a/KotlinTest.ipr
+++ b/KotlinTest.ipr
@@ -19,6 +19,10 @@
+
+
+
+
@@ -43,6 +47,20 @@
+
+
+
@@ -71,10 +89,13 @@
-
+
+
+
+
@@ -161,6 +182,33 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/.idea/modules/kotlin-webgl-test.iml b/.idea/modules/kotlin-webgl-test.iml
new file mode 100644
index 0000000..3bc84ee
--- /dev/null
+++ b/.idea/modules/kotlin-webgl-test.iml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/modules/kotlin-webgl-test_main.iml b/.idea/modules/kotlin-webgl-test_main.iml
new file mode 100644
index 0000000..110e964
--- /dev/null
+++ b/.idea/modules/kotlin-webgl-test_main.iml
@@ -0,0 +1,21 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/modules/kotlin-webgl-test_test.iml b/.idea/modules/kotlin-webgl-test_test.iml
new file mode 100644
index 0000000..c9a195f
--- /dev/null
+++ b/.idea/modules/kotlin-webgl-test_test.iml
@@ -0,0 +1,19 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/KotlinTest.ipr b/KotlinTest.ipr
index b8e3748..a15861c 100644
--- a/KotlinTest.ipr
+++ b/KotlinTest.ipr
@@ -19,6 +19,10 @@
+
+
+
+
@@ -43,6 +47,20 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -71,10 +89,13 @@
-
+
+
+
+
@@ -161,6 +182,33 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/lib/kotludens/com/persesgames/map/tiled/TiledMap.kt b/lib/kotludens/com/persesgames/map/tiled/TiledMap.kt
index 4123720..c310abe 100644
--- a/lib/kotludens/com/persesgames/map/tiled/TiledMap.kt
+++ b/lib/kotludens/com/persesgames/map/tiled/TiledMap.kt
@@ -1,24 +1,22 @@
package com.persesgames.map.tiled
+import com.persesgames.net.getUrlAsString
import com.persesgames.texture.Textures
-import org.w3c.xhr.XMLHttpRequest
import java.util.*
/**
* Created by rnentjes on 22-7-16.
*/
-fun getUrlAsString(url: String): String {
- val req = XMLHttpRequest()
+class MapRenderer(data: MapData) {
- req.open("GET", url, false)
- req.send(null)
+ fun drawTile(tile: Int, x: Int, y: Int) {
- return req.responseText
-}
+ }
-fun drawLayer(layer: MapLayer) {
+ fun drawLayer(layer: MapLayer) {
+ }
}
class MapData {
@@ -50,6 +48,7 @@
var opacity: Float = 1f
var type: String = ""
var visible: Boolean = true
+ var draworder: String = ""
}
class MapTileset {
diff --git a/.idea/modules/kotlin-webgl-test.iml b/.idea/modules/kotlin-webgl-test.iml
new file mode 100644
index 0000000..3bc84ee
--- /dev/null
+++ b/.idea/modules/kotlin-webgl-test.iml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/modules/kotlin-webgl-test_main.iml b/.idea/modules/kotlin-webgl-test_main.iml
new file mode 100644
index 0000000..110e964
--- /dev/null
+++ b/.idea/modules/kotlin-webgl-test_main.iml
@@ -0,0 +1,21 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/modules/kotlin-webgl-test_test.iml b/.idea/modules/kotlin-webgl-test_test.iml
new file mode 100644
index 0000000..c9a195f
--- /dev/null
+++ b/.idea/modules/kotlin-webgl-test_test.iml
@@ -0,0 +1,19 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/KotlinTest.ipr b/KotlinTest.ipr
index b8e3748..a15861c 100644
--- a/KotlinTest.ipr
+++ b/KotlinTest.ipr
@@ -19,6 +19,10 @@
+
+
+
+
@@ -43,6 +47,20 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -71,10 +89,13 @@
-
+
+
+
+
@@ -161,6 +182,33 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/lib/kotludens/com/persesgames/map/tiled/TiledMap.kt b/lib/kotludens/com/persesgames/map/tiled/TiledMap.kt
index 4123720..c310abe 100644
--- a/lib/kotludens/com/persesgames/map/tiled/TiledMap.kt
+++ b/lib/kotludens/com/persesgames/map/tiled/TiledMap.kt
@@ -1,24 +1,22 @@
package com.persesgames.map.tiled
+import com.persesgames.net.getUrlAsString
import com.persesgames.texture.Textures
-import org.w3c.xhr.XMLHttpRequest
import java.util.*
/**
* Created by rnentjes on 22-7-16.
*/
-fun getUrlAsString(url: String): String {
- val req = XMLHttpRequest()
+class MapRenderer(data: MapData) {
- req.open("GET", url, false)
- req.send(null)
+ fun drawTile(tile: Int, x: Int, y: Int) {
- return req.responseText
-}
+ }
-fun drawLayer(layer: MapLayer) {
+ fun drawLayer(layer: MapLayer) {
+ }
}
class MapData {
@@ -50,6 +48,7 @@
var opacity: Float = 1f
var type: String = ""
var visible: Boolean = true
+ var draworder: String = ""
}
class MapTileset {
diff --git a/lib/kotludens/com/persesgames/net/NetUtils.kt b/lib/kotludens/com/persesgames/net/NetUtils.kt
new file mode 100644
index 0000000..b59cbb3
--- /dev/null
+++ b/lib/kotludens/com/persesgames/net/NetUtils.kt
@@ -0,0 +1,18 @@
+package com.persesgames.net
+
+import org.w3c.xhr.XMLHttpRequest
+
+/**
+ * User: rnentjes
+ * Date: 30-7-16
+ * Time: 16:39
+ */
+
+fun getUrlAsString(url: String): String {
+ val req = XMLHttpRequest()
+
+ req.open("GET", url, false)
+ req.send(null)
+
+ return req.responseText
+}
diff --git a/.idea/modules/kotlin-webgl-test.iml b/.idea/modules/kotlin-webgl-test.iml
new file mode 100644
index 0000000..3bc84ee
--- /dev/null
+++ b/.idea/modules/kotlin-webgl-test.iml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/modules/kotlin-webgl-test_main.iml b/.idea/modules/kotlin-webgl-test_main.iml
new file mode 100644
index 0000000..110e964
--- /dev/null
+++ b/.idea/modules/kotlin-webgl-test_main.iml
@@ -0,0 +1,21 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/modules/kotlin-webgl-test_test.iml b/.idea/modules/kotlin-webgl-test_test.iml
new file mode 100644
index 0000000..c9a195f
--- /dev/null
+++ b/.idea/modules/kotlin-webgl-test_test.iml
@@ -0,0 +1,19 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/KotlinTest.ipr b/KotlinTest.ipr
index b8e3748..a15861c 100644
--- a/KotlinTest.ipr
+++ b/KotlinTest.ipr
@@ -19,6 +19,10 @@
+
+
+
+
@@ -43,6 +47,20 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -71,10 +89,13 @@
-
+
+
+
+
@@ -161,6 +182,33 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/lib/kotludens/com/persesgames/map/tiled/TiledMap.kt b/lib/kotludens/com/persesgames/map/tiled/TiledMap.kt
index 4123720..c310abe 100644
--- a/lib/kotludens/com/persesgames/map/tiled/TiledMap.kt
+++ b/lib/kotludens/com/persesgames/map/tiled/TiledMap.kt
@@ -1,24 +1,22 @@
package com.persesgames.map.tiled
+import com.persesgames.net.getUrlAsString
import com.persesgames.texture.Textures
-import org.w3c.xhr.XMLHttpRequest
import java.util.*
/**
* Created by rnentjes on 22-7-16.
*/
-fun getUrlAsString(url: String): String {
- val req = XMLHttpRequest()
+class MapRenderer(data: MapData) {
- req.open("GET", url, false)
- req.send(null)
+ fun drawTile(tile: Int, x: Int, y: Int) {
- return req.responseText
-}
+ }
-fun drawLayer(layer: MapLayer) {
+ fun drawLayer(layer: MapLayer) {
+ }
}
class MapData {
@@ -50,6 +48,7 @@
var opacity: Float = 1f
var type: String = ""
var visible: Boolean = true
+ var draworder: String = ""
}
class MapTileset {
diff --git a/lib/kotludens/com/persesgames/net/NetUtils.kt b/lib/kotludens/com/persesgames/net/NetUtils.kt
new file mode 100644
index 0000000..b59cbb3
--- /dev/null
+++ b/lib/kotludens/com/persesgames/net/NetUtils.kt
@@ -0,0 +1,18 @@
+package com.persesgames.net
+
+import org.w3c.xhr.XMLHttpRequest
+
+/**
+ * User: rnentjes
+ * Date: 30-7-16
+ * Time: 16:39
+ */
+
+fun getUrlAsString(url: String): String {
+ val req = XMLHttpRequest()
+
+ req.open("GET", url, false)
+ req.send(null)
+
+ return req.responseText
+}
diff --git a/lib/kotludens/com/persesgames/texture/Textures.kt b/lib/kotludens/com/persesgames/texture/Textures.kt
index 1ffceb9..08cc283 100644
--- a/lib/kotludens/com/persesgames/texture/Textures.kt
+++ b/lib/kotludens/com/persesgames/texture/Textures.kt
@@ -1,6 +1,7 @@
package com.persesgames.texture
import com.persesgames.game.Game
+import com.persesgames.map.tiled.MapTileset
import com.persesgames.math.Matrix4
import com.persesgames.shader.ShaderProgram
import com.persesgames.shader.ShaderProgramMesh
@@ -68,17 +69,17 @@
}
fun queueDraw(x: Float, y: Float) {
- shaderProgramMesh.queue( x, y, left, bottom, 0f, 0f);
- shaderProgramMesh.queue( x, y, left, top, 0f, 1f);
- shaderProgramMesh.queue( x, y, right, top, 1f, 1f);
- shaderProgramMesh.queue( x, y, right, top, 1f, 1f);
- shaderProgramMesh.queue( x, y, right, bottom, 1f, 0f);
- shaderProgramMesh.queue( x, y, left, bottom, 0f, 0f);
+ shaderProgramMesh.queue( x, y, left, bottom, 0f, 0f)
+ shaderProgramMesh.queue( x, y, left, top, 0f, 1f)
+ shaderProgramMesh.queue( x, y, right, top, 1f, 1f)
+ shaderProgramMesh.queue( x, y, right, top, 1f, 1f)
+ shaderProgramMesh.queue( x, y, right, bottom, 1f, 0f)
+ shaderProgramMesh.queue( x, y, left, bottom, 0f, 0f)
}
fun render(userdata: TextureData) {
Game.gl().activeTexture(WebGLRenderingContext.TEXTURE0)
- Game.gl().bindTexture(WebGLRenderingContext.TEXTURE_2D, glTexture);
+ Game.gl().bindTexture(WebGLRenderingContext.TEXTURE_2D, glTexture)
shaderProgramMesh.userdata = userdata
shaderProgramMesh.render(userdata)
@@ -167,6 +168,10 @@
}
}
+ fun load(mapTileSet: MapTileset) {
+
+ }
+
fun textureLoaded(texture: WebGLTexture, image: HTMLImageElement) {
val gl = Game.gl()
diff --git a/.idea/modules/kotlin-webgl-test.iml b/.idea/modules/kotlin-webgl-test.iml
new file mode 100644
index 0000000..3bc84ee
--- /dev/null
+++ b/.idea/modules/kotlin-webgl-test.iml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/modules/kotlin-webgl-test_main.iml b/.idea/modules/kotlin-webgl-test_main.iml
new file mode 100644
index 0000000..110e964
--- /dev/null
+++ b/.idea/modules/kotlin-webgl-test_main.iml
@@ -0,0 +1,21 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/modules/kotlin-webgl-test_test.iml b/.idea/modules/kotlin-webgl-test_test.iml
new file mode 100644
index 0000000..c9a195f
--- /dev/null
+++ b/.idea/modules/kotlin-webgl-test_test.iml
@@ -0,0 +1,19 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/KotlinTest.ipr b/KotlinTest.ipr
index b8e3748..a15861c 100644
--- a/KotlinTest.ipr
+++ b/KotlinTest.ipr
@@ -19,6 +19,10 @@
+
+
+
+
@@ -43,6 +47,20 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -71,10 +89,13 @@
-
+
+
+
+
@@ -161,6 +182,33 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/lib/kotludens/com/persesgames/map/tiled/TiledMap.kt b/lib/kotludens/com/persesgames/map/tiled/TiledMap.kt
index 4123720..c310abe 100644
--- a/lib/kotludens/com/persesgames/map/tiled/TiledMap.kt
+++ b/lib/kotludens/com/persesgames/map/tiled/TiledMap.kt
@@ -1,24 +1,22 @@
package com.persesgames.map.tiled
+import com.persesgames.net.getUrlAsString
import com.persesgames.texture.Textures
-import org.w3c.xhr.XMLHttpRequest
import java.util.*
/**
* Created by rnentjes on 22-7-16.
*/
-fun getUrlAsString(url: String): String {
- val req = XMLHttpRequest()
+class MapRenderer(data: MapData) {
- req.open("GET", url, false)
- req.send(null)
+ fun drawTile(tile: Int, x: Int, y: Int) {
- return req.responseText
-}
+ }
-fun drawLayer(layer: MapLayer) {
+ fun drawLayer(layer: MapLayer) {
+ }
}
class MapData {
@@ -50,6 +48,7 @@
var opacity: Float = 1f
var type: String = ""
var visible: Boolean = true
+ var draworder: String = ""
}
class MapTileset {
diff --git a/lib/kotludens/com/persesgames/net/NetUtils.kt b/lib/kotludens/com/persesgames/net/NetUtils.kt
new file mode 100644
index 0000000..b59cbb3
--- /dev/null
+++ b/lib/kotludens/com/persesgames/net/NetUtils.kt
@@ -0,0 +1,18 @@
+package com.persesgames.net
+
+import org.w3c.xhr.XMLHttpRequest
+
+/**
+ * User: rnentjes
+ * Date: 30-7-16
+ * Time: 16:39
+ */
+
+fun getUrlAsString(url: String): String {
+ val req = XMLHttpRequest()
+
+ req.open("GET", url, false)
+ req.send(null)
+
+ return req.responseText
+}
diff --git a/lib/kotludens/com/persesgames/texture/Textures.kt b/lib/kotludens/com/persesgames/texture/Textures.kt
index 1ffceb9..08cc283 100644
--- a/lib/kotludens/com/persesgames/texture/Textures.kt
+++ b/lib/kotludens/com/persesgames/texture/Textures.kt
@@ -1,6 +1,7 @@
package com.persesgames.texture
import com.persesgames.game.Game
+import com.persesgames.map.tiled.MapTileset
import com.persesgames.math.Matrix4
import com.persesgames.shader.ShaderProgram
import com.persesgames.shader.ShaderProgramMesh
@@ -68,17 +69,17 @@
}
fun queueDraw(x: Float, y: Float) {
- shaderProgramMesh.queue( x, y, left, bottom, 0f, 0f);
- shaderProgramMesh.queue( x, y, left, top, 0f, 1f);
- shaderProgramMesh.queue( x, y, right, top, 1f, 1f);
- shaderProgramMesh.queue( x, y, right, top, 1f, 1f);
- shaderProgramMesh.queue( x, y, right, bottom, 1f, 0f);
- shaderProgramMesh.queue( x, y, left, bottom, 0f, 0f);
+ shaderProgramMesh.queue( x, y, left, bottom, 0f, 0f)
+ shaderProgramMesh.queue( x, y, left, top, 0f, 1f)
+ shaderProgramMesh.queue( x, y, right, top, 1f, 1f)
+ shaderProgramMesh.queue( x, y, right, top, 1f, 1f)
+ shaderProgramMesh.queue( x, y, right, bottom, 1f, 0f)
+ shaderProgramMesh.queue( x, y, left, bottom, 0f, 0f)
}
fun render(userdata: TextureData) {
Game.gl().activeTexture(WebGLRenderingContext.TEXTURE0)
- Game.gl().bindTexture(WebGLRenderingContext.TEXTURE_2D, glTexture);
+ Game.gl().bindTexture(WebGLRenderingContext.TEXTURE_2D, glTexture)
shaderProgramMesh.userdata = userdata
shaderProgramMesh.render(userdata)
@@ -167,6 +168,10 @@
}
}
+ fun load(mapTileSet: MapTileset) {
+
+ }
+
fun textureLoaded(texture: WebGLTexture, image: HTMLImageElement) {
val gl = Game.gl()
diff --git a/src/com/persesgames/shooter/Shooter.kt b/src/com/persesgames/shooter/Shooter.kt
index 090ddc9..cc9bdbf 100644
--- a/src/com/persesgames/shooter/Shooter.kt
+++ b/src/com/persesgames/shooter/Shooter.kt
@@ -89,26 +89,25 @@
//Music.play("music/DST-TechnoBasic.mp3", 1.0, looping = true)
-
Keys.setInputProcessor(GameInputProcessor())
}
override fun update(time: Float, delta: Float) {
val speed = 500f // pixels per second
if (Keys.isDown(KeyCode.LEFT)) {
- x -= delta * speed;
+ x -= delta * speed
}
if (Keys.isDown(KeyCode.RIGHT)) {
- x += delta * speed;
+ x += delta * speed
}
if (Keys.isDown(KeyCode.UP)) {
- y += delta * speed;
+ y += delta * speed
}
if (Keys.isDown(KeyCode.DOWN)) {
- y -= delta * speed;
+ y -= delta * speed
}
}
@@ -124,7 +123,8 @@
sprites.draw(sprite, x, y);
sprites.render()
- Texts.drawText(150f, 400f, "Playing teh Game!", font = "bold 72pt Arial")
+
+ Texts.drawText(150f, 400f, "Playing teh Game!", font = "bold 72pt Arial")
if (showFPS) {
Texts.drawText(20f, 100f, "Hello! FPS ${Game.fps}", font = "bold 72pt Arial")