Skip to content

Tutorial: Basic Setup

coolhome edited this page Feb 23, 2013 · 4 revisions

Basics

Learning the very basics of ChesterGL will be our first topic. ChesterGL uses HTML5's new canvas tag. ChesterGL will use WebGL if the browser supports it, if not it will default to using the canvas 2d rendering api which should be supported by all major browsers in the near future. Below is a very basic example of setting up a ChesterGL canvas. When if you this the canvas should be black. This is because you are not rendering anything to it.

<!DOCTYPE html>
<html>
<head>
    <script type="text/javascript" src="/path/to/jquery.min.js"></script>
    <script type="text/javascript" src="/path/to/chester.js"></script>
    <script type="text/javascript">
        $(document).ready({}
            chesterGL.setup("game-canvas"); //Init the canvas
            chesterGL.setupPerspective(); //If WebGL is supported, setup the canvas for either 2d or 3d from settings. 
            chesterGL.run(); //Run the update ticks.
        });
    </script>
</head>
<body>
<canvas id="game-canvas" width="800" height="600"></canvas>
</body>
</html>

Primitives

TODO

Loading Assets

TODO

Blocks & Block Groups

TODO

Clone this wiki locally