
local demo_dir = gh_utils.get_demo_dir()
local lib_dir = gh_utils.get_lib_dir() 		

dofile(lib_dir .. "lua/libfont/libfont1.lua")   
dofile(lib_dir .. "lua/gxl.lua")   





winW, winH = gh_window.getsize(0)



color_prog = gh_node.getid("color_prog")



camera_ortho = gh_camera.create_ortho(-winW/2, winW/2, -winH/2, winH/2, 1.0, 10.0)
gh_camera.set_viewport(camera_ortho, 0, 0, winW, winH)
gh_camera.set_position(camera_ortho, 0, 0, 4)


quad_size = 10
quad = gh_mesh.create_quad(quad_size, quad_size)



gh_renderer.set_vsync(0)
gh_renderer.set_depth_test_state(0) -- No depth test for this demo


last_time = gh_utils.get_elapsed_time()





all_boxes = {}
num_boxes = 100

gxl.random_init(1234)

for i=1, num_boxes do
  local box = {x=gxl.random(-100, 100), y=gxl.random(-100, 100), 
               move_x=gxl.random(-200, 200), move_y=gxl.random(-200, 200), 
               r=gxl.random(0.2, 1.0), g=gxl.random(0.2, 1.0), b=gxl.random(0.2, 1.0), a=1,
               velocity_damping=gxl.random(0.5, 10.0), color_damping=gxl.random(0.02, 0.5)}
  all_boxes[i] = box
end
