4--! hide empty description
8--! state 1 as
"boot" #sienna
9--! state 2 as
"download csv" #
darkblue
11--! state 4 as
"menu launcher" #
gray
12--! state 5 as
"download game" #
blue
13--! state 6 as
"load game" #
green
14--! state 7 as
"run game" #
black
15--! state 8 as
"exit game" #
brown
16--! state 9 as
"http failed" #
orange
17--! state 10 as
"error" #
red
43local function next_state(
game, new_state)
44 if game._state + 1 == new_state then
45 game._state = new_state
47 if game._state == 2 and new_state == 9 then
50 if game._state == 5 and new_state == 9 then
51 game._state = new_state
53 if game._state == 8 and new_state == 4 then
58local function halt_state(
game)
59 return function (func)
70 if not
game._state then
77 game._want_leave =
false
78 std.game.exit = function ()
79 game._want_leave = true
82 if
game._state == 7 then
83 halt_state(
game)(function()
90 halt_state(
game)(function ()
102 game._error = '<empty>'
104 if
game._state == 2 then
107 if
game._state == 5 then
114 if
game._state == 0 then
116 elseif
game._state == 1 then
117 halt_state(
game)(function()
121 elseif
game._state == 2 and
#game._csv > 0 then
123 elseif
game._state == 3 then
124 halt_state(
game)(function()
129 elseif
game._state == 4 then
130 halt_state(
game)(function()
131 local key =
std.key.press.down -
std.key.press.up
132 if key ~= 0 and
game.milis >
game._menu_time + 250 then
136 if std.key.press.enter == 1 and
game.milis >
game._menu_time + 250 then
142 elseif
game._state == 5 and
#game._source > 0 then
144 elseif
game._state == 6 then
145 halt_state(
game)(function()
151 elseif
game._state == 7 then
152 halt_state(
game)(function()
153 if not
game._want_leave then
157 game._want_leave = false
161 elseif
game._state == 8 then
162 halt_state(
game)(function()
171 if
game._state == 1 then
175 elseif
game._state == 2 then
179 elseif
game._state == 3 then
183 elseif
game._state == 4 then
188 while index <=
#game._list do
189 std.draw.text(16, 8 + (index * 14),
game._list[index].title)
190 std.draw.text(200, 8 + (index * 14),
game._list[index].version)
191 std.draw.text(300, 8 + (index * 14),
game._list[index].author)
194 std.draw.color(
std.color.red)
195 std.draw.rect(1, 16, 9 + (
game._menu * 14),
game.width - 32, 16)
196 elseif
game._state == 5 then
197 std.draw.clear(
std.color.blue)
198 std.draw.color(
std.color.white)
199 std.draw.text(8, 8,
'download game...')
200 elseif
game._state == 6 then
201 std.draw.clear(
std.color.green)
202 std.draw.color(
std.color.white)
203 std.draw.text(8, 8,
'loading game...')
204 elseif
game._state == 7 then
205 halt_state(
game)(function()
208 elseif
game._state == 8 then
209 std.draw.clear(
std.color.gold)
210 std.draw.color(
std.color.white)
211 std.draw.text(8, 8,
'exiting game...')
212 elseif
game._state == 9 then
213 std.draw.clear(
std.color.orange)
214 std.draw.color(
std.color.white)
215 std.draw.text(8, 8,
'HTTP ERROR:')
216 std.draw.text(200, 8,
game._status)
217 std.draw.text(8, 32,
game._error)
218 elseif
game._state == 10 then
219 std.draw.clear(
std.color.red)
220 std.draw.color(
std.color.white)
221 std.draw.text(8, 8,
'FATAL ERROR:')
222 std.draw.text(8, 32,
game._error)
227 if game._state == 7 then
228 halt_state(
game)(function()
236 title=
'Launcher Games',
237 description=
'online multi game list',
238 author=
'Rodrigo Dornelles',
242 require=
'http random math csv load'
local function file(self, file)
local function require(std, game, application)
local function decode(in_str, out_table)
local function body(self, content)
local function error(self, handler_func)
local function clamp2(value, value_min, value_max)
clamp
local function draw(std, game)
local function init(std, game)
local function exit(std, game)
local function loop(std, game)
local function http(std, game)
local function font(name, size)
local function text(x, y, text)