summaryrefslogtreecommitdiff
path: root/src/world.moon
diff options
context:
space:
mode:
Diffstat (limited to 'src/world.moon')
-rw-r--r--src/world.moon17
1 files changed, 15 insertions, 2 deletions
diff --git a/src/world.moon b/src/world.moon
index 60cb57b..d622351 100644
--- a/src/world.moon
+++ b/src/world.moon
@@ -68,6 +68,18 @@ x.fromscreen = (pos) ->
vec2(globalx, globaly)
x.level.on_land = (pos) ->
not (pos.x > 10 or pos.x < -10 or pos.y > 10 or pos.y < -10)
+x.level.in_sea = (pos) ->
+ pos.x > 15 or pos.x < -15 or pos.y > 15 or pos.y < -15
+-- Each pixel is 4 bytes, 1 byte per channel
+x.level.bubble_buffer = am.buffer(1024 * 4 * 4, "dynamic")
+
+bubble_view = x.level.bubble_buffer\view("vec4") -- xy location, w time?
+bubble_texture = am.texture2d(am.image_buffer(x.level.bubble_buffer, 1024 * 4, 1))
+class Bubble
+ @wrap = 1
+ new: (pos) =>
+ bubble_view[@@wrap] = vec4(pos.x, pos.y, -1, am.current_time!)
+ print("Bubble created")
class PhysicsComponent extends ecs.Component
new: (name, properties, shape, args) =>
@@ -90,7 +102,6 @@ class PhysicsComponent extends ecs.Component
collisions: () =>
x.level.physics_world\collisions(@shape)
-
class GraphicsComponent extends ecs.Component
new: (name, properties) =>
print("Got name", name, "and properties", properties)
@@ -109,7 +120,7 @@ class GraphicsComponent extends ecs.Component
1, 0, 0, 0,
0, aspect, 0, 0,
0, 0, 1, 0,
- 0, 0, 0, 4
+ 0, 0, 0, 3.5
)
binds = {
MV: s_mv
@@ -123,6 +134,7 @@ class GraphicsComponent extends ecs.Component
world_y: x.world_y
rot: 0
water: 0
+ --bubbles: bubble_texture
}
for color, value in pairs(color.am_color)
binds[color] = value
@@ -175,4 +187,5 @@ class GraphicsComponent extends ecs.Component
x.GraphicsComponent = GraphicsComponent
x.PhysicsComponent = PhysicsComponent
+x.Bubble = Bubble
x