Browse Source

fps/particle counter, palette fix

pixelbath 3 years ago
parent
commit
12f8d05b23
1 changed files with 17 additions and 7 deletions
  1. 17 7
      fireworks.lua

+ 17 - 7
fireworks.lua

@@ -16,15 +16,14 @@ seeds = {}
 
 flashy_color = 1
 
+fps = {
+	last_time = time(),
+	frames = 0,
+	val = 0,
+}
 -- basic todo:
-
 --	seed
---		spark trail
---		timed fuse
---		velocity x/y
 --		explosion shape
---		children (stars):
---			x, y, vel_x, vel_y, color, has_trails, life,
 
 -- types:
 --		willow - each star trails particles with low inertia
@@ -154,6 +153,17 @@ function TIC()
 
 	print("Press A to continue", 240/2-42, 90, 12, false, 1, true)
 	print("Press B to go to the main menu", 240/2-58, 98, 12, false, 1, true)
+
+	local fps_val = 0
+	if (time()-fps.last_time <= 1000) then
+		fps.frames=fps.frames+1
+	else
+		fps.val=fps.frames
+		fps.frames = 0
+		fps.last_time = time()
+	end
+
+	print("fps: "..fps.val..", particles: "..#seeds, 2, 128, 12, false, 1, true)
 	t=t+1
 end
 
@@ -168,6 +178,6 @@ end
 -- </SFX>
 
 -- <PALETTE>
--- 000:1a1c2c610018da3038fa484ceec2612cce50108540083c2404366f042c79045dda1085fff4f4f42c0038690071a508b2
+-- 000:000004610018da3038fa484ceec2612cce50108540083c2404366f042c79045dda1085fff4f4f42c0038690071a508b2
 -- </PALETTE>