46 lines
1.4 KiB
Plaintext
46 lines
1.4 KiB
Plaintext
on.initialize = function()
|
|
App_name = load_manifest()
|
|
print('app name', App_name)
|
|
love.window.setTitle('driver.love - '..App_name)
|
|
-- backstop any default settings for this app, and stash everything to a global for on.save_settings
|
|
if Settings[App_name] == nil then
|
|
Settings[App_name] = {}
|
|
Settings[App_name].viewport = Viewport
|
|
Settings[App_name].definitions = get_default_map()
|
|
end
|
|
Viewport = Settings[App_name].viewport
|
|
-- We might have resized the window since the last time we connected to this app, so don't trust viewport dimensions
|
|
Viewport.w = App.screen.width
|
|
Viewport.h = App.screen.height
|
|
Definitions = Settings[App_name].definitions
|
|
local names = {}
|
|
for name, _ in pairs(Definitions) do
|
|
table.insert(names, name)
|
|
end
|
|
local defs = get_multiple_definitions_from_app(names)
|
|
for name, def_editor in pairs(Definitions) do
|
|
if def_editor.type == nil then
|
|
def_editor.type = 'text'
|
|
end
|
|
if def_editor.bg == nil then
|
|
def_editor.bg = definition_background_color(name)
|
|
end
|
|
if def_editor.width == nil then
|
|
def_editor.width = 600
|
|
end
|
|
if defs[name] then
|
|
def_editor.data = load_from_iterator(defs[name]:gmatch("[^\r\n]+"))
|
|
else
|
|
-- app doesn't know about this definition
|
|
-- just delete it from the driver for now
|
|
print('deleting', name)
|
|
Definitions[name] = nil
|
|
end
|
|
end
|
|
if table_and_array_both_empty(Definitions) then
|
|
new_definition()
|
|
A()
|
|
else
|
|
survey_animation() -- calls A internally
|
|
end
|
|
end |