@@ -47,7 +47,8 @@ game.edition = "(LÖVEJAM 2025 B-side)"
4747
4848-- game flags
4949game .dataEntry = false -- flag for when data is being captured from the keyboard
50- game .vizAnimate = false -- to start / stop Visualizer animation
50+ game .vizAnimate = true -- to start / stop Visualizer animation, start with animation
51+ game .vizOnion = false -- onion skinning for Visualizer editing
5152
5253-- game variables
5354game .statusBar = " " -- content string for status Bar at the bottom
@@ -61,6 +62,8 @@ game.selected = {
6162 [" section" ] = " about" , -- "about", "melody", "harmony1", "harmony2", "bass", "rhythm", "pattern", "sequence"
6263 [" noteNum" ] = 0 , -- 0 = nil, normal range 1..19 , middle = 8, when 1 y=30, when 19 y=12, =32-y
6364 [" vizPage" ] = 1 , -- default to showing 1st page of visualizer
65+ [" vizColor" ] = 15 , -- color in numbers
66+
6467}
6568game .inputData = " " -- string to cache data captured from keyboard
6669game .inputPrompt = " " -- prompt for data entry
@@ -1285,6 +1288,20 @@ function love.textinput(t) -- called for every instance of text entry
12851288 if game .dataEntry == true and # game .inputData < game .dataLength then
12861289 game .inputData = game .inputData .. t
12871290 end
1291+ if VIZ .mouseX > 0 and VIZ .mouseY > 0 and game .selected [" section" ] ~= " about" then
1292+ -- cursor captured in Visualizer for data entry
1293+ -- update table location = (mouseY-1)*162 + mouseX*2
1294+ SML .screen [game .selected [" pattern" ]][game .selected [" vizPage" ]][((VIZ .mouseX * 2 )+ ((VIZ .mouseY - 1 )* 162 ))- 1 ] = color [game .selected [" vizColor" ]]
1295+ SML .screen [game .selected [" pattern" ]][game .selected [" vizPage" ]][(VIZ .mouseX * 2 )+ ((VIZ .mouseY - 1 )* 162 )] = t
1296+ if VIZ .mouseX < 80 then
1297+ VIZ .mouseX = VIZ .mouseX + 1
1298+ else
1299+ if VIZ .mouseY < 12 then
1300+ VIZ .mouseY = VIZ .mouseY + 1
1301+ VIZ .mouseX = 1
1302+ end
1303+ end
1304+ end
12881305end
12891306
12901307
@@ -2015,7 +2032,19 @@ function love.draw()
20152032 if game .selected [" section" ]== " about" then
20162033 love .graphics .print (SML .screen .about [game .selected [" vizPage" ]],FONT_WIDTH * 0 ,FONT_HEIGHT * 31 )
20172034 else
2035+ love .graphics .setColor (color .white )
20182036 love .graphics .print (SML .screen [game .selected [" pattern" ]][game .selected [" vizPage" ]],FONT_WIDTH * 0 ,FONT_HEIGHT * 31 )
2037+ -- Visualizer Onion Skin section overlay
2038+ if game .vizOnion == true and game .selected [" vizPage" ] > 1 then
2039+ -- show previous page with transparency
2040+ love .graphics .setColor (1 ,1 ,1 ,0.6 )
2041+ love .graphics .print (SML .screen [game .selected [" pattern" ]][game .selected [" vizPage" ]- 1 ],FONT_WIDTH * 0 ,FONT_HEIGHT * 31 )
2042+ end
2043+ if game .vizOnion == true and game .selected [" vizPage" ] == 1 then
2044+ -- on page one, show page 4 with transparency
2045+ love .graphics .setColor (1 ,1 ,1 ,0.6 )
2046+ love .graphics .print (SML .screen [game .selected [" pattern" ]][4 ],FONT_WIDTH * 0 ,FONT_HEIGHT * 31 )
2047+ end
20192048 end
20202049
20212050 -- show visualizer cursor
@@ -2086,7 +2115,7 @@ elseif game.selected["section"] == "sequence" then
20862115 else
20872116 game .debug3 = " "
20882117 end
2089- game .debug4 = " currentFrame: " .. currentFrame .. " | " .. " timer : " .. oneSecTimer
2118+ game .debug4 = " currentFrame: " .. currentFrame .. " | timer: " .. string.format ( " %.2f " , oneSecTimer ) .. " | vizColor : " .. game . selected [ " vizColor " ] .. " | visOnion: " .. tostring ( game . vizOnion )
20902119 -- draw debug info
20912120 love .graphics .setColor (color .yellow )
20922121 love .graphics .print (game .debug1 ,FONT_WIDTH * 0 ,FONT_HEIGHT * 46 )
@@ -2120,15 +2149,24 @@ function love.update(dt)
21202149
21212150 -- stuff that happens on 4fps
21222151 if currentFrame == 1 then
2123-
2152+ if game .vizAnimate == true then
2153+ game .selected [" vizPage" ] = 1
2154+ end
21242155 end
21252156 if currentFrame == 2 then
2126-
2157+ if game .vizAnimate == true then
2158+ game .selected [" vizPage" ] = 2
2159+ end
21272160 end
21282161 if currentFrame == 3 then
2129-
2162+ if game .vizAnimate == true then
2163+ game .selected [" vizPage" ] = 3
2164+ end
21302165 end
21312166 if currentFrame == 4 then
2167+ if game .vizAnimate == true then
2168+ game .selected [" vizPage" ] = 4
2169+ end
21322170 end
21332171
21342172
@@ -2442,6 +2480,7 @@ function love.keypressed(key, scancode, isrepeat)
24422480 if key == " f1" then
24432481 -- change section to "about" : the welcome screen
24442482 game .selected [" section" ] = " about"
2483+ game .vizAnimate = true
24452484 game .selectBar [" x" ] = 161 -- out of screen
24462485 game .selectBar [" y" ] = 46 -- out of screen
24472486 -- change pattern to "a", noteNum to 0
@@ -2544,6 +2583,15 @@ function love.mousepressed( x, y, button, istouch, presses )
25442583 VIZ .mouseY = 0
25452584 end
25462585
2586+ -- hidden feature, copy current page into "about" by clicking Visualizer
2587+ if (mouse .x >= 5 and mouse .x <= 14 ) and mouse .y == 31 then
2588+ -- copy current page to about page
2589+ for i = 1 ,1944 do
2590+ SML .screen .about [game .selected [" vizPage" ]][i ] = SML .screen [game .selected [" pattern" ]][game .selected [" vizPage" ]][i ]
2591+ end
2592+
2593+ end
2594+
25472595 -- Visualizer Page changing
25482596 if mouse .x == 19 and mouse .y == 31 then
25492597 -- change to page 1
@@ -2554,14 +2602,132 @@ function love.mousepressed( x, y, button, istouch, presses )
25542602 game .selected [" vizPage" ] = 2
25552603 end
25562604 if mouse .x == 27 and mouse .y == 31 then
2557- -- change to page 1
2605+ -- change to page 3
25582606 game .selected [" vizPage" ] = 3
25592607 end
25602608 if mouse .x == 31 and mouse .y == 31 then
2561- -- change to page 1
2609+ -- change to page 4
25622610 game .selected [" vizPage" ] = 4
25632611 end
25642612
2613+ if (mouse .x >= 36 and mouse .x <= 40 ) and mouse .y == 31 then
2614+ -- clear
2615+ for i = 1 ,1944 do
2616+ -- if i is odd, fill {0,0,0,0}
2617+ -- if i is even, fill with "."
2618+ if (i % 2 == 0 ) then
2619+ -- even number
2620+ SML .screen [game .selected [" pattern" ]][game .selected [" vizPage" ]][i ] = " "
2621+ else
2622+ -- odd number
2623+ SML .screen [game .selected [" pattern" ]][game .selected [" vizPage" ]][i ] = {0 ,0 ,0 ,0 }
2624+ end
2625+ end
2626+ for i = 1 ,12 do
2627+ SML .screen [game .selected [" pattern" ]][game .selected [" vizPage" ]][i * 162 ] = " \n "
2628+ end
2629+ end
2630+
2631+ if (mouse .x >= 46 and mouse .x <= 49 ) and mouse .y == 31 then
2632+ -- start animation
2633+ game .vizAnimate = true
2634+ game .vizOnion = false
2635+ end
2636+
2637+ if (mouse .x >= 55 and mouse .x <= 58 ) and mouse .y == 31 then
2638+ -- start animation
2639+ game .vizAnimate = false
2640+ game .selected [" vizPage" ] = 1 -- reset to page 1
2641+ end
2642+
2643+ -- Visualizer Bottom section
2644+ -- love.graphics.print(visualizerBottom,FONT_WIDTH*0,FONT_HEIGHT*43)
2645+ if mouse .y == 44 and (mouse .x > 1 and mouse .y < 80 ) then
2646+ -- Visualizer Color selector
2647+ if mouse .x == 12 then
2648+ game .selected [" vizColor" ] = 1
2649+ end
2650+ if mouse .x == 14 then
2651+ game .selected [" vizColor" ] = 2
2652+ end
2653+ if mouse .x == 16 then
2654+ game .selected [" vizColor" ] = 3
2655+ end
2656+ if mouse .x == 18 then
2657+ game .selected [" vizColor" ] = 4
2658+ end
2659+ if mouse .x == 20 then
2660+ game .selected [" vizColor" ] = 5
2661+ end
2662+ if mouse .x == 22 then
2663+ game .selected [" vizColor" ] = 6
2664+ end
2665+ if mouse .x == 24 then
2666+ game .selected [" vizColor" ] = 7
2667+ end
2668+ if mouse .x == 26 then
2669+ game .selected [" vizColor" ] = 8
2670+ end
2671+ if mouse .x == 28 then
2672+ game .selected [" vizColor" ] = 9
2673+ end
2674+ if mouse .x >= 30 and mouse .x <= 31 then
2675+ game .selected [" vizColor" ] = 10
2676+ end
2677+ if mouse .x >= 33 and mouse .x <= 34 then
2678+ game .selected [" vizColor" ] = 11
2679+ end
2680+ if mouse .x >= 36 and mouse .x <= 37 then
2681+ game .selected [" vizColor" ] = 12
2682+ end
2683+ if mouse .x >= 39 and mouse .x <= 40 then
2684+ game .selected [" vizColor" ] = 13
2685+ end
2686+ if mouse .x >= 42 and mouse .x <= 43 then
2687+ game .selected [" vizColor" ] = 14
2688+ end
2689+ if mouse .x >= 45 and mouse .x <= 46 then
2690+ game .selected [" vizColor" ] = 15
2691+ end
2692+
2693+ -- copy 1 2 3 4
2694+ if mouse .x == 58 then
2695+ -- copy page 1 to current page
2696+ for i = 1 ,1944 do
2697+ SML .screen [game .selected [" pattern" ]][game .selected [" vizPage" ]][i ] = SML .screen [game .selected [" pattern" ]][1 ][i ]
2698+ end
2699+ end
2700+ if mouse .x == 60 then
2701+ -- copy page 2 to current page
2702+ for i = 1 ,1944 do
2703+ SML .screen [game .selected [" pattern" ]][game .selected [" vizPage" ]][i ] = SML .screen [game .selected [" pattern" ]][2 ][i ]
2704+ end
2705+ end
2706+ if mouse .x == 62 then
2707+ -- copy page 3 to current page
2708+ for i = 1 ,1944 do
2709+ SML .screen [game .selected [" pattern" ]][game .selected [" vizPage" ]][i ] = SML .screen [game .selected [" pattern" ]][3 ][i ]
2710+ end
2711+ end
2712+ if mouse .x == 64 then
2713+ -- copy page 4 to current page
2714+ for i = 1 ,1944 do
2715+ SML .screen [game .selected [" pattern" ]][game .selected [" vizPage" ]][i ] = SML .screen [game .selected [" pattern" ]][4 ][i ]
2716+ end
2717+ end
2718+
2719+ -- toggle onion skin with "@" , 69 44
2720+ if mouse .x == 69 then
2721+ -- toggle game.vizOnion
2722+ if game .vizOnion == false then
2723+ game .vizOnion = true
2724+ else
2725+ game .vizOnion = false
2726+ end
2727+ end
2728+
2729+ end
2730+
25652731 -- Melody Instrument
25662732 if mouse .x >= 13 and mouse .x <= 19 and mouse .y == 5 then
25672733 if mouse .x == 13 then -- A clicked
0 commit comments