-
Notifications
You must be signed in to change notification settings - Fork 24
Expand file tree
/
Copy pathsprite.lua
More file actions
55 lines (48 loc) · 939 Bytes
/
sprite.lua
File metadata and controls
55 lines (48 loc) · 939 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
-- To run this sample :
-- bin/soluna.exe entry=test/sprite.lua
local soluna = require "soluna"
local ltask = require "ltask"
soluna.set_window_title "soluna sprite sample"
local sprites = soluna.load_sprites "asset/sprites.dl"
soluna.preload {
{
filename = "@red",
content = "\xff\0\0\xff",
w = 1,
h = 1,
},
{
filename = "@green",
content = "\0\xff\0\xff",
w = 1,
h = 1,
},
}
local rects = soluna.load_sprites {
{
name = "red",
filename = "@red",
},
{
name = "green",
filename = "@green",
}
}
local args = ...
local batch = args.batch
local callback = {}
local rot = 0
local delta = math.rad(1)
function callback.frame(count)
batch:layer(100, args.width/2 , args.height/2)
batch:layer(rot)
batch:add(rects.red)
batch:layer()
batch:layer(-rot)
batch:add(rects.green)
batch:layer()
batch:layer()
rot = rot + delta
batch:add(sprites.avatar, args.width / 2, args.height/2)
end
return callback