Merge branch 'develop' into #3585

This commit is contained in:
chengstory 2014-01-06 10:43:44 +08:00
commit e1b36e2e20
7 changed files with 28 additions and 16 deletions

View File

@ -57,7 +57,7 @@ TMXLayerInfo::~TMXLayerInfo()
}
}
ValueMap TMXLayerInfo::getProperties()
ValueMap& TMXLayerInfo::getProperties()
{
return _properties;
}

View File

@ -102,7 +102,7 @@ public:
virtual ~TMXLayerInfo();
void setProperties(ValueMap properties);
ValueMap getProperties();
ValueMap& getProperties();
ValueMap _properties;
std::string _name;

@ -1 +1 @@
Subproject commit bfbc9df5933bc2cdaba496561da584ce02a06ed3
Subproject commit f3d5f69b7b088e348e1a6a58734b949c381f9a78

View File

@ -101,12 +101,6 @@ RenderTextureSave::RenderTextureSave()
// note that the render texture is a Node, and contains a sprite of its texture for convience,
// so we can just parent it to the scene like any other Node
this->addChild(_target, -1);
// create a brush image to draw into the texture with
_brush = Sprite::create("Images/fire.png");
_brush->retain();
_brush->setColor(Color3B::RED);
_brush->setOpacity(20);
auto listener = EventListenerTouchAllAtOnce::create();
listener->onTouchesMoved = CC_CALLBACK_2(RenderTextureSave::onTouchesMoved, this);
@ -170,7 +164,6 @@ void RenderTextureSave::saveImage(cocos2d::Object *sender)
RenderTextureSave::~RenderTextureSave()
{
_brush->release();
_target->release();
Director::getInstance()->getTextureCache()->removeUnusedTextures();
}
@ -190,20 +183,28 @@ void RenderTextureSave::onTouchesMoved(const std::vector<Touch*>& touches, Event
if (distance > 1)
{
int d = (int)distance;
_brushs.clear();
for(int i = 0; i < d; ++i)
{
Sprite * sprite = Sprite::create("Images/fire.png");
sprite->setColor(Color3B::RED);
sprite->setOpacity(20);
_brushs.pushBack(sprite);
}
for (int i = 0; i < d; i++)
{
float difx = end.x - start.x;
float dify = end.y - start.y;
float delta = (float)i / distance;
_brush->setPosition(Point(start.x + (difx * delta), start.y + (dify * delta)));
_brush->setRotation(rand() % 360);
_brushs.at(i)->setPosition(Point(start.x + (difx * delta), start.y + (dify * delta)));
_brushs.at(i)->setRotation(rand() % 360);
float r = (float)(rand() % 50 / 50.f) + 0.25f;
_brush->setScale(r);
_brushs.at(i)->setScale(r);
/*_brush->setColor(Color3B(CCRANDOM_0_1() * 127 + 128, 255, 255));*/
// Use CCRANDOM_0_1() will cause error when loading libtests.so on android, I don't know why.
_brush->setColor(Color3B(rand() % 127 + 128, 255, 255));
_brushs.at(i)->setColor(Color3B(rand() % 127 + 128, 255, 255));
// Call visit to draw the brush, don't call draw..
_brush->visit();
_brushs.at(i)->visit();
}
}

View File

@ -32,7 +32,7 @@ public:
private:
RenderTexture *_target;
Sprite *_brush;
Vector<Sprite*> _brushs;
};
class RenderTextureIssue937 : public RenderTextureTest

View File

@ -189,6 +189,7 @@ xcopy /Y /Q "$(ProjectDir)..\..\..\..\external\websockets\prebuilt\win32\*.*" "$
<ClCompile Include="..\Classes\ShaderTest\ShaderTest2.cpp" />
<ClCompile Include="..\Classes\SpineTest\SpineTest.cpp" />
<ClCompile Include="..\Classes\TexturePackerEncryptionTest\TextureAtlasEncryptionTest.cpp" />
<ClCompile Include="..\Classes\UnitTest\UnitTest.cpp" />
<ClCompile Include="..\Classes\VisibleRect.cpp" />
<ClCompile Include="main.cpp" />
<ClCompile Include="..\Classes\AppDelegate.cpp" />
@ -330,6 +331,7 @@ xcopy /Y /Q "$(ProjectDir)..\..\..\..\external\websockets\prebuilt\win32\*.*" "$
<ClInclude Include="..\Classes\ShaderTest\ShaderTest2.h" />
<ClInclude Include="..\Classes\SpineTest\SpineTest.h" />
<ClInclude Include="..\Classes\TexturePackerEncryptionTest\TextureAtlasEncryptionTest.h" />
<ClInclude Include="..\Classes\UnitTest\UnitTest.h" />
<ClInclude Include="..\Classes\VisibleRect.h" />
<ClInclude Include="main.h" />
<ClInclude Include="..\Classes\AppDelegate.h" />

View File

@ -301,6 +301,9 @@
<Filter Include="Classes\ExtensionsTest\CocoStudioGUITest\UILayoutTest">
<UniqueIdentifier>{c4dbbfb3-0e91-492f-bbbf-f03fb26f3f54}</UniqueIdentifier>
</Filter>
<Filter Include="Classes\UnitTest">
<UniqueIdentifier>{1821914f-c088-4946-8c1e-19ab57b5eabc}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="main.cpp">
@ -700,6 +703,9 @@
<ClCompile Include="..\Classes\ExtensionsTest\CocoStudioGUITest\UILayoutTest\UILayoutTest.cpp">
<Filter>Classes\ExtensionsTest\CocoStudioGUITest\UILayoutTest</Filter>
</ClCompile>
<ClCompile Include="..\Classes\UnitTest\UnitTest.cpp">
<Filter>Classes\UnitTest</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="main.h">
@ -1291,5 +1297,8 @@
<ClInclude Include="..\Classes\ExtensionsTest\CocoStudioGUITest\UILayoutTest\UILayoutTest.h">
<Filter>Classes\ExtensionsTest\CocoStudioGUITest\UILayoutTest</Filter>
</ClInclude>
<ClInclude Include="..\Classes\UnitTest\UnitTest.h">
<Filter>Classes\UnitTest</Filter>
</ClInclude>
</ItemGroup>
</Project>