From 8951d0133b04400ea41a7044006a59f17c10fb44 Mon Sep 17 00:00:00 2001 From: Walzer Date: Thu, 8 Jul 2010 08:23:06 +0000 Subject: [PATCH] issue #5, add CCScene --- cocos2dx/base_nodes/CCAtlasNode.cpp | 2 + cocos2dx/base_nodes/CCNode.cpp | 64 ++++++++----------- cocos2dx/include/CCScene.h | 40 ++++++++++++ .../CCScene.cpp | 33 ++++++++++ 4 files changed, 103 insertions(+), 36 deletions(-) create mode 100644 cocos2dx/include/CCScene.h create mode 100644 cocos2dx/layers_scenes_transitions_nodes/CCScene.cpp diff --git a/cocos2dx/base_nodes/CCAtlasNode.cpp b/cocos2dx/base_nodes/CCAtlasNode.cpp index dc6d7296bf..0eb3c13bad 100644 --- a/cocos2dx/base_nodes/CCAtlasNode.cpp +++ b/cocos2dx/base_nodes/CCAtlasNode.cpp @@ -24,6 +24,8 @@ THE SOFTWARE. #include "CCAtlasNode.h" +using namespace std; + ccColor3B CCAtlasNode::getColor(void) { if(m_bOpacityModifyRGB) diff --git a/cocos2dx/base_nodes/CCNode.cpp b/cocos2dx/base_nodes/CCNode.cpp index 5a456863fd..067f552697 100644 --- a/cocos2dx/base_nodes/CCNode.cpp +++ b/cocos2dx/base_nodes/CCNode.cpp @@ -27,46 +27,38 @@ THE SOFTWARE. using namespace std; CCNode::CCNode(void) -{ - m_bIsRunning = false; - m_fRotation = 0.0f; - m_fScaleX = m_fScaleY = 1.0f; - m_tPosition = CGPoint(0,0); - m_tAnchorPointInPixels = m_tAnchorPoint = CGPoint(0,0); - m_tContentSize = CGSize(0,0); - - // "whole screen" objects. like Scenes and Layers, should set isRelativeAnchorPoint to false - m_bIsRelativeAnchorPoint = true; - m_bIsTransformDirty = m_bIsInverseDirty = true; - - #ifdef CCX_NODE_TRANSFORM_USING_AFFINE_MATRIX - m_bIsTransformGLDirty = true; - #endif - - m_fVertexZ = 0.0f; - -// m_pGrid = NULL; - - m_bIsVisible = true; - - m_iTag = kCCNodeTagInvalid; - - m_iZOrder = 0; - - // lazy alloc - m_pCamera = NULL; - - // children (lazy allocs) - m_pChildren = NULL; - - // userData is always inited as nil - m_pUserData = NULL; -} +:m_bIsRunning(false) +,m_fRotation(0.0f) +,m_fScaleX(1.0f) +,m_fScaleY(1.0f) +,m_tPosition(CGPoint(0,0)) +,m_tAnchorPointInPixels(CGPoint(0,0)) +,m_tAnchorPoint(CGPoint(0,0)) +,m_tContentSize(CGSize(0,0)) +// "whole screen" objects. like Scenes and Layers, should set isRelativeAnchorPoint to false +,m_bIsRelativeAnchorPoint(true) +,m_bIsTransformDirty(true) +,m_bIsInverseDirty(true) +#ifdef CCX_NODE_TRANSFORM_USING_AFFINE_MATRIX +,m_bIsTransformGLDirty(true) +#endif +,m_fVertexZ(0.0f) +,m_pGrid(NULL) +,m_bIsVisible(true) +,m_iTag(kCCNodeTagInvalid) +,m_iZOrder(0) +// lazy alloc +,m_pCamera(NULL) +// children (lazy allocs) +,m_pChildren(NULL) +// userData is always inited as nil +,m_pUserData(NULL) +{} /*initialize*/ bool CCNode::init(void) { - return false; + return true; } float CCNode::getRotation() diff --git a/cocos2dx/include/CCScene.h b/cocos2dx/include/CCScene.h new file mode 100644 index 0000000000..6bd7e37ac0 --- /dev/null +++ b/cocos2dx/include/CCScene.h @@ -0,0 +1,40 @@ +/**************************************************************************** +Copyright (c) 2010 cocos2d-x.org + +http://www.cocos2d-x.org + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +****************************************************************************/ + +#ifndef __CCSCENE_H__ +#define __CCSCENE_H__ + +#include "CCNode.h" + +class CCScene : public CCNode +{ +public: + CCScene(); + virtual ~CCScene(); + + /** initializes the scene */ + virtual bool init(void); +}; + +#endif \ No newline at end of file diff --git a/cocos2dx/layers_scenes_transitions_nodes/CCScene.cpp b/cocos2dx/layers_scenes_transitions_nodes/CCScene.cpp new file mode 100644 index 0000000000..7ccd91312e --- /dev/null +++ b/cocos2dx/layers_scenes_transitions_nodes/CCScene.cpp @@ -0,0 +1,33 @@ +/**************************************************************************** +Copyright (c) 2010 cocos2d-x.org + +http://www.cocos2d-x.org + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +****************************************************************************/ + +#include "CCScene.h" + +using namespace std; + +bool CCScene::init(void) +{ + + return true; +} \ No newline at end of file