fixed getContentSize pass by reference issue

update project setting for release mode
This commit is contained in:
Phenix Yu 2012-04-14 17:13:38 +08:00
parent 1ed6df9de8
commit 61a7ca71c5
5 changed files with 12 additions and 11 deletions

View File

@ -81,7 +81,7 @@
<ClCompile>
<Optimization>MaxSpeed</Optimization>
<IntrinsicFunctions>true</IntrinsicFunctions>
<AdditionalIncludeDirectories>$(SolutionDir)cocos2dx\platform;$(SolutionDir)cocos2dx\include;$(SolutionDir)cocos2dx;$(SolutionDir)cocos2dx\platform\third_party\win32\OGLES;..\Classes;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>$(SolutionDir)cocos2dx\platform;$(SolutionDir)cocos2dx\include;$(SolutionDir)cocos2dx;$(SolutionDir)cocos2dx\platform\third_party\win32\OGLES;..\Classes;$(SolutionDir)cocos2dx\kazmath\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<FunctionLevelLinking>true</FunctionLevelLinking>

View File

@ -220,7 +220,8 @@ public:
static void PVRImagesHavePremultipliedAlpha(bool haveAlphaPremultiplied);
/** content size */
const CCSize& getContentSizeInPixels();
CCSize getContentSize();
private:
bool initPremultipliedATextureWithImage(CCImage * image, unsigned int pixelsWide, unsigned int pixelsHigh);
@ -242,7 +243,7 @@ private:
/** texture max T */
CC_PROPERTY(GLfloat, m_fMaxT, MaxT)
/** content size */
CC_PROPERTY_READONLY_PASS_BY_REF(CCSize, m_tContentSize, ContentSize)
CC_PROPERTY_READONLY_PASS_BY_REF(CCSize, m_tContentSize, ContentSizeInPixels)
/** whether or not the texture has their Alpha premultiplied */
CC_PROPERTY_READONLY(bool, m_bHasPremultipliedAlpha, HasPremultipliedAlpha);

View File

@ -95,7 +95,7 @@ xcopy /Y /Q "$(SolutionDir)cocos2dx\platform\third_party\win32\libraries\*.*" "$
</Command>
</PreBuildEvent>
<ClCompile>
<AdditionalIncludeDirectories>..\platform;..\platform\third_party\win32\iconv;..\platform\third_party\win32\zlib;..\platform\third_party\win32\libpng;..\platform\third_party\win32\libjpeg;..\platform\third_party\win32\pthread;..\platform\third_party\win32\libxml2;..\platform\third_party\win32\OGLES;..\include;..;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>..\platform;..\platform\third_party\win32\iconv;..\platform\third_party\win32\zlib;..\platform\third_party\win32\libpng;..\platform\third_party\win32\libjpeg;..\platform\third_party\win32\pthread;..\platform\third_party\win32\libxml2;..\platform\third_party\win32\OGLES;..\include;..;..\kazmath\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;COCOS2DXWIN32_EXPORTS;GL_GLEXT_PROTOTYPES;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<PrecompiledHeader>
@ -110,7 +110,7 @@ xcopy /Y /Q "$(SolutionDir)cocos2dx\platform\third_party\win32\libraries\*.*" "$
</Command>
</PreLinkEvent>
<Link>
<AdditionalDependencies>libEGL.lib;libgles_cm.lib;libxml2.lib;libzlib.lib;libpng.lib;libjpeg.lib;libiconv.lib;pthreadVCE2.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies>libEGL.lib;libglesv2.lib;libxml2.lib;libzlib.lib;libpng.lib;libjpeg.lib;libiconv.lib;pthreadVCE2.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>$(OutDir)$(ProjectName).dll</OutputFile>
<AdditionalLibraryDirectories>$(OutDir);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<IgnoreSpecificDefaultLibraries> ;%(IgnoreSpecificDefaultLibraries)</IgnoreSpecificDefaultLibraries>

View File

@ -68,7 +68,7 @@ bool CCShaderCache::init()
loadDefaultShaders();
return true;
}
#define ENABLE_ALL_SHADER 1
void CCShaderCache::loadDefaultShaders()
{
// Position Texture Color shader
@ -86,7 +86,7 @@ void CCShaderCache::loadDefaultShaders()
p->release();
CHECK_GL_ERROR_DEBUG();
#if ENABLE_ALL_SHADER
// Position Texture Color alpha test
p = new CCGLProgram();
p->initWithVertexShaderByteArray(ccPositionTextureColor_vert, ccPositionTextureColorAlphaTest_frag);
@ -135,7 +135,7 @@ void CCShaderCache::loadDefaultShaders()
p->release();
CHECK_GL_ERROR_DEBUG();
#endif
//
// Position, Texture attribs, 1 Color as uniform shader
//
@ -152,7 +152,7 @@ void CCShaderCache::loadDefaultShaders()
p->release();
CHECK_GL_ERROR_DEBUG();
#if ENABLE_ALL_SHADER
//
// Position Texture A8 Color shader
//
@ -186,6 +186,7 @@ void CCShaderCache::loadDefaultShaders()
p->release();
CHECK_GL_ERROR_DEBUG();
#endif
}
CCGLProgram* CCShaderCache::programForKey(const char* key)

View File

@ -117,12 +117,11 @@ const CCSize& CCTexture2D::getContentSizeInPixels()
return m_tContentSize;
}
const CCSize& CCTexture2D::getContentSize()
CCSize CCTexture2D::getContentSize()
{
CCSize ret;
ret.width = m_tContentSize.width / CC_CONTENT_SCALE_FACTOR();
ret.height = m_tContentSize.height / CC_CONTENT_SCALE_FACTOR();
return ret;
}