@gamely/gly-engine-micro 0.1.3 → 0.1.5

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 +75 -90
  2. package/package.json +1 -1
package/dist/main.lua CHANGED
@@ -1,28 +1,32 @@
1
1
  local math = ((function() local x, y = pcall(require, 'math'); return x and y end)()) or _G.math
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()
2
+ local source_version_13ea = nil
3
+ local source_engine_api_system_app_13fc = nil
4
+ local source_engine_api_system_key_1407 = nil
5
+ local source_engine_api_math_basic_1412 = nil
6
+ local source_engine_api_math_clib_141d = nil
7
+ local source_engine_api_math_random_1428 = nil
8
+ local source_engine_api_data_array_1433 = nil
9
+ local source_engine_api_draw_text_143e = nil
10
+ local source_engine_api_draw_poly_1449 = nil
11
+ local source_engine_api_raw_memory_1454 = nil
12
+ local source_engine_api_system_color_1466 = nil
13
+ local source_shared_var_object_std_1471 = nil
14
+ local source_shared_string_eval_code_1483 = nil
15
+ local source_shared_functional_decorator_17e1 = nil
16
+ local function main_13e1()
17
+ local version = source_version_13ea()
18
+ local engine_game = source_engine_api_system_app_13fc()
19
+ local engine_key = source_engine_api_system_key_1407()
20
+ local engine_math = source_engine_api_math_basic_1412()
21
+ local engine_math_clib = source_engine_api_math_clib_141d()
22
+ local engine_math_random = source_engine_api_math_random_1428()
23
+ local engine_array = source_engine_api_data_array_1433()
24
+ local engine_api_draw_text = source_engine_api_draw_text_143e()
25
+ local engine_api_draw_poly = source_engine_api_draw_poly_1449()
26
+ local engine_raw_memory = source_engine_api_raw_memory_1454()
27
+ local color = source_engine_api_system_color_1466()
28
+ local std = source_shared_var_object_std_1471()
29
+ local eval_code = source_shared_string_eval_code_1483()
26
30
  local f=function(a,b)end
27
31
  local engine={keyboard=f}
28
32
  local application={
@@ -54,6 +58,7 @@ poly=native_draw_poly,
54
58
  line=native_draw_line
55
59
  }
56
60
  local cfg_text={
61
+ is_tui = native_text_is_tui,
57
62
  font_previous=native_text_font_previous
58
63
  }
59
64
  function native_callback_loop(dt)
@@ -105,18 +110,19 @@ std.draw.clear=function(tint)
105
110
  native_draw_clear(tint, 0, 0, application.data.width, application.data.height)
106
111
  end
107
112
  engine.root=application
113
+ color.install(std, engine)
108
114
  engine_raw_memory.install(std, engine)
109
115
  engine_game.install(std, engine, cfg_system)
110
116
  engine_key.install(std, engine, {})
111
- engine_math.install(std, engine)
112
- engine_math.wave.install(std, engine)
113
- engine_math.clib.install(std, engine)
114
- engine_math.clib_random.install(std, engine)
115
117
  engine_array.install(std, engine, nil, 'array')
116
118
  engine_api_draw_text.install(std, engine, cfg_text)
117
119
  engine_api_draw_poly.install(std, engine, cfg_poly)
118
- color.install(std, engine)
119
- std.app.title(application.meta.title..' - '..application.meta.version)
120
+ engine_math.install(std, engine)
121
+ if math or flr then engine_math_clib.install(std, engine) end
122
+ if math then engine_math_random.install(std, engine) end
123
+ if application.meta and application.meta.title then
124
+ std.app.title(application.meta.title..' - '..(application.meta.version or ''))
125
+ end
120
126
  engine.current=application
121
127
  application.callbacks.init(std, application.data)
122
128
  end
@@ -130,12 +136,12 @@ version=version
130
136
  }
131
137
  return P
132
138
  end
133
- source_version_608 = function()
134
- return '0.1.3'
139
+ source_version_13ea = function()
140
+ return '0.1.5'
135
141
  end
136
142
  --
137
- source_engine_api_system_app_61a = function()
138
- local util_decorator = source_shared_functional_decorator_9db()
143
+ source_engine_api_system_app_13fc = function()
144
+ local util_decorator = source_shared_functional_decorator_17e1()
139
145
  local function reset(std, engine)
140
146
  if std.node then
141
147
  std.bus.emit('exit')
@@ -175,7 +181,7 @@ install=install
175
181
  return P
176
182
  end
177
183
  --
178
- source_engine_api_system_key_625 = function()
184
+ source_engine_api_system_key_1407 = function()
179
185
  local function real_key(std, engine, rkey, rvalue)
180
186
  local value = rvalue == 1 or rvalue == true
181
187
  local key = engine.key_bindings[rkey] or (std.key.axis[rkey] and rkey)
@@ -212,7 +218,7 @@ install = install
212
218
  return P
213
219
  end
214
220
  --
215
- source_engine_api_system_math_630 = function()
221
+ source_engine_api_math_basic_1412 = function()
216
222
  local function abs(value)
217
223
  if value < 0 then
218
224
  return -value
@@ -291,30 +297,6 @@ index = index + 1
291
297
  end
292
298
  return min_value
293
299
  end
294
- local function sine(t, freq)
295
- return math.pi and math.sin(2 * math.pi * freq * t) or 1
296
- end
297
- local function ramp(t, freq, ratio)
298
- t = (t / 2) % (1 / freq) * freq
299
- if t < ratio then
300
- return 2 * t / ratio - 1
301
- else
302
- return (2 * t - ratio - 1) / (ratio - 1)
303
- end
304
- end
305
- local function saw(t, freq)
306
- return ramp(t, freq, 1)
307
- end
308
- local function triangle(t, freq)
309
- return ramp(t, freq, 1/2)
310
- end
311
- local function rect(t, freq, duty)
312
- duty = 1 - duty * 2
313
- return saw(t, freq) > duty and 1 or -1
314
- end
315
- local function square(t, freq)
316
- return rect(t, freq, 1/2)
317
- end
318
300
  local function install(std)
319
301
  std.math = std.math or {}
320
302
  std.math.abs=abs
@@ -329,14 +311,15 @@ std.math.map=map
329
311
  std.math.max=max
330
312
  std.math.min=min
331
313
  end
332
- local function install_wave(std)
333
- std.math = std.math or {}
334
- std.math.sine=sine
335
- std.math.saw=saw
336
- std.math.square=square
337
- std.math.triangle=triangle
314
+ local P = {
315
+ install = install
316
+ }
317
+ return P
338
318
  end
339
- local function install_clib(std)
319
+ --
320
+ source_engine_api_math_clib_141d = function()
321
+ local function install(std)
322
+ assert(math and (1/2 ~= 0))
340
323
  std.math = std.math or {}
341
324
  std.math.acos=math.acos
342
325
  std.math.asin=math.asin
@@ -364,31 +347,31 @@ std.math.sqrt=math.sqrt
364
347
  std.math.tan=math.tan
365
348
  std.math.tanh=math.tanh
366
349
  end
367
- local function install_clib_random(std)
350
+ local P = {
351
+ install = install
352
+ }
353
+ return P
354
+ end
355
+ --
356
+ source_engine_api_math_random_1428 = function()
357
+ local function install(std)
358
+ assert(math and (1/2 ~= 0))
368
359
  std.math = std.math or {}
369
360
  std.math.random = function(a, b)
370
361
  a = a and math.floor(a)
371
362
  b = b and math.floor(b)
363
+ if a > b then a, b = b, a end
372
364
  return math.random(a, b)
373
365
  end
374
366
  end
375
367
  local P = {
376
- install = install,
377
- wave = {
378
- install = install_wave
379
- },
380
- clib = {
381
- install = install_clib
382
- },
383
- clib_random = {
384
- install = install_clib_random
385
- }
368
+ install = install
386
369
  }
387
- return P;
370
+ return P
388
371
  end
389
372
  --
390
- source_engine_api_data_array_63b = function()
391
- local util_decorator = source_shared_functional_decorator_9db()
373
+ source_engine_api_data_array_1433 = function()
374
+ local util_decorator = source_shared_functional_decorator_17e1()
392
375
  local function array_map(array, func)
393
376
  local res = {}
394
377
  local index = 1
@@ -549,8 +532,8 @@ install = install
549
532
  return P
550
533
  end
551
534
  --
552
- source_engine_api_draw_text_646 = function()
553
- local util_decorator = source_shared_functional_decorator_9db()
535
+ source_engine_api_draw_text_143e = function()
536
+ local util_decorator = source_shared_functional_decorator_17e1()
554
537
  local function text_put(std, engine, font_previous, pos_x, pos_y, text, size)
555
538
  size = size or 2
556
539
  local hem = engine.current.data.width / 80
@@ -568,6 +551,8 @@ std.text.print(x - aligns_x[(align_x or 1) + 2], y - aligns_y[(align_y or 1) + 2
568
551
  return w, h
569
552
  end
570
553
  local function install(std, engine, config)
554
+ std.text.font_previous = config.font_previous
555
+ std.text.is_tui = config.is_tui or function() return false end
571
556
  std.text.print_ex = util_decorator.prefix2(std, engine, text_print_ex)
572
557
  std.text.put = util_decorator.prefix3(std, engine, config.font_previous, text_put)
573
558
  end
@@ -577,7 +562,7 @@ install=install
577
562
  return P
578
563
  end
579
564
  --
580
- source_engine_api_draw_poly_651 = function()
565
+ source_engine_api_draw_poly_1449 = function()
581
566
  local function decorator_poo(object, func)
582
567
  if not object or not func then return func end
583
568
  return function(a, b, c, d)
@@ -684,7 +669,7 @@ install=install
684
669
  return P
685
670
  end
686
671
  --
687
- source_engine_api_raw_memory_65c = function()
672
+ source_engine_api_raw_memory_1454 = function()
688
673
  local memory_dict_unload = {}
689
674
  local memory_dict = {}
690
675
  local memory_list = {}
@@ -739,7 +724,7 @@ install=install
739
724
  return P
740
725
  end
741
726
  --
742
- source_engine_api_system_color_66e = function()
727
+ source_engine_api_system_color_1466 = function()
743
728
  local function install(std)
744
729
  std.color = std.color or {}
745
730
  std.color.white = 0xFFFFFFFF
@@ -774,7 +759,7 @@ install = install
774
759
  return P
775
760
  end
776
761
  --
777
- source_shared_var_object_std_679 = function()
762
+ source_shared_var_object_std_1471 = function()
778
763
  local P = {
779
764
  milis = 0,
780
765
  delta = 0,
@@ -842,7 +827,7 @@ any=false
842
827
  return P;
843
828
  end
844
829
  --
845
- source_shared_string_eval_code_68b = function()
830
+ source_shared_string_eval_code_1483 = function()
846
831
  local function script(src)
847
832
  local loader = loadstring or load
848
833
  if not loader then
@@ -863,7 +848,7 @@ script = script,
863
848
  return P
864
849
  end
865
850
  --
866
- source_shared_functional_decorator_9db = function()
851
+ source_shared_functional_decorator_17e1 = function()
867
852
  local function decorator_prefix3(zig, zag, zom, func)
868
853
  return function (a, b, c, d, e, f)
869
854
  return func(zig, zag, zom, a, b, c, d, e, f)
@@ -921,4 +906,4 @@ prefix1_t = table_prefix1
921
906
  return P
922
907
  end
923
908
  --
924
- return main_5ff()
909
+ return main_13e1()
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gamely/gly-engine-micro",
3
- "version": "0.1.3",
3
+ "version": "0.1.5",
4
4
  "author": "RodrigoDornelles",
5
5
  "license": "Apache-2.0",
6
6
  "homepage": "https://docs.gamely.com.br",