Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Tree: 06114e13a0
Fetching contributors…

Cannot retrieve contributors at this time

81 lines (73 sloc) 2.783 kB
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" type="text/css" href="test.css"/>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<!-- <script type="text/javascript" src="externals/webgl-debug.js"></script> -->
<script src="http://commondatastorage.googleapis.com/chestergl/Stats.js"></script>
<script type="text/javascript" src="chester.js"></script>
<!-- audio!! -->
<script type="text/javascript">
$(document).ready(function () {
setupGame();
function setupGame() {
chesterGL.settings['useGoogleAnalytics'] = true;
chesterGL.setup("demo-canvas");
var size = chesterGL.viewportSize();
var oneDeg = Math.PI / 180.0;
chesterGL.loadAsset("texture", "images/test.png");
chesterGL.loadAsset("texture", "images/star.png");
chesterGL.assetsLoaded("texture", function () {
// $("#loading").html("Test Single Block");
// finish with the setup and run the game
chesterGL.setupPerspective();
var sceneBlock = new chesterGL.Block(null, chesterGL.Block.TYPE['SCENE']);
sceneBlock.title = "Test::Primitives";
chesterGL.setRunningScene(sceneBlock);
// create a primitive block
var someBlock = new chesterGL.PrimitiveBlock();
var w = size.width / 2, h = size.height / 2;
var poly1 = [[w - 50, h - 50, 0], [w - 50, h + 50, 0], [w + 50, h + 50, 0], [w + 50, h - 50, 0]];
var poly2 = [[w, h , 0], [w, h + 100, 0], [w + 100, h + 100, 0], [w + 100, h, 0]];
someBlock.setUpdate(function () {
var i;
var color = [1, 1, 1, 1];
for (i=0; i < size.width / 4; i += 2) {
color[0] = Math.random();
color[1] = Math.random();
color[2] = Math.random();
someBlock.drawPoint(i, i, color);
}
someBlock.drawLine(0, 0, 12, 150);
someBlock.drawLine(10, 300, 100, 300);
someBlock.drawPolygon(poly1, [1, 0, 0, 1], true);
someBlock.drawPolygon(poly2, [0, 1, 0, 1], true);
});
sceneBlock.addChild(someBlock);
chesterGL.run();
// draw a single frame (for debug purposes)
// chesterGL.drawScene();
});
} // setupGame()
});
</script>
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-77863-9']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
</head>
<body>
<div id="loading" style="position: absolute; z-index: 100;"></div>
<div id="game-container">
<canvas id="demo-canvas" width="640" height="480"></canvas>
<div>
</div>
</div>
</body>
</html>
Jump to Line
Something went wrong with that request. Please try again.