    
local elapsed_time = gh_utils.get_elapsed_time()
local dt = elapsed_time - _keyboard_last_time 



local platform_windows = 1 
local platform_osx = 2 
local platform_linux = 3 

if (gh_utils.get_platform() == platform_windows) then
  gh_window.keyboard_update_buffer(0)
end
    

if (dt > 0.2) then
  
  local KC_SPACE = 57

  if (gh_input.keyboard_is_key_down(KC_SPACE) == 1) then
    _keyboard_last_time = elapsed_time
    gh_audio.update()

		local channel = gh_audio.sound_play(sound)
    status_str = string.format("Playing... - channel=%d", channel)

		gh_audio.sound_set_volume(sound, channel, 1.0)
  end
  
end
  
    


gh_renderer.clear_color_buffer(0.2, 0.2, 0.2, 1.0)




libfont_clear()

local y_offset = 40

libfont_print(20, y_offset, 1.0, 1.0, 0, 1, "FMOD demo")
y_offset = y_offset + 30

libfont_print(20, y_offset, 1.0, 1.0, 1.0, 1, "Press SPACE to play the sound of a bullet shoot")
y_offset = y_offset + 30

local hms_str, hour, min, sec = gh_utils.time_to_hour_min_sec(elapsed_time)
libfont_print(20, y_offset, 0.7, 0.7, 0.7, 1, string.format("elapsed time: %s", hms_str))
y_offset = y_offset + 40

libfont_print(20, y_offset, 0.7, 0.7, 0.7, 1, string.format("%s", status_str))
y_offset = y_offset + 40

libfont_render()


