dxopal 1.4.4 → 1.5.0
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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +8 -0
- data/Gemfile.lock +1 -1
- data/build/dxopal.js +223 -168
- data/build/dxopal.min.js +1 -1
- data/config.ru +7 -0
- data/doc/api/_index.html +1 -1
- data/doc/api/file.README.html +1 -1
- data/doc/api/index.html +1 -1
- data/doc/api/top-level-namespace.html +1 -1
- data/exe/dxopal +1 -1
- data/lib/dxopal/image.rb +28 -0
- data/lib/dxopal/input.rb +3 -0
- data/lib/dxopal/version.rb +1 -1
- data/lib/dxopal/window.rb +22 -6
- data/template/index.html +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8dea35c3a32a9e469abca36a05910228b212f6a5e0af6e83cbb3c7bef4383255
|
4
|
+
data.tar.gz: a146eefca6e94323325273fcb95fa3d07a5786970ec3eee58c46bb09198306c2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6093f9bc46f30044c3606944eeff8651b8e022cc974f5f83e86259b5cce5f70b151da25b4f987b9c98b6c736ad35e48a74e2967eca6add98751e954c319c4245
|
7
|
+
data.tar.gz: e03608f42538fe1ae30ef4a45abef66aab261bcaf08df3d8041b473b930c1c6e4c3987629ab73f8e5df3e027e117bae4fadfe61b763627a041c76ee1cd29bd37
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,11 @@
|
|
1
|
+
## v1.5.0 (2020-01-31)
|
2
|
+
|
3
|
+
- feat: Better error msg (#29)
|
4
|
+
- feat: Support Window.fps= (#30)
|
5
|
+
- feat: dxopal server prints access log (#31)
|
6
|
+
- feat: Default index.html avoids main.rb cache (#32)
|
7
|
+
- feat: Add Image.hsl2rgb (#34)
|
8
|
+
|
1
9
|
## v1.4.4 (2020-01-21)
|
2
10
|
|
3
11
|
- feat: Multi-touch (#26)
|
data/Gemfile.lock
CHANGED
data/build/dxopal.js
CHANGED
@@ -22774,7 +22774,7 @@ Opal.modules["dxopal/input"] = function(Opal) {
|
|
22774
22774
|
}
|
22775
22775
|
var self = Opal.top, $nesting = [], nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $truthy = Opal.truthy, $send = Opal.send, $hash2 = Opal.hash2, $klass = Opal.klass;
|
22776
22776
|
|
22777
|
-
Opal.add_stubs(['$_init_mouse_events', '$_init_touch_events', '$keyevent_target', '$keyevent_target=', '$-', '$+', '$_update_touch_info', '$key_down?', '$_pressing_keys', '$_move', '$[]', '$new', '$[]=', '$push', '$_released', '$delete_if', '$released?', '$<', '$_released_at', '$attr_reader', '$!', '$released_at', '$id', '$x', '$y', '$inspect', '$data', '$values']);
|
22777
|
+
Opal.add_stubs(['$_init_mouse_events', '$_init_touch_events', '$keyevent_target', '$keyevent_target=', '$-', '$+', '$_update_touch_info', '$key_down?', '$_pressing_keys', '$raise', '$_move', '$[]', '$new', '$[]=', '$push', '$_released', '$delete_if', '$released?', '$<', '$_released_at', '$attr_reader', '$!', '$released_at', '$id', '$x', '$y', '$inspect', '$data', '$values']);
|
22778
22778
|
return (function($base, $parent_nesting) {
|
22779
22779
|
var $DXOpal, self = $DXOpal = $module($base, 'DXOpal');
|
22780
22780
|
|
@@ -22963,17 +22963,32 @@ Opal.modules["dxopal/input"] = function(Opal) {
|
|
22963
22963
|
Opal.defs(self, '$mouse_down?', TMP_Input_mouse_down$q_14 = function(mouse_code) {
|
22964
22964
|
var $a, self = this;
|
22965
22965
|
|
22966
|
-
|
22966
|
+
|
22967
|
+
if ($truthy(mouse_code)) {
|
22968
|
+
} else {
|
22969
|
+
self.$raise("missing argument of `mouse_down?'")
|
22970
|
+
};
|
22971
|
+
return (($a = $Input.$$cvars['@@pressing_mouse_buttons']) == null ? nil : $a)[mouse_code] > 0;
|
22967
22972
|
}, TMP_Input_mouse_down$q_14.$$arity = 1);
|
22968
22973
|
Opal.defs(self, '$mouse_push?', TMP_Input_mouse_push$q_15 = function(mouse_code) {
|
22969
22974
|
var $a, self = this;
|
22970
22975
|
|
22971
|
-
|
22976
|
+
|
22977
|
+
if ($truthy(mouse_code)) {
|
22978
|
+
} else {
|
22979
|
+
self.$raise("missing argument of `mouse_push?'")
|
22980
|
+
};
|
22981
|
+
return (($a = $Input.$$cvars['@@pressing_mouse_buttons']) == null ? nil : $a)[mouse_code] == -((($a = $Input.$$cvars['@@tick']) == null ? nil : $a)-1);
|
22972
22982
|
}, TMP_Input_mouse_push$q_15.$$arity = 1);
|
22973
22983
|
Opal.defs(self, '$mouse_release?', TMP_Input_mouse_release$q_16 = function(mouse_code) {
|
22974
22984
|
var $a, self = this;
|
22975
22985
|
|
22976
|
-
|
22986
|
+
|
22987
|
+
if ($truthy(mouse_code)) {
|
22988
|
+
} else {
|
22989
|
+
self.$raise("missing argument of `mouse_release?'")
|
22990
|
+
};
|
22991
|
+
return (($a = $Input.$$cvars['@@pressing_mouse_buttons']) == null ? nil : $a)[mouse_code] == -((($a = $Input.$$cvars['@@tick']) == null ? nil : $a)-1);
|
22977
22992
|
}, TMP_Input_mouse_release$q_16.$$arity = 1);
|
22978
22993
|
Opal.defs(self, '$_init_touch_events', TMP_Input__init_touch_events_17 = function $$_init_touch_events() {
|
22979
22994
|
var $a, $b, $c, self = this, new_touch = nil, $writer = nil;
|
@@ -23422,21 +23437,24 @@ if (klass_name == null) klass_name = nil;if (items == null) items = nil;
|
|
23422
23437
|
|
23423
23438
|
/* Generated by Opal 0.11.4 */
|
23424
23439
|
Opal.modules["dxopal/image"] = function(Opal) {
|
23425
|
-
function $
|
23426
|
-
return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs
|
23440
|
+
function $rb_lt(lhs, rhs) {
|
23441
|
+
return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs < rhs : lhs['$<'](rhs);
|
23442
|
+
}
|
23443
|
+
function $rb_times(lhs, rhs) {
|
23444
|
+
return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs * rhs : lhs['$*'](rhs);
|
23427
23445
|
}
|
23428
23446
|
function $rb_plus(lhs, rhs) {
|
23429
23447
|
return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs + rhs : lhs['$+'](rhs);
|
23430
23448
|
}
|
23449
|
+
function $rb_divide(lhs, rhs) {
|
23450
|
+
return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs / rhs : lhs['$/'](rhs);
|
23451
|
+
}
|
23431
23452
|
function $rb_minus(lhs, rhs) {
|
23432
23453
|
return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs - rhs : lhs['$-'](rhs);
|
23433
23454
|
}
|
23434
|
-
|
23435
|
-
return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs * rhs : lhs['$*'](rhs);
|
23436
|
-
}
|
23437
|
-
var self = Opal.top, $nesting = [], nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $klass = Opal.klass, $truthy = Opal.truthy, $hash2 = Opal.hash2, $send = Opal.send;
|
23455
|
+
var self = Opal.top, $nesting = [], nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $klass = Opal.klass, $truthy = Opal.truthy, $range = Opal.range, $hash2 = Opal.hash2, $send = Opal.send;
|
23438
23456
|
|
23439
|
-
Opal.add_stubs(['$require', '$add_class', '$new', '$attr_accessor', '$loaded', '$load', '$call', '$_resize', '$box_fill', '$attr_reader', '$canvas', '$draw_ex', '$[]', '
|
23457
|
+
Opal.add_stubs(['$require', '$add_class', '$<', '$*', '$+', '$/', '$-', '$===', '$new', '$attr_accessor', '$loaded', '$load', '$call', '$_resize', '$box_fill', '$attr_reader', '$canvas', '$draw_ex', '$[]', '$width', '$height', '$_spec_str', '$_rgba', '$_rgba_ary', '$fill', '$_image_data', '$_put_image_data', '$flat_map', '$map', '$slice', '$length', '$raise', '$inspect', '$join']);
|
23440
23458
|
|
23441
23459
|
self.$require("dxopal/remote_resource");
|
23442
23460
|
return (function($base, $parent_nesting) {
|
@@ -23448,12 +23466,33 @@ Opal.modules["dxopal/image"] = function(Opal) {
|
|
23448
23466
|
function $Image(){};
|
23449
23467
|
var self = $Image = $klass($base, $super, 'Image', $Image);
|
23450
23468
|
|
23451
|
-
var def = self.$$proto, $nesting = [self].concat($parent_nesting),
|
23469
|
+
var def = self.$$proto, $nesting = [self].concat($parent_nesting), TMP_Image_hsl2rgb_1, TMP_Image__load_2, TMP_Image_loaded$q_3, TMP_Image_load_4, TMP_Image_load_5, TMP_Image_onload_6, TMP_Image_initialize_7, TMP_Image__resize_8, TMP_Image_draw_9, TMP_Image_draw_scale_10, TMP_Image_draw_rot_11, TMP_Image_draw_ex_12, TMP_Image_draw_font_13, TMP_Image_$$_14, TMP_Image_$$$eq_15, TMP_Image_compare_16, TMP_Image_line_17, TMP_Image_box_18, TMP_Image_box_fill_19, TMP_Image_circle_20, TMP_Image_circle_fill_21, TMP_Image_triangle_22, TMP_Image_triangle_fill_23, TMP_Image_fill_24, TMP_Image_clear_25, TMP_Image_slice_26, TMP_Image_slice_tiles_29, TMP_Image_set_color_key_30, TMP_Image__draw_raw_image_31, TMP_Image__image_data_32, TMP_Image__put_image_data_33, TMP_Image__rgb_34, TMP_Image__rgba_35, TMP_Image__rgba_ary_36;
|
23452
23470
|
|
23453
23471
|
def.promise = def.canvas = def.width = def.height = def.ctx = nil;
|
23454
23472
|
|
23455
23473
|
Opal.const_get_relative($nesting, 'RemoteResource').$add_class(Opal.const_get_relative($nesting, 'Image'));
|
23456
|
-
Opal.defs(self, '$
|
23474
|
+
Opal.defs(self, '$hsl2rgb', TMP_Image_hsl2rgb_1 = function $$hsl2rgb(h, s, l) {
|
23475
|
+
var self = this, max = nil, min = nil, $case = nil;
|
23476
|
+
|
23477
|
+
|
23478
|
+
if ($truthy($rb_lt(l, 50))) {
|
23479
|
+
|
23480
|
+
max = $rb_times(2.55, $rb_plus(l, $rb_times(l, $rb_divide(s, 100.0))));
|
23481
|
+
min = $rb_times(2.55, $rb_minus(l, $rb_times(l, $rb_divide(s, 100.0))));
|
23482
|
+
} else {
|
23483
|
+
|
23484
|
+
max = $rb_times(2.55, $rb_plus(l, $rb_times($rb_minus(100, l), $rb_divide(s, 100.0))));
|
23485
|
+
min = $rb_times(2.55, $rb_minus(l, $rb_times($rb_minus(100, l), $rb_divide(s, 100.0))));
|
23486
|
+
};
|
23487
|
+
return (function() {$case = h;
|
23488
|
+
if ($range(0, 60, true)['$===']($case)) {return [max, $rb_plus($rb_times($rb_divide(h, 60.0), $rb_minus(max, min)), min), min]}
|
23489
|
+
else if ($range(60, 120, true)['$===']($case)) {return [$rb_plus($rb_times($rb_divide($rb_minus(120, h), 60.0), $rb_minus(max, min)), min), max, min]}
|
23490
|
+
else if ($range(120, 180, true)['$===']($case)) {return [min, max, $rb_plus($rb_times($rb_divide($rb_minus(h, 120), 60.0), $rb_minus(max, min)), min)]}
|
23491
|
+
else if ($range(180, 240, true)['$===']($case)) {return [min, $rb_plus($rb_times($rb_divide($rb_minus(240, h), 60.0), $rb_minus(max, min)), min), max]}
|
23492
|
+
else if ($range(240, 300, true)['$===']($case)) {return [$rb_plus($rb_times($rb_divide($rb_minus(h, 240), 60.0), $rb_minus(max, min)), min), min, max]}
|
23493
|
+
else {return [max, min, $rb_plus($rb_times($rb_divide($rb_minus(360, h), 60.0), $rb_minus(max, min)), min)]}})();
|
23494
|
+
}, TMP_Image_hsl2rgb_1.$$arity = 3);
|
23495
|
+
Opal.defs(self, '$_load', TMP_Image__load_2 = function $$_load(path_or_url) {
|
23457
23496
|
var self = this, raw_img = nil, img_promise = nil, img = nil;
|
23458
23497
|
|
23459
23498
|
|
@@ -23474,21 +23513,21 @@ Opal.modules["dxopal/image"] = function(Opal) {
|
|
23474
23513
|
});
|
23475
23514
|
;
|
23476
23515
|
return [img, img_promise];
|
23477
|
-
},
|
23516
|
+
}, TMP_Image__load_2.$$arity = 1);
|
23478
23517
|
self.$attr_accessor("promise", "loaded");
|
23479
23518
|
|
23480
|
-
Opal.defn(self, '$loaded?', TMP_Image_loaded$
|
23519
|
+
Opal.defn(self, '$loaded?', TMP_Image_loaded$q_3 = function() {
|
23481
23520
|
var self = this;
|
23482
23521
|
|
23483
23522
|
return self.$loaded()
|
23484
|
-
}, TMP_Image_loaded$
|
23485
|
-
Opal.defs(self, '$load',
|
23523
|
+
}, TMP_Image_loaded$q_3.$$arity = 0);
|
23524
|
+
Opal.defs(self, '$load', TMP_Image_load_4 = function $$load(path_or_url) {
|
23486
23525
|
var self = this;
|
23487
23526
|
|
23488
23527
|
return self.$new(1, 1).$load(path_or_url)
|
23489
|
-
},
|
23528
|
+
}, TMP_Image_load_4.$$arity = 1);
|
23490
23529
|
|
23491
|
-
Opal.defn(self, '$load',
|
23530
|
+
Opal.defn(self, '$load', TMP_Image_load_5 = function $$load(path_or_url) {
|
23492
23531
|
var self = this, raw_img = nil;
|
23493
23532
|
|
23494
23533
|
|
@@ -23505,20 +23544,20 @@ Opal.modules["dxopal/image"] = function(Opal) {
|
|
23505
23544
|
});
|
23506
23545
|
;
|
23507
23546
|
return self;
|
23508
|
-
},
|
23547
|
+
}, TMP_Image_load_5.$$arity = 1);
|
23509
23548
|
|
23510
|
-
Opal.defn(self, '$onload',
|
23511
|
-
var self = this, $iter =
|
23549
|
+
Opal.defn(self, '$onload', TMP_Image_onload_6 = function $$onload() {
|
23550
|
+
var self = this, $iter = TMP_Image_onload_6.$$p, block = $iter || nil;
|
23512
23551
|
|
23513
|
-
if ($iter)
|
23552
|
+
if ($iter) TMP_Image_onload_6.$$p = null;
|
23514
23553
|
|
23515
23554
|
self.promise.then(function(response){
|
23516
23555
|
block.$call()
|
23517
23556
|
});
|
23518
23557
|
|
23519
|
-
},
|
23558
|
+
}, TMP_Image_onload_6.$$arity = 0);
|
23520
23559
|
|
23521
|
-
Opal.defn(self, '$initialize',
|
23560
|
+
Opal.defn(self, '$initialize', TMP_Image_initialize_7 = function $$initialize(width, height, $color, $kwargs) {
|
23522
23561
|
var $a, self = this, $post_args, canvas, color;
|
23523
23562
|
|
23524
23563
|
$post_args = Opal.slice.call(arguments, 2, arguments.length);
|
@@ -23546,10 +23585,10 @@ Opal.modules["dxopal/image"] = function(Opal) {
|
|
23546
23585
|
self.ctx = self.canvas.getContext('2d');
|
23547
23586
|
self.$_resize(self.width, self.height);
|
23548
23587
|
return self.$box_fill(0, 0, self.width, self.height, color);
|
23549
|
-
},
|
23588
|
+
}, TMP_Image_initialize_7.$$arity = -3);
|
23550
23589
|
self.$attr_reader("ctx", "canvas", "width", "height");
|
23551
23590
|
|
23552
|
-
Opal.defn(self, '$_resize',
|
23591
|
+
Opal.defn(self, '$_resize', TMP_Image__resize_8 = function $$_resize(w, h) {
|
23553
23592
|
var $a, self = this;
|
23554
23593
|
|
23555
23594
|
|
@@ -23558,9 +23597,9 @@ Opal.modules["dxopal/image"] = function(Opal) {
|
|
23558
23597
|
self.canvas.width = w;
|
23559
23598
|
self.canvas.height = h;
|
23560
23599
|
;
|
23561
|
-
},
|
23600
|
+
}, TMP_Image__resize_8.$$arity = 2);
|
23562
23601
|
|
23563
|
-
Opal.defn(self, '$draw',
|
23602
|
+
Opal.defn(self, '$draw', TMP_Image_draw_9 = function $$draw(x, y, image) {
|
23564
23603
|
var self = this;
|
23565
23604
|
|
23566
23605
|
|
@@ -23568,9 +23607,9 @@ Opal.modules["dxopal/image"] = function(Opal) {
|
|
23568
23607
|
self.ctx.drawImage(image.$canvas(), x, y);
|
23569
23608
|
;
|
23570
23609
|
return self;
|
23571
|
-
},
|
23610
|
+
}, TMP_Image_draw_9.$$arity = 3);
|
23572
23611
|
|
23573
|
-
Opal.defn(self, '$draw_scale',
|
23612
|
+
Opal.defn(self, '$draw_scale', TMP_Image_draw_scale_10 = function $$draw_scale(x, y, image, scale_x, scale_y, center_x, center_y) {
|
23574
23613
|
var self = this;
|
23575
23614
|
|
23576
23615
|
if (center_x == null) {
|
@@ -23580,9 +23619,9 @@ Opal.modules["dxopal/image"] = function(Opal) {
|
|
23580
23619
|
center_y = nil;
|
23581
23620
|
}
|
23582
23621
|
return self.$draw_ex(x, y, image, $hash2(["scale_x", "scale_y", "center_x", "center_y"], {"scale_x": scale_x, "scale_y": scale_y, "center_x": center_x, "center_y": center_y}))
|
23583
|
-
},
|
23622
|
+
}, TMP_Image_draw_scale_10.$$arity = -6);
|
23584
23623
|
|
23585
|
-
Opal.defn(self, '$draw_rot',
|
23624
|
+
Opal.defn(self, '$draw_rot', TMP_Image_draw_rot_11 = function $$draw_rot(x, y, image, angle, center_x, center_y) {
|
23586
23625
|
var self = this;
|
23587
23626
|
|
23588
23627
|
if (center_x == null) {
|
@@ -23592,10 +23631,10 @@ Opal.modules["dxopal/image"] = function(Opal) {
|
|
23592
23631
|
center_y = nil;
|
23593
23632
|
}
|
23594
23633
|
return self.$draw_ex(x, y, image, $hash2(["angle", "center_x", "center_y"], {"angle": angle, "center_x": center_x, "center_y": center_y}))
|
23595
|
-
},
|
23634
|
+
}, TMP_Image_draw_rot_11.$$arity = -5);
|
23596
23635
|
Opal.const_set($nesting[0], 'BLEND_TYPES', $hash2(["alpha", "add"], {"alpha": "source-over", "add": "lighter"}));
|
23597
23636
|
|
23598
|
-
Opal.defn(self, '$draw_ex',
|
23637
|
+
Opal.defn(self, '$draw_ex', TMP_Image_draw_ex_12 = function $$draw_ex(x, y, image, options) {
|
23599
23638
|
var $a, self = this, scale_x = nil, scale_y = nil, center_x = nil, center_y = nil, alpha = nil, blend = nil, angle = nil, cx = nil, cy = nil;
|
23600
23639
|
|
23601
23640
|
if (options == null) {
|
@@ -23623,9 +23662,9 @@ Opal.modules["dxopal/image"] = function(Opal) {
|
|
23623
23662
|
self.ctx.setTransform(1, 0, 0, 1, 0, 0); // reset
|
23624
23663
|
;
|
23625
23664
|
return self;
|
23626
|
-
},
|
23665
|
+
}, TMP_Image_draw_ex_12.$$arity = -4);
|
23627
23666
|
|
23628
|
-
Opal.defn(self, '$draw_font',
|
23667
|
+
Opal.defn(self, '$draw_font', TMP_Image_draw_font_13 = function $$draw_font(x, y, string, font, color) {
|
23629
23668
|
var self = this, ctx = nil;
|
23630
23669
|
|
23631
23670
|
if (color == null) {
|
@@ -23640,9 +23679,9 @@ Opal.modules["dxopal/image"] = function(Opal) {
|
|
23640
23679
|
ctx.fillText(string, x, y);
|
23641
23680
|
;
|
23642
23681
|
return self;
|
23643
|
-
},
|
23682
|
+
}, TMP_Image_draw_font_13.$$arity = -5);
|
23644
23683
|
|
23645
|
-
Opal.defn(self, '$[]', TMP_Image_$$
|
23684
|
+
Opal.defn(self, '$[]', TMP_Image_$$_14 = function(x, y) {
|
23646
23685
|
var self = this, ctx = nil, ret = nil;
|
23647
23686
|
|
23648
23687
|
|
@@ -23654,15 +23693,15 @@ Opal.modules["dxopal/image"] = function(Opal) {
|
|
23654
23693
|
ret = [rgba[3], rgba[0], rgba[1], rgba[2]];
|
23655
23694
|
;
|
23656
23695
|
return ret;
|
23657
|
-
}, TMP_Image_$$
|
23696
|
+
}, TMP_Image_$$_14.$$arity = 2);
|
23658
23697
|
|
23659
|
-
Opal.defn(self, '$[]=', TMP_Image_$$$
|
23698
|
+
Opal.defn(self, '$[]=', TMP_Image_$$$eq_15 = function(x, y, color) {
|
23660
23699
|
var self = this;
|
23661
23700
|
|
23662
23701
|
return self.$box_fill(x, y, x, y, color)
|
23663
|
-
}, TMP_Image_$$$
|
23702
|
+
}, TMP_Image_$$$eq_15.$$arity = 3);
|
23664
23703
|
|
23665
|
-
Opal.defn(self, '$compare',
|
23704
|
+
Opal.defn(self, '$compare', TMP_Image_compare_16 = function $$compare(x, y, color) {
|
23666
23705
|
var self = this, ctx = nil, rgba1 = nil, rgba2 = nil, ret = nil;
|
23667
23706
|
|
23668
23707
|
|
@@ -23680,9 +23719,9 @@ Opal.modules["dxopal/image"] = function(Opal) {
|
|
23680
23719
|
rgba1[3] == rgba2[3]
|
23681
23720
|
;
|
23682
23721
|
return ret;
|
23683
|
-
},
|
23722
|
+
}, TMP_Image_compare_16.$$arity = 3);
|
23684
23723
|
|
23685
|
-
Opal.defn(self, '$line',
|
23724
|
+
Opal.defn(self, '$line', TMP_Image_line_17 = function $$line(x1, y1, x2, y2, color) {
|
23686
23725
|
var self = this, ctx = nil;
|
23687
23726
|
|
23688
23727
|
|
@@ -23695,9 +23734,9 @@ Opal.modules["dxopal/image"] = function(Opal) {
|
|
23695
23734
|
ctx.stroke();
|
23696
23735
|
;
|
23697
23736
|
return self;
|
23698
|
-
},
|
23737
|
+
}, TMP_Image_line_17.$$arity = 5);
|
23699
23738
|
|
23700
|
-
Opal.defn(self, '$box',
|
23739
|
+
Opal.defn(self, '$box', TMP_Image_box_18 = function $$box(x1, y1, x2, y2, color) {
|
23701
23740
|
var self = this, ctx = nil;
|
23702
23741
|
|
23703
23742
|
|
@@ -23709,9 +23748,9 @@ Opal.modules["dxopal/image"] = function(Opal) {
|
|
23709
23748
|
ctx.stroke();
|
23710
23749
|
;
|
23711
23750
|
return self;
|
23712
|
-
},
|
23751
|
+
}, TMP_Image_box_18.$$arity = 5);
|
23713
23752
|
|
23714
|
-
Opal.defn(self, '$box_fill',
|
23753
|
+
Opal.defn(self, '$box_fill', TMP_Image_box_fill_19 = function $$box_fill(x1, y1, x2, y2, color) {
|
23715
23754
|
var self = this, ctx = nil;
|
23716
23755
|
|
23717
23756
|
|
@@ -23722,9 +23761,9 @@ Opal.modules["dxopal/image"] = function(Opal) {
|
|
23722
23761
|
ctx.fillRect(x1, y1, x2-x1, y2-y1);
|
23723
23762
|
;
|
23724
23763
|
return self;
|
23725
|
-
},
|
23764
|
+
}, TMP_Image_box_fill_19.$$arity = 5);
|
23726
23765
|
|
23727
|
-
Opal.defn(self, '$circle',
|
23766
|
+
Opal.defn(self, '$circle', TMP_Image_circle_20 = function $$circle(x, y, r, color) {
|
23728
23767
|
var self = this, ctx = nil;
|
23729
23768
|
|
23730
23769
|
|
@@ -23736,9 +23775,9 @@ Opal.modules["dxopal/image"] = function(Opal) {
|
|
23736
23775
|
ctx.stroke();
|
23737
23776
|
;
|
23738
23777
|
return self;
|
23739
|
-
},
|
23778
|
+
}, TMP_Image_circle_20.$$arity = 4);
|
23740
23779
|
|
23741
|
-
Opal.defn(self, '$circle_fill',
|
23780
|
+
Opal.defn(self, '$circle_fill', TMP_Image_circle_fill_21 = function $$circle_fill(x, y, r, color) {
|
23742
23781
|
var self = this, ctx = nil;
|
23743
23782
|
|
23744
23783
|
|
@@ -23750,9 +23789,9 @@ Opal.modules["dxopal/image"] = function(Opal) {
|
|
23750
23789
|
ctx.fill();
|
23751
23790
|
;
|
23752
23791
|
return self;
|
23753
|
-
},
|
23792
|
+
}, TMP_Image_circle_fill_21.$$arity = 4);
|
23754
23793
|
|
23755
|
-
Opal.defn(self, '$triangle',
|
23794
|
+
Opal.defn(self, '$triangle', TMP_Image_triangle_22 = function $$triangle(x1, y1, x2, y2, x3, y3, color) {
|
23756
23795
|
var self = this, ctx = nil;
|
23757
23796
|
|
23758
23797
|
|
@@ -23767,9 +23806,9 @@ Opal.modules["dxopal/image"] = function(Opal) {
|
|
23767
23806
|
ctx.stroke();
|
23768
23807
|
;
|
23769
23808
|
return self;
|
23770
|
-
},
|
23809
|
+
}, TMP_Image_triangle_22.$$arity = 7);
|
23771
23810
|
|
23772
|
-
Opal.defn(self, '$triangle_fill',
|
23811
|
+
Opal.defn(self, '$triangle_fill', TMP_Image_triangle_fill_23 = function $$triangle_fill(x1, y1, x2, y2, x3, y3, color) {
|
23773
23812
|
var self = this, ctx = nil;
|
23774
23813
|
|
23775
23814
|
|
@@ -23783,21 +23822,21 @@ Opal.modules["dxopal/image"] = function(Opal) {
|
|
23783
23822
|
ctx.fill();
|
23784
23823
|
;
|
23785
23824
|
return self;
|
23786
|
-
},
|
23825
|
+
}, TMP_Image_triangle_fill_23.$$arity = 7);
|
23787
23826
|
|
23788
|
-
Opal.defn(self, '$fill',
|
23827
|
+
Opal.defn(self, '$fill', TMP_Image_fill_24 = function $$fill(color) {
|
23789
23828
|
var self = this;
|
23790
23829
|
|
23791
23830
|
return self.$box_fill(0, 0, $rb_minus(self.width, 1), $rb_minus(self.height, 1), color)
|
23792
|
-
},
|
23831
|
+
}, TMP_Image_fill_24.$$arity = 1);
|
23793
23832
|
|
23794
|
-
Opal.defn(self, '$clear',
|
23833
|
+
Opal.defn(self, '$clear', TMP_Image_clear_25 = function $$clear() {
|
23795
23834
|
var self = this;
|
23796
23835
|
|
23797
23836
|
return self.$fill([0, 0, 0, 0])
|
23798
|
-
},
|
23837
|
+
}, TMP_Image_clear_25.$$arity = 0);
|
23799
23838
|
|
23800
|
-
Opal.defn(self, '$slice',
|
23839
|
+
Opal.defn(self, '$slice', TMP_Image_slice_26 = function $$slice(x, y, width, height) {
|
23801
23840
|
var self = this, newimg = nil, data = nil;
|
23802
23841
|
|
23803
23842
|
|
@@ -23805,22 +23844,22 @@ Opal.modules["dxopal/image"] = function(Opal) {
|
|
23805
23844
|
data = self.$_image_data(x, y, width, height);
|
23806
23845
|
newimg.$_put_image_data(data);
|
23807
23846
|
return newimg;
|
23808
|
-
},
|
23847
|
+
}, TMP_Image_slice_26.$$arity = 4);
|
23809
23848
|
|
23810
|
-
Opal.defn(self, '$slice_tiles',
|
23811
|
-
var
|
23849
|
+
Opal.defn(self, '$slice_tiles', TMP_Image_slice_tiles_29 = function $$slice_tiles(xcount, ycount) {
|
23850
|
+
var TMP_27, self = this, tile_w = nil, tile_h = nil;
|
23812
23851
|
|
23813
23852
|
|
23814
23853
|
tile_w = $rb_divide(self.width, xcount);
|
23815
23854
|
tile_h = $rb_divide(self.height, ycount);
|
23816
|
-
return $send(Opal.Range.$new(0,ycount, true), 'flat_map', [], (
|
23855
|
+
return $send(Opal.Range.$new(0,ycount, true), 'flat_map', [], (TMP_27 = function(v){var self = TMP_27.$$s || this, TMP_28;
|
23817
23856
|
if (v == null) v = nil;
|
23818
|
-
return $send(Opal.Range.$new(0,xcount, true), 'map', [], (
|
23857
|
+
return $send(Opal.Range.$new(0,xcount, true), 'map', [], (TMP_28 = function(u){var self = TMP_28.$$s || this;
|
23819
23858
|
if (u == null) u = nil;
|
23820
|
-
return self.$slice($rb_times(tile_w, u), $rb_times(tile_h, v), tile_w, tile_h)},
|
23821
|
-
},
|
23859
|
+
return self.$slice($rb_times(tile_w, u), $rb_times(tile_h, v), tile_w, tile_h)}, TMP_28.$$s = self, TMP_28.$$arity = 1, TMP_28))}, TMP_27.$$s = self, TMP_27.$$arity = 1, TMP_27));
|
23860
|
+
}, TMP_Image_slice_tiles_29.$$arity = 2);
|
23822
23861
|
|
23823
|
-
Opal.defn(self, '$set_color_key',
|
23862
|
+
Opal.defn(self, '$set_color_key', TMP_Image_set_color_key_30 = function $$set_color_key(color) {
|
23824
23863
|
var $a, $b, self = this, r = nil, g = nil, b = nil, _ = nil, data = nil;
|
23825
23864
|
|
23826
23865
|
|
@@ -23836,17 +23875,17 @@ if (u == null) u = nil;
|
|
23836
23875
|
}
|
23837
23876
|
;
|
23838
23877
|
return self.$_put_image_data(data);
|
23839
|
-
},
|
23878
|
+
}, TMP_Image_set_color_key_30.$$arity = 1);
|
23840
23879
|
|
23841
|
-
Opal.defn(self, '$_draw_raw_image',
|
23880
|
+
Opal.defn(self, '$_draw_raw_image', TMP_Image__draw_raw_image_31 = function $$_draw_raw_image(x, y, raw_img) {
|
23842
23881
|
var self = this;
|
23843
23882
|
|
23844
23883
|
|
23845
23884
|
self.ctx.drawImage(raw_img, x, y);
|
23846
23885
|
|
23847
|
-
},
|
23886
|
+
}, TMP_Image__draw_raw_image_31.$$arity = 3);
|
23848
23887
|
|
23849
|
-
Opal.defn(self, '$_image_data',
|
23888
|
+
Opal.defn(self, '$_image_data', TMP_Image__image_data_32 = function $$_image_data(x, y, w, h) {
|
23850
23889
|
var self = this;
|
23851
23890
|
|
23852
23891
|
if (x == null) {
|
@@ -23862,9 +23901,9 @@ if (u == null) u = nil;
|
|
23862
23901
|
h = self.height;
|
23863
23902
|
}
|
23864
23903
|
return self.ctx.getImageData(x, y, w, h)
|
23865
|
-
},
|
23904
|
+
}, TMP_Image__image_data_32.$$arity = -1);
|
23866
23905
|
|
23867
|
-
Opal.defn(self, '$_put_image_data',
|
23906
|
+
Opal.defn(self, '$_put_image_data', TMP_Image__put_image_data_33 = function $$_put_image_data(image_data, x, y) {
|
23868
23907
|
var self = this;
|
23869
23908
|
|
23870
23909
|
if (x == null) {
|
@@ -23874,9 +23913,9 @@ if (u == null) u = nil;
|
|
23874
23913
|
y = 0;
|
23875
23914
|
}
|
23876
23915
|
return self.ctx.putImageData(image_data, x, y)
|
23877
|
-
},
|
23916
|
+
}, TMP_Image__put_image_data_33.$$arity = -2);
|
23878
23917
|
|
23879
|
-
Opal.defn(self, '$_rgb',
|
23918
|
+
Opal.defn(self, '$_rgb', TMP_Image__rgb_34 = function $$_rgb(color) {
|
23880
23919
|
var self = this, $case = nil, rgb = nil;
|
23881
23920
|
|
23882
23921
|
|
@@ -23885,21 +23924,21 @@ if (u == null) u = nil;
|
|
23885
23924
|
else if ((3)['$===']($case)) {rgb = color}
|
23886
23925
|
else {self.$raise("" + "invalid color: " + (color.$inspect()))};
|
23887
23926
|
return $rb_plus($rb_plus("rgb(", rgb.$join(", ")), ")");
|
23888
|
-
},
|
23927
|
+
}, TMP_Image__rgb_34.$$arity = 1);
|
23889
23928
|
|
23890
|
-
Opal.defn(self, '$_rgba',
|
23929
|
+
Opal.defn(self, '$_rgba', TMP_Image__rgba_35 = function $$_rgba(color) {
|
23891
23930
|
var self = this;
|
23892
23931
|
|
23893
23932
|
return $rb_plus($rb_plus("rgba(", self.$_rgba_ary(color).$join(", ")), ")")
|
23894
|
-
},
|
23895
|
-
return (Opal.defn(self, '$_rgba_ary',
|
23933
|
+
}, TMP_Image__rgba_35.$$arity = 1);
|
23934
|
+
return (Opal.defn(self, '$_rgba_ary', TMP_Image__rgba_ary_36 = function $$_rgba_ary(color) {
|
23896
23935
|
var self = this, $case = nil;
|
23897
23936
|
|
23898
23937
|
return (function() {$case = color.$length();
|
23899
23938
|
if ((4)['$===']($case)) {return $rb_plus(color['$[]'](1, 3), [$rb_divide(color['$[]'](0), 255.0)])}
|
23900
23939
|
else if ((3)['$===']($case)) {return $rb_plus(color, [1.0])}
|
23901
23940
|
else {return self.$raise("" + "invalid color: " + (color.$inspect()))}})()
|
23902
|
-
},
|
23941
|
+
}, TMP_Image__rgba_ary_36.$$arity = 1), nil) && '_rgba_ary';
|
23903
23942
|
})($nesting[0], Opal.const_get_relative($nesting, 'RemoteResource'), $nesting)
|
23904
23943
|
})($nesting[0], $nesting);
|
23905
23944
|
};
|
@@ -25187,8 +25226,8 @@ if (sprite == null) sprite = nil;
|
|
25187
25226
|
|
25188
25227
|
/* Generated by Opal 0.11.4 */
|
25189
25228
|
Opal.modules["dxopal/window"] = function(Opal) {
|
25190
|
-
function $
|
25191
|
-
return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs
|
25229
|
+
function $rb_divide(lhs, rhs) {
|
25230
|
+
return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs / rhs : lhs['$/'](rhs);
|
25192
25231
|
}
|
25193
25232
|
function $rb_minus(lhs, rhs) {
|
25194
25233
|
return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs - rhs : lhs['$-'](rhs);
|
@@ -25196,9 +25235,12 @@ Opal.modules["dxopal/window"] = function(Opal) {
|
|
25196
25235
|
function $rb_plus(lhs, rhs) {
|
25197
25236
|
return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs + rhs : lhs['$+'](rhs);
|
25198
25237
|
}
|
25238
|
+
function $rb_ge(lhs, rhs) {
|
25239
|
+
return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs >= rhs : lhs['$>='](rhs);
|
25240
|
+
}
|
25199
25241
|
var self = Opal.top, $nesting = [], nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $send = Opal.send, $truthy = Opal.truthy, $hash2 = Opal.hash2;
|
25200
25242
|
|
25201
|
-
Opal.add_stubs(['$require', '$now', '$_load_resources', '$dump_error', '$to_proc', '$!', '$_loop', '$clear', '$draw_pause_screen', '$nil?', '$raise', '$loop', '$draw_box_fill', '$width', '$height', '$draw_font', '$default', '$_init', '
|
25243
|
+
Opal.add_stubs(['$require', '$now', '$_load_resources', '$dump_error', '$to_proc', '$!', '$_loop', '$clear', '$draw_pause_screen', '$nil?', '$raise', '$loop', '$draw_box_fill', '$width', '$height', '$draw_font', '$default', '$_init', '$/', '$-', '$+', '$>=', '$matter_enabled?', '$matter_tick', '$_on_tick', '$box_fill', '$sort', '$==', '$[]', '$<=>', '$each', '$===', '$draw', '$drop', '$draw_rot', '$draw_scale', '$draw_ex', '$[]=', '$line', '$box', '$circle', '$circle_fill', '$triangle', '$triangle_fill', '$width=', '$height=', '$new', '$enqueue_draw', '$push', '$length']);
|
25202
25244
|
|
25203
25245
|
self.$require("dxopal/constants/colors");
|
25204
25246
|
return (function($base, $parent_nesting) {
|
@@ -25209,10 +25251,12 @@ Opal.modules["dxopal/window"] = function(Opal) {
|
|
25209
25251
|
(function($base, $parent_nesting) {
|
25210
25252
|
var $Window, self = $Window = $module($base, 'Window');
|
25211
25253
|
|
25212
|
-
var def = self.$$proto, $nesting = [self].concat($parent_nesting), TMP_Window_load_resources_1, TMP_Window_loop_3,
|
25254
|
+
var def = self.$$proto, $nesting = [self].concat($parent_nesting), TMP_Window_load_resources_1, TMP_Window_loop_3, TMP_Window_pause_5, TMP_Window_paused$q_6, TMP_Window_resume_7, TMP_Window_draw_pause_screen_8, TMP_Window__loop_13, TMP_Window__init_14, TMP_Window__img_15, TMP_Window_fps_16, TMP_Window_fps$eq_17, TMP_Window_real_fps_18, TMP_Window_width_19, TMP_Window_width$eq_20, TMP_Window_height_21, TMP_Window_height$eq_22, TMP_Window_bgcolor_23, TMP_Window_bgcolor$eq_24, TMP_Window_draw_25, TMP_Window_draw_scale_26, TMP_Window_draw_rot_27, TMP_Window_draw_ex_28, TMP_Window_draw_font_29, TMP_Window_draw_pixel_30, TMP_Window_draw_line_31, TMP_Window_draw_box_32, TMP_Window_draw_box_fill_33, TMP_Window_draw_circle_34, TMP_Window_draw_circle_fill_35, TMP_Window_draw_triangle_36, TMP_Window_draw_triangle_fill_37, TMP_Window_enqueue_draw_38;
|
25213
25255
|
|
25214
25256
|
|
25215
25257
|
(Opal.class_variable_set($Window, '@@fps', 60));
|
25258
|
+
(Opal.class_variable_set($Window, '@@fps_ts', nil));
|
25259
|
+
(Opal.class_variable_set($Window, '@@fps_ct', 0));
|
25216
25260
|
(Opal.class_variable_set($Window, '@@real_fps', 0));
|
25217
25261
|
(Opal.class_variable_set($Window, '@@real_fps_ct', 1));
|
25218
25262
|
(Opal.class_variable_set($Window, '@@real_fps_t', Opal.const_get_relative($nesting, 'Time').$now()));
|
@@ -25229,32 +25273,32 @@ Opal.modules["dxopal/window"] = function(Opal) {
|
|
25229
25273
|
return $send(Opal.const_get_relative($nesting, 'DXOpal'), 'dump_error', [], block.$to_proc())}, TMP_2.$$s = self, TMP_2.$$arity = 0, TMP_2))
|
25230
25274
|
}, TMP_Window_load_resources_1.$$arity = 0);
|
25231
25275
|
Opal.defs(self, '$loop', TMP_Window_loop_3 = function $$loop() {
|
25232
|
-
var $a, self = this, $iter = TMP_Window_loop_3.$$p, block = $iter || nil, already_running = nil;
|
25276
|
+
var $a, TMP_4, self = this, $iter = TMP_Window_loop_3.$$p, block = $iter || nil, already_running = nil;
|
25233
25277
|
|
25234
25278
|
if ($iter) TMP_Window_loop_3.$$p = null;
|
25235
25279
|
|
25236
25280
|
already_running = (($a = $Window.$$cvars['@@block']) == null ? nil : $a)['$!']()['$!']();
|
25237
25281
|
(Opal.class_variable_set($Window, '@@block', block));
|
25238
25282
|
if ($truthy(already_running)) {
|
25239
|
-
return nil
|
25240
|
-
|
25241
|
-
|
25242
|
-
};
|
25283
|
+
return nil};
|
25284
|
+
return (window).requestAnimationFrame((TMP_4 = function(time){var self = TMP_4.$$s || this;
|
25285
|
+
if (time == null) time = nil;
|
25286
|
+
return self.$_loop(time)}, TMP_4.$$s = self, TMP_4.$$arity = 1, TMP_4));
|
25243
25287
|
}, TMP_Window_loop_3.$$arity = 0);
|
25244
|
-
Opal.defs(self, '$pause',
|
25288
|
+
Opal.defs(self, '$pause', TMP_Window_pause_5 = function $$pause() {
|
25245
25289
|
var $a, self = this;
|
25246
25290
|
|
25247
25291
|
|
25248
25292
|
(Opal.class_variable_set($Window, '@@paused', true));
|
25249
25293
|
(($a = $Window.$$cvars['@@draw_queue']) == null ? nil : $a).$clear();
|
25250
25294
|
return self.$draw_pause_screen();
|
25251
|
-
},
|
25252
|
-
Opal.defs(self, '$paused?', TMP_Window_paused$
|
25295
|
+
}, TMP_Window_pause_5.$$arity = 0);
|
25296
|
+
Opal.defs(self, '$paused?', TMP_Window_paused$q_6 = function() {
|
25253
25297
|
var $a, self = this;
|
25254
25298
|
|
25255
25299
|
return (($a = $Window.$$cvars['@@paused']) == null ? nil : $a)
|
25256
|
-
}, TMP_Window_paused$
|
25257
|
-
Opal.defs(self, '$resume',
|
25300
|
+
}, TMP_Window_paused$q_6.$$arity = 0);
|
25301
|
+
Opal.defs(self, '$resume', TMP_Window_resume_7 = function $$resume() {
|
25258
25302
|
var $a, self = this;
|
25259
25303
|
|
25260
25304
|
|
@@ -25262,33 +25306,44 @@ Opal.modules["dxopal/window"] = function(Opal) {
|
|
25262
25306
|
self.$raise("Window.resume is called before Window.loop")};
|
25263
25307
|
(Opal.class_variable_set($Window, '@@paused', false));
|
25264
25308
|
return $send(Opal.const_get_relative($nesting, 'Window'), 'loop', [], (($a = $Window.$$cvars['@@block']) == null ? nil : $a).$to_proc());
|
25265
|
-
},
|
25266
|
-
Opal.defs(self, '$draw_pause_screen',
|
25309
|
+
}, TMP_Window_resume_7.$$arity = 0);
|
25310
|
+
Opal.defs(self, '$draw_pause_screen', TMP_Window_draw_pause_screen_8 = function $$draw_pause_screen() {
|
25267
25311
|
var self = this;
|
25268
25312
|
|
25269
25313
|
|
25270
25314
|
Opal.const_get_relative($nesting, 'Window').$draw_box_fill(0, 0, Opal.const_get_relative($nesting, 'Window').$width(), Opal.const_get_relative($nesting, 'Window').$height(), Opal.const_get_relative($nesting, 'C_BLACK'));
|
25271
25315
|
return Opal.const_get_relative($nesting, 'Window').$draw_font(0, 0, "...PAUSE...", Opal.const_get_relative($nesting, 'Font').$default(), $hash2(["color"], {"color": Opal.const_get_relative($nesting, 'C_WHITE')}));
|
25272
|
-
},
|
25273
|
-
Opal.defs(self, '$_loop',
|
25274
|
-
var $a, $b,
|
25316
|
+
}, TMP_Window_draw_pause_screen_8.$$arity = 0);
|
25317
|
+
Opal.defs(self, '$_loop', TMP_Window__loop_13 = function $$_loop(timestamp) {
|
25318
|
+
var $a, $b, TMP_9, TMP_10, TMP_11, TMP_12, self = this, frame_msec = nil, passed_msec = nil, t = nil, sorted = nil;
|
25275
25319
|
|
25276
|
-
if (time == null) {
|
25277
|
-
time = 0;
|
25278
|
-
}
|
25279
25320
|
|
25280
25321
|
(Opal.class_variable_set($Window, '@@img', ($truthy($a = (($b = $Window.$$cvars['@@img']) == null ? nil : $b)) ? $a : self.$_init())));
|
25281
|
-
|
25282
|
-
|
25322
|
+
frame_msec = $rb_divide(1000.0, (($a = $Window.$$cvars['@@fps']) == null ? nil : $a));
|
25323
|
+
(Opal.class_variable_set($Window, '@@fps_ts', ($truthy($a = (($b = $Window.$$cvars['@@fps_ts']) == null ? nil : $b)) ? $a : timestamp)));
|
25324
|
+
passed_msec = $rb_minus(timestamp, (($a = $Window.$$cvars['@@fps_ts']) == null ? nil : $a));
|
25325
|
+
(Opal.class_variable_set($Window, '@@fps_ts', timestamp));
|
25326
|
+
(Opal.class_variable_set($Window, '@@fps_ct', $rb_plus((($a = $Window.$$cvars['@@fps_ct']) == null ? nil : $a), passed_msec)));
|
25327
|
+
if ($truthy($rb_ge((($a = $Window.$$cvars['@@fps_ct']) == null ? nil : $a), frame_msec))) {
|
25328
|
+
(Opal.class_variable_set($Window, '@@fps_ct', $rb_minus((($a = $Window.$$cvars['@@fps_ct']) == null ? nil : $a), frame_msec)))
|
25329
|
+
} else {
|
25330
|
+
|
25331
|
+
(window).requestAnimationFrame((TMP_9 = function(time){var self = TMP_9.$$s || this;
|
25332
|
+
if (time == null) time = nil;
|
25333
|
+
return self.$_loop(time)}, TMP_9.$$s = self, TMP_9.$$arity = 1, TMP_9));
|
25334
|
+
return nil;
|
25335
|
+
};
|
25336
|
+
t = Opal.const_get_relative($nesting, 'Time').$now();
|
25337
|
+
if ($truthy($rb_ge($rb_minus(t, (($a = $Window.$$cvars['@@real_fps_t']) == null ? nil : $a)), 1.0))) {
|
25283
25338
|
|
25284
25339
|
(Opal.class_variable_set($Window, '@@real_fps', (($a = $Window.$$cvars['@@real_fps_ct']) == null ? nil : $a)));
|
25285
25340
|
(Opal.class_variable_set($Window, '@@real_fps_ct', 1));
|
25286
|
-
(Opal.class_variable_set($Window, '@@real_fps_t',
|
25341
|
+
(Opal.class_variable_set($Window, '@@real_fps_t', t));
|
25287
25342
|
} else {
|
25288
25343
|
(Opal.class_variable_set($Window, '@@real_fps_ct', $rb_plus((($a = $Window.$$cvars['@@real_fps_ct']) == null ? nil : $a), 1)))
|
25289
25344
|
};
|
25290
25345
|
if ($truthy(Opal.const_get_relative($nesting, 'Sprite')['$matter_enabled?']())) {
|
25291
|
-
Opal.const_get_relative($nesting, 'Sprite').$matter_tick(
|
25346
|
+
Opal.const_get_relative($nesting, 'Sprite').$matter_tick(timestamp)};
|
25292
25347
|
Opal.const_get_relative($nesting, 'Input').$_on_tick();
|
25293
25348
|
(Opal.class_variable_set($Window, '@@draw_queue', []));
|
25294
25349
|
if ($truthy((($a = $Window.$$cvars['@@paused']) == null ? nil : $a))) {
|
@@ -25297,14 +25352,14 @@ Opal.modules["dxopal/window"] = function(Opal) {
|
|
25297
25352
|
$send(Opal.const_get_relative($nesting, 'DXOpal'), 'dump_error', [], (($a = $Window.$$cvars['@@block']) == null ? nil : $a).$to_proc())
|
25298
25353
|
};
|
25299
25354
|
(($a = $Window.$$cvars['@@img']) == null ? nil : $a).$box_fill(0, 0, (($a = $Window.$$cvars['@@width']) == null ? nil : $a), (($a = $Window.$$cvars['@@height']) == null ? nil : $a), (($a = $Window.$$cvars['@@bgcolor']) == null ? nil : $a));
|
25300
|
-
sorted = $send((($a = $Window.$$cvars['@@draw_queue']) == null ? nil : $a), 'sort', [], (
|
25355
|
+
sorted = $send((($a = $Window.$$cvars['@@draw_queue']) == null ? nil : $a), 'sort', [], (TMP_10 = function(a, b){var self = TMP_10.$$s || this;
|
25301
25356
|
if (a == null) a = nil;if (b == null) b = nil;
|
25302
25357
|
if (a['$[]'](0)['$=='](b['$[]'](0))) {
|
25303
25358
|
return a['$[]'](1)['$<=>'](b['$[]'](1))
|
25304
25359
|
} else {
|
25305
25360
|
return a['$[]'](0)['$<=>'](b['$[]'](0))
|
25306
|
-
}},
|
25307
|
-
$send(sorted, 'each', [], (
|
25361
|
+
}}, TMP_10.$$s = self, TMP_10.$$arity = 2, TMP_10));
|
25362
|
+
$send(sorted, 'each', [], (TMP_11 = function(item){var self = TMP_11.$$s || this, $c, $case = nil, $writer = nil;
|
25308
25363
|
if (item == null) item = nil;
|
25309
25364
|
return (function() {$case = item['$[]'](2);
|
25310
25365
|
if ("image"['$===']($case)) {return $send((($c = $Window.$$cvars['@@img']) == null ? nil : $c), 'draw', Opal.to_a(item.$drop(3)))}
|
@@ -25323,12 +25378,12 @@ if (item == null) item = nil;
|
|
25323
25378
|
else if ("circle_fill"['$===']($case)) {return $send((($c = $Window.$$cvars['@@img']) == null ? nil : $c), 'circle_fill', Opal.to_a(item.$drop(3)))}
|
25324
25379
|
else if ("triangle"['$===']($case)) {return $send((($c = $Window.$$cvars['@@img']) == null ? nil : $c), 'triangle', Opal.to_a(item.$drop(3)))}
|
25325
25380
|
else if ("triangle_fill"['$===']($case)) {return $send((($c = $Window.$$cvars['@@img']) == null ? nil : $c), 'triangle_fill', Opal.to_a(item.$drop(3)))}
|
25326
|
-
else { return nil }})()},
|
25327
|
-
return (window).requestAnimationFrame((
|
25381
|
+
else { return nil }})()}, TMP_11.$$s = self, TMP_11.$$arity = 1, TMP_11));
|
25382
|
+
return (window).requestAnimationFrame((TMP_12 = function(time){var self = TMP_12.$$s || this;
|
25328
25383
|
if (time == null) time = nil;
|
25329
|
-
return self.$_loop(time)},
|
25330
|
-
},
|
25331
|
-
Opal.defs(self, '$_init',
|
25384
|
+
return self.$_loop(time)}, TMP_12.$$s = self, TMP_12.$$arity = 1, TMP_12));
|
25385
|
+
}, TMP_Window__loop_13.$$arity = 1);
|
25386
|
+
Opal.defs(self, '$_init', TMP_Window__init_14 = function $$_init() {
|
25332
25387
|
var $a, self = this, canvas = nil, $writer = nil, img = nil;
|
25333
25388
|
|
25334
25389
|
|
@@ -25344,33 +25399,33 @@ if (time == null) time = nil;
|
|
25344
25399
|
img = Opal.const_get_relative($nesting, 'Image').$new(self.$width(), self.$height(), $hash2(["canvas"], {"canvas": canvas}));
|
25345
25400
|
Opal.const_get_relative($nesting, 'Input').$_init(canvas);
|
25346
25401
|
return img;
|
25347
|
-
},
|
25348
|
-
Opal.defs(self, '$_img',
|
25402
|
+
}, TMP_Window__init_14.$$arity = 0);
|
25403
|
+
Opal.defs(self, '$_img', TMP_Window__img_15 = function $$_img() {
|
25349
25404
|
var $a, self = this;
|
25350
25405
|
|
25351
25406
|
return (($a = $Window.$$cvars['@@img']) == null ? nil : $a)
|
25352
|
-
},
|
25353
|
-
Opal.defs(self, '$fps',
|
25407
|
+
}, TMP_Window__img_15.$$arity = 0);
|
25408
|
+
Opal.defs(self, '$fps', TMP_Window_fps_16 = function $$fps() {
|
25354
25409
|
var $a, self = this;
|
25355
25410
|
|
25356
25411
|
return (($a = $Window.$$cvars['@@fps']) == null ? nil : $a)
|
25357
|
-
},
|
25358
|
-
Opal.defs(self, '$fps=', TMP_Window_fps$
|
25412
|
+
}, TMP_Window_fps_16.$$arity = 0);
|
25413
|
+
Opal.defs(self, '$fps=', TMP_Window_fps$eq_17 = function(w) {
|
25359
25414
|
var self = this;
|
25360
25415
|
|
25361
25416
|
return (Opal.class_variable_set($Window, '@@fps', w))
|
25362
|
-
}, TMP_Window_fps$
|
25363
|
-
Opal.defs(self, '$real_fps',
|
25417
|
+
}, TMP_Window_fps$eq_17.$$arity = 1);
|
25418
|
+
Opal.defs(self, '$real_fps', TMP_Window_real_fps_18 = function $$real_fps() {
|
25364
25419
|
var $a, self = this;
|
25365
25420
|
|
25366
25421
|
return (($a = $Window.$$cvars['@@real_fps']) == null ? nil : $a)
|
25367
|
-
},
|
25368
|
-
Opal.defs(self, '$width',
|
25422
|
+
}, TMP_Window_real_fps_18.$$arity = 0);
|
25423
|
+
Opal.defs(self, '$width', TMP_Window_width_19 = function $$width() {
|
25369
25424
|
var $a, self = this;
|
25370
25425
|
|
25371
25426
|
return (($a = $Window.$$cvars['@@width']) == null ? nil : $a)
|
25372
|
-
},
|
25373
|
-
Opal.defs(self, '$width=', TMP_Window_width$
|
25427
|
+
}, TMP_Window_width_19.$$arity = 0);
|
25428
|
+
Opal.defs(self, '$width=', TMP_Window_width$eq_20 = function(w) {
|
25374
25429
|
var $a, self = this, canvas = nil;
|
25375
25430
|
|
25376
25431
|
|
@@ -25378,13 +25433,13 @@ if (time == null) time = nil;
|
|
25378
25433
|
(Opal.class_variable_set($Window, '@@width', ($truthy($a = w) ? $a : window.innerWidth)));
|
25379
25434
|
canvas.width = (($a = $Window.$$cvars['@@width']) == null ? nil : $a);
|
25380
25435
|
return canvas.style.width = (($a = $Window.$$cvars['@@width']) == null ? nil : $a);
|
25381
|
-
}, TMP_Window_width$
|
25382
|
-
Opal.defs(self, '$height',
|
25436
|
+
}, TMP_Window_width$eq_20.$$arity = 1);
|
25437
|
+
Opal.defs(self, '$height', TMP_Window_height_21 = function $$height() {
|
25383
25438
|
var $a, self = this;
|
25384
25439
|
|
25385
25440
|
return (($a = $Window.$$cvars['@@height']) == null ? nil : $a)
|
25386
|
-
},
|
25387
|
-
Opal.defs(self, '$height=', TMP_Window_height$
|
25441
|
+
}, TMP_Window_height_21.$$arity = 0);
|
25442
|
+
Opal.defs(self, '$height=', TMP_Window_height$eq_22 = function(h) {
|
25388
25443
|
var $a, self = this, canvas = nil;
|
25389
25444
|
|
25390
25445
|
|
@@ -25392,27 +25447,27 @@ if (time == null) time = nil;
|
|
25392
25447
|
(Opal.class_variable_set($Window, '@@height', ($truthy($a = h) ? $a : window.innerHeight)));
|
25393
25448
|
canvas.height = (($a = $Window.$$cvars['@@height']) == null ? nil : $a);
|
25394
25449
|
return canvas.style.height = (($a = $Window.$$cvars['@@height']) == null ? nil : $a);
|
25395
|
-
}, TMP_Window_height$
|
25450
|
+
}, TMP_Window_height$eq_22.$$arity = 1);
|
25396
25451
|
(Opal.class_variable_set($Window, '@@bgcolor', Opal.const_get_qualified(Opal.const_get_qualified(Opal.const_get_relative($nesting, 'Constants'), 'Colors'), 'C_BLACK')));
|
25397
|
-
Opal.defs(self, '$bgcolor',
|
25452
|
+
Opal.defs(self, '$bgcolor', TMP_Window_bgcolor_23 = function $$bgcolor() {
|
25398
25453
|
var $a, self = this;
|
25399
25454
|
|
25400
25455
|
return (($a = $Window.$$cvars['@@bgcolor']) == null ? nil : $a)
|
25401
|
-
},
|
25402
|
-
Opal.defs(self, '$bgcolor=', TMP_Window_bgcolor$
|
25456
|
+
}, TMP_Window_bgcolor_23.$$arity = 0);
|
25457
|
+
Opal.defs(self, '$bgcolor=', TMP_Window_bgcolor$eq_24 = function(col) {
|
25403
25458
|
var self = this;
|
25404
25459
|
|
25405
25460
|
return (Opal.class_variable_set($Window, '@@bgcolor', col))
|
25406
|
-
}, TMP_Window_bgcolor$
|
25407
|
-
Opal.defs(self, '$draw',
|
25461
|
+
}, TMP_Window_bgcolor$eq_24.$$arity = 1);
|
25462
|
+
Opal.defs(self, '$draw', TMP_Window_draw_25 = function $$draw(x, y, image, z) {
|
25408
25463
|
var self = this;
|
25409
25464
|
|
25410
25465
|
if (z == null) {
|
25411
25466
|
z = 0;
|
25412
25467
|
}
|
25413
25468
|
return self.$enqueue_draw(z, "image", x, y, image)
|
25414
|
-
},
|
25415
|
-
Opal.defs(self, '$draw_scale',
|
25469
|
+
}, TMP_Window_draw_25.$$arity = -4);
|
25470
|
+
Opal.defs(self, '$draw_scale', TMP_Window_draw_scale_26 = function $$draw_scale(x, y, image, scale_x, scale_y, center_x, center_y, z) {
|
25416
25471
|
var self = this;
|
25417
25472
|
|
25418
25473
|
if (center_x == null) {
|
@@ -25425,8 +25480,8 @@ if (time == null) time = nil;
|
|
25425
25480
|
z = 0;
|
25426
25481
|
}
|
25427
25482
|
return self.$enqueue_draw(z, "image_scale", x, y, image, scale_x, scale_y, center_x, center_y)
|
25428
|
-
},
|
25429
|
-
Opal.defs(self, '$draw_rot',
|
25483
|
+
}, TMP_Window_draw_scale_26.$$arity = -6);
|
25484
|
+
Opal.defs(self, '$draw_rot', TMP_Window_draw_rot_27 = function $$draw_rot(x, y, image, angle, center_x, center_y, z) {
|
25430
25485
|
var self = this;
|
25431
25486
|
|
25432
25487
|
if (center_x == null) {
|
@@ -25439,16 +25494,16 @@ if (time == null) time = nil;
|
|
25439
25494
|
z = 0;
|
25440
25495
|
}
|
25441
25496
|
return self.$enqueue_draw(z, "image_rot", x, y, image, angle, center_x, center_y)
|
25442
|
-
},
|
25443
|
-
Opal.defs(self, '$draw_ex',
|
25497
|
+
}, TMP_Window_draw_rot_27.$$arity = -5);
|
25498
|
+
Opal.defs(self, '$draw_ex', TMP_Window_draw_ex_28 = function $$draw_ex(x, y, image, options) {
|
25444
25499
|
var $a, self = this;
|
25445
25500
|
|
25446
25501
|
if (options == null) {
|
25447
25502
|
options = $hash2([], {});
|
25448
25503
|
}
|
25449
25504
|
return self.$enqueue_draw(($truthy($a = options['$[]']("z")) ? $a : 0), "draw_ex", x, y, image, options)
|
25450
|
-
},
|
25451
|
-
Opal.defs(self, '$draw_font',
|
25505
|
+
}, TMP_Window_draw_ex_28.$$arity = -4);
|
25506
|
+
Opal.defs(self, '$draw_font', TMP_Window_draw_font_29 = function $$draw_font(x, y, string, font, option) {
|
25452
25507
|
var $a, self = this, z = nil, color = nil;
|
25453
25508
|
|
25454
25509
|
if (option == null) {
|
@@ -25458,72 +25513,72 @@ if (time == null) time = nil;
|
|
25458
25513
|
z = ($truthy($a = option['$[]']("z")) ? $a : 0);
|
25459
25514
|
color = ($truthy($a = option['$[]']("color")) ? $a : [255, 255, 255]);
|
25460
25515
|
return self.$enqueue_draw(z, "font", x, y, string, font, color);
|
25461
|
-
},
|
25462
|
-
Opal.defs(self, '$draw_pixel',
|
25516
|
+
}, TMP_Window_draw_font_29.$$arity = -5);
|
25517
|
+
Opal.defs(self, '$draw_pixel', TMP_Window_draw_pixel_30 = function $$draw_pixel(x, y, color, z) {
|
25463
25518
|
var self = this;
|
25464
25519
|
|
25465
25520
|
if (z == null) {
|
25466
25521
|
z = 0;
|
25467
25522
|
}
|
25468
25523
|
return self.$enqueue_draw(z, "pixel", x, y, color)
|
25469
|
-
},
|
25470
|
-
Opal.defs(self, '$draw_line',
|
25524
|
+
}, TMP_Window_draw_pixel_30.$$arity = -4);
|
25525
|
+
Opal.defs(self, '$draw_line', TMP_Window_draw_line_31 = function $$draw_line(x1, y1, x2, y2, color, z) {
|
25471
25526
|
var self = this;
|
25472
25527
|
|
25473
25528
|
if (z == null) {
|
25474
25529
|
z = 0;
|
25475
25530
|
}
|
25476
25531
|
return self.$enqueue_draw(z, "line", x1, y1, x2, y2, color)
|
25477
|
-
},
|
25478
|
-
Opal.defs(self, '$draw_box',
|
25532
|
+
}, TMP_Window_draw_line_31.$$arity = -6);
|
25533
|
+
Opal.defs(self, '$draw_box', TMP_Window_draw_box_32 = function $$draw_box(x1, y1, x2, y2, color, z) {
|
25479
25534
|
var self = this;
|
25480
25535
|
|
25481
25536
|
if (z == null) {
|
25482
25537
|
z = 0;
|
25483
25538
|
}
|
25484
25539
|
return self.$enqueue_draw(z, "box", x1, y1, x2, y2, color)
|
25485
|
-
},
|
25486
|
-
Opal.defs(self, '$draw_box_fill',
|
25540
|
+
}, TMP_Window_draw_box_32.$$arity = -6);
|
25541
|
+
Opal.defs(self, '$draw_box_fill', TMP_Window_draw_box_fill_33 = function $$draw_box_fill(x1, y1, x2, y2, color, z) {
|
25487
25542
|
var self = this;
|
25488
25543
|
|
25489
25544
|
if (z == null) {
|
25490
25545
|
z = 0;
|
25491
25546
|
}
|
25492
25547
|
return self.$enqueue_draw(z, "box_fill", x1, y1, x2, y2, color)
|
25493
|
-
},
|
25494
|
-
Opal.defs(self, '$draw_circle',
|
25548
|
+
}, TMP_Window_draw_box_fill_33.$$arity = -6);
|
25549
|
+
Opal.defs(self, '$draw_circle', TMP_Window_draw_circle_34 = function $$draw_circle(x, y, r, color, z) {
|
25495
25550
|
var self = this;
|
25496
25551
|
|
25497
25552
|
if (z == null) {
|
25498
25553
|
z = 0;
|
25499
25554
|
}
|
25500
25555
|
return self.$enqueue_draw(z, "circle", x, y, r, color)
|
25501
|
-
},
|
25502
|
-
Opal.defs(self, '$draw_circle_fill',
|
25556
|
+
}, TMP_Window_draw_circle_34.$$arity = -5);
|
25557
|
+
Opal.defs(self, '$draw_circle_fill', TMP_Window_draw_circle_fill_35 = function $$draw_circle_fill(x, y, r, color, z) {
|
25503
25558
|
var self = this;
|
25504
25559
|
|
25505
25560
|
if (z == null) {
|
25506
25561
|
z = 0;
|
25507
25562
|
}
|
25508
25563
|
return self.$enqueue_draw(z, "circle_fill", x, y, r, color)
|
25509
|
-
},
|
25510
|
-
Opal.defs(self, '$draw_triangle',
|
25564
|
+
}, TMP_Window_draw_circle_fill_35.$$arity = -5);
|
25565
|
+
Opal.defs(self, '$draw_triangle', TMP_Window_draw_triangle_36 = function $$draw_triangle(x1, y1, x2, y2, x3, y3, color, z) {
|
25511
25566
|
var self = this;
|
25512
25567
|
|
25513
25568
|
if (z == null) {
|
25514
25569
|
z = 0;
|
25515
25570
|
}
|
25516
25571
|
return self.$enqueue_draw(z, "triangle", x1, y1, x2, y2, x3, y3, color)
|
25517
|
-
},
|
25518
|
-
Opal.defs(self, '$draw_triangle_fill',
|
25572
|
+
}, TMP_Window_draw_triangle_36.$$arity = -8);
|
25573
|
+
Opal.defs(self, '$draw_triangle_fill', TMP_Window_draw_triangle_fill_37 = function $$draw_triangle_fill(x1, y1, x2, y2, x3, y3, color, z) {
|
25519
25574
|
var self = this;
|
25520
25575
|
|
25521
25576
|
if (z == null) {
|
25522
25577
|
z = 0;
|
25523
25578
|
}
|
25524
25579
|
return self.$enqueue_draw(z, "triangle_fill", x1, y1, x2, y2, x3, y3, color)
|
25525
|
-
},
|
25526
|
-
Opal.defs(self, '$enqueue_draw',
|
25580
|
+
}, TMP_Window_draw_triangle_fill_37.$$arity = -8);
|
25581
|
+
Opal.defs(self, '$enqueue_draw', TMP_Window_enqueue_draw_38 = function $$enqueue_draw(z, $a_rest) {
|
25527
25582
|
var $b, self = this, args;
|
25528
25583
|
|
25529
25584
|
var $args_len = arguments.length, $rest_len = $args_len - 1;
|
@@ -25533,7 +25588,7 @@ if (time == null) time = nil;
|
|
25533
25588
|
args[$arg_idx - 1] = arguments[$arg_idx];
|
25534
25589
|
}
|
25535
25590
|
return (($b = $Window.$$cvars['@@draw_queue']) == null ? nil : $b).$push([z, (($b = $Window.$$cvars['@@draw_queue']) == null ? nil : $b).$length()].concat(Opal.to_a(args)))
|
25536
|
-
},
|
25591
|
+
}, TMP_Window_enqueue_draw_38.$$arity = -2);
|
25537
25592
|
})($nesting[0], $nesting)
|
25538
25593
|
})($nesting[0], $nesting);
|
25539
25594
|
};
|
@@ -25547,7 +25602,7 @@ Opal.modules["dxopal/version"] = function(Opal) {
|
|
25547
25602
|
|
25548
25603
|
var def = self.$$proto, $nesting = [self].concat($parent_nesting);
|
25549
25604
|
|
25550
|
-
Opal.const_set($nesting[0], 'VERSION', "1.
|
25605
|
+
Opal.const_set($nesting[0], 'VERSION', "1.5.0")
|
25551
25606
|
})($nesting[0], $nesting)
|
25552
25607
|
};
|
25553
25608
|
|