Permalink
Browse files

Allow setting size and anchor point when creating a Node

  • Loading branch information...
1 parent 9993054 commit b6464465a549ed54b23feaac6b2a86bcba4ca29f @ryanwilliams committed Sep 17, 2012
Showing with 7 additions and 6 deletions.
  1. +1 −1 src/config.js
  2. +6 −5 src/nodes/Node.js
View
@@ -2,7 +2,7 @@ module.exports = {
// Enable BObject's get/set/extend/etc methods
ENABLE_DEPRECATED_METHODS: false,
- // Invert the Y axis so origin is at the bottom left
+ // Invert the Y axis so origin is at the bottom left (same as cocos2d-iphone)
FLIP_Y_AXIS: true,
// No implemented yet
View
@@ -16,11 +16,12 @@ var Scheduler = require('../Scheduler').Scheduler
*
* @memberOf cocos.nodes
*/
-function Node () {
- this._contentSize = new geo.Size(0, 0)
- this._anchorPoint = ccp(0.0, 0.0)
- this.anchorPointInPixels = ccp(0, 0)
- this._position = ccp(0, 0)
+function Node (options) {
+ options = options || {}
+ this._contentSize = options.contentSize || new geo.Size(0, 0)
+ this._anchorPoint = options.anchorPoint || ccp(0.0, 0.0)
+ this._updateAnchorPointInPixels() // Sets this.anchorPointInPixels
+ this._position = options.position || ccp(0, 0)
this.children = []
events.addListener(this, 'dirtytransform', this._dirtyTransform.bind(this))

0 comments on commit b646446

Please sign in to comment.