function p.on_start(wid)
    --Nothing to do.
end

function p.on_end(wid)
    --Nothing to do.
end

function p.render(wid)
    ga_win_set_background(wid, std.vec(0.0, 0.0, 0.0), 0.95)

    ga_win_set_char_size(wid, 0.03, 0.06)
    ga_win_txt_center(wid, 0.85, "USE KEY")

    ga_win_set_char_size(wid, 0.015, 0.03)

    ga_win_txt_center(wid, 0.6, "USING PRIMARY ATTACK DOUBLES AS THE USE KEY?")

    local enabled = ga_get_b("xar.input.use_primary_uses_object")
    local enabled_str = "NO"
    if enabled then enabled_str = "YES" end
    ga_win_txt_center(wid, 0.5,enabled_str)

    ga_win_txt_center(wid, 0.3, "ENABLE?")
    ga_win_txt_center(wid, 0.25, "Y / N")

    ga_win_set_char_size(wid, 0.02, 0.04)
    ga_win_txt_center(wid, 0.06, "Go Back (ESC)")
end

function p.process_input(wid)
    if( ga_win_key_pressed(wid, "N") ) then
        ga_play_sound("menu_select")
        ga_set_b("xar.input.use_primary_uses_object", false)
        return
    end
    if( ga_win_key_pressed(wid, "Y") ) then
        ga_play_sound("menu_select")
        ga_set_b("xar.input.use_primary_uses_object", true)
        return
    end
    if ga_win_key_pressed(wid, "ESC") then
        ga_play_sound("menu_back")
        ga_main_menu_pop()
        return
    end
end
