diff --git a/cocos2dx/CCConfiguration.cpp b/cocos2dx/CCConfiguration.cpp index d811807707..40e1aeb61a 100644 --- a/cocos2dx/CCConfiguration.cpp +++ b/cocos2dx/CCConfiguration.cpp @@ -1,3 +1,27 @@ +/**************************************************************************** +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 "CCConfiguration.h" #include "ccMacros.h" #include "ccConfig.h" @@ -24,26 +48,26 @@ CCConfiguration::CCConfiguration() m_bSupportsBGRA8888 = checkForGLExtension("GL_IMG_texture_format_BGRA888"); m_bSupportsDiscardFramebuffer = checkForGLExtension("GL_EXT_discard_framebuffer"); - CCLOG("cocos2d: GL_MAX_TEXTURE_SIZE: %d", m_nMaxTextureSize); - CCLOG("cocos2d: GL_MAX_MODELVIEW_STACK_DEPTH: %d",m_nMaxModelviewStackDepth); - CCLOG("cocos2d: GL supports PVRTC: %s", (m_bSupportsPVRTC ? "YES" : "NO")); - CCLOG("cocos2d: GL supports BGRA8888 textures: %s", (m_bSupportsBGRA8888 ? "YES" : "NO")); - CCLOG("cocos2d: GL supports NPOT textures: %s", (m_bSupportsNPOT ? "YES" : "NO")); - CCLOG("cocos2d: GL supports discard_framebuffer: %s", (m_bSupportsDiscardFramebuffer ? "YES" : "NO")); + CCLOG("cocos2d: GL_MAX_TEXTURE_SIZE: %d", m_nMaxTextureSize); + CCLOG("cocos2d: GL_MAX_MODELVIEW_STACK_DEPTH: %d",m_nMaxModelviewStackDepth); + CCLOG("cocos2d: GL supports PVRTC: %s", (m_bSupportsPVRTC ? "YES" : "NO")); + CCLOG("cocos2d: GL supports BGRA8888 textures: %s", (m_bSupportsBGRA8888 ? "YES" : "NO")); + CCLOG("cocos2d: GL supports NPOT textures: %s", (m_bSupportsNPOT ? "YES" : "NO")); + CCLOG("cocos2d: GL supports discard_framebuffer: %s", (m_bSupportsDiscardFramebuffer ? "YES" : "NO")); CCLOG("cocos2d: compiled with NPOT support: %s", -#if CC_TEXTURE_NPOT_SUPPORT - "YES" -#else - "NO" -#endif // CC_TEXTURE_NPOT_SUPPORT - ); - - CCLOG("cocos2d: compiled with VBO support in TextureAtlas : %s", -#if CC_TEXTURE_ATLAS_USES_VBO - "YES" -#else - "NO" -#endif // CC_TEXTURE_ATLAS_USES_VBO +#if CC_TEXTURE_NPOT_SUPPORT + "YES" +#else + "NO" +#endif // CC_TEXTURE_NPOT_SUPPORT + ); + + CCLOG("cocos2d: compiled with VBO support in TextureAtlas : %s", +#if CC_TEXTURE_ATLAS_USES_VBO + "YES" +#else + "NO" +#endif // CC_TEXTURE_ATLAS_USES_VBO ); } diff --git a/cocos2dx/CCConfiguration.h b/cocos2dx/CCConfiguration.h index d27369503d..7e86f4c175 100644 --- a/cocos2dx/CCConfiguration.h +++ b/cocos2dx/CCConfiguration.h @@ -1,6 +1,8 @@ /**************************************************************************** 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 diff --git a/cocos2dx/CCDrawingPrimitives.cpp b/cocos2dx/CCDrawingPrimitives.cpp index bb9d48df31..a13e60b30f 100644 --- a/cocos2dx/CCDrawingPrimitives.cpp +++ b/cocos2dx/CCDrawingPrimitives.cpp @@ -1,3 +1,27 @@ +/**************************************************************************** +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 "CCDrawingPrimitives.h" #define _USE_MATH_DEFINES @@ -6,198 +30,198 @@ #include #include -void ccDrawPoint(CGPoint point) -{ - // Default GL states: GL_TEXTURE_2D, GL_VERTEX_ARRAY, GL_COLOR_ARRAY, GL_TEXTURE_COORD_ARRAY - // Needed states: GL_VERTEX_ARRAY, - // Unneeded states: GL_TEXTURE_2D, GL_TEXTURE_COORD_ARRAY, GL_COLOR_ARRAY - glDisable(GL_TEXTURE_2D); - glDisableClientState(GL_TEXTURE_COORD_ARRAY); - glDisableClientState(GL_COLOR_ARRAY); - - glVertexPointer(2, GL_FLOAT, 0, &point); - glDrawArrays(GL_POINTS, 0, 1); - - // restore default state - glEnableClientState(GL_COLOR_ARRAY); - glEnableClientState(GL_TEXTURE_COORD_ARRAY); - glEnable(GL_TEXTURE_2D); -} - -void ccDrawPoints(CGPoint *points, unsigned int numberOfPoints) -{ - // Default GL states: GL_TEXTURE_2D, GL_VERTEX_ARRAY, GL_COLOR_ARRAY, GL_TEXTURE_COORD_ARRAY - // Needed states: GL_VERTEX_ARRAY, - // Unneeded states: GL_TEXTURE_2D, GL_TEXTURE_COORD_ARRAY, GL_COLOR_ARRAY - glDisable(GL_TEXTURE_2D); - glDisableClientState(GL_TEXTURE_COORD_ARRAY); - glDisableClientState(GL_COLOR_ARRAY); - - glVertexPointer(2, GL_FLOAT, 0, points); - glDrawArrays(GL_POINTS, 0, numberOfPoints); - - // restore default state - glEnableClientState(GL_COLOR_ARRAY); - glEnableClientState(GL_TEXTURE_COORD_ARRAY); - glEnable(GL_TEXTURE_2D); -} - - -void ccDrawLine(CGPoint origin, CGPoint destination) -{ - CGPoint vertices[2]; - - vertices[0] = origin; - vertices[1] = destination; - - // Default GL states: GL_TEXTURE_2D, GL_VERTEX_ARRAY, GL_COLOR_ARRAY, GL_TEXTURE_COORD_ARRAY - // Needed states: GL_VERTEX_ARRAY, - // Unneeded states: GL_TEXTURE_2D, GL_TEXTURE_COORD_ARRAY, GL_COLOR_ARRAY - glDisable(GL_TEXTURE_2D); - glDisableClientState(GL_TEXTURE_COORD_ARRAY); - glDisableClientState(GL_COLOR_ARRAY); - - glVertexPointer(2, GL_FLOAT, 0, vertices); - glDrawArrays(GL_LINES, 0, 2); - - // restore default state - glEnableClientState(GL_COLOR_ARRAY); - glEnableClientState(GL_TEXTURE_COORD_ARRAY); - glEnable(GL_TEXTURE_2D); -} - - -void ccDrawPoly(CGPoint *poli, int points, BOOL closePolygon) -{ - // Default GL states: GL_TEXTURE_2D, GL_VERTEX_ARRAY, GL_COLOR_ARRAY, GL_TEXTURE_COORD_ARRAY - // Needed states: GL_VERTEX_ARRAY, - // Unneeded states: GL_TEXTURE_2D, GL_TEXTURE_COORD_ARRAY, GL_COLOR_ARRAY - glDisable(GL_TEXTURE_2D); - glDisableClientState(GL_TEXTURE_COORD_ARRAY); - glDisableClientState(GL_COLOR_ARRAY); - - glVertexPointer(2, GL_FLOAT, 0, poli); - if (closePolygon) - { - glDrawArrays(GL_LINE_LOOP, 0, points); - } - else - { - glDrawArrays(GL_LINE_STRIP, 0, points); - } - - // restore default state - glEnableClientState(GL_COLOR_ARRAY); - glEnableClientState(GL_TEXTURE_COORD_ARRAY); - glEnable(GL_TEXTURE_2D); -} - -void ccDrawCircle(CGPoint center, float r, float a, int segs, BOOL drawLineToCenter) -{ - int additionalSegment = 1; - if (drawLineToCenter) - { - ++additionalSegment; - } - - const float coef = 2.0f * (float)M_PI/segs; - - float *vertices = (float *)malloc( sizeof(float)*2*(segs+2)); - if( ! vertices ) - { - return; - } - - memset( vertices,0, sizeof(float)*2*(segs+2)); - - for(int i=0;i<=segs;i++) - { - float rads = i*coef; - float j = r * cosf(rads + a) + center.x; - float k = r * sinf(rads + a) + center.y; - - vertices[i*2] = j; - vertices[i*2+1] =k; - } - vertices[(segs+1)*2] = center.x; - vertices[(segs+1)*2+1] = center.y; - - // Default GL states: GL_TEXTURE_2D, GL_VERTEX_ARRAY, GL_COLOR_ARRAY, GL_TEXTURE_COORD_ARRAY - // Needed states: GL_VERTEX_ARRAY, - // Unneeded states: GL_TEXTURE_2D, GL_TEXTURE_COORD_ARRAY, GL_COLOR_ARRAY - glDisable(GL_TEXTURE_2D); - glDisableClientState(GL_TEXTURE_COORD_ARRAY); - glDisableClientState(GL_COLOR_ARRAY); - - glVertexPointer(2, GL_FLOAT, 0, vertices); - glDrawArrays(GL_LINE_STRIP, 0, segs+additionalSegment); - - // restore default state - glEnableClientState(GL_COLOR_ARRAY); - glEnableClientState(GL_TEXTURE_COORD_ARRAY); - glEnable(GL_TEXTURE_2D); - - free(vertices); -} - -void ccDrawQuadBezier(CGPoint origin, CGPoint control, CGPoint destination, int segments) -{ - CGPoint *vertices = new CGPoint[segments + 1]; - - float t = 0.0f; - for(int i = 0; i < segments; i++) - { - float x = powf(1 - t, 2) * origin.x + 2.0f * (1 - t) * t * control.x + t * t * destination.x; - float y = powf(1 - t, 2) * origin.y + 2.0f * (1 - t) * t * control.y + t * t * destination.y; - vertices[i] = CGPointMake(x, y); - t += 1.0f / segments; - } - vertices[segments] = destination; - - // Default GL states: GL_TEXTURE_2D, GL_VERTEX_ARRAY, GL_COLOR_ARRAY, GL_TEXTURE_COORD_ARRAY - // Needed states: GL_VERTEX_ARRAY, - // Unneeded states: GL_TEXTURE_2D, GL_TEXTURE_COORD_ARRAY, GL_COLOR_ARRAY - glDisable(GL_TEXTURE_2D); - glDisableClientState(GL_TEXTURE_COORD_ARRAY); - glDisableClientState(GL_COLOR_ARRAY); - - glVertexPointer(2, GL_FLOAT, 0, vertices); - glDrawArrays(GL_LINE_STRIP, 0, segments + 1); - delete[] vertices; - - // restore default state - glEnableClientState(GL_COLOR_ARRAY); - glEnableClientState(GL_TEXTURE_COORD_ARRAY); - glEnable(GL_TEXTURE_2D); -} - -void ccDrawCubicBezier(CGPoint origin, CGPoint control1, CGPoint control2, CGPoint destination, int segments) -{ - CGPoint *vertices = new CGPoint[segments + 1]; - - float t = 0; - for(int i = 0; i < segments; ++i) - { - float x = powf(1 - t, 3) * origin.x + 3.0f * powf(1 - t, 2) * t * control1.x + 3.0f * (1 - t) * t * t * control2.x + t * t * t * destination.x; - float y = powf(1 - t, 3) * origin.y + 3.0f * powf(1 - t, 2) * t * control1.y + 3.0f * (1 - t) * t * t * control2.y + t * t * t * destination.y; - vertices[i] = CGPointMake(x, y); - t += 1.0f / segments; - } - vertices[segments] = destination; - - // Default GL states: GL_TEXTURE_2D, GL_VERTEX_ARRAY, GL_COLOR_ARRAY, GL_TEXTURE_COORD_ARRAY - // Needed states: GL_VERTEX_ARRAY, - // Unneeded states: GL_TEXTURE_2D, GL_TEXTURE_COORD_ARRAY, GL_COLOR_ARRAY - glDisable(GL_TEXTURE_2D); - glDisableClientState(GL_TEXTURE_COORD_ARRAY); - glDisableClientState(GL_COLOR_ARRAY); - - glVertexPointer(2, GL_FLOAT, 0, vertices); - glDrawArrays(GL_LINE_STRIP, 0, segments + 1); - delete[] vertices; - - // restore default state - glEnableClientState(GL_COLOR_ARRAY); - glEnableClientState(GL_TEXTURE_COORD_ARRAY); - glEnable(GL_TEXTURE_2D); +void ccDrawPoint(CGPoint point) +{ + // Default GL states: GL_TEXTURE_2D, GL_VERTEX_ARRAY, GL_COLOR_ARRAY, GL_TEXTURE_COORD_ARRAY + // Needed states: GL_VERTEX_ARRAY, + // Unneeded states: GL_TEXTURE_2D, GL_TEXTURE_COORD_ARRAY, GL_COLOR_ARRAY + glDisable(GL_TEXTURE_2D); + glDisableClientState(GL_TEXTURE_COORD_ARRAY); + glDisableClientState(GL_COLOR_ARRAY); + + glVertexPointer(2, GL_FLOAT, 0, &point); + glDrawArrays(GL_POINTS, 0, 1); + + // restore default state + glEnableClientState(GL_COLOR_ARRAY); + glEnableClientState(GL_TEXTURE_COORD_ARRAY); + glEnable(GL_TEXTURE_2D); +} + +void ccDrawPoints(CGPoint *points, unsigned int numberOfPoints) +{ + // Default GL states: GL_TEXTURE_2D, GL_VERTEX_ARRAY, GL_COLOR_ARRAY, GL_TEXTURE_COORD_ARRAY + // Needed states: GL_VERTEX_ARRAY, + // Unneeded states: GL_TEXTURE_2D, GL_TEXTURE_COORD_ARRAY, GL_COLOR_ARRAY + glDisable(GL_TEXTURE_2D); + glDisableClientState(GL_TEXTURE_COORD_ARRAY); + glDisableClientState(GL_COLOR_ARRAY); + + glVertexPointer(2, GL_FLOAT, 0, points); + glDrawArrays(GL_POINTS, 0, numberOfPoints); + + // restore default state + glEnableClientState(GL_COLOR_ARRAY); + glEnableClientState(GL_TEXTURE_COORD_ARRAY); + glEnable(GL_TEXTURE_2D); +} + + +void ccDrawLine(CGPoint origin, CGPoint destination) +{ + CGPoint vertices[2]; + + vertices[0] = origin; + vertices[1] = destination; + + // Default GL states: GL_TEXTURE_2D, GL_VERTEX_ARRAY, GL_COLOR_ARRAY, GL_TEXTURE_COORD_ARRAY + // Needed states: GL_VERTEX_ARRAY, + // Unneeded states: GL_TEXTURE_2D, GL_TEXTURE_COORD_ARRAY, GL_COLOR_ARRAY + glDisable(GL_TEXTURE_2D); + glDisableClientState(GL_TEXTURE_COORD_ARRAY); + glDisableClientState(GL_COLOR_ARRAY); + + glVertexPointer(2, GL_FLOAT, 0, vertices); + glDrawArrays(GL_LINES, 0, 2); + + // restore default state + glEnableClientState(GL_COLOR_ARRAY); + glEnableClientState(GL_TEXTURE_COORD_ARRAY); + glEnable(GL_TEXTURE_2D); +} + + +void ccDrawPoly(CGPoint *poli, int points, BOOL closePolygon) +{ + // Default GL states: GL_TEXTURE_2D, GL_VERTEX_ARRAY, GL_COLOR_ARRAY, GL_TEXTURE_COORD_ARRAY + // Needed states: GL_VERTEX_ARRAY, + // Unneeded states: GL_TEXTURE_2D, GL_TEXTURE_COORD_ARRAY, GL_COLOR_ARRAY + glDisable(GL_TEXTURE_2D); + glDisableClientState(GL_TEXTURE_COORD_ARRAY); + glDisableClientState(GL_COLOR_ARRAY); + + glVertexPointer(2, GL_FLOAT, 0, poli); + if (closePolygon) + { + glDrawArrays(GL_LINE_LOOP, 0, points); + } + else + { + glDrawArrays(GL_LINE_STRIP, 0, points); + } + + // restore default state + glEnableClientState(GL_COLOR_ARRAY); + glEnableClientState(GL_TEXTURE_COORD_ARRAY); + glEnable(GL_TEXTURE_2D); +} + +void ccDrawCircle(CGPoint center, float r, float a, int segs, BOOL drawLineToCenter) +{ + int additionalSegment = 1; + if (drawLineToCenter) + { + ++additionalSegment; + } + + const float coef = 2.0f * (float)M_PI/segs; + + float *vertices = (float *)malloc( sizeof(float)*2*(segs+2)); + if( ! vertices ) + { + return; + } + + memset( vertices,0, sizeof(float)*2*(segs+2)); + + for(int i=0;i<=segs;i++) + { + float rads = i*coef; + float j = r * cosf(rads + a) + center.x; + float k = r * sinf(rads + a) + center.y; + + vertices[i*2] = j; + vertices[i*2+1] =k; + } + vertices[(segs+1)*2] = center.x; + vertices[(segs+1)*2+1] = center.y; + + // Default GL states: GL_TEXTURE_2D, GL_VERTEX_ARRAY, GL_COLOR_ARRAY, GL_TEXTURE_COORD_ARRAY + // Needed states: GL_VERTEX_ARRAY, + // Unneeded states: GL_TEXTURE_2D, GL_TEXTURE_COORD_ARRAY, GL_COLOR_ARRAY + glDisable(GL_TEXTURE_2D); + glDisableClientState(GL_TEXTURE_COORD_ARRAY); + glDisableClientState(GL_COLOR_ARRAY); + + glVertexPointer(2, GL_FLOAT, 0, vertices); + glDrawArrays(GL_LINE_STRIP, 0, segs+additionalSegment); + + // restore default state + glEnableClientState(GL_COLOR_ARRAY); + glEnableClientState(GL_TEXTURE_COORD_ARRAY); + glEnable(GL_TEXTURE_2D); + + free(vertices); +} + +void ccDrawQuadBezier(CGPoint origin, CGPoint control, CGPoint destination, int segments) +{ + CGPoint *vertices = new CGPoint[segments + 1]; + + float t = 0.0f; + for(int i = 0; i < segments; i++) + { + float x = powf(1 - t, 2) * origin.x + 2.0f * (1 - t) * t * control.x + t * t * destination.x; + float y = powf(1 - t, 2) * origin.y + 2.0f * (1 - t) * t * control.y + t * t * destination.y; + vertices[i] = CGPointMake(x, y); + t += 1.0f / segments; + } + vertices[segments] = destination; + + // Default GL states: GL_TEXTURE_2D, GL_VERTEX_ARRAY, GL_COLOR_ARRAY, GL_TEXTURE_COORD_ARRAY + // Needed states: GL_VERTEX_ARRAY, + // Unneeded states: GL_TEXTURE_2D, GL_TEXTURE_COORD_ARRAY, GL_COLOR_ARRAY + glDisable(GL_TEXTURE_2D); + glDisableClientState(GL_TEXTURE_COORD_ARRAY); + glDisableClientState(GL_COLOR_ARRAY); + + glVertexPointer(2, GL_FLOAT, 0, vertices); + glDrawArrays(GL_LINE_STRIP, 0, segments + 1); + delete[] vertices; + + // restore default state + glEnableClientState(GL_COLOR_ARRAY); + glEnableClientState(GL_TEXTURE_COORD_ARRAY); + glEnable(GL_TEXTURE_2D); +} + +void ccDrawCubicBezier(CGPoint origin, CGPoint control1, CGPoint control2, CGPoint destination, int segments) +{ + CGPoint *vertices = new CGPoint[segments + 1]; + + float t = 0; + for(int i = 0; i < segments; ++i) + { + float x = powf(1 - t, 3) * origin.x + 3.0f * powf(1 - t, 2) * t * control1.x + 3.0f * (1 - t) * t * t * control2.x + t * t * t * destination.x; + float y = powf(1 - t, 3) * origin.y + 3.0f * powf(1 - t, 2) * t * control1.y + 3.0f * (1 - t) * t * t * control2.y + t * t * t * destination.y; + vertices[i] = CGPointMake(x, y); + t += 1.0f / segments; + } + vertices[segments] = destination; + + // Default GL states: GL_TEXTURE_2D, GL_VERTEX_ARRAY, GL_COLOR_ARRAY, GL_TEXTURE_COORD_ARRAY + // Needed states: GL_VERTEX_ARRAY, + // Unneeded states: GL_TEXTURE_2D, GL_TEXTURE_COORD_ARRAY, GL_COLOR_ARRAY + glDisable(GL_TEXTURE_2D); + glDisableClientState(GL_TEXTURE_COORD_ARRAY); + glDisableClientState(GL_COLOR_ARRAY); + + glVertexPointer(2, GL_FLOAT, 0, vertices); + glDrawArrays(GL_LINE_STRIP, 0, segments + 1); + delete[] vertices; + + // restore default state + glEnableClientState(GL_COLOR_ARRAY); + glEnableClientState(GL_TEXTURE_COORD_ARRAY); + glEnable(GL_TEXTURE_2D); } diff --git a/cocos2dx/CCDrawingPrimitives.h b/cocos2dx/CCDrawingPrimitives.h index d03de8bf91..6c53c004e8 100644 --- a/cocos2dx/CCDrawingPrimitives.h +++ b/cocos2dx/CCDrawingPrimitives.h @@ -1,6 +1,8 @@ /**************************************************************************** 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 diff --git a/cocos2dx/CCamera.cpp b/cocos2dx/CCamera.cpp index e45b4c4dfb..9d5ad010c2 100644 --- a/cocos2dx/CCamera.cpp +++ b/cocos2dx/CCamera.cpp @@ -1,3 +1,27 @@ +/**************************************************************************** +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 "CCCamera.h" //#include "CCDirector.h" #include "ccMacros.h" diff --git a/cocos2dx/cocoa/CGGeometry.h b/cocos2dx/cocoa/CGGeometry.h index 1e38347b17..dd69c125cc 100644 --- a/cocos2dx/cocoa/CGGeometry.h +++ b/cocos2dx/cocoa/CGGeometry.h @@ -1,6 +1,8 @@ /**************************************************************************** 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 diff --git a/cocos2dx/cocoa/NSArray.cpp b/cocos2dx/cocoa/NSArray.cpp index 1defc3291c..4662cd6a0e 100644 --- a/cocos2dx/cocoa/NSArray.cpp +++ b/cocos2dx/cocoa/NSArray.cpp @@ -1,6 +1,8 @@ /**************************************************************************** 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 diff --git a/cocos2dx/cocoa/NSArray.h b/cocos2dx/cocoa/NSArray.h index 707f5e3f95..b08588b744 100644 --- a/cocos2dx/cocoa/NSArray.h +++ b/cocos2dx/cocoa/NSArray.h @@ -1,6 +1,8 @@ /**************************************************************************** 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 diff --git a/cocos2dx/cocoa/NSAutoreleasePool.cpp b/cocos2dx/cocoa/NSAutoreleasePool.cpp index 373d4731ba..5eb750b99b 100644 --- a/cocos2dx/cocoa/NSAutoreleasePool.cpp +++ b/cocos2dx/cocoa/NSAutoreleasePool.cpp @@ -1,6 +1,8 @@ /**************************************************************************** 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 diff --git a/cocos2dx/cocoa/NSAutoreleasePool.h b/cocos2dx/cocoa/NSAutoreleasePool.h index d5a8970381..89daeb6b79 100644 --- a/cocos2dx/cocoa/NSAutoreleasePool.h +++ b/cocos2dx/cocoa/NSAutoreleasePool.h @@ -1,6 +1,8 @@ /**************************************************************************** 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 diff --git a/cocos2dx/cocoa/NSData.cpp b/cocos2dx/cocoa/NSData.cpp index d80842b71e..01e0a89b5c 100644 --- a/cocos2dx/cocoa/NSData.cpp +++ b/cocos2dx/cocoa/NSData.cpp @@ -1,6 +1,8 @@ /**************************************************************************** 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 diff --git a/cocos2dx/cocoa/NSData.h b/cocos2dx/cocoa/NSData.h index d2c2a3a7ac..47846253f6 100644 --- a/cocos2dx/cocoa/NSData.h +++ b/cocos2dx/cocoa/NSData.h @@ -1,6 +1,8 @@ /**************************************************************************** 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 diff --git a/cocos2dx/cocoa/NSLock.cpp b/cocos2dx/cocoa/NSLock.cpp index 01b9411424..f217d72d22 100644 --- a/cocos2dx/cocoa/NSLock.cpp +++ b/cocos2dx/cocoa/NSLock.cpp @@ -1,6 +1,8 @@ /**************************************************************************** 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 diff --git a/cocos2dx/cocoa/NSLock.h b/cocos2dx/cocoa/NSLock.h index a9d69a32e9..b69ef5ddf1 100644 --- a/cocos2dx/cocoa/NSLock.h +++ b/cocos2dx/cocoa/NSLock.h @@ -1,6 +1,8 @@ /**************************************************************************** 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 diff --git a/cocos2dx/cocoa/NSMutableArray.cpp b/cocos2dx/cocoa/NSMutableArray.cpp index 4f94a8f69e..95af38c470 100644 --- a/cocos2dx/cocoa/NSMutableArray.cpp +++ b/cocos2dx/cocoa/NSMutableArray.cpp @@ -1,6 +1,8 @@ /**************************************************************************** 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 diff --git a/cocos2dx/cocoa/NSMutableArray.h b/cocos2dx/cocoa/NSMutableArray.h index e1ebb26615..59ef10d254 100644 --- a/cocos2dx/cocoa/NSMutableArray.h +++ b/cocos2dx/cocoa/NSMutableArray.h @@ -1,6 +1,8 @@ /**************************************************************************** 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 diff --git a/cocos2dx/cocoa/NSObject.cpp b/cocos2dx/cocoa/NSObject.cpp index 750e2d4a25..38a471d3c4 100644 --- a/cocos2dx/cocoa/NSObject.cpp +++ b/cocos2dx/cocoa/NSObject.cpp @@ -1,6 +1,8 @@ /**************************************************************************** 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 diff --git a/cocos2dx/cocoa/NSObject.h b/cocos2dx/cocoa/NSObject.h index 234e7bb222..94b6ea20cd 100644 --- a/cocos2dx/cocoa/NSObject.h +++ b/cocos2dx/cocoa/NSObject.h @@ -1,6 +1,8 @@ /**************************************************************************** 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 diff --git a/cocos2dx/cocoa/NSSet.cpp b/cocos2dx/cocoa/NSSet.cpp index 1defc3291c..4662cd6a0e 100644 --- a/cocos2dx/cocoa/NSSet.cpp +++ b/cocos2dx/cocoa/NSSet.cpp @@ -1,6 +1,8 @@ /**************************************************************************** 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 diff --git a/cocos2dx/cocoa/NSSet.h b/cocos2dx/cocoa/NSSet.h index ecd4002c39..5c6ecfd3e4 100644 --- a/cocos2dx/cocoa/NSSet.h +++ b/cocos2dx/cocoa/NSSet.h @@ -1,6 +1,8 @@ /**************************************************************************** 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 diff --git a/cocos2dx/cocoa/NSString.cpp b/cocos2dx/cocoa/NSString.cpp index 1defc3291c..4662cd6a0e 100644 --- a/cocos2dx/cocoa/NSString.cpp +++ b/cocos2dx/cocoa/NSString.cpp @@ -1,6 +1,8 @@ /**************************************************************************** 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 diff --git a/cocos2dx/cocoa/NSString.h b/cocos2dx/cocoa/NSString.h index 0c88f8a69b..c7b2372f3f 100644 --- a/cocos2dx/cocoa/NSString.h +++ b/cocos2dx/cocoa/NSString.h @@ -1,6 +1,8 @@ /**************************************************************************** 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 diff --git a/cocos2dx/cocoa/NSZone.cpp b/cocos2dx/cocoa/NSZone.cpp index 1defc3291c..4662cd6a0e 100644 --- a/cocos2dx/cocoa/NSZone.cpp +++ b/cocos2dx/cocoa/NSZone.cpp @@ -1,6 +1,8 @@ /**************************************************************************** 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 diff --git a/cocos2dx/cocoa/NSZone.h b/cocos2dx/cocoa/NSZone.h index 10512dcf1c..f7aa5e0a88 100644 --- a/cocos2dx/cocoa/NSZone.h +++ b/cocos2dx/cocoa/NSZone.h @@ -1,6 +1,8 @@ /**************************************************************************** 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 diff --git a/cocos2dx/cocos2d.cpp b/cocos2dx/cocos2d.cpp index bccadec660..3a95415af9 100644 --- a/cocos2dx/cocos2d.cpp +++ b/cocos2dx/cocos2d.cpp @@ -1,3 +1,27 @@ +/**************************************************************************** +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 "include/cocos2d.h" using namespace std; diff --git a/cocos2dx/include/CCCamera.h b/cocos2dx/include/CCCamera.h index 1df6866f87..a2e5ba1d24 100644 --- a/cocos2dx/include/CCCamera.h +++ b/cocos2dx/include/CCCamera.h @@ -1,6 +1,8 @@ /**************************************************************************** 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 diff --git a/cocos2dx/include/CCProtocols.h b/cocos2dx/include/CCProtocols.h index 3935144f13..5dfa6e1051 100644 --- a/cocos2dx/include/CCProtocols.h +++ b/cocos2dx/include/CCProtocols.h @@ -1,6 +1,8 @@ /**************************************************************************** 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 diff --git a/cocos2dx/include/Cocos2dDefine.h b/cocos2dx/include/Cocos2dDefine.h index 189c05797f..a30739c304 100644 --- a/cocos2dx/include/Cocos2dDefine.h +++ b/cocos2dx/include/Cocos2dDefine.h @@ -1,6 +1,8 @@ /**************************************************************************** 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 @@ -23,19 +25,19 @@ THE SOFTWARE. #ifndef __COCOS2D_DEFINE_H__ #define __COCOS2D_DEFINE_H__ -#define GET_VARIABLE(varType, varName)\ - public inline varType get##varName() { return varName; }; - -#define SET_VARIABLE(varType, varName)\ - public inline void set##varName(varType funVar) { varName = funVar; }; - -#define VAR_PROPERTY_READONLY(varType, varName)\ - protected varType m_##varName;\ - GET_VARIABLE(varType, varName) - -#define VAR_PROPERTY_READWRITE(varType, varName)\ - protected varType m_##varName;\ - GET_VARIABLE(varType, varName)\ +#define GET_VARIABLE(varType, varName)\ + public inline varType get##varName() { return varName; }; + +#define SET_VARIABLE(varType, varName)\ + public inline void set##varName(varType funVar) { varName = funVar; }; + +#define VAR_PROPERTY_READONLY(varType, varName)\ + protected varType m_##varName;\ + GET_VARIABLE(varType, varName) + +#define VAR_PROPERTY_READWRITE(varType, varName)\ + protected varType m_##varName;\ + GET_VARIABLE(varType, varName)\ SET_VARIABLE(varTYPE, varName) #endif // __COCOS2D_DEFINE_H__ \ No newline at end of file diff --git a/cocos2dx/include/Cocos2dTypes.h b/cocos2dx/include/Cocos2dTypes.h index ccf961827b..d69e17930b 100644 --- a/cocos2dx/include/Cocos2dTypes.h +++ b/cocos2dx/include/Cocos2dTypes.h @@ -1,6 +1,8 @@ /**************************************************************************** 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 diff --git a/cocos2dx/include/ccConfig.h b/cocos2dx/include/ccConfig.h index a65ce13b04..107355e2ee 100644 --- a/cocos2dx/include/ccConfig.h +++ b/cocos2dx/include/ccConfig.h @@ -1,6 +1,8 @@ /**************************************************************************** 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 diff --git a/cocos2dx/include/ccMacros.h b/cocos2dx/include/ccMacros.h index b716d2df52..5dc8840b0e 100644 --- a/cocos2dx/include/ccMacros.h +++ b/cocos2dx/include/ccMacros.h @@ -1,6 +1,8 @@ /**************************************************************************** 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 diff --git a/cocos2dx/include/ccTypes.h b/cocos2dx/include/ccTypes.h index a595b46033..3b791f570e 100644 --- a/cocos2dx/include/ccTypes.h +++ b/cocos2dx/include/ccTypes.h @@ -1,6 +1,8 @@ /**************************************************************************** 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 diff --git a/cocos2dx/include/cocos2d.h b/cocos2dx/include/cocos2d.h index 64b56ff103..2dc27b5ad8 100644 --- a/cocos2dx/include/cocos2d.h +++ b/cocos2dx/include/cocos2d.h @@ -1,6 +1,8 @@ /**************************************************************************** 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 diff --git a/cocos2dx/include/glu.h b/cocos2dx/include/glu.h index 03a82a82ac..627eebe822 100644 --- a/cocos2dx/include/glu.h +++ b/cocos2dx/include/glu.h @@ -1,6 +1,8 @@ /**************************************************************************** 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