aboutsummaryrefslogtreecommitdiff
path: root/bin/game/main.lua
diff options
context:
space:
mode:
Diffstat (limited to 'bin/game/main.lua')
-rw-r--r--bin/game/main.lua15
1 files changed, 11 insertions, 4 deletions
diff --git a/bin/game/main.lua b/bin/game/main.lua
index 0824509..c5f6095 100644
--- a/bin/game/main.lua
+++ b/bin/game/main.lua
@@ -10,8 +10,8 @@ local bitmap = nil
local sprs = {}
local animator = nil
local spr = nil
-local particle_sprite = nil
local ps = nil
+local mesh = nil
local function createAnimation(path, count, r, c, w, h, loop, speed)
local tex = jin.graphics.newTexture(path)
local ssheet = jin.graphics.newSpriteSheet(tex)
@@ -24,8 +24,13 @@ function jin.core.onLoad()
-- bitmap = jin.graphics.newBitmap(200, 200, function(w, h, x, y)
-- return {255*math.sin(x/w),255 - 255,255*math.cos(y/w),255}
-- end)
- local tex = jin.graphics.newTexture("particle.png")
- particle_sprite = jin.graphics.newSprite(tex, jin.graphics.SpriteOrigin.MIDDLECENTER)
+ local tex = jin.graphics.newTexture("splash.png")
+ mesh = jin.graphics.newMesh()
+ mesh:setGraphic(tex)
+ mesh:pushVertex(-20, -20, 0, 0, {255, 0, 0, 255})
+ mesh:pushVertex(20, -20, 1, 0, {255, 0, 255, 255})
+ mesh:pushVertex(20, 20, 1, 1, {255, 255, 0, 255})
+ mesh:pushVertex(-20, 120, 0, 1, {255, 255, 255, 255})
ps = jin.graphics.newParticleSystem()
for i = 0, 10 do
local t = jin.graphics.newTexture("dust/s_dust_A_" .. i .. ".png")
@@ -45,7 +50,6 @@ function jin.core.onLoad()
ps:setParticleLife(0.5, 2)
ps:addParticleScalePoint(3, 0)
ps:addParticleScalePoint(0, 1)
- --ps:addParticleSprite(particle_sprite)
local animation = createAnimation("anim2.png", 27, 3, 10, 200, 200, true, 50)
animator = jin.graphics.newAnimator(animation)
spr = animation:getFrame(1)
@@ -99,5 +103,8 @@ function jin.core.onDraw()
animator:render(350, 150, 1, 1, 0)
jin.graphics.print("* Particle system test\n* Animation test", 10, 10)
jin.graphics.draw(spr, 100, 200, 1, 1, 0)
+ jin.graphics.useShader(jin.graphics.Shaders.Mesh)
+ jin.graphics.draw(mesh, 200, 100)
+ jin.graphics.unuseShader();
ps:render()
end \ No newline at end of file