Skip to content

Commit

Permalink
support for internet explorer
Browse files Browse the repository at this point in the history
  • Loading branch information
shooshx committed Apr 10, 2015
1 parent 92cbf53 commit d6fbb1b
Show file tree
Hide file tree
Showing 22 changed files with 187 additions and 61 deletions.
2 changes: 2 additions & 0 deletions .htaccess
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
AddOutputFilterByType DEFLATE text/html text/plain text/xml text/javascript text/css application/javascript application/json

# you need to add to WAMP apache mod_filter,mod_deflate for these to work
84 changes: 58 additions & 26 deletions build/build_release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,31 +5,32 @@ if [ ! -d "release" ]; then
fi

#increment build number
bldnum=`cat work/build_number.js | tr -cd '[:digit:]'`
bldnum=`cat src/build_number.js | tr -cd '[:digit:]'`
bldnum=$((bldnum+1))
echo build number $bldnum
echo // this file is created by the build script > work/build_number.js
echo var BUILD_NUMBER=$bldnum\; >> work/build_number.js
echo // this file is created by the build script > src/build_number.js
echo var BUILD_NUMBER=$bldnum\; >> src/build_number.js

jslist="
work/jquery.cookie.js
work/browserDetect.js
work/webgl-utils.js
work/glMatrix-0.9.4.min.js
work/pUtils.js
work/transform.js
work/shaders.js
work/player.js
work/userInput.js
work/geomProcess.js
work/aiControl.js
work/sfx.js
work/viewPoint.js
work/screens2d.js
work/build_number.js
work/gameControl.js
work/loadManager.js
work/main.js"
src/jquery.cookie.js
src/browserDetect.js
src/webgl-utils.js
src/glMatrix-0.9.4.min.js
src/pUtils.js
src/transform.js
src/shaders.js
src/player.js
src/userInput.js
src/geomProcess.js
src/aiControl.js
src/sfx.js
src/viewPoint.js
src/widgets2d.js
src/screens2d.js
src/build_number.js
src/gameControl.js
src/loadManager.js
src/main.js"

minjsout=release/cycleblob.min.js

Expand All @@ -38,17 +39,48 @@ acnt=($cnt)
echo original:
echo ${acnt[0]} lines, ${acnt[1]} bytes

cat $jslist | ./minify/UglifyJS/bin/uglifyjs -mt -nc --max-line-len 600 --reserved-names webGLStart -o $minjsout
#./node_modules/uglify-js/bin/uglifyjs --help
./node_modules/uglify-js/bin/uglifyjs $jslist -mt -nc --max-line-len 600 --reserved-names webGLStart -o $minjsout

cnt=`cat $minjsout | wc -l -c`
acnt=($cnt)
echo minified:
echo ${acnt[0]} lines, ${acnt[1]} bytes

cp work/release.html release/index.html
cp work/shaders.html release/
cp work/about.php release/
cp work/contact.php release/
cp ./release.html release/index.html
cp ./src/jquery-1.4.4.min.js release/

reclist="
img/title_text9.svg
img/speaker_on.svg
img/speaker_off.svg
img/icon_Refresh.png
img/icon_Playb.png
img/icon_Desktop.png
img/icon_Forward.png
img/instructions3.svgz
img/instructions_header.png
img/rep_image.png
img/.htaccess
sound/turn5.ogg
sound/turn5.mp3
sound/powerup2.ogg
sound/powerup2.mp3
sound/crash2.ogg
sound/crash2.mp3
sound/coin_up3.ogg
sound/coin_up3.mp3
./shaders.html
./about.php
./contact.php
./page.css
./.htaccess
"

cp --parents $reclist release/




# count all identifiers:
# cat release/cycleblob.min.js | tr -c '[:alnum:]' '\n' | sort | uniq -c | sort -r > _count1.txt
Expand Down
12 changes: 10 additions & 2 deletions instructions.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,10 @@
install node.js installer for windows
extract node-modules to this directory where the build script is
install mingw, add msys package (install cygwin, default packages)
download nodejs executable for windows
extract node-modules.zip to the git root
copy node.exe to C:\MinGW\msys\1.0\bin (C:\cygwin64\bin)
run C:\MinGW\msys\1.0\msys.bat / cygwin terminal
in terminal:
cd to the git root /c/projects/webgl/cycleblob/work (/cygdrive/c/projects/webgl/cycleblob/work)
where \build is
run ./build/build_release.sh

28 changes: 20 additions & 8 deletions page.html
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
<!--<script type="text/javascript" src="worker.js"></script> <!-- here just for listing in the debugger -->

<script type="text/javascript">
enableDebug();
enableDebug(); // use writeDebug()
</script>

<script src="src/colorwheel/raphael-1.3.1-min.js"></script>
Expand Down Expand Up @@ -143,21 +143,33 @@ <h2>You have JavaScript disabled</h2>
-->
<script src="http://connect.facebook.net/en_US/all.js#xfbml=1"></script><fb:like href="http://cycleblob.com/" layout="button_count" show_faces="false" width="70" font="" colorscheme="dark"></fb:like>
</div>
<audio id="turnSound1" src="sound/turn5.ogg" preload="auto"></audio>
<audio id="powerupSound" src="sound/powerup2.ogg" preload="auto"></audio>
<audio id="crashSound" src="sound/crash2.ogg" preload="auto"></audio>
<audio id="coinUp" src="sound/coin_up3.ogg" preload="auto"></audio>
<audio id="turnSound1" preload="auto">
<source src="sound/turn5.ogg" type="audio/ogg"></source>
<source src="sound/turn5.mp3" type="audio/mpeg"></source>
</audio>
<audio id="powerupSound" preload="auto">
<source src="sound/powerup2.ogg" type="audio/ogg"></source>
<source src="sound/powerup2.mp3" type="audio/mpeg"></source>
</audio>
<audio id="crashSound" preload="auto">
<source src="sound/crash2.ogg" type="audio/ogg"></source>
<source src="sound/crash2.mp3" type="audio/mpeg"></source>
</audio>
<audio id="coinUp" preload="auto">
<source src="sound/coin_up3.ogg" type="audio/ogg"></source>
<source src="sound/coin_up3.mp3" type="audio/mpeg"></source>
</audio>

<img id="soundOnImg" src="img/speaker_on.svg" style="display:none"></img>
<img id="soundOffImg" src="img/speaker_off.svg" style="display:none"></img>
<img id="titleTextImg" src="img/title_text8.svg" style="display:none"></img>
<img id="titleTextImg" src="img/title_text9.svg" style="visibility:hidden"></img> <!--IE11 doesn't know the size without this style-->
<img id="againImg" src="img/icon_Refresh.png" style="display:none"></img>
<img id="resumeImg" src="img/icon_Playb.png" style="display:none"></img>
<img id="menuImg" src="img/icon_Desktop.png" style="display:none"></img>
<img id="nextImg" src="img/icon_Forward.png" style="display:none"></img>

<img id="instructImg" src="img/instructions3.svgz" style="display:none"></img> <!-- missing the header image -->
<img id="instructHeader" src="img/instructions_header.png" style="display:none"></img> <!-- missing the header image -->
<img id="instructImg" src="img/instructions3.svgz" style="visibility:hidden"></img> <!-- missing the header image -->
<img id="instructHeader" src="img/instructions_header.png" style="display:none"></img>

<!-- debugging UI -->
<link rel="stylesheet" href="ui/themes/base/jquery.ui.all.css">
Expand Down
26 changes: 19 additions & 7 deletions release.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
})();
</script>
</head>
<body onload="cb.webGLStart();">
<body onload="webGLStart();">
<iframe id="shadersFrame" src="shaders.html" style="display:none"></iframe>

<div id="canvas-container" style="position:relative; height:650px; width:80%; margin:auto;">
Expand All @@ -42,20 +42,32 @@ <h2>You have JavaScript disabled</h2>
</div>
<img id="repImg" src="img/rep_image.png" style="display:none"></img> <!-- for facebook -->

<audio id="turnSound1" src="sound/turn5.ogg" preload="auto" style="display:none"></audio>
<audio id="powerupSound" src="sound/powerup2.ogg" preload="auto" style="display:none"></audio>
<audio id="crashSound" src="sound/crash2.ogg" preload="auto" style="display:none"></audio>
<audio id="coinUp" src="sound/coin_up3.ogg" preload="auto" style="display:none"></audio>
<audio id="turnSound1" preload="auto">
<source src="sound/turn5.ogg" type="audio/ogg"></source>
<source src="sound/turn5.mp3" type="audio/mpeg"></source>
</audio>
<audio id="powerupSound" preload="auto">
<source src="sound/powerup2.ogg" type="audio/ogg"></source>
<source src="sound/powerup2.mp3" type="audio/mpeg"></source>
</audio>
<audio id="crashSound" preload="auto">
<source src="sound/crash2.ogg" type="audio/ogg"></source>
<source src="sound/crash2.mp3" type="audio/mpeg"></source>
</audio>
<audio id="coinUp" preload="auto">
<source src="sound/coin_up3.ogg" type="audio/ogg"></source>
<source src="sound/coin_up3.mp3" type="audio/mpeg"></source>
</audio>

<img id="soundOnImg" src="img/speaker_on.svg" style="display:none"></img>
<img id="soundOffImg" src="img/speaker_off.svg" style="display:none"></img>
<img id="titleTextImg" src="img/title_text8.svg" style="display:none"></img>
<img id="titleTextImg" src="img/title_text9.svg" style="visibility:hidden"></img> <!--IE11 doesn't know the size without this style-->
<img id="againImg" src="img/icon_Refresh.png" style="display:none"></img>
<img id="resumeImg" src="img/icon_Playb.png" style="display:none"></img>
<img id="menuImg" src="img/icon_Desktop.png" style="display:none"></img>
<img id="nextImg" src="img/icon_Forward.png" style="display:none"></img>

<img id="instructImg" src="img/instructions3.svgz" style="display:none"></img> <!-- missing the header image -->
<img id="instructImg" src="img/instructions3.svgz" style="visibility:hidden"></img> <!-- missing the header image -->
<img id="instructHeader" src="img/instructions_header.png" style="display:none"></img> <!-- missing the header image -->

</body>
Expand Down
Binary file added sound/coin_up3.mp3
Binary file not shown.
Binary file added sound/crash2.mp3
Binary file not shown.
Binary file added sound/powerup2.mp3
Binary file not shown.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Binary file added sound/turn5.mp3
Binary file not shown.
4 changes: 2 additions & 2 deletions src/build_number.js
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
// this file is created by the build script
var BUILD_NUMBER=166
// this file is created by the build script
var BUILD_NUMBER=182;
13 changes: 10 additions & 3 deletions src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -323,11 +323,16 @@ function animate(elapsed) {
world.staticDraw[si].advance(elapsed);
}
for(var bi in world.bonuses) {
world.bonuses[bi].advance(elapsed);
if (!world.bonuses[bi].advance(elapsed)) {
delete world.bonuses[bi]
}
}

world.background.advance(elapsed);
if (!game.isPaused() || game._startPause) // on the start we want to animate the back
world.background.advance(elapsed); // 3d background stripes

if (c2d.menuAnim)
c2d.menuAnim(elapsed)

return doDraw;
//writeDebug(elapsed + " " + iterCount );
Expand Down Expand Up @@ -390,7 +395,8 @@ function tick() {
if (enabled3d) // enabled3d can change in animate
drawScene();

if (gameConf.printFps) dispFps(elapsed);
if (gameConf.printFps)
dispFps(elapsed);

}

Expand All @@ -401,6 +407,7 @@ function deployBonus() {
if (!world.ready || !resources._ready || !enabled3d || game.isPaused())
return;

//var chance = 100
var chance = (world.bonuses.length > 0)?0.2:3
// 5% chance every 500 msec is 1 in 10 sec
// 2% chance every 500 msec is 1 in 25 sec
Expand Down
34 changes: 27 additions & 7 deletions src/screens2d.js
Original file line number Diff line number Diff line change
Expand Up @@ -267,9 +267,26 @@ C2d.prototype.verbosePauseScreen = function()
return true;
}

this.drawGameState();
this.fadeIn()
//this.drawGameState();
}

C2d.prototype.fadeIn = function()
{
canvas2d.style.opacity = 0
this.menuAnim = function(elapsed) {
op = parseFloat(canvas2d.style.opacity) + elapsed * 0.008
if (op >= 1) {
op = 1
c2d.menuAnim = null
}
//writeDebug(op)
canvas2d.style.opacity = op
this.drawGameState();
}
}


C2d.prototype.loadingScreen = function(pc)
{
this.blankScr("black");
Expand Down Expand Up @@ -774,16 +791,20 @@ LifesRenderable.ROTX_SPEED = 90 / 1000;
LifesRenderable.ROTY_SPEED = 180 / 1000;
// a pass is either a death or a new life
LifesRenderable.PASS_PEAK_LIGHT = 3;
LifesRenderable.PASS_PEAK_TIME = 1000;
LifesRenderable.PASS_TOTAL_TIME = 2000; // starting from the beginning
LifesRenderable.PASS_PEAK_TIME = 500; //1000;
LifesRenderable.PASS_TOTAL_TIME = 1000; //2000; // starting from the beginning

// static function.
// climb from 1 to 3 and then back to 0 again
// if its time for the end of the animation, call onstop.
// this is better than using a return value because I don't need to checn the return value when this function returns.
LifesRenderable.getLightFactor = function(msec, onstop) {

// this is better than using a return value because I don't need to check the return value when this function returns.
LifesRenderable.getLightFactor = function(msec, onstop) {
if (msec >= 0) {
d = 1 + 2*Math.sin(msec/LifesRenderable.PASS_TOTAL_TIME * Math.PI)
//writeDebug(msec + " " + d)
if (d > 0)
return d; // when it goes negative, time to remove it

if (msec <= LifesRenderable.PASS_PEAK_TIME)
return 1 + (LifesRenderable.PASS_PEAK_LIGHT / LifesRenderable.PASS_PEAK_TIME) * msec;
else if (msec <= LifesRenderable.PASS_TOTAL_TIME)
Expand Down Expand Up @@ -840,7 +861,6 @@ LifesRenderable.prototype.startDeath = function() {
this.activeDeath = 0;
}
LifesRenderable.prototype.startOneUp = function() {

this.activeOneUp = 0;
}

Expand Down
Loading

0 comments on commit d6fbb1b

Please sign in to comment.