Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(384)

Side by Side Diff: chrome/renderer/resources/offline.js

Issue 917093003: Shorten Closure template notation from Array.<*> to Array<*>. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: remove cvox Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2014 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 (function() { 4 (function() {
5 'use strict'; 5 'use strict';
6 /** 6 /**
7 * T-Rex runner. 7 * T-Rex runner.
8 * @param {string} outerContainerId Outer containing element id. 8 * @param {string} outerContainerId Outer containing element id.
9 * @param {object} opt_config 9 * @param {object} opt_config
10 * @constructor 10 * @constructor
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 CANVAS: 'runner-canvas', 134 CANVAS: 'runner-canvas',
135 CONTAINER: 'runner-container', 135 CONTAINER: 'runner-container',
136 CRASHED: 'crashed', 136 CRASHED: 'crashed',
137 ICON: 'icon-offline', 137 ICON: 'icon-offline',
138 TOUCH_CONTROLLER: 'controller' 138 TOUCH_CONTROLLER: 'controller'
139 }; 139 };
140 140
141 141
142 /** 142 /**
143 * Image source urls. 143 * Image source urls.
144 * @enum {array.<object>} 144 * @enum {array<object>}
145 */ 145 */
146 Runner.imageSources = { 146 Runner.imageSources = {
147 LDPI: [ 147 LDPI: [
148 {name: 'CACTUS_LARGE', id: '1x-obstacle-large'}, 148 {name: 'CACTUS_LARGE', id: '1x-obstacle-large'},
149 {name: 'CACTUS_SMALL', id: '1x-obstacle-small'}, 149 {name: 'CACTUS_SMALL', id: '1x-obstacle-small'},
150 {name: 'CLOUD', id: '1x-cloud'}, 150 {name: 'CLOUD', id: '1x-cloud'},
151 {name: 'HORIZON', id: '1x-horizon'}, 151 {name: 'HORIZON', id: '1x-horizon'},
152 {name: 'RESTART', id: '1x-restart'}, 152 {name: 'RESTART', id: '1x-restart'},
153 {name: 'TEXT_SPRITE', id: '1x-text'}, 153 {name: 'TEXT_SPRITE', id: '1x-text'},
154 {name: 'TREX', id: '1x-trex'} 154 {name: 'TREX', id: '1x-trex'}
(...skipping 807 matching lines...) Expand 10 before | Expand all | Expand 10 after
962 962
963 963
964 //****************************************************************************** 964 //******************************************************************************
965 965
966 /** 966 /**
967 * Check for a collision. 967 * Check for a collision.
968 * @param {!Obstacle} obstacle 968 * @param {!Obstacle} obstacle
969 * @param {!Trex} tRex T-rex object. 969 * @param {!Trex} tRex T-rex object.
970 * @param {HTMLCanvasContext} opt_canvasCtx Optional canvas context for drawing 970 * @param {HTMLCanvasContext} opt_canvasCtx Optional canvas context for drawing
971 * collision boxes. 971 * collision boxes.
972 * @return {Array.<CollisionBox>} 972 * @return {Array<CollisionBox>}
973 */ 973 */
974 function checkForCollision(obstacle, tRex, opt_canvasCtx) { 974 function checkForCollision(obstacle, tRex, opt_canvasCtx) {
975 var obstacleBoxXPos = Runner.defaultDimensions.WIDTH + obstacle.xPos; 975 var obstacleBoxXPos = Runner.defaultDimensions.WIDTH + obstacle.xPos;
976 976
977 // Adjustments are made to the bounding box as there is a 1 pixel white 977 // Adjustments are made to the bounding box as there is a 1 pixel white
978 // border around the t-rex and obstacles. 978 // border around the t-rex and obstacles.
979 var tRexBox = new CollisionBox( 979 var tRexBox = new CollisionBox(
980 tRex.xPos + 1, 980 tRex.xPos + 1,
981 tRex.yPos + 1, 981 tRex.yPos + 1,
982 tRex.config.WIDTH - 2, 982 tRex.config.WIDTH - 2,
(...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after
1337 MIN_JUMP_HEIGHT: 30, 1337 MIN_JUMP_HEIGHT: 30,
1338 SPEED_DROP_COEFFICIENT: 3, 1338 SPEED_DROP_COEFFICIENT: 3,
1339 SPRITE_WIDTH: 262, 1339 SPRITE_WIDTH: 262,
1340 START_X_POS: 50, 1340 START_X_POS: 50,
1341 WIDTH: 44 1341 WIDTH: 44
1342 }; 1342 };
1343 1343
1344 1344
1345 /** 1345 /**
1346 * Used in collision detection. 1346 * Used in collision detection.
1347 * @type {Array.<CollisionBox>} 1347 * @type {Array<CollisionBox>}
1348 */ 1348 */
1349 Trex.collisionBoxes = [ 1349 Trex.collisionBoxes = [
1350 new CollisionBox(1, -1, 30, 26), 1350 new CollisionBox(1, -1, 30, 26),
1351 new CollisionBox(32, 0, 8, 16), 1351 new CollisionBox(32, 0, 8, 16),
1352 new CollisionBox(10, 35, 14, 8), 1352 new CollisionBox(10, 35, 14, 8),
1353 new CollisionBox(1, 24, 29, 5), 1353 new CollisionBox(1, 24, 29, 5),
1354 new CollisionBox(5, 30, 21, 4), 1354 new CollisionBox(5, 30, 21, 4),
1355 new CollisionBox(9, 34, 15, 4) 1355 new CollisionBox(9, 34, 15, 4)
1356 ]; 1356 ];
1357 1357
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after
1634 DistanceMeter.dimensions = { 1634 DistanceMeter.dimensions = {
1635 WIDTH: 10, 1635 WIDTH: 10,
1636 HEIGHT: 13, 1636 HEIGHT: 13,
1637 DEST_WIDTH: 11 1637 DEST_WIDTH: 11
1638 }; 1638 };
1639 1639
1640 1640
1641 /** 1641 /**
1642 * Y positioning of the digits in the sprite sheet. 1642 * Y positioning of the digits in the sprite sheet.
1643 * X position is always 0. 1643 * X position is always 0.
1644 * @type {array.<number>} 1644 * @type {array<number>}
1645 */ 1645 */
1646 DistanceMeter.yPos = [0, 13, 27, 40, 53, 67, 80, 93, 107, 120]; 1646 DistanceMeter.yPos = [0, 13, 27, 40, 53, 67, 80, 93, 107, 120];
1647 1647
1648 1648
1649 /** 1649 /**
1650 * Distance meter config. 1650 * Distance meter config.
1651 * @enum {number} 1651 * @enum {number}
1652 */ 1652 */
1653 DistanceMeter.config = { 1653 DistanceMeter.config = {
1654 // Number of digits. 1654 // Number of digits.
(...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after
2063 this.xPos[1] = HorizonLine.dimensions.WIDTH; 2063 this.xPos[1] = HorizonLine.dimensions.WIDTH;
2064 } 2064 }
2065 }; 2065 };
2066 2066
2067 2067
2068 //****************************************************************************** 2068 //******************************************************************************
2069 2069
2070 /** 2070 /**
2071 * Horizon background class. 2071 * Horizon background class.
2072 * @param {HTMLCanvasElement} canvas 2072 * @param {HTMLCanvasElement} canvas
2073 * @param {Array.<HTMLImageElement>} images 2073 * @param {Array<HTMLImageElement>} images
2074 * @param {object} dimensions Canvas dimensions. 2074 * @param {object} dimensions Canvas dimensions.
2075 * @param {number} gapCoefficient 2075 * @param {number} gapCoefficient
2076 * @constructor 2076 * @constructor
2077 */ 2077 */
2078 function Horizon(canvas, images, dimensions, gapCoefficient) { 2078 function Horizon(canvas, images, dimensions, gapCoefficient) {
2079 this.canvas = canvas; 2079 this.canvas = canvas;
2080 this.canvasCtx = this.canvas.getContext('2d'); 2080 this.canvasCtx = this.canvas.getContext('2d');
2081 this.config = Horizon.config; 2081 this.config = Horizon.config;
2082 this.dimensions = dimensions; 2082 this.dimensions = dimensions;
2083 this.gapCoefficient = gapCoefficient; 2083 this.gapCoefficient = gapCoefficient;
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
2244 2244
2245 /** 2245 /**
2246 * Add a new cloud to the horizon. 2246 * Add a new cloud to the horizon.
2247 */ 2247 */
2248 addCloud: function() { 2248 addCloud: function() {
2249 this.clouds.push(new Cloud(this.canvas, this.cloudImg, 2249 this.clouds.push(new Cloud(this.canvas, this.cloudImg,
2250 this.dimensions.WIDTH)); 2250 this.dimensions.WIDTH));
2251 } 2251 }
2252 }; 2252 };
2253 })(); 2253 })();
OLDNEW
« no previous file with comments | « chrome/renderer/resources/extensions/file_system_provider_custom_bindings.js ('k') | chrome/test/base/js2gtest.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698