@gamely/gly-engine-micro 0.1.0 → 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.
- package/dist/main.lua +49 -52
- package/package.json +1 -1
package/dist/main.lua
CHANGED
|
@@ -1,28 +1,28 @@
|
|
|
1
1
|
local math = ((function() local x, y = pcall(require, 'math'); return x and y end)()) or _G.math
|
|
2
|
-
local
|
|
3
|
-
local
|
|
4
|
-
local
|
|
5
|
-
local
|
|
6
|
-
local
|
|
7
|
-
local
|
|
8
|
-
local
|
|
9
|
-
local
|
|
10
|
-
local
|
|
11
|
-
local
|
|
12
|
-
local
|
|
13
|
-
local
|
|
14
|
-
local function
|
|
15
|
-
local version =
|
|
16
|
-
local engine_game =
|
|
17
|
-
local engine_key =
|
|
18
|
-
local engine_math =
|
|
19
|
-
local engine_array =
|
|
20
|
-
local engine_api_draw_text =
|
|
21
|
-
local engine_api_draw_poly =
|
|
22
|
-
local engine_raw_memory =
|
|
23
|
-
local color =
|
|
24
|
-
local std =
|
|
25
|
-
local
|
|
2
|
+
local source_version_55e1a30cf5b0 = nil
|
|
3
|
+
local source_engine_api_system_app_55e1a3106da0 = nil
|
|
4
|
+
local source_engine_api_system_key_55e1a30cb790 = nil
|
|
5
|
+
local source_engine_api_system_math_55e1a30f2ca0 = nil
|
|
6
|
+
local source_engine_api_data_array_55e1a3118770 = nil
|
|
7
|
+
local source_engine_api_draw_text_55e1a3117cb0 = nil
|
|
8
|
+
local source_engine_api_draw_poly_55e1a3125030 = nil
|
|
9
|
+
local source_engine_api_raw_memory_55e1a312a370 = nil
|
|
10
|
+
local source_engine_api_system_color_55e1a311eb20 = nil
|
|
11
|
+
local source_shared_var_object_std_55e1a3130f10 = nil
|
|
12
|
+
local source_shared_string_eval_code_55e1a310d160 = nil
|
|
13
|
+
local source_shared_functional_decorator_55e1a312bf80 = nil
|
|
14
|
+
local function main_55e1a312c2b0()
|
|
15
|
+
local version = source_version_55e1a30cf5b0()
|
|
16
|
+
local engine_game = source_engine_api_system_app_55e1a3106da0()
|
|
17
|
+
local engine_key = source_engine_api_system_key_55e1a30cb790()
|
|
18
|
+
local engine_math = source_engine_api_system_math_55e1a30f2ca0()
|
|
19
|
+
local engine_array = source_engine_api_data_array_55e1a3118770()
|
|
20
|
+
local engine_api_draw_text = source_engine_api_draw_text_55e1a3117cb0()
|
|
21
|
+
local engine_api_draw_poly = source_engine_api_draw_poly_55e1a3125030()
|
|
22
|
+
local engine_raw_memory = source_engine_api_raw_memory_55e1a312a370()
|
|
23
|
+
local color = source_engine_api_system_color_55e1a311eb20()
|
|
24
|
+
local std = source_shared_var_object_std_55e1a3130f10()
|
|
25
|
+
local eval_code = source_shared_string_eval_code_55e1a310d160()
|
|
26
26
|
local f=function(a,b)end
|
|
27
27
|
local engine={keyboard=f}
|
|
28
28
|
local application={
|
|
@@ -77,7 +77,7 @@ end
|
|
|
77
77
|
function native_callback_init(width, height, game_lua)
|
|
78
78
|
local ok, script=true, game_lua
|
|
79
79
|
if type(script) == 'string' then
|
|
80
|
-
ok, script=
|
|
80
|
+
ok, script=eval_code.script(script)
|
|
81
81
|
end
|
|
82
82
|
if not script then
|
|
83
83
|
ok, script=pcall(loadfile, 'game.lua')
|
|
@@ -131,12 +131,12 @@ version=version
|
|
|
131
131
|
}
|
|
132
132
|
return P
|
|
133
133
|
end
|
|
134
|
-
|
|
135
|
-
return '0.1.
|
|
134
|
+
source_version_55e1a30cf5b0 = function()
|
|
135
|
+
return '0.1.2'
|
|
136
136
|
end
|
|
137
137
|
--
|
|
138
|
-
|
|
139
|
-
local util_decorator =
|
|
138
|
+
source_engine_api_system_app_55e1a3106da0 = function()
|
|
139
|
+
local util_decorator = source_shared_functional_decorator_55e1a312bf80()
|
|
140
140
|
local function reset(std, engine)
|
|
141
141
|
if std.node then
|
|
142
142
|
std.bus.emit('exit')
|
|
@@ -176,7 +176,7 @@ install=install
|
|
|
176
176
|
return P
|
|
177
177
|
end
|
|
178
178
|
--
|
|
179
|
-
|
|
179
|
+
source_engine_api_system_key_55e1a30cb790 = function()
|
|
180
180
|
local function real_key(std, engine, rkey, rvalue)
|
|
181
181
|
local value = rvalue == 1 or rvalue == true
|
|
182
182
|
local key = engine.key_bindings[rkey] or (std.key.axis[rkey] and rkey)
|
|
@@ -200,23 +200,20 @@ end
|
|
|
200
200
|
local function real_keyup(std, engine, key)
|
|
201
201
|
real_key(std, engine, key, 0)
|
|
202
202
|
end
|
|
203
|
-
local function event_bus(std, engine)
|
|
204
|
-
std.bus.listen_std_engine('rkey', real_key)
|
|
205
|
-
std.bus.listen_std_engine('rkey1', real_keydown)
|
|
206
|
-
std.bus.listen_std_engine('rkey0', real_keyup)
|
|
207
|
-
end
|
|
208
203
|
local function install(std, engine, key_bindings)
|
|
209
204
|
engine.key_bindings = key_bindings or {}
|
|
210
205
|
engine.keyboard = real_key
|
|
206
|
+
std.bus.listen_std_engine('rkey', real_key)
|
|
207
|
+
std.bus.listen_std_engine('rkey1', real_keydown)
|
|
208
|
+
std.bus.listen_std_engine('rkey0', real_keyup)
|
|
211
209
|
end
|
|
212
210
|
local P = {
|
|
213
|
-
event_bus = event_bus,
|
|
214
211
|
install = install
|
|
215
212
|
}
|
|
216
213
|
return P
|
|
217
214
|
end
|
|
218
215
|
--
|
|
219
|
-
|
|
216
|
+
source_engine_api_system_math_55e1a30f2ca0 = function()
|
|
220
217
|
local function abs(value)
|
|
221
218
|
if value < 0 then
|
|
222
219
|
return -value
|
|
@@ -391,8 +388,8 @@ install = install_clib_random
|
|
|
391
388
|
return P;
|
|
392
389
|
end
|
|
393
390
|
--
|
|
394
|
-
|
|
395
|
-
local util_decorator =
|
|
391
|
+
source_engine_api_data_array_55e1a3118770 = function()
|
|
392
|
+
local util_decorator = source_shared_functional_decorator_55e1a312bf80()
|
|
396
393
|
local function array_map(array, func)
|
|
397
394
|
local res = {}
|
|
398
395
|
local index = 1
|
|
@@ -553,8 +550,8 @@ install = install
|
|
|
553
550
|
return P
|
|
554
551
|
end
|
|
555
552
|
--
|
|
556
|
-
|
|
557
|
-
local util_decorator =
|
|
553
|
+
source_engine_api_draw_text_55e1a3117cb0 = function()
|
|
554
|
+
local util_decorator = source_shared_functional_decorator_55e1a312bf80()
|
|
558
555
|
local function text_put(std, engine, font_previous, pos_x, pos_y, text, size)
|
|
559
556
|
size = size or 2
|
|
560
557
|
local hem = engine.current.data.width / 80
|
|
@@ -581,7 +578,7 @@ install=install
|
|
|
581
578
|
return P
|
|
582
579
|
end
|
|
583
580
|
--
|
|
584
|
-
|
|
581
|
+
source_engine_api_draw_poly_55e1a3125030 = function()
|
|
585
582
|
local function decorator_poo(object, func)
|
|
586
583
|
if not object or not func then return func end
|
|
587
584
|
return function(a, b, c, d)
|
|
@@ -688,7 +685,7 @@ install=install
|
|
|
688
685
|
return P
|
|
689
686
|
end
|
|
690
687
|
--
|
|
691
|
-
|
|
688
|
+
source_engine_api_raw_memory_55e1a312a370 = function()
|
|
692
689
|
local memory_dict_unload = {}
|
|
693
690
|
local memory_dict = {}
|
|
694
691
|
local memory_list = {}
|
|
@@ -743,7 +740,7 @@ install=install
|
|
|
743
740
|
return P
|
|
744
741
|
end
|
|
745
742
|
--
|
|
746
|
-
|
|
743
|
+
source_engine_api_system_color_55e1a311eb20 = function()
|
|
747
744
|
local function install(std)
|
|
748
745
|
std.color = std.color or {}
|
|
749
746
|
std.color.white = 0xFFFFFFFF
|
|
@@ -778,7 +775,7 @@ install = install
|
|
|
778
775
|
return P
|
|
779
776
|
end
|
|
780
777
|
--
|
|
781
|
-
|
|
778
|
+
source_shared_var_object_std_55e1a3130f10 = function()
|
|
782
779
|
local P = {
|
|
783
780
|
milis = 0,
|
|
784
781
|
delta = 0,
|
|
@@ -844,28 +841,28 @@ any=false
|
|
|
844
841
|
return P;
|
|
845
842
|
end
|
|
846
843
|
--
|
|
847
|
-
|
|
848
|
-
local function
|
|
844
|
+
source_shared_string_eval_code_55e1a310d160 = function()
|
|
845
|
+
local function script(src)
|
|
849
846
|
local loader = loadstring or load
|
|
850
847
|
if not loader then
|
|
851
848
|
error('eval not allowed')
|
|
852
849
|
end
|
|
853
|
-
local ok, chunk = pcall(loader,
|
|
850
|
+
local ok, chunk = pcall(loader, src)
|
|
854
851
|
if not ok then
|
|
855
852
|
return false, chunk
|
|
856
853
|
end
|
|
857
854
|
if type(chunk) ~= 'function' then
|
|
858
|
-
return false, 'failed to eval'
|
|
855
|
+
return false, 'failed to eval code'
|
|
859
856
|
end
|
|
860
857
|
return pcall(chunk)
|
|
861
858
|
end
|
|
862
859
|
local P = {
|
|
863
|
-
|
|
860
|
+
script = script,
|
|
864
861
|
}
|
|
865
862
|
return P
|
|
866
863
|
end
|
|
867
864
|
--
|
|
868
|
-
|
|
865
|
+
source_shared_functional_decorator_55e1a312bf80 = function()
|
|
869
866
|
local function decorator_prefix3(zig, zag, zom, func)
|
|
870
867
|
return function (a, b, c, d, e, f)
|
|
871
868
|
return func(zig, zag, zom, a, b, c, d, e, f)
|
|
@@ -923,4 +920,4 @@ prefix1_t = table_prefix1
|
|
|
923
920
|
return P
|
|
924
921
|
end
|
|
925
922
|
--
|
|
926
|
-
return
|
|
923
|
+
return main_55e1a312c2b0()
|