CCScene.js 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. /****************************************************************************
  2. Copyright (c) 2010-2012 cocos2d-x.org
  3. Copyright (c) 2008-2010 Ricardo Quesada
  4. Copyright (c) 2011 Zynga Inc.
  5. http://www.cocos2d-x.org
  6. Permission is hereby granted, free of charge, to any person obtaining a copy
  7. of this software and associated documentation files (the "Software"), to deal
  8. in the Software without restriction, including without limitation the rights
  9. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  10. copies of the Software, and to permit persons to whom the Software is
  11. furnished to do so, subject to the following conditions:
  12. The above copyright notice and this permission notice shall be included in
  13. all copies or substantial portions of the Software.
  14. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  15. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  16. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  17. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  18. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  19. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  20. THE SOFTWARE.
  21. ****************************************************************************/
  22. /**
  23. * <p>cc.Scene is a subclass of cc.Node that is used only as an abstract concept.</p>
  24. * <p>cc.Scene an cc.Node are almost identical with the difference that cc.Scene has it's
  25. * anchor point (by default) at the center of the screen.</p>
  26. *
  27. * <p>For the moment cc.Scene has no other logic than that, but in future releases it might have
  28. * additional logic.</p>
  29. *
  30. * <p>It is a good practice to use and cc.Scene as the parent of all your nodes.</p>
  31. * @class
  32. * @extends cc.Node
  33. */
  34. cc.Scene = cc.Node.extend(/** @lends cc.Scene# */{
  35. /**
  36. * Constructor
  37. */
  38. ctor:function () {
  39. cc.Node.prototype.ctor.call(this);
  40. this._ignoreAnchorPointForPosition = true;
  41. this.setAnchorPoint(0.5, 0.5);
  42. this.setContentSize(cc.Director.getInstance().getWinSize());
  43. }
  44. });
  45. /**
  46. * creates a scene
  47. * @return {cc.Scene}
  48. * @example
  49. * // Example
  50. * var aScene = cc.Scene.create();
  51. * //OR
  52. * var aScene = new cc.Scene();
  53. */
  54. cc.Scene.create = function () {
  55. return new cc.Scene();
  56. };