Commit bbdc9fdf authored by Roque's avatar Roque

erp5_officejs_drone_simulator: fullscreen feature

parent b8cbf53d
Pipeline #28645 failed with stage
in 0 seconds
...@@ -513,6 +513,8 @@ var GameManager = /** @class */ (function () { ...@@ -513,6 +513,8 @@ var GameManager = /** @class */ (function () {
function GameManager(canvas, game_parameters_json) { function GameManager(canvas, game_parameters_json) {
var drone, header_list; var drone, header_list;
this._canvas = canvas; this._canvas = canvas;
this._canvas_width = canvas.width;
this._canvas_height = canvas.height;
this._scene = null; this._scene = null;
this._engine = null; this._engine = null;
this._droneList = []; this._droneList = [];
...@@ -575,7 +577,7 @@ var GameManager = /** @class */ (function () { ...@@ -575,7 +577,7 @@ var GameManager = /** @class */ (function () {
}); });
}; };
GameManager.prototype.update = function () { GameManager.prototype.update = function (fullscreen) {
// time delta means that drone are updated every virtual second // time delta means that drone are updated every virtual second
// This is fixed and must not be modified // This is fixed and must not be modified
// otherwise, it will lead to different scenario results // otherwise, it will lead to different scenario results
...@@ -587,10 +589,8 @@ var GameManager = /** @class */ (function () { ...@@ -587,10 +589,8 @@ var GameManager = /** @class */ (function () {
function triggerUpdateIfPossible() { function triggerUpdateIfPossible() {
if ((_this._canUpdate) && (_this.ongoing_update_promise === null) && if ((_this._canUpdate) && (_this.ongoing_update_promise === null) &&
(0 < _this.waiting_update_count)) { (0 < _this.waiting_update_count)) {
_this.ongoing_update_promise = _this._update( _this.ongoing_update_promise = _this._update(TIME_DELTA, fullscreen)
TIME_DELTA, .push(function () {
(_this.waiting_update_count === 1)
).push(function () {
_this.waiting_update_count -= 1; _this.waiting_update_count -= 1;
_this.ongoing_update_promise = null; _this.ongoing_update_promise = null;
triggerUpdateIfPossible(); triggerUpdateIfPossible();
...@@ -626,7 +626,7 @@ var GameManager = /** @class */ (function () { ...@@ -626,7 +626,7 @@ var GameManager = /** @class */ (function () {
return false; return false;
}; };
GameManager.prototype._update = function (delta_time) { GameManager.prototype._update = function (delta_time, fullscreen) {
var _this = this, var _this = this,
queue = new RSVP.Queue(), queue = new RSVP.Queue(),
i; i;
...@@ -642,6 +642,20 @@ var GameManager = /** @class */ (function () { ...@@ -642,6 +642,20 @@ var GameManager = /** @class */ (function () {
} }
} }
if (fullscreen) {
//Only resize if size changes
if (this._canvas.width !== this._canvas_width * 2) {
this._canvas.width = this._canvas_width * 2;
this._canvas.height = this._canvas_height * 2;
}
} else {
if (this._canvas.width !== this._canvas_width) {
this._canvas.width = this._canvas_width;
this._canvas.height = this._canvas_height;
this._engine.resize(true);
}
}
this._droneList.forEach(function (drone) { this._droneList.forEach(function (drone) {
queue.push(function () { queue.push(function () {
drone._tick += 1; drone._tick += 1;
...@@ -1043,9 +1057,9 @@ var runGame, updateGame; ...@@ -1043,9 +1057,9 @@ var runGame, updateGame;
return game_manager_instance.run(); return game_manager_instance.run();
}; };
updateGame = function () { updateGame = function (fullscreen) {
if (game_manager_instance) { if (game_manager_instance) {
return game_manager_instance.update(); return game_manager_instance.update(fullscreen);
} }
}; };
......
...@@ -226,7 +226,7 @@ ...@@ -226,7 +226,7 @@
</item> </item>
<item> <item>
<key> <string>actor</string> </key> <key> <string>actor</string> </key>
<value> <string>zope</string> </value> <value> <unicode>zope</unicode> </value>
</item> </item>
<item> <item>
<key> <string>comment</string> </key> <key> <string>comment</string> </key>
...@@ -240,7 +240,7 @@ ...@@ -240,7 +240,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>1006.43905.28804.11980</string> </value> <value> <string>1009.7343.39937.16861</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -260,7 +260,7 @@ ...@@ -260,7 +260,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1677600104.11</float> <float>1686857368.61</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment