Skip to content

Commit

Permalink
Improved IE 10+ support.
Browse files Browse the repository at this point in the history
Now shows relevant error message if game cannot be ran.
  • Loading branch information
Jafnee committed Apr 22, 2014
1 parent 87e6782 commit 201c42f
Show file tree
Hide file tree
Showing 21 changed files with 32 additions and 17 deletions.
14 changes: 12 additions & 2 deletions css/main.css
Original file line number Diff line number Diff line change
@@ -1,8 +1,18 @@
@charset 'UTF-8';
@charset "UTF-8";
/*This CSS file does not validate to W3 CSS3 due to vendor prefixes required to create gradients in CSS3,
this causes parsing errors in the validator. The correct syntax has been used according to each browser
vendor.*/
body.info {
background-image: url("../images/menu/backdrop/stars.png");
}

h1.error {
position:absolute;
top: 50%;
left: 100px;
z-index: -1;
}

header {
text-align: center;
text-decoration: underline;
Expand Down Expand Up @@ -98,7 +108,7 @@ article#about {
top: 70px;
left: 4%;
width: 90%;
color: yellow;
color: yellow;
font-size: 130%;
font-family: zephyrean_brknormal, Futura, "Trebuchet MS", Arial, sans-serif;
}
Expand Down
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
<section id="gameSection">
<canvas id="gameCanvas" width="1000" height="500">
</canvas>
<h1>Your browser does not support Canvas. Please upgrade your browser.</h1>
<h1 class="error">Your browser does not support Canvas. Please upgrade your browser.</h1>
</section>
</body>

Expand Down
9 changes: 6 additions & 3 deletions js/controller/gameRunner.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
define(["view/draw", "model/game", "controller/gameLogic", "controller/action", "model/canvas", "model/sounds"], function (Draw, Game, GameLogic, Action, Canvas, Sounds) {
var gameLoop = function gameLoop() {
if (window.requestAnimationFrame === null) {
if (window.requestAnimationFrame === undefined) {
Canvas.context.fillStyle = "#FFFFFF";
Canvas.context.fillRect(0, 0, Canvas.canvas.width, Canvas.canvas.height);
Canvas.context.fillStyle = "#000000";
Canvas.context.font = "20px Verdana";
Canvas.context.fillText("Your browser does not support requestAnimationFrame", 100, 100);
Canvas.context.fillText("Please upgrade your browser", 100, 300);
Canvas.context.fillText("Your browser does not support requestAnimationFrame", 100, Canvas.canvasHeight*0.25);
Canvas.context.fillText("Please upgrade your browser", 100, Canvas.canvasHeight*0.75);
} else {
requestAnimationFrame(GameRunner.gameLoop);
GameRunner.changeTextSize();
Expand Down
4 changes: 3 additions & 1 deletion js/controller/listener.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,7 @@ define(["controller/action", "model/canvas"], function (Action, Canvas) {
Canvas.canvas.addEventListener("mouseup", function () {
Action.mouseClicked(false);
}, false);
window.addEventListener("resize", Action.resize, false);
if (window.requestAnimationFrame !== undefined) {
window.addEventListener("resize", Action.resize, false);
}
});
2 changes: 1 addition & 1 deletion js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ define(["model/sounds", "model/images", "model/canvas", "model/character", "mode
//end of test
LSM.init();
LSM.load();
if (!Game.muteMusic) {
if (!Game.muteMusic && window.requestAnimationFrame !== undefined) {
Game.musicCreated = true;
Sounds.bgMusic.play();
}
Expand Down
18 changes: 9 additions & 9 deletions js/model/sounds.js
Original file line number Diff line number Diff line change
@@ -1,44 +1,44 @@
define(["howler"], function (Howler) {
var bgMusic = new Howl({
urls: ["./sound/music/DST-DasElectron.ogg"],
urls: ["./sound/music/DST-DasElectron.ogg", "./sound/music/DST-DasElectron.mp3"],
buffer: true,
loop: true
});

var laser1 = new Howl({
urls: ["./sound/sfx/sfx_laser1.ogg"]
urls: ["./sound/sfx/sfx_laser1.ogg", "./sound/sfx/sfx_laser1.mp3"]
});

var explosion = new Howl({
urls: ["./sound/sfx/explosion.mp3"]
urls: ["./sound/sfx/explosion.ogg", "./sound/sfx/explosion.mp3"]
});

var laser2 = new Howl({
urls: ["./sound/sfx/sfx_laser2.ogg"]
urls: ["./sound/sfx/sfx_laser2.ogg", "./sound/sfx/sfx_laser2.mp3"]
});

var playerHit = new Howl({
urls: ["./sound/sfx/sfx_shieldDown.ogg"]
urls: ["./sound/sfx/sfx_shieldDown.ogg", "./sound/sfx/sfx_shieldDown.mp3"]
});

var pause = new Howl({
urls: ["./sound/sfx/pause.wav"]
});

var select = new Howl({
urls: ["./sound/sfx/select.wav"]
urls: ["./sound/sfx/select.ogg", "./sound/sfx/select.mp3", "./sound/sfx/select.wav"]
});

var death = new Howl({
urls: ["./sound/sfx/death.wav"]
urls: ["./sound/sfx/death.ogg", "./sound/sfx/death.mp3", "./sound/sfx/death.wav"]
});

var levelUp = new Howl({
urls: ["./sound/sfx/levelUp.wav"]
urls: ["./sound/sfx/levelUp.ogg", "./sound/sfx/levelUp.mp3", "./sound/sfx/levelUp.wav"]
});

var powerUp = new Howl({
urls: ["./sound/sfx/sfx_zap.ogg"]
urls: ["./sound/sfx/sfx_zap.ogg", "./sound/sfx/levelUp.mp3"]
});
var Sounds = {
levelUp: levelUp,
Expand Down
Binary file modified sound/music/DST-DasElectron.mp3
Binary file not shown.
Binary file added sound/sfx/death.mp3
Binary file not shown.
Binary file added sound/sfx/death.ogg
Binary file not shown.
Binary file added sound/sfx/explosion.ogg
Binary file not shown.
Binary file added sound/sfx/levelUp.mp3
Binary file not shown.
Binary file added sound/sfx/levelUp.ogg
Binary file not shown.
Binary file added sound/sfx/pause.mp3
Binary file not shown.
Binary file added sound/sfx/pause.ogg
Binary file not shown.
Binary file added sound/sfx/select.mp3
Binary file not shown.
Binary file added sound/sfx/select.ogg
Binary file not shown.
Binary file added sound/sfx/sfx_laser1.mp3
Binary file not shown.
Binary file added sound/sfx/sfx_laser2.mp3
Binary file not shown.
Binary file added sound/sfx/sfx_lose.mp3
Binary file not shown.
Binary file added sound/sfx/sfx_shieldDown.mp3
Binary file not shown.
Binary file added sound/sfx/sfx_zap.mp3
Binary file not shown.

0 comments on commit 201c42f

Please sign in to comment.