Browse files

Added SpaceExample and core optimizations

  • Loading branch information...
1 parent 96ef772 commit 68614a2cf1717b4d82b7a7404eb8302f98aee7e1 John Smilanick committed Feb 21, 2011
View
18 CardsExample/cards.js
@@ -1,16 +1,14 @@
-CCApplication.cache.loadImage('hearts', 'heart.png');
-CCApplication.cache.loadImage('diamonds', 'diamond.png');
-CCApplication.cache.loadImage('clubs', 'club.png');
-CCApplication.cache.loadImage('spades', 'spade.png');
+CCCache.loadImage('hearts', 'heart.png');
+CCCache.loadImage('diamonds', 'diamond.png');
+CCCache.loadImage('clubs', 'club.png');
+CCCache.loadImage('spades', 'spade.png');
function CardGame(canvasName) {
CCApplication.call(this, canvasName);
this.window.addSubview(new Table(this.window.frame));
}
-CardGame.prototype = subclass(CCApplication.prototype);
-
-
+CCSubclass(CardGame, CCApplication);
function Table(frame) {
CCView.call(this, frame);
@@ -29,7 +27,7 @@ function Table(frame) {
cy = 10;
}
}
-Table.prototype = subclass(CCView.prototype);
+CCSubclass(Table, CCView);
Table.prototype.drawRect = function(rect) {
var ctx = this.context();
@@ -55,7 +53,7 @@ Table.prototype.doMouseDown = function(e) {
var localPoint = this.convertPointFromWindow(new CCPoint(e.offsetX, e.offsetY));
var card = this.subviewWithPoint(localPoint);
- if(card && Card.prototype.isPrototypeOf(card)) {
+ if(card && card.isKindOfClass(Card)) {
var dragData = {startOrigin:new CCPoint(card.frame.origin.x,card.frame.origin.y), startPosition:localPoint, card:card};
card.bringToFront();
this.beginDrag(function(event,data){self.doDrag(event,data);}, function(event,data){self.doEndDrag(event,data);}, dragData);
@@ -93,7 +91,7 @@ function Card(origin, suit, value) {
this.value = value;
this.imageData = null;
}
-Card.prototype = subclass(CCView.prototype);
+CCSubclass(Card, CCView);
Card.prototype.drawRect = function(rect) {
var ctx = this.context();
View
11 CardsExample/index.html
@@ -3,25 +3,16 @@
<head>
<title>Cards</title>
<link rel="stylesheet" media="screen" href="main.css" type="text/css" />
- <script src="jquery-1.5.js"></script>
<script src="cocoa-canvas.js"></script>
<script src="cards.js"></script>
<script>
-
- var app;
function onBodyLoad()
{
- app = new CardGame('cards');
- $('#frameRate').html(app.frameRate + ' fps');
- setInterval(function() {
- $('#frameRate').html(app.frameRate + ' fps');
- },1000);
+ new CardGame('cards');
}
</script>
</head>
<body onload="onBodyLoad()">
-
- <div><span id="frameRate">0 fps</span><br /><br /></div>
<canvas id="cards" width="640" height="480">This browser does not support HTML5 Canvas.</canvas>
</body>
View
8,176 CardsExample/jquery-1.5.js
0 additions, 8,176 deletions not shown because the diff is too large. Please use a local Git client to view these changes.
View
6 README.markdown
@@ -4,7 +4,7 @@ Cocoa Canvas is designed to be the MVC foundation for HTML5 Canvas applications.
Development Note
-----------------
-The API is splint into modules. Only the 'Core' module is available at this time. The other modules sets will be mentioned, but no documentation is available.
+The API is split into modules. Only the 'Core' module is available at this time. The other modules sets will be mentioned, but no documentation is available.
Core (cocoa-canvas.js)
-----------------------
@@ -14,8 +14,8 @@ UI (under development)
-----------------------
The UI module extends the API with Control and Text fields.
-Proposed Feature Sets
+Proposed Modules
----------------------
* Networking
* Documents
-*
+* Core Data
View
BIN SpaceExample/Earth.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN SpaceExample/Mars.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN SpaceExample/Planet3.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN SpaceExample/Sun.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
1 SpaceExample/cocoa-canvas.js
View
19 SpaceExample/index.html
@@ -0,0 +1,19 @@
+<!DOCTYPE HTML>
+<html>
+ <head>
+ <title>Space</title>
+ <link rel="stylesheet" media="screen" href="main.css" type="text/css" />
+ <script src="cocoa-canvas.js"></script>
+ <script src="space.js"></script>
+ <script>
+ function onBodyLoad()
+ {
+ new SpaceGame('spaceCanvas');
+ }
+ </script>
+ </head>
+ <body onload="onBodyLoad()">
+ <canvas id="spaceCanvas" width="640" height="480">This browser does not support HTML5 Canvas.</canvas>
+
+ </body>
+</html>
View
21 SpaceExample/main.css
@@ -0,0 +1,21 @@
+div.card {
+ padding: 2px;
+ height: 40px;
+ width: 24px;
+ background-color: #FFF;
+ border: 1px solid #666;
+ position: fixed;
+}
+
+#frameRate {
+ color: #FFFFFF;
+ background-color: rgba(150,150,150,0.8);
+ -webkit-transition: all 0.3s ease;
+ text-shadow: 1px 1px rgba(0,0,0,0.8);
+ border-radius: 10px;
+ padding: 4px;
+}
+
+#frameRate:hover {
+ background-color: rgba(100,100,100,0.8);
+}
View
197 SpaceExample/space.js
@@ -0,0 +1,197 @@
+CCCache.loadImage('sun', 'Sun.png');
+CCCache.loadImage('planet1', 'Earth.png');
+CCCache.loadImage('planet2', 'Mars.png');
+CCCache.loadImage('planet3', 'Planet3.png');
+
+function SpaceGame(canvasName) {
+ CCApplication.call(this, canvasName);
+
+ this.window.addSubview(new Galaxy(this.window.frame));
+}
+CCSubclass(SpaceGame, CCApplication);
+
+function Star(x,y,size) {
+ this.x = x;
+ this.y = y;
+ this.size = size;
+}
+
+function Galaxy(frame) {
+ CCView.call(this, frame);
+
+ this.stars = [];
+ for(var i = 0; i < 30; i++) {
+ this.stars.push(this.randomStar());
+ }
+
+ var rect = CCRectMake(0, 0, 480, 480);
+ this.solarSystem = new SolarSystem(rect, 'sun');
+ this.solarSystem.delegate = this;
+ this.addSubview(this.solarSystem);
+
+ rect = CCRectMake(480, 0, 160, 480);
+ this.infoBar = new InfoBar(rect);
+ this.addSubview(this.infoBar);
+}
+CCSubclass(Galaxy, CCView);
+Galaxy.prototype.randomStar = function() {
+ return new Star(Math.floor(Math.random() * (480 - 10) + 4), Math.floor(Math.random() * (480 - 10) + 4) , Math.floor(Math.random() * 2 + 1));
+}
+Galaxy.prototype.drawRect = function(rect) {
+ var ctx = this.context();
+
+ var inset = 0.5;
+ var radius = 4;
+
+ ctx.fillStyle = "#000000";
+ ctx.fillRect(this.frame.origin.x, this.frame.origin.y ,this.frame.size.w, this.frame.size.h);
+
+ ctx.fillStyle = "#FFFFFF";
+ // stars
+ for(var i in this.stars) {
+ ctx.fillRect(this.stars[i].x, this.stars[i].y, this.stars[i].size, this.stars[i].size);
+ }
+}
+Galaxy.prototype.setSelectedPlanet = function(planet) {
+ this.infoBar.setSelectedPlanet(planet);
+}
+
+function SolarSystem(frame, sunName) {
+ CCView.call(this, frame);
+ this.image = CCImage(sunName);
+ this.delegate = null;
+
+ this.addPlanet(100, 12, {name:'Earth', imageName:'planet1', radius:'6,371.0 km', mass:'5.9736x10^24 kg', surfacePressure:'101.325 kPa'});
+ this.addPlanet(160, 10, {name:'Mars', imageName:'planet2', radius:'3,396.2 km', mass:'6.4185x10^23 kg', surfacePressure:'0.636 kPa'});
+ this.addPlanet(220, 5, {name:'Uranus', imageName:'planet3', radius:'25,559 km', mass:'8.6810x10^25 kg', surfacePressure:'n/a'});
+
+ var self = this;
+ //setTimeout(function(){self.updateOrbits()},10000);
+ setInterval(function(){self.updateOrbits()},50);
+}
+CCSubclass(SolarSystem, CCView);
+SolarSystem.prototype.addPlanet = function(orbit, speed, data) {
+ var planet = new Planet(this.frame.size.w / 2, this.frame.size.h / 2, orbit, speed, data);
+ this.addSubview(planet);
+ return planet;
+}
+SolarSystem.prototype.drawRect = function(rect) {
+ var ctx = this.context();
+ ctx.drawImage(this.image, (this.frame.size.w - this.image.width) / 2, (this.frame.size.h - this.image.height) / 2);
+}
+SolarSystem.prototype.doClick = function(e) {
+ var self = this;
+ var localPoint = this.convertPointFromWindow(new CCPoint(e.offsetX, e.offsetY));
+ var subview = this.subviewWithPoint(localPoint);
+
+ for(var i in this.subviews) {
+ this.subviews[i].setSelected(false);
+ }
+
+ if(subview && subview.isMemberOfClass(Planet)) {
+ subview.setSelected(true);
+ if(this.delegate) {
+ this.delegate.setSelectedPlanet(subview);
+ }
+ } else {
+ if(this.delegate) {
+ this.delegate.setSelectedPlanet(null);
+ }
+ }
+
+}
+SolarSystem.prototype.updateOrbits = function(e) {
+ for(var i in this.subviews) {
+ this.subviews[i].stepForward();
+ }
+}
+
+function Planet(x, y, orbit, speed, data) {
+ this.data = data
+ this.image = CCImage(data.imageName);
+ this.selected = false;
+ this.origin = new CCPoint(x, y);
+ this.orbit = orbit;
+ this.speed = speed;
+ this.step = Math.floor(Math.random()*360);
+ this.frame = CCRectMake(0, 0, this.image.width + 2, this.image.height + 2);
+ CCView.call(this, this.frameForStep());
+}
+CCSubclass(Planet, CCView);
+Planet.prototype.setSelected = function(newValue) {
+ this.selected = newValue;
+ this.setNeedsDisplay();
+}
+Planet.prototype.drawRect = function(rect) {
+ var ctx = this.context();
+
+ ctx.drawImage(this.image, 1, 1);
+
+ if(this.selected) {
+ var inset = 1;
+ var radius = this.image.height / 2; // assume square
+
+ ctx.beginPath();
+ ctx.moveTo(inset + radius, inset);
+ ctx.arcTo(this.frame.size.w - inset, inset, this.frame.size.w - inset, inset + radius, radius);
+ ctx.arcTo(this.frame.size.w - inset, this.frame.size.h - inset, this.frame.size.w - inset - radius, this.frame.size.h - inset, radius);
+ ctx.arcTo(inset, this.frame.size.h - inset, inset, this.frame.size.h - inset - radius, radius);
+ ctx.arcTo(inset, inset, inset + radius, inset, radius);
+ ctx.closePath();
+ ctx.strokeStyle = "#77B4FC";
+ ctx.lineWidth = 2;
+ ctx.stroke();
+ }
+}
+Planet.prototype.frameForStep = function() {
+ var rect = CCRectMake(Math.round(this.origin.x + this.orbit * Math.sin(this.step / 360) - (this.frame.size.w / 2)), Math.round(this.origin.y + this.orbit * 0.7 * Math.cos(this.step / 360) - (this.frame.size.h / 2)), this.frame.size.w, this.frame.size.h);
+ return rect;
+}
+Planet.prototype.stepForward = function() {
+ this.step = this.step + this.speed;
+ this.setFrame(this.frameForStep());
+}
+
+function InfoBar(frame) {
+ CCView.call(this, frame);
+ this.selectedPlanet = null;
+ this.count = 0;
+}
+CCSubclass(InfoBar, CCView);
+InfoBar.prototype.setSelectedPlanet = function(planet) {
+ this.selectedPlanet = planet;
+ this.setNeedsDisplay();
+}
+InfoBar.prototype.drawRect = function(rect) {
+ var ctx = this.context();
+ this.count += 1;
+
+ ctx.fillStyle = "#999999";
+ ctx.fillRect(0, 0, this.bounds.size.w, this.bounds.size.h);
+ ctx.lineWidth = 2;
+ ctx.strokeStyle = "#666666";
+ var inset = CCRectInset(this.bounds, 1, 1);
+ ctx.strokeRect(inset.origin.x, inset.origin.y, inset.size.w, inset.size.h);
+
+ if(this.selectedPlanet) {
+ ctx.textBaseline = 'top';
+ ctx.font = "18px Arial";
+ ctx.fillStyle = "#FFFFFF";
+ ctx.fillText(this.selectedPlanet.data.name, 10, 10);
+
+ ctx.font = "10px Arial";
+ ctx.fillText("Mass: "+this.selectedPlanet.data.mass, 10, 40);
+ ctx.fillText("Radius: "+this.selectedPlanet.data.radius, 10, 55);
+ ctx.fillText("Surface Pressure: "+this.selectedPlanet.data.surfacePressure, 10, 70);
+ } else {
+ ctx.textBaseline = 'top';
+ ctx.font = "18px Arial";
+ ctx.fillStyle = "#FFFFFF";
+ ctx.fillText("Planet Info", 10, 10);
+
+ ctx.font = "10px Arial";
+ ctx.fillStyle = "#CCCCCC";
+ ctx.fillText("No planet selected", 40, 50);
+
+ }
+}
View
118 cocoa-canvas.js 100644 → 100755
@@ -1,27 +1,48 @@
-function subclass(p) {
- function f(){}
- f.prototype = p;
- return new f();
+function CCSubclass(sub, sup) {
+ function inheritance() {}
+ inheritance.prototype = sup.prototype;
+
+ sub.prototype = new inheritance();
+ sub.prototype.constructor = sub;
+ sub.baseConstructor = sup;
+ sub.superClass = sup.prototype;
+}
+function CCObject() {
+}
+CCObject.prototype.isKindOfClass = function(klass) {
+ return (klass == this.getClass());
+}
+CCObject.prototype.isMemberOfClass = function(klass) {
+ return klass.prototype.isPrototypeOf(this);
+}
+CCObject.prototype.getClass = function() {
+ return this.constructor;
+}
+CCObject.prototype.description = function() {
+ return '<'+this.className()+'>'
}
function CCPoint(x,y) {
this.x = x;
this.y = y;
}
-CCPoint.prototype.toString = function() {'x:'+this.x+',y:'+this.y}
function CCSize(w,h) {
this.w = w;
this.h = h;
}
-CCSize.prototype.toString = function() {'w:'+this.w+',h:'+this.h}
function CCRect(origin,size) {
this.origin = origin
this.size = size
}
-CCRect.prototype.toString = function() {this.origin.toString()+','+this.size.toString()}
-function CMakeRect(x,y,w,h) {
+CCRect.prototype.components = function() {
+ return [this.origin.x, this.origin.y, this.size.w, this.size.h];
+}
+function CCRectMake(x,y,w,h) {
return new CCRect(new CCPoint(x,y), new CCSize(w,h));
}
+function CCRectInset(rect, dx, dy) {
+ return CCRectMake(rect.origin.x + dx, rect.origin.y + dy, rect.size.w - (2 * dx), rect.size.h - (2 * dy));
+}
function CCRectIntersectsRect(rectA,rectB) {
return (rectA.origin.x < rectB.origin.x + rectB.size.w && rectB.origin.x < rectA.origin.x + rectA.size.w && rectA.origin.y < rectB.origin.y + rectB.size.h && rectB.origin.y < rectA.origin.y + rectA.size.h)
}
@@ -30,29 +51,24 @@ function CCRectUnion(rectA,rectB) {
var topRect = rectA.origin.y < rectB.origin.y ? rectA : rectB;
var rightRect = rectA.origin.x + rectA.size.w > rectB.origin.x + rectB.size.w ? rectA : rectB;
var bottomRect = rectA.origin.y + rectA.size.h > rectB.origin.y + rectB.size.h ? rectA : rectB;
- return CMakeRect(leftRect.origin.x, topRect.origin.y, rightRect.origin.x + rightRect.size.w - leftRect.origin.x, bottomRect.origin.y + bottomRect.size.h - topRect.origin.y);
+ return CCRectMake(leftRect.origin.x, topRect.origin.y, rightRect.origin.x + rightRect.size.w - leftRect.origin.x, bottomRect.origin.y + bottomRect.size.h - topRect.origin.y);
}
function CCRectIntersection(rectA,rectB){
var notLeftRect = rectA.origin.x < rectB.origin.x ? rectB : rectA;
var notTopRect = rectA.origin.y < rectB.origin.y ? rectB : rectA;
var notRightRect = rectA.origin.x + rectA.size.w > rectB.origin.x + rectB.size.w ? rectB : rectA;
var notBottomRect = rectA.origin.y + rectA.size.h > rectB.origin.y + rectB.size.h ? rectB : rectA;
- return CMakeRect(notLeftRect.origin.x, notTopRect.origin.y, notRightRect.origin.x + notRightRect.size.w - notLeftRect.origin.x, notBottomRect.origin.y + notBottomRect.size.h - notTopRect.origin.y);
+ return CCRectMake(notLeftRect.origin.x, notTopRect.origin.y, notRightRect.origin.x + notRightRect.size.w - notLeftRect.origin.x, notBottomRect.origin.y + notBottomRect.size.h - notTopRect.origin.y);
}
-CCApplication.cache = {imageNames:[], images:{}, loadImage:function(imageName, imagePath) {this.images[imageName] = imagePath; this.imageNames.push(imageName)}}
function CCApplication(canvasName) {
+ CCObject.call(this);
this.canvas = document.getElementById(canvasName);
this.ctx = this.canvas.getContext('2d');
- this.window = new CCWindow(CMakeRect(0,0,this.canvas.width,this.canvas.height));
+ this.window = new CCWindow(CCRectMake(0,0,this.canvas.width,this.canvas.height));
this.window.superview = this;
- this.desiredFrameRate = 30;
- this.frameRate = 30;
- this.frameCount = 0;
- this.lastFrameSample = 0;
-
this.dragging = false;
this.dragData = null;
this.doDragCallback = null;
@@ -64,7 +80,7 @@ function CCApplication(canvasName) {
// begin loading images
- this.animationTimer = setInterval(function(){
+ var animationTimer = setInterval(function(){
var ctx = self.ctx;
var width = 200;
var height = 18;
@@ -84,11 +100,11 @@ function CCApplication(canvasName) {
ctx.restore();
},200);
- var count = CCApplication.cache.imageNames.length;
+ var count = CCCache.imageNames.length;
var images = [];
- for(var i in CCApplication.cache.imageNames) {
+ for(var i in CCCache.imageNames) {
var image = new Image();
- image.src = CCApplication.cache.images[CCApplication.cache.imageNames[i]];
+ image.src = CCCache.images[CCCache.imageNames[i]];
images << image;
}
@@ -106,35 +122,22 @@ function CCApplication(canvasName) {
this.loadingPercentComplete = 100;
- clearInterval(this.animationTimer);
+ clearInterval(animationTimer);
- // Done loading. Begin animating...
-
- this.animationTimer = setInterval(function(){self.drawWindow()},1000 / this.desiredFrameRate);
- setInterval(function(){self.calculateFrameRate()},1000);
+ // Done loading. Start event listeners.
this.canvas.addEventListener("click", function(e){self.doClick(e);}, true);
this.canvas.addEventListener("mousedown", function(e){self.doMouseDown(e);}, true);
this.canvas.addEventListener("mouseup", function(e){self.doMouseUp(e);}, true);
this.canvas.addEventListener("mousemove", function(e){self.doMouseMove(e);}, true);
}
+CCSubclass(CCApplication, CCObject);
CCApplication.prototype.drawWindow = function() {
if(this.invalidRect) {
this.ctx.clearRect(this.invalidRect.origin.x, this.invalidRect.origin.y, this.invalidRect.size.w, this.invalidRect.size.h);
this.window._drawRect(this.invalidRect);
this.invalidRect = null;
}
- this.frameCount += 1;
-}
-CCApplication.prototype.calculateFrameRate = function() {
- this.frameRate = this.frameCount - this.lastFrameSample;
- this.lastFrameSample = this.frameCount;
-}
-CCApplication.prototype.setFrameRate = function(newRate) {
- var self = this;
- this.desiredFrameRate = newRate;
- stopInterval(this.animationTimer);
- this.animationTimer = setInterval(function(){self.drawWindow()}, 1000 / this.desiredFrameRate);
}
CCApplication.prototype.context = function() {
return this.ctx;
@@ -195,13 +198,17 @@ CCApplication.prototype._invalidateRect = function(rect) {
} else {
this.invalidRect = rect;
}
+ this.drawWindow();
}
function CCView(frame) {
+ CCObject.call(this);
this.frame = frame;
+ this.bounds = new CCRect(new CCPoint(0, 0), this.frame.size);
this.subviews = [];
this.superview = null;
}
+CCSubclass(CCView, CCObject);
CCView.prototype.context = function() {
if(this.superview) {
return this.superview.context();
@@ -212,7 +219,6 @@ CCView.prototype.context = function() {
CCView.prototype._drawRect = function(rect) {
var ctx = this.context();
var localRect = this.convertRectFromSuper(rect);
-
ctx.save();
ctx.translate(this.frame.origin.x, this.frame.origin.y);
@@ -224,12 +230,15 @@ CCView.prototype._drawRect = function(rect) {
for (i in this.subviews) {
if(this.subviews[i].containsRect(localRect)) {
- this.subviews[i]._drawRect(CCRectUnion(this.subviews[i].frame, localRect));
+ this.subviews[i]._drawRect(CCRectIntersection(this.subviews[i].frame, localRect));
}
}
ctx.restore();
}
+CCView.prototype.bounds = function() {
+ return CCRectMake(0, 0, this.frame.size.w, this.frame.size.h)
+}
CCView.prototype.drawRect = function(rect) {
// overload this to do drawing
}
@@ -309,7 +318,7 @@ CCView.prototype.containsRect = function(rect) {
return CCRectIntersectsRect(this.frame, rect);
}
CCView.prototype.convertRectFromSuper = function(rect) {
- return CMakeRect(rect.origin.x - this.frame.origin.x, rect.origin.y - this.frame.origin.y, rect.size.w, rect.size.h);
+ return CCRectMake(rect.origin.x - this.frame.origin.x, rect.origin.y - this.frame.origin.y, rect.size.w, rect.size.h);
}
CCView.prototype.addSubview = function(view) {
this.subviews.push(view);
@@ -325,21 +334,30 @@ CCView.prototype.removeFromSuperview = function() {
CCView.prototype._invalidateRect = function(rect) {
// this could get called before added to a superview
if(this.superview) {
- this.superview._invalidateRect(CMakeRect(rect.origin.x + this.frame.origin.x, rect.origin.y + this.frame.origin.y, rect.size.w, rect.size.h));
+ this.superview._invalidateRect(CCRectMake(rect.origin.x + this.frame.origin.x, rect.origin.y + this.frame.origin.y, rect.size.w, rect.size.h));
}
}
CCView.prototype.setFrame = function(frame) {
- this.superview._invalidateRect(this.frame);
- this.frame = frame;
- this.superview._invalidateRect(this.frame);
+ if(CCRectIntersectsRect(this.frame,frame)) {
+ var rect = CCRectUnion(this.frame, frame);
+ this.frame = frame;
+ this.bounds.size = this.frame.size;
+ this.superview._invalidateRect(rect);
+ } else {
+ var rect = this.frame;
+ this.frame = frame;
+ this.bounds.size = this.frame.size;
+ this.superview._invalidateRect(rect);
+ this.superview._invalidateRect(this.frame);
+ }
}
CCView.prototype.setNeedsDisplay = function() {
this.cachedContent = null;
this.superview._invalidateRect(this.frame);
}
function CCImage(imageName) {
- var imagePath = CCApplication.cache.images[imageName];
+ var imagePath = CCCache.images[imageName];
var image = new Image();
image.src = imagePath;
return image;
@@ -348,4 +366,12 @@ function CCImage(imageName) {
function CCWindow(frame) {
CCView.call(this, frame);
}
-CCWindow.prototype = subclass(CCView.prototype);
+CCSubclass(CCWindow, CCView);
+
+function CCViewController(frame) {
+ CCObject.call(this, frame);
+}
+CCSubclass(CCViewController, CCObject);
+
+
+CCCache = {imageNames:[], images:{}, loadImage:function(imageName, imagePath) {this.images[imageName] = imagePath; this.imageNames.push(imageName)}}

0 comments on commit 68614a2

Please sign in to comment.