Skip to content

Commit 505102d

Browse files
committed
let the cursor move when a file is played.
1 parent ba2b8e4 commit 505102d

File tree

3 files changed

+43
-24
lines changed

3 files changed

+43
-24
lines changed

tiny-cli/sfx.aseprite

-92 Bytes
Binary file not shown.

tiny-cli/src/main/resources/sfx/bar-editor.lua

Lines changed: 43 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ local CursorEditor = {
3737
beat = 0,
3838
note = 0,
3939
step_x = 8, -- adjust regarding the size of half of a bit on screen,
40+
time = 0,
41+
play = false,
4042
}
4143

4244
CursorEditor._update = function(self)
@@ -45,6 +47,23 @@ CursorEditor._update = function(self)
4547
elseif (ctrl.pressed(keys.right)) then
4648
self.beat = self.beat + 1
4749
end
50+
51+
if ctrl.pressed(keys.space) then
52+
self.beat = 0
53+
self.play = not self.play
54+
self.time = 0
55+
end
56+
57+
if self.play then
58+
self.time = self.time + tiny.dt
59+
self.beat = self.time * (state.current_bar.bpm / 60) * 2
60+
61+
if (self.beat >= 32) then
62+
self.play = false
63+
self.beat = 0
64+
end
65+
end
66+
4867
self.beat = math.clamp(0, self.beat, 32)
4968
end
5069

@@ -60,30 +79,30 @@ end
6079
local BarEditor = {
6180
-- position of the keys (y only)
6281
keys_y = {
63-
{ y = 0, h = 15 },
64-
{ y = 10, h = 11 },
65-
{ y = 16, h = 13 },
66-
{ y = 24, h = 10 },
67-
{ y = 29, h = 13 },
68-
{ y = 37, h = 11 },
69-
{ y = 43, h = 13 },
70-
{ y = 56, h = 13 },
71-
{ y = 65, h = 11 },
72-
{ y = 70, h = 13 },
73-
{ y = 78, h = 10 },
74-
{ y = 83, h = 13 },
75-
{ y = 96, h = 13 },
76-
{ y = 104, h = 11 },
77-
{ y = 110, h = 13 },
78-
{ y = 118, h = 10 },
79-
{ y = 124, h = 12 },
80-
{ y = 131, h = 11 },
81-
{ y = 137, h = 13 },
82-
{ y = 150, h = 13 },
83-
{ y = 158, h = 11 },
84-
{ y = 164, h = 13 },
85-
{ y = 172, h = 10 },
86-
{ y = 178, h = 13 },
82+
{ y = 0, h = 8 },
83+
{ y = 9, h = 8 },
84+
{ y = 17, h = 8 },
85+
{ y = 25, h = 8 },
86+
{ y = 33, h = 8 },
87+
{ y = 41, h = 8 },
88+
{ y = 49, h = 8 },
89+
{ y = 57, h = 8 },
90+
{ y = 65, h = 8 },
91+
{ y = 73, h = 8 },
92+
{ y = 81, h = 8 },
93+
{ y = 89, h = 8 },
94+
{ y = 97, h = 8 },
95+
{ y = 105, h = 8 },
96+
{ y = 113, h = 8 },
97+
{ y = 121, h = 8 },
98+
{ y = 129, h = 8 },
99+
{ y = 137, h = 8 },
100+
{ y = 145, h = 8 },
101+
{ y = 153, h = 8 },
102+
{ y = 161, h = 8 },
103+
{ y = 169, h = 8 },
104+
{ y = 177, h = 8 },
105+
{ y = 185, h = 8 },
87106
},
88107

89108
octave = 0,
-156 Bytes
Loading

0 commit comments

Comments
 (0)