public
Description: A proof of concept tower defense game written in Processing.js
Homepage: http://www.willarson.com/code/processing/ptd.html
Clone URL: git://github.com/rictic/processing-tower-defense.git
rictic (author)
Thu Jun 12 19:25:09 -0700 2008
commit  3ba799af4eebe0e61942e25e3820e42d9590aa0d
tree    8cc2727e7b3d5be12083c678ef863f8bd9239b78
parent  6ff639074df8eac70282b241ff72704ff8005ee9
processing-tower-defense / jsfprocessing.js
100644 102 lines (79 sloc) 2.009 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
var GLOBAL_PROCESSING;
function set_canvas(id) {
  var canvas = document.getElementById(id);
  GLOBAL_PROCESSING = Processing(canvas);
}
 
function size(height, width) {
  GLOBAL_PROCESSING.size(height, width);
}
function stroke(color) {
  GLOBAL_PROCESSING.stroke(color);
}
function background(color) {
  GLOBAL_PROCESSING.background(color);
}
 
function line(x1, y1, x2, y2) {
  GLOBAL_PROCESSING.line(x1, y1, x2, y2);
}
 
var draw = function() {}; // stub to replace
 
function frameRate(rate) {
  var interval = 1000.00 / rate;
  setInterval(draw, interval);
}
 
function height() {
  return GLOBAL_PROCESSING.height;
}
 
function width() {
  return GLOBAL_PROCESSING.width;
}
 
function rect(x,y,width,height) {
  return GLOBAL_PROCESSING.rect(x,y,width,height);
}
 
function ellipse(x,y,width,height) {
  return GLOBAL_PROCESSING.ellipse(x,y,width,height);
}
 
function triangle(x1,y1,x2,y2,x3,y3) {
  return GLOBAL_PROCESSING.triangle(x1,y1,x2,y2,x3,y3);
}
 
function fill(color) {
  return GLOBAL_PROCESSING.fill(color);
}
 
var color = function(r,g,b,a) {
  if (!a)
    return "rgb(" + r + "," + g + "," + b + ")";
  else
    return "rgba(" + r + "," + g + "," + b + "," + a +")";
};
 
function translate(width, height) {
  return GLOBAL_PROCESSING.translate(width, height);
}
 
function noFill() {
  return GLOBAL_PROCESSING.noFill();
}
 
function noStroke() {
  return GLOBAL_PROCESSING.noStroke();
}
 
function mouse_pos() {
  return {x:GLOBAL_PROCESSING.mouseX, y:GLOBAL_PROCESSING.mouseY};
}
 
function previous_mouse_pos() {
  return {x:GLOBAL_PROCESSING.pmouseX, y:GLOBAL_PROCESSING.pmouseY};
}
 
function mousePressed(func) {
  GLOBAL_PROCESSING.mousePressed = func;
}
 
function mouseReleased(func) {
  GLOBAL_PROCESSING.mouseReleased = func;
}
 
function mouseMoved(func) {
  GLOBAL_PROCESSING.mouseMoved = func;
}
 
function mouseReleased(func) {
  GLOBAL_PROCESSING.mouseDragged = func;
}
 
function millis() {
  return GLOBAL_PROCESSING.millis();
}
 
function initProcessing() {
  GLOBAL_PROCESSING.init();
}