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,
},
}
Camera_list = -1
local Input_tracker
local Screen_grp_h = 0
local Mouse_input_tracker = -1
local Screen_capture_doc_h = -1
function screen_capture_init()
Screen_capture_doc_h = vint_document_find("screen_capture")
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
Camera_list = Vdo_mega_list:new("megalist", 0, Screen_capture_doc_h, "screen_capture.lua", "Camera_list")
Camera_list:set_highlight_color(COLOR_STORE_REWARDS_PRIMARY, COLOR_STORE_REWARDS_SECONDARY)
Camera_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()
Camera_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)
if game_get_platform() == "PC" then
Mouse_input_tracker:subscribe(true)
end
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)
if game_get_platform() == "PC" then
Mouse_input_tracker:subscribe(false)
end
vint_set_property(Screen_grp_h, "visible", false)
end
function screen_capture_input(event)
if event == "nav_up" then
Camera_list:move_cursor(-1)
elseif event == "nav_down" then
Camera_list:move_cursor(1)
elseif event == "select" then
if Camera_list:list_is_playing() == false then
local id = Camera_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
end
elseif event == "back" then
screen_capture_close_dialog(false)
end
end
function screen_capture_mouse_move(event, target_handle)
local new_index = Camera_list:get_button_index(target_handle)
if new_index ~= 0 then
Camera_list:set_selection(new_index)
Camera_list:move_cursor(0, true)
end
end
-- Mouse inputs
function screen_capture_mouse_click(event, target_handle, mouse_x, mouse_y)
if Camera_list:list_is_playing() == false then
local new_index = Camera_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
end