Browse Source

play with palette swaps

pixelbath 4 months ago
parent
commit
3b66e0b508
1 changed files with 23 additions and 2 deletions
  1. 23 2
      bdash.lua

+ 23 - 2
bdash.lua

@@ -26,6 +26,20 @@ function append_elem(obj, append_obj)
 	table.insert(obj.children, append_obj)
 end
 
+-- this method swaps active palette entries
+function swap_palette(idx)
+	local map_addr = 0x3ff0
+	if idx == 0 then
+		poke4(map_addr*2 + 12, 5)
+		poke4(map_addr*2 + 14, 3)
+		poke4(map_addr*2 + 15, 2)
+	end
+end
+
+-- this method pokes new colors into the palette
+function direct_palette(idx)
+end
+
 function render_ui(obj, xs, ys)
 	xs = xs or 0
 	ys = ys or 0
@@ -148,8 +162,14 @@ function draw_toolbox()
 	end
 end
 
+function draw_map()
+	map(0, 0)
+end
+
+swap_palette(0)
+
 function TIC()
-	update_editor()
+	-- update_editor()
 
 	if btn(0) then y=y-1 end
 	if btn(1) then y=y+1 end
@@ -157,7 +177,8 @@ function TIC()
 	if btn(3) then x=x+1 end
 
 	cls(0)
-	render_ui(ui_container)
+	-- render_ui(ui_container)
+	draw_map()
 	-- draw_grid(1)
 	-- draw_toolbox()
 end