@gamely/gly-engine-lite 0.1.1 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/main.lua +302 -260
  2. package/package.json +1 -1
package/dist/main.lua CHANGED
@@ -1,49 +1,54 @@
1
1
  local math = ((function() local x, y = pcall(require, 'math'); return x and y end)()) or _G.math
2
- local source_version_55e9adc93630 = nil
3
- local source_shared_module_55e9adcfcee0 = nil
4
- local source_engine_api_data_encoder_55e9adcde7b0 = nil
5
- local source_engine_api_system_app_55e9add022a0 = nil
6
- local source_engine_api_data_hash_55e9adcec2d0 = nil
7
- local source_engine_api_io_http_55e9add09cc0 = nil
8
- local source_engine_api_data_i18n_55e9adcfb4b0 = nil
9
- local source_engine_api_system_key_55e9adcdd690 = nil
10
- local source_engine_api_debug_log_55e9adc93400 = nil
11
- local source_engine_api_system_math_55e9add12fd0 = nil
12
- local source_engine_api_data_array_55e9add03280 = nil
13
- local source_engine_api_io_media_55e9add024e0 = nil
14
- local source_engine_api_draw_fps_55e9add01370 = nil
15
- local source_engine_api_draw_text_55e9adcfd720 = nil
16
- local source_engine_api_draw_poly_55e9add12880 = nil
17
- local source_engine_api_raw_memory_55e9add0b7e0 = nil
18
- local source_engine_protocol_http_callback_55e9adcfea60 = nil
19
- local source_shared_var_object_root_55e9add070f0 = nil
20
- local source_engine_api_system_color_55e9adc94310 = nil
21
- local source_shared_var_object_std_55e9adc94a00 = nil
22
- local source_shared_functional_pipeline_55e9adca5c50 = nil
23
- local source_shared_functional_decorator_55e9adca5750 = nil
24
- local source_shared_string_encode_http_55e9add02410 = nil
25
- local source_shared_string_encode_url_55e9adca91f0 = nil
26
- local function main_55e9adc932d0()
27
- local version = source_version_55e9adc93630()
28
- local zeebo_module = source_shared_module_55e9adcfcee0()
29
- local engine_encoder = source_engine_api_data_encoder_55e9adcde7b0()
30
- local engine_game = source_engine_api_system_app_55e9add022a0()
31
- local engine_hash = source_engine_api_data_hash_55e9adcec2d0()
32
- local engine_http = source_engine_api_io_http_55e9add09cc0()
33
- local engine_i18n = source_engine_api_data_i18n_55e9adcfb4b0()
34
- local engine_key = source_engine_api_system_key_55e9adcdd690()
35
- local engine_log = source_engine_api_debug_log_55e9adc93400()
36
- local engine_math = source_engine_api_system_math_55e9add12fd0()
37
- local engine_array = source_engine_api_data_array_55e9add03280()
38
- local engine_media = source_engine_api_io_media_55e9add024e0()
39
- local engine_api_draw_fps = source_engine_api_draw_fps_55e9add01370()
40
- local engine_api_draw_text = source_engine_api_draw_text_55e9adcfd720()
41
- local engine_api_draw_poly = source_engine_api_draw_poly_55e9add12880()
42
- local engine_raw_memory = source_engine_api_raw_memory_55e9add0b7e0()
43
- local callback_http = source_engine_protocol_http_callback_55e9adcfea60()
44
- local application_default = source_shared_var_object_root_55e9add070f0()
45
- local color = source_engine_api_system_color_55e9adc94310()
46
- local std = source_shared_var_object_std_55e9adc94a00()
2
+ local source_version_56220a4a1950 = nil
3
+ local source_shared_engine_loadcore_56220a501f60 = nil
4
+ local source_shared_engine_loadgame_56220a508730 = nil
5
+ local source_engine_api_data_encoder_56220a502900 = nil
6
+ local source_engine_api_system_app_56220a50a020 = nil
7
+ local source_engine_api_data_hash_56220a510b30 = nil
8
+ local source_engine_api_io_http_56220a507ca0 = nil
9
+ local source_engine_api_data_i18n_56220a5082f0 = nil
10
+ local source_engine_api_system_key_56220a500cf0 = nil
11
+ local source_engine_api_debug_log_56220a4f3170 = nil
12
+ local source_engine_api_system_math_56220a4f37c0 = nil
13
+ local source_engine_api_data_array_56220a514a90 = nil
14
+ local source_engine_api_io_media_56220a4ff470 = nil
15
+ local source_engine_api_draw_fps_56220a4ffbf0 = nil
16
+ local source_engine_api_draw_text_56220a506130 = nil
17
+ local source_engine_api_draw_poly_56220a515410 = nil
18
+ local source_engine_api_raw_memory_56220a50f100 = nil
19
+ local source_engine_protocol_http_callback_56220a4a0ab0 = nil
20
+ local source_shared_var_object_root_56220a505340 = nil
21
+ local source_engine_api_system_color_56220a50c360 = nil
22
+ local source_shared_var_object_std_56220a516510 = nil
23
+ local source_shared_functional_pipeline_56220a5145d0 = nil
24
+ local source_shared_string_dsl_requires_56220a4752f0 = nil
25
+ local source_shared_string_eval_file_56220a47ff00 = nil
26
+ local source_shared_string_eval_code_56220a4c4f40 = nil
27
+ local source_shared_functional_decorator_56220a48ae90 = nil
28
+ local source_shared_string_encode_http_56220a471880 = nil
29
+ local source_shared_string_encode_url_56220a465e50 = nil
30
+ local function main_56220a508c40()
31
+ local version = source_version_56220a4a1950()
32
+ local loadcore = source_shared_engine_loadcore_56220a501f60()
33
+ local loadgame = source_shared_engine_loadgame_56220a508730()
34
+ local engine_encoder = source_engine_api_data_encoder_56220a502900()
35
+ local engine_game = source_engine_api_system_app_56220a50a020()
36
+ local engine_hash = source_engine_api_data_hash_56220a510b30()
37
+ local engine_http = source_engine_api_io_http_56220a507ca0()
38
+ local engine_i18n = source_engine_api_data_i18n_56220a5082f0()
39
+ local engine_key = source_engine_api_system_key_56220a500cf0()
40
+ local engine_log = source_engine_api_debug_log_56220a4f3170()
41
+ local engine_math = source_engine_api_system_math_56220a4f37c0()
42
+ local engine_array = source_engine_api_data_array_56220a514a90()
43
+ local engine_media = source_engine_api_io_media_56220a4ff470()
44
+ local engine_api_draw_fps = source_engine_api_draw_fps_56220a4ffbf0()
45
+ local engine_api_draw_text = source_engine_api_draw_text_56220a506130()
46
+ local engine_api_draw_poly = source_engine_api_draw_poly_56220a515410()
47
+ local engine_raw_memory = source_engine_api_raw_memory_56220a50f100()
48
+ local callback_http = source_engine_protocol_http_callback_56220a4a0ab0()
49
+ local application_default = source_shared_var_object_root_56220a505340()
50
+ local color = source_engine_api_system_color_56220a50c360()
51
+ local std = source_shared_var_object_std_56220a516510()
47
52
  local application = application_default
48
53
  local engine = {
49
54
  keyboard = function(a, b, c, d) end,
@@ -134,7 +139,7 @@ end
134
139
  return nil
135
140
  end
136
141
  function native_callback_init(width, height, game_lua)
137
- application = zeebo_module.loadgame(game_lua)
142
+ application = loadgame.script(game_lua, application_default)
138
143
  if application then
139
144
  application.data.width = width
140
145
  application.data.height = height
@@ -163,7 +168,7 @@ std.draw.clear=function(tint)
163
168
  native_draw_clear(tint, 0, 0, application.data.width, application.data.height)
164
169
  end
165
170
  engine.root = application
166
- zeebo_module.require(std, application, engine)
171
+ loadcore.setup(std, application, engine)
167
172
  :package('@memory', engine_raw_memory)
168
173
  :package('@game', engine_game, cfg_system)
169
174
  :package('@math', engine_math)
@@ -203,215 +208,162 @@ version=version
203
208
  }
204
209
  return P
205
210
  end
206
- source_version_55e9adc93630 = function()
207
- return '0.1.1'
211
+ source_version_56220a4a1950 = function()
212
+ return '0.1.2'
208
213
  end
209
214
  --
210
- source_shared_module_55e9adcfcee0 = function()
211
- local zeebo_pipeline = source_shared_functional_pipeline_55e9adca5c50()
212
- local application_default = source_shared_var_object_root_55e9add070f0()
213
- local function default(application, defaults)
214
- if not application then return nil end
215
- local index = 1
216
- local items = {'data', 'meta', 'config', 'callbacks'}
217
- local normalized_aplication = {}
218
- defaults = defaults or application_default
219
- while index <= #items do
220
- local key1 = items[index]
221
- local keys = defaults[key1]
222
- normalized_aplication[key1] = {}
223
- for key2, default_value in pairs(keys) do
224
- local value = application[key1] and application[key1][key2]
225
- normalized_aplication[key1][key2] = value or default_value
226
- end
227
- index = index + 1
228
- end
229
- normalized_aplication.config.id = tostring(application)
230
- normalized_aplication.fonts = application.fonts or {}
231
- normalized_aplication.assets = application.assets or {}
232
- if application.callbacks then
233
- for event, handler in pairs(application.callbacks) do
234
- normalized_aplication.callbacks[event] = handler
235
- end
236
- end
237
- return normalized_aplication
238
- end
239
- local function normalize(application)
240
- if not application then return nil end
241
- if application.Game then
242
- application = application.Game
243
- end
244
- if application.new and type(application.new) == 'function' then
245
- application = application.new()
246
- end
247
- if application and (application.meta or application.callbacks) then
248
- return application
249
- end
250
- local normalized_aplication = {
251
- data = {},
252
- meta = {},
253
- fonts = {},
254
- assets = {},
255
- config = {},
256
- callbacks = {}
257
- }
258
- for key, value in pairs(application) do
259
- if key == 'assets' then
260
- normalized_aplication.assets = value
261
- elseif key == 'fonts' then
262
- normalized_aplication.fonts = value
263
- elseif application_default.meta[key] then
264
- normalized_aplication.meta[key] = value
265
- elseif application_default.config[key] then
266
- normalized_aplication.config[key] = value
267
- elseif type(value) == 'function' then
268
- normalized_aplication.callbacks[key] = value
269
- else
270
- normalized_aplication.data[key] = value
271
- end
272
- end
273
- return normalized_aplication
274
- end
275
- local function loadgame(game_file, defaults)
276
- if type(game_file) == 'table' or type(game_file) == 'userdata' then
277
- return default(normalize(game_file), defaults)
278
- end
279
- local cwd = '.'
280
- local application = type(game_file) == 'function' and game_file
281
- local game_title = not application and game_file and game_file:gsub('%.lua$', '') or 'game'
282
- if not application and game_file and game_file:find('\n') then
283
- local ok, app = pcall(load, game_file)
284
- if not ok then
285
- ok, app = pcall(loadstring, game_file)
286
- end
287
- application = ok and app
215
+ source_shared_engine_loadcore_56220a501f60 = function()
216
+ local zeebo_pipeline = source_shared_functional_pipeline_56220a5145d0()
217
+ local requires = source_shared_string_dsl_requires_56220a4752f0()
218
+ local function step_install_libsys(self, lib_name, library, custom, is_system)
219
+ if not is_system then return end
220
+ local ok, msg = pcall(function()
221
+ library.install(self.std, self.engine, custom, lib_name)
222
+ end)
223
+ if ok then
224
+ self.libsys[lib_name] = true
288
225
  else
289
- if love and love.filesystem and love.filesystem.getSource then
290
- cwd = love.filesystem.getSource()
291
- end
292
- if not application then
293
- application = loadfile(cwd..'/'..game_title..'.lua')
294
- end
295
- if not application then
296
- local ok, app = pcall(require, game_title)
297
- application = ok and app
298
- end
299
- end
300
- if not application and io and io.open and game_file then
301
- local app_file = io.open(game_file)
302
- if app_file then
303
- local app_src = app_file:read('*a')
304
- local ok, app = pcall(load, app_src)
305
- if not ok then
306
- ok, app = pcall(loadstring, app_src)
307
- end
308
- application = ok and app
309
- app_file:close()
310
- end
226
+ self.error('sys', lib_name, msg)
311
227
  end
312
- while application and type(application) == 'function' do
313
- application = application()
314
228
  end
315
- return default(normalize(application), defaults)
229
+ local function step_check_libsys(self, lib_name, library, custom, is_system)
230
+ if not is_system then return end
231
+ if not self.libsys[lib_name] then
232
+ self.error('sys', lib_name, 'is missing!')
316
233
  end
317
- local function package(self, module_name, module, custom)
318
- local system = module_name:sub(1, 1) == '@'
319
- local name = system and module_name:sub(2) or module_name
320
- if system then
321
- self.list_append(name)
322
- self.stdlib_required[name] = true
323
- end
324
- self.pipeline[#self.pipeline + 1] = function ()
325
- if not self.list_exist(name) then return end
326
- if not system and not self.lib_required[name] then return end
327
- if not system and self.engine.lib_installed[name] then return end
328
- if system and self.engine.stdlib_installed[name] then return end
329
- local try_install = function()
330
- module.install(self.std, self.engine, custom, name)
331
- if module.event_bus then
332
- module.event_bus(self.std, self.engine, custom, name)
333
234
  end
235
+ local function step_install_libusr(self, lib_name, library, custom, is_system)
236
+ if is_system then return end
237
+ if self.libusr[lib_name] then return end
238
+ if not requires.should_import(self.spec, lib_name) then return end
239
+ self.libusr[lib_name] = pcall(function()
240
+ library.install(self.std, self.engine, custom, lib_name)
241
+ end)
334
242
  end
335
- local ok, msg = pcall(try_install)
336
- if not ok then
337
- self.lib_error[name] = msg
338
- return
243
+ local function step_check_libsys_all(self)
244
+ local missing = requires.missing(self.spec, self.libusr)
245
+ if #missing > 0 then
246
+ self.error('usr', '*', 'missing libs: '..table.concat(missing, ' '))
339
247
  end
340
- if system then
341
- self.engine.stdlib_installed[name] = true
342
- else
343
- self.engine.lib_installed[name] = true
344
248
  end
249
+ local function package(self, lib_name, library, custom)
250
+ self.pipeline[#self.pipeline + 1] = function()
251
+ local is_system = lib_name:sub(1, 1) == '@'
252
+ local name = is_system and lib_name:sub(2) or lib_name
253
+ self:step(name, library, custom, is_system)
345
254
  end
346
255
  return self
347
256
  end
348
- local function require(std, application, engine)
257
+ local function setup(std, application, engine)
349
258
  if not application then
350
259
  error('game not found!')
351
260
  end
352
- local application_require = application.config.require
353
- local next_library = application_require:gmatch('%S+')
261
+ local spec = requires.encode((application.config or application).require or '')
354
262
  local self = {
355
- std=std,
356
- engine=engine,
263
+ std = std,
264
+ spec = spec,
265
+ errmsg = '',
266
+ engine = engine,
357
267
  package = package,
358
- event = {},
359
- list = {},
360
- lib_error = {},
361
- lib_optional = {},
362
- lib_required = {},
363
- stdlib_required = {},
268
+ libusr = {},
269
+ libsys = {},
364
270
  pipeline = {},
365
271
  pipe = zeebo_pipeline.pipe
366
272
  }
367
- if not engine.lib_installed then
368
- engine.lib_installed = {}
369
- engine.stdlib_installed = {}
273
+ self.error = function (prefix, lib_name, message)
274
+ self.errmsg = self.errmsg..'['..prefix..':'..lib_name..'] '..message..'\n'
370
275
  end
371
- self.list_exist = function (name)
372
- return self.lib_optional[name] or self.lib_required[name] or self.stdlib_required[name]
276
+ self.run = function()
277
+ self.step = step_install_libsys
278
+ zeebo_pipeline.reset(self)
279
+ zeebo_pipeline.run(self)
280
+ self.step = step_check_libsys
281
+ zeebo_pipeline.reset(self)
282
+ zeebo_pipeline.run(self)
283
+ self.step = step_install_libusr
284
+ zeebo_pipeline.reset(self)
285
+ zeebo_pipeline.run(self)
286
+ step_check_libsys_all(self)
287
+ if #self.errmsg > 0 then
288
+ error(self.errmsg, 0)
373
289
  end
374
- self.list_append = function (name)
375
- if not self.list_exist(name) then
376
- self.list[#self.list + 1] = name
377
290
  end
291
+ return self
378
292
  end
379
- self.run = function()
380
- local index = 1
381
- zeebo_pipeline.run(self)
382
- while index <= #self.list do
383
- local name = self.list[index]
384
- if self.stdlib_required[name] and not self.engine.stdlib_installed[name] then
385
- error('system library not loaded: '..name..'\n'..(self.lib_error[name] or ''))
293
+ local P = {
294
+ setup = setup
295
+ }
296
+ return P
297
+ end
298
+ --
299
+ source_shared_engine_loadgame_56220a508730 = function()
300
+ local eval_file = source_shared_string_eval_file_56220a47ff00()
301
+ local eval_code = source_shared_string_eval_code_56220a4c4f40()
302
+ local has_io_open = io and io.open
303
+ local function normalize(app, base)
304
+ if not app then return nil end
305
+ if not app.callbacks then
306
+ local old_app = app
307
+ app = {meta={},config={},callbacks={}, data={}}
308
+ for key, value in pairs(old_app) do
309
+ local is_function = type(value) == 'function'
310
+ if base.meta and base.meta[key] and not is_function then
311
+ app.meta[key] = value
312
+ elseif base.config and base.config[key] and not is_function then
313
+ app.config[key] = value
314
+ elseif is_function then
315
+ app.callbacks[key] = value
316
+ else
317
+ app.data[key] = value
386
318
  end
387
- if self.lib_required[name] and not self.engine.lib_installed[name] then
388
- error('library not loaded: '..name..'\n'..(self.lib_error[name] or ''))
389
319
  end
390
- index = index + 1
391
320
  end
321
+ local function defaults(a, b, key)
322
+ if type(a[key]) ~= "table" then a[key] = {} end
323
+ for k, v in pairs(b[key]) do
324
+ if a[key][k] == nil then
325
+ a[key][k] = b[key][k]
392
326
  end
393
- repeat
394
- local lib = next_library()
395
- if lib then
396
- local name, optional = lib:match('([%w%.]+)([?]?)')
397
- self.list_append(name)
398
- if optional and #optional > 0 then
399
- self.lib_optional[name] = true
327
+ end
328
+ end
329
+ for field in pairs(base) do
330
+ defaults(app, base, field)
331
+ end
332
+ return app
333
+ end
334
+ local function script(src, base)
335
+ if type(src) == 'table' or type(src) == 'userdata' then
336
+ return normalize(src, base)
337
+ end
338
+ local application = type(src) == 'function' and src
339
+ if not src or #src == 0 then
340
+ src = 'game'
341
+ end
342
+ if not application and src and src:find('\n') then
343
+ local ok, app = eval_code.script(src)
344
+ application = ok and app
400
345
  else
401
- self.lib_required[name] = true
346
+ local ok, app = eval_file.script(src)
347
+ application = ok and app
402
348
  end
349
+ if not application and has_io_open then
350
+ local app_file = io.open(src)
351
+ if app_file then
352
+ local app_src = app_file:read('*a')
353
+ local ok, app = eval_code.script(app_src)
354
+ application = ok and app
355
+ app_file:close()
403
356
  end
404
- until not lib
405
- return self
357
+ end
358
+ return normalize(application, base)
406
359
  end
407
360
  local P = {
408
- loadgame = loadgame,
409
- require = require
361
+ script = script
410
362
  }
411
363
  return P
412
364
  end
413
365
  --
414
- source_engine_api_data_encoder_55e9adcde7b0 = function()
366
+ source_engine_api_data_encoder_56220a502900 = function()
415
367
  local function install(std, engine, library, name)
416
368
  std = std or {}
417
369
  std[name] = {
@@ -426,8 +378,8 @@ install=install
426
378
  return P
427
379
  end
428
380
  --
429
- source_engine_api_system_app_55e9add022a0 = function()
430
- local util_decorator = source_shared_functional_decorator_55e9adca5750()
381
+ source_engine_api_system_app_56220a50a020 = function()
382
+ local util_decorator = source_shared_functional_decorator_56220a48ae90()
431
383
  local function reset(std, engine)
432
384
  if std.node then
433
385
  std.bus.emit('exit')
@@ -467,7 +419,7 @@ install=install
467
419
  return P
468
420
  end
469
421
  --
470
- source_engine_api_data_hash_55e9adcec2d0 = function()
422
+ source_engine_api_data_hash_56220a510b30 = function()
471
423
  local function djb2(digest)
472
424
  local index = 1
473
425
  local hash = 5381
@@ -491,8 +443,8 @@ install = install
491
443
  return P
492
444
  end
493
445
  --
494
- source_engine_api_io_http_55e9add09cc0 = function()
495
- local zeebo_pipeline = source_shared_functional_pipeline_55e9adca5c50()
446
+ source_engine_api_io_http_56220a507ca0 = function()
447
+ local zeebo_pipeline = source_shared_functional_pipeline_56220a5145d0()
496
448
  local function json(self)
497
449
  self.options['json'] = true
498
450
  return self
@@ -655,7 +607,7 @@ install=install
655
607
  return P
656
608
  end
657
609
  --
658
- source_engine_api_data_i18n_55e9adcfb4b0 = function()
610
+ source_engine_api_data_i18n_56220a5082f0 = function()
659
611
  local language = 'en-US'
660
612
  local language_default = 'en-US'
661
613
  local language_list = {}
@@ -747,7 +699,7 @@ install=install
747
699
  return P
748
700
  end
749
701
  --
750
- source_engine_api_system_key_55e9adcdd690 = function()
702
+ source_engine_api_system_key_56220a500cf0 = function()
751
703
  local function real_key(std, engine, rkey, rvalue)
752
704
  local value = rvalue == 1 or rvalue == true
753
705
  local key = engine.key_bindings[rkey] or (std.key.axis[rkey] and rkey)
@@ -771,24 +723,21 @@ end
771
723
  local function real_keyup(std, engine, key)
772
724
  real_key(std, engine, key, 0)
773
725
  end
774
- local function event_bus(std, engine)
775
- std.bus.listen_std_engine('rkey', real_key)
776
- std.bus.listen_std_engine('rkey1', real_keydown)
777
- std.bus.listen_std_engine('rkey0', real_keyup)
778
- end
779
726
  local function install(std, engine, key_bindings)
780
727
  engine.key_bindings = key_bindings or {}
781
728
  engine.keyboard = real_key
729
+ std.bus.listen_std_engine('rkey', real_key)
730
+ std.bus.listen_std_engine('rkey1', real_keydown)
731
+ std.bus.listen_std_engine('rkey0', real_keyup)
782
732
  end
783
733
  local P = {
784
- event_bus = event_bus,
785
734
  install = install
786
735
  }
787
736
  return P
788
737
  end
789
738
  --
790
- source_engine_api_debug_log_55e9adc93400 = function()
791
- local util_decorator = source_shared_functional_decorator_55e9adca5750()
739
+ source_engine_api_debug_log_56220a4f3170 = function()
740
+ local util_decorator = source_shared_functional_decorator_56220a48ae90()
792
741
  local logging_types = {
793
742
  'none', 'fatal', 'error', 'warn', 'debug', 'info'
794
743
  }
@@ -834,7 +783,7 @@ install = install
834
783
  return P
835
784
  end
836
785
  --
837
- source_engine_api_system_math_55e9add12fd0 = function()
786
+ source_engine_api_system_math_56220a4f37c0 = function()
838
787
  local function abs(value)
839
788
  if value < 0 then
840
789
  return -value
@@ -1009,8 +958,8 @@ install = install_clib_random
1009
958
  return P;
1010
959
  end
1011
960
  --
1012
- source_engine_api_data_array_55e9add03280 = function()
1013
- local util_decorator = source_shared_functional_decorator_55e9adca5750()
961
+ source_engine_api_data_array_56220a514a90 = function()
962
+ local util_decorator = source_shared_functional_decorator_56220a48ae90()
1014
963
  local function array_map(array, func)
1015
964
  local res = {}
1016
965
  local index = 1
@@ -1171,7 +1120,7 @@ install = install
1171
1120
  return P
1172
1121
  end
1173
1122
  --
1174
- source_engine_api_io_media_55e9add024e0 = function()
1123
+ source_engine_api_io_media_56220a4ff470 = function()
1175
1124
  local function media_create(node, channels, handler)
1176
1125
  local decorator = function(func)
1177
1126
  func = func or function() end
@@ -1218,7 +1167,7 @@ install=install
1218
1167
  return P
1219
1168
  end
1220
1169
  --
1221
- source_engine_api_draw_fps_55e9add01370 = function()
1170
+ source_engine_api_draw_fps_56220a4ffbf0 = function()
1222
1171
  local function draw_fps(std, engine, show, pos_x, pos_y)
1223
1172
  if show < 1 then return end
1224
1173
  local x = engine.current.config.offset_x + pos_x
@@ -1251,27 +1200,24 @@ std.text.print(x + s, y, engine.root.config.fps_max)
1251
1200
  s = s + 46
1252
1201
  end
1253
1202
  end
1254
- local function event_bus(std, engine)
1255
- std.bus.listen('post_draw', function()
1256
- engine.current = engine.root
1257
- draw_fps(std, engine, engine.root.config.fps_show, 8, 8)
1258
- end)
1259
- end
1260
1203
  local function install(std, engine)
1261
1204
  std.app = std.app or {}
1262
1205
  std.app.fps_show = function(show)
1263
1206
  engine.root.config.fps_show = show
1264
1207
  end
1208
+ std.bus.listen('post_draw', function()
1209
+ engine.current = engine.root
1210
+ draw_fps(std, engine, engine.root.config.fps_show, 8, 8)
1211
+ end)
1265
1212
  end
1266
1213
  local P = {
1267
- event_bus=event_bus,
1268
1214
  install=install
1269
1215
  }
1270
1216
  return P
1271
1217
  end
1272
1218
  --
1273
- source_engine_api_draw_text_55e9adcfd720 = function()
1274
- local util_decorator = source_shared_functional_decorator_55e9adca5750()
1219
+ source_engine_api_draw_text_56220a506130 = function()
1220
+ local util_decorator = source_shared_functional_decorator_56220a48ae90()
1275
1221
  local function text_put(std, engine, font_previous, pos_x, pos_y, text, size)
1276
1222
  size = size or 2
1277
1223
  local hem = engine.current.data.width / 80
@@ -1298,7 +1244,7 @@ install=install
1298
1244
  return P
1299
1245
  end
1300
1246
  --
1301
- source_engine_api_draw_poly_55e9add12880 = function()
1247
+ source_engine_api_draw_poly_56220a515410 = function()
1302
1248
  local function decorator_poo(object, func)
1303
1249
  if not object or not func then return func end
1304
1250
  return function(a, b, c, d)
@@ -1405,7 +1351,7 @@ install=install
1405
1351
  return P
1406
1352
  end
1407
1353
  --
1408
- source_engine_api_raw_memory_55e9add0b7e0 = function()
1354
+ source_engine_api_raw_memory_56220a50f100 = function()
1409
1355
  local memory_dict_unload = {}
1410
1356
  local memory_dict = {}
1411
1357
  local memory_list = {}
@@ -1460,9 +1406,9 @@ install=install
1460
1406
  return P
1461
1407
  end
1462
1408
  --
1463
- source_engine_protocol_http_callback_55e9adcfea60 = function()
1464
- local str_http = source_shared_string_encode_http_55e9add02410()
1465
- local str_url = source_shared_string_encode_url_55e9adca91f0()
1409
+ source_engine_protocol_http_callback_56220a4a0ab0 = function()
1410
+ local str_http = source_shared_string_encode_http_56220a471880()
1411
+ local str_url = source_shared_string_encode_url_56220a465e50()
1466
1412
  local callbacks = {
1467
1413
  ['async-promise'] = function(self)
1468
1414
  return self:promise()
@@ -1529,7 +1475,7 @@ func = native_http_callback
1529
1475
  return P
1530
1476
  end
1531
1477
  --
1532
- source_shared_var_object_root_55e9add070f0 = function()
1478
+ source_shared_var_object_root_56220a505340 = function()
1533
1479
  local P = {
1534
1480
  data={
1535
1481
  width=1280,
@@ -1559,7 +1505,7 @@ callbacks={
1559
1505
  return P;
1560
1506
  end
1561
1507
  --
1562
- source_engine_api_system_color_55e9adc94310 = function()
1508
+ source_engine_api_system_color_56220a50c360 = function()
1563
1509
  local function install(std)
1564
1510
  std.color = std.color or {}
1565
1511
  std.color.white = 0xFFFFFFFF
@@ -1594,7 +1540,7 @@ install = install
1594
1540
  return P
1595
1541
  end
1596
1542
  --
1597
- source_shared_var_object_std_55e9adc94a00 = function()
1543
+ source_shared_var_object_std_56220a516510 = function()
1598
1544
  local P = {
1599
1545
  milis = 0,
1600
1546
  delta = 0,
@@ -1660,7 +1606,7 @@ any=false
1660
1606
  return P;
1661
1607
  end
1662
1608
  --
1663
- source_shared_functional_pipeline_55e9adca5c50 = function()
1609
+ source_shared_functional_pipeline_56220a5145d0 = function()
1664
1610
  local function pipe(self)
1665
1611
  return function()
1666
1612
  self:run()
@@ -1710,7 +1656,103 @@ run=run
1710
1656
  return P
1711
1657
  end
1712
1658
  --
1713
- source_shared_functional_decorator_55e9adca5750 = function()
1659
+ source_shared_string_dsl_requires_56220a4752f0 = function()
1660
+ local function encode(dsl_string)
1661
+ local spec = {
1662
+ list = {},
1663
+ required = {},
1664
+ all = false
1665
+ }
1666
+ for entry in (dsl_string or ''):gmatch("[^%s]+") do
1667
+ if entry == "*" then
1668
+ spec.all = true
1669
+ else
1670
+ local is_optional = entry:sub(-1) == "?"
1671
+ local name = is_optional and entry:sub(1, -2) or entry
1672
+ spec.list[#spec.list + 1] = name
1673
+ spec.required[#spec.required + 1] = not is_optional
1674
+ end
1675
+ end
1676
+ return spec
1677
+ end
1678
+ local function missing(spec, imported)
1679
+ local result = {}
1680
+ do
1681
+ local index = 1
1682
+ while spec.list[index] do
1683
+ local name = spec.list[index]
1684
+ if spec.required[index] and not imported[name] then
1685
+ result[#result + 1] = name
1686
+ end
1687
+ index = index + 1
1688
+ end
1689
+ end
1690
+ return result
1691
+ end
1692
+ local function should_import(spec, libname)
1693
+ local index = 1
1694
+ while spec.list[index] do
1695
+ if spec.list[index] == libname then return true end
1696
+ index = index + 1
1697
+ end
1698
+ return spec.all
1699
+ end
1700
+ local P = {
1701
+ encode = encode,
1702
+ missing = missing,
1703
+ should_import = should_import
1704
+ }
1705
+ return P
1706
+ end
1707
+ --
1708
+ source_shared_string_eval_file_56220a47ff00 = function()
1709
+ local function script(src)
1710
+ local ok, app = false, nil
1711
+ if require then
1712
+ ok, app = pcall(require, src:gsub('%.lua$', ''))
1713
+ end
1714
+ if not ok and dofile then
1715
+ ok, app = pcall(dofile, src)
1716
+ end
1717
+ if not ok and loadfile then
1718
+ ok, app = pcall(loadfile, src)
1719
+ end
1720
+ if type(app) == 'function' then
1721
+ ok, app = pcall(app)
1722
+ end
1723
+ if not ok then
1724
+ return false, 'failed to eval file'
1725
+ end
1726
+ return ok, app
1727
+ end
1728
+ local P = {
1729
+ script = script,
1730
+ }
1731
+ return P
1732
+ end
1733
+ --
1734
+ source_shared_string_eval_code_56220a4c4f40 = function()
1735
+ local function script(src)
1736
+ local loader = loadstring or load
1737
+ if not loader then
1738
+ error('eval not allowed')
1739
+ end
1740
+ local ok, chunk = pcall(loader, src)
1741
+ if not ok then
1742
+ return false, chunk
1743
+ end
1744
+ if type(chunk) ~= 'function' then
1745
+ return false, 'failed to eval code'
1746
+ end
1747
+ return pcall(chunk)
1748
+ end
1749
+ local P = {
1750
+ script = script,
1751
+ }
1752
+ return P
1753
+ end
1754
+ --
1755
+ source_shared_functional_decorator_56220a48ae90 = function()
1714
1756
  local function decorator_prefix3(zig, zag, zom, func)
1715
1757
  return function (a, b, c, d, e, f)
1716
1758
  return func(zig, zag, zom, a, b, c, d, e, f)
@@ -1768,7 +1810,7 @@ prefix1_t = table_prefix1
1768
1810
  return P
1769
1811
  end
1770
1812
  --
1771
- source_shared_string_encode_http_55e9add02410 = function()
1813
+ source_shared_string_encode_http_56220a471880 = function()
1772
1814
  local function is_ok(status)
1773
1815
  return (status and 200 <= status and status < 300) or false
1774
1816
  end
@@ -1915,7 +1957,7 @@ create_request=create_request
1915
1957
  }
1916
1958
  end
1917
1959
  --
1918
- source_shared_string_encode_url_55e9adca91f0 = function()
1960
+ source_shared_string_encode_url_56220a465e50 = function()
1919
1961
  local function search_param(param_list, param_dict)
1920
1962
  local index, params = 1, ''
1921
1963
  while param_list and param_dict and index <= #param_list do
@@ -1937,4 +1979,4 @@ search_param = search_param
1937
1979
  return P
1938
1980
  end
1939
1981
  --
1940
- return main_55e9adc932d0()
1982
+ return main_56220a508c40()
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gamely/gly-engine-lite",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "author": "RodrigoDornelles",
5
5
  "license": "Apache-2.0",
6
6
  "homepage": "https://docs.gamely.com.br",