@gamely/gly-engine-micro 0.1.1 → 0.1.3
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 +51 -53
- package/package.json +9 -2
- package/README.md +0 -3
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_608 = nil
|
|
3
|
+
local source_engine_api_system_app_61a = nil
|
|
4
|
+
local source_engine_api_system_key_625 = nil
|
|
5
|
+
local source_engine_api_system_math_630 = nil
|
|
6
|
+
local source_engine_api_data_array_63b = nil
|
|
7
|
+
local source_engine_api_draw_text_646 = nil
|
|
8
|
+
local source_engine_api_draw_poly_651 = nil
|
|
9
|
+
local source_engine_api_raw_memory_65c = nil
|
|
10
|
+
local source_engine_api_system_color_66e = nil
|
|
11
|
+
local source_shared_var_object_std_679 = nil
|
|
12
|
+
local source_shared_string_eval_code_68b = nil
|
|
13
|
+
local source_shared_functional_decorator_9db = nil
|
|
14
|
+
local function main_5ff()
|
|
15
|
+
local version = source_version_608()
|
|
16
|
+
local engine_game = source_engine_api_system_app_61a()
|
|
17
|
+
local engine_key = source_engine_api_system_key_625()
|
|
18
|
+
local engine_math = source_engine_api_system_math_630()
|
|
19
|
+
local engine_array = source_engine_api_data_array_63b()
|
|
20
|
+
local engine_api_draw_text = source_engine_api_draw_text_646()
|
|
21
|
+
local engine_api_draw_poly = source_engine_api_draw_poly_651()
|
|
22
|
+
local engine_raw_memory = source_engine_api_raw_memory_65c()
|
|
23
|
+
local color = source_engine_api_system_color_66e()
|
|
24
|
+
local std = source_shared_var_object_std_679()
|
|
25
|
+
local eval_code = source_shared_string_eval_code_68b()
|
|
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')
|
|
@@ -94,7 +94,6 @@ std.draw.color=native_draw_color
|
|
|
94
94
|
std.draw.font=native_draw_font
|
|
95
95
|
std.draw.rect=native_draw_rect
|
|
96
96
|
std.draw.line=native_draw_line
|
|
97
|
-
std.draw.image=native_image_draw
|
|
98
97
|
std.image.load=native_image_load
|
|
99
98
|
std.image.draw=native_image_draw
|
|
100
99
|
std.text.print=native_text_print
|
|
@@ -131,12 +130,12 @@ version=version
|
|
|
131
130
|
}
|
|
132
131
|
return P
|
|
133
132
|
end
|
|
134
|
-
|
|
135
|
-
return '0.1.
|
|
133
|
+
source_version_608 = function()
|
|
134
|
+
return '0.1.3'
|
|
136
135
|
end
|
|
137
136
|
--
|
|
138
|
-
|
|
139
|
-
local util_decorator =
|
|
137
|
+
source_engine_api_system_app_61a = function()
|
|
138
|
+
local util_decorator = source_shared_functional_decorator_9db()
|
|
140
139
|
local function reset(std, engine)
|
|
141
140
|
if std.node then
|
|
142
141
|
std.bus.emit('exit')
|
|
@@ -176,7 +175,7 @@ install=install
|
|
|
176
175
|
return P
|
|
177
176
|
end
|
|
178
177
|
--
|
|
179
|
-
|
|
178
|
+
source_engine_api_system_key_625 = function()
|
|
180
179
|
local function real_key(std, engine, rkey, rvalue)
|
|
181
180
|
local value = rvalue == 1 or rvalue == true
|
|
182
181
|
local key = engine.key_bindings[rkey] or (std.key.axis[rkey] and rkey)
|
|
@@ -200,23 +199,20 @@ end
|
|
|
200
199
|
local function real_keyup(std, engine, key)
|
|
201
200
|
real_key(std, engine, key, 0)
|
|
202
201
|
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
202
|
local function install(std, engine, key_bindings)
|
|
209
203
|
engine.key_bindings = key_bindings or {}
|
|
210
204
|
engine.keyboard = real_key
|
|
205
|
+
std.bus.listen_std_engine('rkey', real_key)
|
|
206
|
+
std.bus.listen_std_engine('rkey1', real_keydown)
|
|
207
|
+
std.bus.listen_std_engine('rkey0', real_keyup)
|
|
211
208
|
end
|
|
212
209
|
local P = {
|
|
213
|
-
event_bus = event_bus,
|
|
214
210
|
install = install
|
|
215
211
|
}
|
|
216
212
|
return P
|
|
217
213
|
end
|
|
218
214
|
--
|
|
219
|
-
|
|
215
|
+
source_engine_api_system_math_630 = function()
|
|
220
216
|
local function abs(value)
|
|
221
217
|
if value < 0 then
|
|
222
218
|
return -value
|
|
@@ -391,8 +387,8 @@ install = install_clib_random
|
|
|
391
387
|
return P;
|
|
392
388
|
end
|
|
393
389
|
--
|
|
394
|
-
|
|
395
|
-
local util_decorator =
|
|
390
|
+
source_engine_api_data_array_63b = function()
|
|
391
|
+
local util_decorator = source_shared_functional_decorator_9db()
|
|
396
392
|
local function array_map(array, func)
|
|
397
393
|
local res = {}
|
|
398
394
|
local index = 1
|
|
@@ -553,8 +549,8 @@ install = install
|
|
|
553
549
|
return P
|
|
554
550
|
end
|
|
555
551
|
--
|
|
556
|
-
|
|
557
|
-
local util_decorator =
|
|
552
|
+
source_engine_api_draw_text_646 = function()
|
|
553
|
+
local util_decorator = source_shared_functional_decorator_9db()
|
|
558
554
|
local function text_put(std, engine, font_previous, pos_x, pos_y, text, size)
|
|
559
555
|
size = size or 2
|
|
560
556
|
local hem = engine.current.data.width / 80
|
|
@@ -581,7 +577,7 @@ install=install
|
|
|
581
577
|
return P
|
|
582
578
|
end
|
|
583
579
|
--
|
|
584
|
-
|
|
580
|
+
source_engine_api_draw_poly_651 = function()
|
|
585
581
|
local function decorator_poo(object, func)
|
|
586
582
|
if not object or not func then return func end
|
|
587
583
|
return function(a, b, c, d)
|
|
@@ -688,7 +684,7 @@ install=install
|
|
|
688
684
|
return P
|
|
689
685
|
end
|
|
690
686
|
--
|
|
691
|
-
|
|
687
|
+
source_engine_api_raw_memory_65c = function()
|
|
692
688
|
local memory_dict_unload = {}
|
|
693
689
|
local memory_dict = {}
|
|
694
690
|
local memory_list = {}
|
|
@@ -743,7 +739,7 @@ install=install
|
|
|
743
739
|
return P
|
|
744
740
|
end
|
|
745
741
|
--
|
|
746
|
-
|
|
742
|
+
source_engine_api_system_color_66e = function()
|
|
747
743
|
local function install(std)
|
|
748
744
|
std.color = std.color or {}
|
|
749
745
|
std.color.white = 0xFFFFFFFF
|
|
@@ -778,12 +774,14 @@ install = install
|
|
|
778
774
|
return P
|
|
779
775
|
end
|
|
780
776
|
--
|
|
781
|
-
|
|
777
|
+
source_shared_var_object_std_679 = function()
|
|
782
778
|
local P = {
|
|
783
779
|
milis = 0,
|
|
784
780
|
delta = 0,
|
|
785
781
|
math = {
|
|
786
782
|
},
|
|
783
|
+
media = {
|
|
784
|
+
},
|
|
787
785
|
draw = {
|
|
788
786
|
image = function() end,
|
|
789
787
|
clear = function () end,
|
|
@@ -844,28 +842,28 @@ any=false
|
|
|
844
842
|
return P;
|
|
845
843
|
end
|
|
846
844
|
--
|
|
847
|
-
|
|
848
|
-
local function
|
|
845
|
+
source_shared_string_eval_code_68b = function()
|
|
846
|
+
local function script(src)
|
|
849
847
|
local loader = loadstring or load
|
|
850
848
|
if not loader then
|
|
851
849
|
error('eval not allowed')
|
|
852
850
|
end
|
|
853
|
-
local ok, chunk = pcall(loader,
|
|
851
|
+
local ok, chunk = pcall(loader, src)
|
|
854
852
|
if not ok then
|
|
855
853
|
return false, chunk
|
|
856
854
|
end
|
|
857
855
|
if type(chunk) ~= 'function' then
|
|
858
|
-
return false, 'failed to eval'
|
|
856
|
+
return false, 'failed to eval code'
|
|
859
857
|
end
|
|
860
858
|
return pcall(chunk)
|
|
861
859
|
end
|
|
862
860
|
local P = {
|
|
863
|
-
|
|
861
|
+
script = script,
|
|
864
862
|
}
|
|
865
863
|
return P
|
|
866
864
|
end
|
|
867
865
|
--
|
|
868
|
-
|
|
866
|
+
source_shared_functional_decorator_9db = function()
|
|
869
867
|
local function decorator_prefix3(zig, zag, zom, func)
|
|
870
868
|
return function (a, b, c, d, e, f)
|
|
871
869
|
return func(zig, zag, zom, a, b, c, d, e, f)
|
|
@@ -923,4 +921,4 @@ prefix1_t = table_prefix1
|
|
|
923
921
|
return P
|
|
924
922
|
end
|
|
925
923
|
--
|
|
926
|
-
return
|
|
924
|
+
return main_5ff()
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gamely/gly-engine-micro",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.3",
|
|
4
4
|
"author": "RodrigoDornelles",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"homepage": "https://docs.gamely.com.br",
|
|
@@ -15,5 +15,12 @@
|
|
|
15
15
|
"game engine",
|
|
16
16
|
"game",
|
|
17
17
|
"engine"
|
|
18
|
-
]
|
|
18
|
+
],
|
|
19
|
+
"scripts": {
|
|
20
|
+
"step1": "cd ../.. && rm -Rf dist && mkdir -p ./dist/types",
|
|
21
|
+
"step2": "cd ../.. && node cli.js build --core micro --bundler --outdir dist/dist",
|
|
22
|
+
"step3": "cd ../.. && node cli.js meta source/cli/main.lua --infile npm/gly-engine-micro/package.json --outfile dist/package.json",
|
|
23
|
+
"step4": "cd ../.. && echo \"declare module '@gamely/gly-engine-micro' {\n const content: string;\n export default content;\n}\" > dist/types/main.d.ts",
|
|
24
|
+
"build": "npm run step1 && npm run step2 && npm run step3 && npm run step4"
|
|
25
|
+
}
|
|
19
26
|
}
|
package/README.md
DELETED