Here is a simple example of changing screens from within a LUA function depending on which key was pressed.
Just unzip the attached zip somewhere, then go
file-> import->Storyboard Embedded Engine (GAPP)
And just point it at the gapp file in the root directory of the unzipped archive.
In this example I use a variable for the screen_name of the screen fade action. Then I trigger all the screen transitions with a single custom event.
The other way do do this is to make a new unique event name for each screen you want to change to. Then the simply select the newly created event type and tie it directly to the desired action. Then just send the correctly named event depending on where you want to go.
This is what the key press function looks like in example :
function key_press(mapargs)
local ev = mapargs["context_event_data"]
local key_char = string.format("%c", ev["code"])
local data = {}
print("Key press code: " .. ev["code"] .. " char: " .. key_char)
if key_char == 'S' then
data["screen_name"] = "settings_screen"
elseif key_char == 'M' then
data["screen_name"] = "music_screen"
elseif key_char == 'P' then
data["screen_name"] = "photo_screen"
end
gre.set_data(data)
gre.send_event("change_screen")
end