local SCREEN_CAPTURE_ACTION_UPLOAD = 1
local SCREEN_CAPTURE_ACTION_CANCEL = 2
local Megalist_data = {
[1] = {
type = TYPE_BUTTON,
label = "CELL_CAMERA_MODE_UPLOAD_SNAPSHOT",
id = SCREEN_CAPTURE_ACTION_UPLOAD,
},
[2] = {
type = TYPE_BUTTON,
label = "CONTROL_CANCEL",
id = SCREEN_CAPTURE_ACTION_CANCEL,
},
}
local Mega_list
local Input_tracker
local Screen_grp_h = 0
local Mouse_input_tracker = -1
function screen_capture_init()
Screen_grp_h = vint_object_find("screen_grp")
vint_set_property(Screen_grp_h, "visible", false)
local message_h = vint_object_find("message")
vint_set_property(message_h, "text_tag", "CELL_CAMERA_MODE_UPLOAD_PROMPT")
--this will bring up options
Mega_list = Vdo_mega_list:new("megalist")
Mega_list:set_highlight_color(COLOR_STORE_REWARDS_PRIMARY, COLOR_STORE_REWARDS_SECONDARY)
Mega_list:draw_items(Megalist_data, 1, 500)
--subscribe to inputs...
Input_tracker = Vdo_input_tracker:new()
Input_tracker:add_input("select", "screen_capture_input", 50)
Input_tracker:add_input("back", "screen_capture_input", 50)
Input_tracker:add_input("nav_up", "screen_capture_input", 50)
Input_tracker:add_input("nav_down", "screen_capture_input", 50)
Input_tracker:add_input("nav_left", "screen_capture_input", 50)
Input_tracker:add_input("nav_right", "screen_capture_input", 50)
Input_tracker:subscribe(false);
-- Add mouse inputs for the PC
if game_get_platform() == "PC" then
Mouse_input_tracker = Vdo_input_tracker:new()
Mega_list:add_mouse_inputs("screen_capture", Mouse_input_tracker)
Mouse_input_tracker:subscribe(false)
end
end
function screen_capture_open_preview_dialog()
--show screen
vint_set_property(Screen_grp_h, "visible", true)
--subscribe to inputs...
Input_tracker:subscribe(true)
Mouse_input_tracker:subscribe(true)
end
function screen_capture_close_dialog(do_upload)
-- tell c++ to upload or bail
screen_capture_preview_should_upload(do_upload)
-- hide upload dialog
Input_tracker:subscribe(false)
Mouse_input_tracker:subscribe(false)
vint_set_property(Screen_grp_h, "visible", false)
end
function screen_capture_input(event)
if event == "nav_up" then
Mega_list:move_cursor(-1)
elseif event == "nav_down" then
Mega_list:move_cursor(1)
elseif event == "select" then
local id = Mega_list:get_id()
if id == SCREEN_CAPTURE_ACTION_UPLOAD then
screen_capture_close_dialog(true)
elseif id == SCREEN_CAPTURE_ACTION_CANCEL then
screen_capture_close_dialog(false)
end
elseif event == "back" then
screen_capture_close_dialog(false)
end
end
function screen_capture_mouse_move(event, target_handle)
local new_index = Mega_list:get_button_index(target_handle)
if new_index ~= 0 then
Mega_list:set_selection(new_index)
Mega_list:move_cursor(0, true)
end
end
-- Mouse inputs
function screen_capture_mouse_click(event, target_handle, mouse_x, mouse_y)
local new_index = Mega_list:get_button_index(target_handle)
if new_index == SCREEN_CAPTURE_ACTION_UPLOAD then
screen_capture_close_dialog(true)
end
if new_index == SCREEN_CAPTURE_ACTION_CANCEL then
screen_capture_close_dialog(false)
end
end