First commit.

This commit is contained in:
Robert Kolner committed 2012-03-12 20:53:13 +01:00
commit 3d1727986b
3 files changed
+9320

No files matched your search

Executable
+10
View File
@@ -0,0 +1,10 @@
<html>
<head>
<script src="jquery-1.7.1.js"></script>
<script src="tetris.js"></script>
</head>
<body>
<canvas id="tetris-board" height="720" width="480" />
</body>
</html>
+9266
View File
File diff suppressed because it is too large. Load diff
+44
View File
@@ -0,0 +1,44 @@
/********************/
/* Global variables */
/********************/
/* Pixel-dependant: */
var pxWidth = 168;
var pxHeight = 253;
var pxSeparatorSize = 2;
var pxRectSize = 15;
var context = null;
/* Segment-dependant: */
var sWidth = 10;
var sHeight = 15;
var segments = 0;
/**************/
/* Functions: */
/**************/
function drawRectangle(x, y, color) {
var topLeftCornerX = x*(pxSeparatorSize+pxRectSize);
var topLeftCornerY = pxHeight - y*(pxSeparatorSize+pxRectSize);
context.beginPath();
context.rect(topLeftCornerX, topLeftCornerY, pxRectSize, pxRectSize);
context.fillStyle = color;
context.fill();
}
/**********/
/* "Main" */
/**********/
$(document).ready(function() {
var canvas = document.getElementById("tetris-board");
context = canvas.getContext("2d");
drawRectangle(0,0,"blue");
drawRectangle(1,1,"red");
drawRectangle(2,2,"red");
drawRectangle(3,1,"red");
});