mirror of https://github.com/axmolengine/axmol.git
Merge pull request #8958 from MSOpenTech/wp8-shader-fix
WP8 Shader fix for cocos2d-x issue 8933
This commit is contained in:
commit
e87e0290fd
|
@ -23,8 +23,11 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libSpine.Shared", "..\..\..
|
|||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libSpine.Windows", "..\..\..\cocos\editor-support\spine\proj.win8.1-universal\libSpine.Windows\libSpine.Windows.vcxproj", "{F3550FE0-C795-44F6-8FEB-093EB68143AE}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libcocos2d_8_1.Windows", "..\..\..\cocos\2d\libcocos2d_8_1\libcocos2d_8_1\libcocos2d_8_1.Windows\libcocos2d_8_1.Windows.vcxproj", "{9335005F-678E-4E8E-9B84-50037216AEC8}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SharedMSBuildProjectFiles) = preSolution
|
||||
..\..\..\cocos\2d\libcocos2d_8_1\libcocos2d_8_1\libcocos2d_8_1.Shared\libcocos2d_8_1.Shared.vcxitems*{9335005f-678e-4e8e-9b84-50037216aec8}*SharedItemsImports = 4
|
||||
..\..\..\external\Box2D\proj.win8.1-universal\libbox2d.Shared\libbox2d.Shared.vcxitems*{4a3c6ba8-c227-498b-aa21-40bda27b461f}*SharedItemsImports = 9
|
||||
..\..\..\cocos\editor-support\spine\proj.win8.1-universal\libSpine.Shared\libSpine.Shared.vcxitems*{adafd00d-a0d6-46ef-9f0b-ea2880bfe1de}*SharedItemsImports = 9
|
||||
..\..\..\cocos\2d\libcocos2d_8_1\libcocos2d_8_1\libcocos2d_8_1.Shared\libcocos2d_8_1.Shared.vcxitems*{5d6f020f-7e72-4494-90a0-2df11d235df9}*SharedItemsImports = 9
|
||||
|
@ -82,6 +85,18 @@ Global
|
|||
{F3550FE0-C795-44F6-8FEB-093EB68143AE}.Release|Win32.Build.0 = Release|Win32
|
||||
{F3550FE0-C795-44F6-8FEB-093EB68143AE}.Release|x64.ActiveCfg = Release|x64
|
||||
{F3550FE0-C795-44F6-8FEB-093EB68143AE}.Release|x64.Build.0 = Release|x64
|
||||
{9335005F-678E-4E8E-9B84-50037216AEC8}.Debug|ARM.ActiveCfg = Debug|ARM
|
||||
{9335005F-678E-4E8E-9B84-50037216AEC8}.Debug|ARM.Build.0 = Debug|ARM
|
||||
{9335005F-678E-4E8E-9B84-50037216AEC8}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{9335005F-678E-4E8E-9B84-50037216AEC8}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{9335005F-678E-4E8E-9B84-50037216AEC8}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{9335005F-678E-4E8E-9B84-50037216AEC8}.Debug|x64.Build.0 = Debug|x64
|
||||
{9335005F-678E-4E8E-9B84-50037216AEC8}.Release|ARM.ActiveCfg = Release|ARM
|
||||
{9335005F-678E-4E8E-9B84-50037216AEC8}.Release|ARM.Build.0 = Release|ARM
|
||||
{9335005F-678E-4E8E-9B84-50037216AEC8}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{9335005F-678E-4E8E-9B84-50037216AEC8}.Release|Win32.Build.0 = Release|Win32
|
||||
{9335005F-678E-4E8E-9B84-50037216AEC8}.Release|x64.ActiveCfg = Release|x64
|
||||
{9335005F-678E-4E8E-9B84-50037216AEC8}.Release|x64.Build.0 = Release|x64
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
@ -94,5 +109,6 @@ Global
|
|||
{3B26A12D-3A44-47EA-82D2-282660FC844D} = {7CA66464-6A5E-493B-82EF-DBD84F91766F}
|
||||
{ADAFD00D-A0D6-46EF-9F0B-EA2880BFE1DE} = {8F8A69D6-BD64-4BAD-AE20-2D07E7BD57BA}
|
||||
{F3550FE0-C795-44F6-8FEB-093EB68143AE} = {8F8A69D6-BD64-4BAD-AE20-2D07E7BD57BA}
|
||||
{9335005F-678E-4E8E-9B84-50037216AEC8} = {29321038-F308-421E-B8CA-140BB23D3C6D}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
|
|
|
@ -395,7 +395,13 @@ void Label::setFontAtlas(FontAtlas* atlas,bool distanceFieldEnabled /* = false *
|
|||
_commonLineHeight = _fontAtlas->getCommonLineHeight();
|
||||
_contentDirty = true;
|
||||
}
|
||||
#if CC_TARGET_PLATFORM != CC_PLATFORM_WP8
|
||||
_useDistanceField = distanceFieldEnabled;
|
||||
#else
|
||||
// some older Windows Phones cannot run the ccShader_Label_df.frag program
|
||||
// so we must disable distance field
|
||||
_useDistanceField = false;
|
||||
#endif
|
||||
_useA8Shader = useA8Shader;
|
||||
|
||||
if (_currentLabelType != LabelType::TTF)
|
||||
|
|
|
@ -53,12 +53,6 @@
|
|||
<Filter Include="platform\winrt">
|
||||
<UniqueIdentifier>{a2fd6c36-9078-45e7-bc11-c235357f565e}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="platform\renderer">
|
||||
<UniqueIdentifier>{c52c9563-bc10-4b77-8bcc-0e061628fae7}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="platform\renderer\shaders">
|
||||
<UniqueIdentifier>{1be811ab-a9b0-44f7-9a37-b7ef7f1ef24a}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="cocosbuilder">
|
||||
<UniqueIdentifier>{794d19d1-2992-497a-a770-081932fa9242}</UniqueIdentifier>
|
||||
</Filter>
|
||||
|
@ -236,6 +230,12 @@
|
|||
<Filter Include="cocostudio\json\protobuf-lite\src\google\protobuf\stubs">
|
||||
<UniqueIdentifier>{b7fdf4e2-b3be-4b7a-b586-ddab39fb05b7}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="renderer">
|
||||
<UniqueIdentifier>{c52c9563-bc10-4b77-8bcc-0e061628fae7}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="renderer\shaders">
|
||||
<UniqueIdentifier>{1be811ab-a9b0-44f7-9a37-b7ef7f1ef24a}</UniqueIdentifier>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="CCAction.cpp">
|
||||
|
@ -782,67 +782,67 @@
|
|||
<Filter>platform\winrt</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\renderer\CCBatchCommand.cpp">
|
||||
<Filter>platform\renderer</Filter>
|
||||
<Filter>renderer</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\renderer\CCCustomCommand.cpp">
|
||||
<Filter>platform\renderer</Filter>
|
||||
<Filter>renderer</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\renderer\CCGLProgram.cpp">
|
||||
<Filter>platform\renderer</Filter>
|
||||
<Filter>renderer</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\renderer\CCGLProgramCache.cpp">
|
||||
<Filter>platform\renderer</Filter>
|
||||
<Filter>renderer</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\renderer\CCGLProgramState.cpp">
|
||||
<Filter>platform\renderer</Filter>
|
||||
<Filter>renderer</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\renderer\CCGLProgramStateCache.cpp">
|
||||
<Filter>platform\renderer</Filter>
|
||||
<Filter>renderer</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\renderer\ccGLStateCache.cpp">
|
||||
<Filter>platform\renderer</Filter>
|
||||
<Filter>renderer</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\renderer\CCGroupCommand.cpp">
|
||||
<Filter>platform\renderer</Filter>
|
||||
<Filter>renderer</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\renderer\CCMeshCommand.cpp">
|
||||
<Filter>platform\renderer</Filter>
|
||||
<Filter>renderer</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\renderer\CCPrimitive.cpp">
|
||||
<Filter>platform\renderer</Filter>
|
||||
<Filter>renderer</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\renderer\CCPrimitiveCommand.cpp">
|
||||
<Filter>platform\renderer</Filter>
|
||||
<Filter>renderer</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\renderer\CCQuadCommand.cpp">
|
||||
<Filter>platform\renderer</Filter>
|
||||
<Filter>renderer</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\renderer\CCRenderCommand.cpp">
|
||||
<Filter>platform\renderer</Filter>
|
||||
<Filter>renderer</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\renderer\CCRenderer.cpp">
|
||||
<Filter>platform\renderer</Filter>
|
||||
<Filter>renderer</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\renderer\ccShaders.cpp">
|
||||
<Filter>platform\renderer</Filter>
|
||||
<Filter>renderer</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\renderer\CCTexture2D.cpp">
|
||||
<Filter>platform\renderer</Filter>
|
||||
<Filter>renderer</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\renderer\CCTextureAtlas.cpp">
|
||||
<Filter>platform\renderer</Filter>
|
||||
<Filter>renderer</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\renderer\CCTextureCache.cpp">
|
||||
<Filter>platform\renderer</Filter>
|
||||
<Filter>renderer</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\renderer\CCTrianglesCommand.cpp">
|
||||
<Filter>platform\renderer</Filter>
|
||||
<Filter>renderer</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\renderer\CCVertexIndexBuffer.cpp">
|
||||
<Filter>platform\renderer</Filter>
|
||||
<Filter>renderer</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\renderer\CCVertexIndexData.cpp">
|
||||
<Filter>platform\renderer</Filter>
|
||||
<Filter>renderer</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\cocos2d.cpp" />
|
||||
<ClCompile Include="..\editor-support\cocosbuilder\CCBAnimationManager.cpp">
|
||||
|
@ -1932,70 +1932,70 @@
|
|||
<Filter>platform\winrt</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\renderer\CCBatchCommand.h">
|
||||
<Filter>platform\renderer</Filter>
|
||||
<Filter>renderer</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\renderer\CCCustomCommand.h">
|
||||
<Filter>platform\renderer</Filter>
|
||||
<Filter>renderer</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\renderer\CCGLProgram.h">
|
||||
<Filter>platform\renderer</Filter>
|
||||
<Filter>renderer</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\renderer\CCGLProgramCache.h">
|
||||
<Filter>platform\renderer</Filter>
|
||||
<Filter>renderer</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\renderer\CCGLProgramState.h">
|
||||
<Filter>platform\renderer</Filter>
|
||||
<Filter>renderer</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\renderer\CCGLProgramStateCache.h">
|
||||
<Filter>platform\renderer</Filter>
|
||||
<Filter>renderer</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\renderer\ccGLStateCache.h">
|
||||
<Filter>platform\renderer</Filter>
|
||||
<Filter>renderer</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\renderer\CCGroupCommand.h">
|
||||
<Filter>platform\renderer</Filter>
|
||||
<Filter>renderer</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\renderer\CCMeshCommand.h">
|
||||
<Filter>platform\renderer</Filter>
|
||||
<Filter>renderer</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\renderer\CCPrimitive.h">
|
||||
<Filter>platform\renderer</Filter>
|
||||
<Filter>renderer</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\renderer\CCPrimitiveCommand.h">
|
||||
<Filter>platform\renderer</Filter>
|
||||
<Filter>renderer</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\renderer\CCQuadCommand.h">
|
||||
<Filter>platform\renderer</Filter>
|
||||
<Filter>renderer</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\renderer\CCRenderCommand.h">
|
||||
<Filter>platform\renderer</Filter>
|
||||
<Filter>renderer</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\renderer\CCRenderCommandPool.h">
|
||||
<Filter>platform\renderer</Filter>
|
||||
<Filter>renderer</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\renderer\CCRenderer.h">
|
||||
<Filter>platform\renderer</Filter>
|
||||
<Filter>renderer</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\renderer\ccShaders.h">
|
||||
<Filter>platform\renderer</Filter>
|
||||
<Filter>renderer</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\renderer\CCTexture2D.h">
|
||||
<Filter>platform\renderer</Filter>
|
||||
<Filter>renderer</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\renderer\CCTextureAtlas.h">
|
||||
<Filter>platform\renderer</Filter>
|
||||
<Filter>renderer</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\renderer\CCTextureCache.h">
|
||||
<Filter>platform\renderer</Filter>
|
||||
<Filter>renderer</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\renderer\CCTrianglesCommand.h">
|
||||
<Filter>platform\renderer</Filter>
|
||||
<Filter>renderer</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\renderer\CCVertexIndexBuffer.h">
|
||||
<Filter>platform\renderer</Filter>
|
||||
<Filter>renderer</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\renderer\CCVertexIndexData.h">
|
||||
<Filter>platform\renderer</Filter>
|
||||
<Filter>renderer</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\editor-support\cocosbuilder\CCBAnimationManager.h">
|
||||
<Filter>cocosbuilder\Header Files</Filter>
|
||||
|
@ -2586,70 +2586,70 @@
|
|||
<Filter>math</Filter>
|
||||
</None>
|
||||
<None Include="..\renderer\ccShader_Label.vert">
|
||||
<Filter>platform\renderer\shaders</Filter>
|
||||
<Filter>renderer\shaders</Filter>
|
||||
</None>
|
||||
<None Include="..\renderer\ccShader_Label_df.frag">
|
||||
<Filter>platform\renderer\shaders</Filter>
|
||||
<Filter>renderer\shaders</Filter>
|
||||
</None>
|
||||
<None Include="..\renderer\ccShader_Label_df_glow.frag">
|
||||
<Filter>platform\renderer\shaders</Filter>
|
||||
<Filter>renderer\shaders</Filter>
|
||||
</None>
|
||||
<None Include="..\renderer\ccShader_Label_normal.frag">
|
||||
<Filter>platform\renderer\shaders</Filter>
|
||||
<Filter>renderer\shaders</Filter>
|
||||
</None>
|
||||
<None Include="..\renderer\ccShader_Label_outline.frag">
|
||||
<Filter>platform\renderer\shaders</Filter>
|
||||
<Filter>renderer\shaders</Filter>
|
||||
</None>
|
||||
<None Include="..\renderer\ccShader_PositionColor.frag">
|
||||
<Filter>platform\renderer\shaders</Filter>
|
||||
<Filter>renderer\shaders</Filter>
|
||||
</None>
|
||||
<None Include="..\renderer\ccShader_PositionColor.vert">
|
||||
<Filter>platform\renderer\shaders</Filter>
|
||||
<Filter>renderer\shaders</Filter>
|
||||
</None>
|
||||
<None Include="..\renderer\ccShader_PositionColorLengthTexture.frag">
|
||||
<Filter>platform\renderer\shaders</Filter>
|
||||
<Filter>renderer\shaders</Filter>
|
||||
</None>
|
||||
<None Include="..\renderer\ccShader_PositionColorLengthTexture.vert">
|
||||
<Filter>platform\renderer\shaders</Filter>
|
||||
<Filter>renderer\shaders</Filter>
|
||||
</None>
|
||||
<None Include="..\renderer\ccShader_PositionTexture.frag">
|
||||
<Filter>platform\renderer\shaders</Filter>
|
||||
<Filter>renderer\shaders</Filter>
|
||||
</None>
|
||||
<None Include="..\renderer\ccShader_PositionTexture.vert">
|
||||
<Filter>platform\renderer\shaders</Filter>
|
||||
<Filter>renderer\shaders</Filter>
|
||||
</None>
|
||||
<None Include="..\renderer\ccShader_PositionTextureA8Color.frag">
|
||||
<Filter>platform\renderer\shaders</Filter>
|
||||
<Filter>renderer\shaders</Filter>
|
||||
</None>
|
||||
<None Include="..\renderer\ccShader_PositionTextureA8Color.vert">
|
||||
<Filter>platform\renderer\shaders</Filter>
|
||||
<Filter>renderer\shaders</Filter>
|
||||
</None>
|
||||
<None Include="..\renderer\ccShader_PositionTextureColor.frag">
|
||||
<Filter>platform\renderer\shaders</Filter>
|
||||
<Filter>renderer\shaders</Filter>
|
||||
</None>
|
||||
<None Include="..\renderer\ccShader_PositionTextureColor.vert">
|
||||
<Filter>platform\renderer\shaders</Filter>
|
||||
<Filter>renderer\shaders</Filter>
|
||||
</None>
|
||||
<None Include="..\renderer\ccShader_PositionTextureColorAlphaTest.frag">
|
||||
<Filter>platform\renderer\shaders</Filter>
|
||||
<Filter>renderer\shaders</Filter>
|
||||
</None>
|
||||
<None Include="..\renderer\ccShader_PositionTextureColor_noMVP.frag">
|
||||
<Filter>platform\renderer\shaders</Filter>
|
||||
<Filter>renderer\shaders</Filter>
|
||||
</None>
|
||||
<None Include="..\renderer\ccShader_PositionTextureColor_noMVP.vert">
|
||||
<Filter>platform\renderer\shaders</Filter>
|
||||
<Filter>renderer\shaders</Filter>
|
||||
</None>
|
||||
<None Include="..\renderer\ccShader_PositionTexture_uColor.frag">
|
||||
<Filter>platform\renderer\shaders</Filter>
|
||||
<Filter>renderer\shaders</Filter>
|
||||
</None>
|
||||
<None Include="..\renderer\ccShader_PositionTexture_uColor.vert">
|
||||
<Filter>platform\renderer\shaders</Filter>
|
||||
<Filter>renderer\shaders</Filter>
|
||||
</None>
|
||||
<None Include="..\renderer\ccShader_Position_uColor.frag">
|
||||
<Filter>platform\renderer\shaders</Filter>
|
||||
<Filter>renderer\shaders</Filter>
|
||||
</None>
|
||||
<None Include="..\renderer\ccShader_Position_uColor.vert">
|
||||
<Filter>platform\renderer\shaders</Filter>
|
||||
<Filter>renderer\shaders</Filter>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
</Project>
|
|
@ -15,7 +15,7 @@
|
|||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
<MinimalRebuild>false</MinimalRebuild>
|
||||
<DebugInformationFormat>OldStyle</DebugInformationFormat>
|
||||
<DisableSpecificWarnings>4056;4996;4244;4251;</DisableSpecificWarnings>
|
||||
<DisableSpecificWarnings>4056;4996;4244;4251;4756;</DisableSpecificWarnings>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>libGLESv2.lib;libEGL.lib;ws2_32.lib;libwebsockets.lib;libcurl.lib;libchipmunk.lib;zlib.lib;libpng.lib;libjpeg.lib;libtiff.lib;freetype250.lib;sqlite3.lib;d2d1.lib;d3d11.lib;dxgi.lib;windowscodecs.lib;dwrite.lib;dxguid.lib;xaudio2.lib;mfcore.lib;mfplat.lib;mfreadwrite.lib;mfuuid.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
|
|
|
@ -543,7 +543,7 @@ static Data getData(const std::string& filename, bool forString)
|
|||
|
||||
Data ret;
|
||||
unsigned char* buffer = nullptr;
|
||||
ssize_t size = 0;
|
||||
size_t size = 0;
|
||||
size_t readsize;
|
||||
const char* mode = nullptr;
|
||||
if (forString)
|
||||
|
@ -1062,7 +1062,7 @@ bool FileUtils::createDirectory(const std::string& path)
|
|||
if (!(GetFileAttributesEx(wpath.c_str(), GetFileExInfoStandard, &wfad)))
|
||||
{
|
||||
subpath = "";
|
||||
for(int i = 0 ; i < dirs.size() ; ++i)
|
||||
for(unsigned int i = 0 ; i < dirs.size() ; ++i)
|
||||
{
|
||||
subpath += dirs[i];
|
||||
if (i > 0 && !isDirectoryExist(subpath))
|
||||
|
@ -1146,7 +1146,7 @@ bool FileUtils::removeDirectory(const std::string& path)
|
|||
bool ret=true;
|
||||
if (search!=INVALID_HANDLE_VALUE)
|
||||
{
|
||||
bool find=true;
|
||||
BOOL find=true;
|
||||
while (find)
|
||||
{
|
||||
//. ..
|
||||
|
@ -1168,8 +1168,10 @@ bool FileUtils::removeDirectory(const std::string& path)
|
|||
}
|
||||
FindClose(search);
|
||||
}
|
||||
if (ret)
|
||||
return RemoveDirectory(wpath.c_str());
|
||||
if (ret && RemoveDirectory(wpath.c_str()))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
#elif (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32)
|
||||
std::string command = "cmd /c rd /s /q ";
|
||||
|
|
|
@ -35,39 +35,46 @@ using namespace Windows::Graphics::Display;
|
|||
USING_NS_CC;
|
||||
|
||||
|
||||
Cocos2dRenderer::Cocos2dRenderer(const int width, const int height, CoreDispatcher^ dispatcher, Panel^ panel)
|
||||
: mApp(nullptr)
|
||||
, mWidth(width)
|
||||
, mHeight(height)
|
||||
Cocos2dRenderer::Cocos2dRenderer(int width, int height, float dpi, CoreDispatcher^ dispatcher, Panel^ panel)
|
||||
: m_app(nullptr)
|
||||
, m_width(width)
|
||||
, m_height(height)
|
||||
, m_dpi(dpi)
|
||||
, m_dispatcher(dispatcher)
|
||||
, m_panel(panel)
|
||||
{
|
||||
mApp = new AppDelegate();
|
||||
m_app = new AppDelegate();
|
||||
auto director = cocos2d::Director::getInstance();
|
||||
|
||||
GLViewImpl* glview = GLViewImpl::create("Test Cpp");
|
||||
glview->setDispatcher(dispatcher);
|
||||
glview->setPanel(panel);
|
||||
glview->Create(static_cast<float>(width), static_cast<float>(height), DisplayOrientations::Landscape);
|
||||
glview->Create(static_cast<float>(width), static_cast<float>(height), dpi, DisplayOrientations::Landscape);
|
||||
director->setOpenGLView(glview);
|
||||
CCApplication::getInstance()->run();
|
||||
}
|
||||
|
||||
Cocos2dRenderer::~Cocos2dRenderer()
|
||||
{
|
||||
delete mApp;
|
||||
delete m_app;
|
||||
}
|
||||
|
||||
// Draws a basic triangle
|
||||
void Cocos2dRenderer::Draw(GLsizei width, GLsizei height)
|
||||
void Cocos2dRenderer::Draw(GLsizei width, GLsizei height, float dpi)
|
||||
{
|
||||
if (width != mWidth || height != mHeight)
|
||||
if (width != m_width || height != m_height)
|
||||
{
|
||||
mWidth = width;
|
||||
mHeight = height;
|
||||
m_width = width;
|
||||
m_height = height;
|
||||
GLViewImpl::sharedOpenGLView()->UpdateForWindowSizeChange(static_cast<float>(width), static_cast<float>(height));
|
||||
}
|
||||
|
||||
if (dpi != m_dpi)
|
||||
{
|
||||
m_dpi = dpi;
|
||||
GLViewImpl::sharedOpenGLView()->SetDPI(m_dpi);
|
||||
}
|
||||
|
||||
GLViewImpl::sharedOpenGLView()->ProcessEvents();
|
||||
GLViewImpl::sharedOpenGLView()->Render();
|
||||
}
|
||||
|
|
|
@ -29,18 +29,20 @@ namespace cocos2d
|
|||
class Cocos2dRenderer
|
||||
{
|
||||
public:
|
||||
Cocos2dRenderer(const int width, const int height, Windows::UI::Core::CoreDispatcher^ dispathcer, Windows::UI::Xaml::Controls::Panel^ panel);
|
||||
Cocos2dRenderer( int width, int height, float dpi, Windows::UI::Core::CoreDispatcher^ dispathcer, Windows::UI::Xaml::Controls::Panel^ panel);
|
||||
~Cocos2dRenderer();
|
||||
void Draw(GLsizei width, GLsizei height);
|
||||
void Draw(GLsizei width, GLsizei height, float dpi);
|
||||
void QueuePointerEvent(PointerEventType type, Windows::UI::Core::PointerEventArgs^ args);
|
||||
void QueueKeyBoardEvent(Cocos2dKeyEvent type, Windows::UI::Core::KeyEventArgs^ e);
|
||||
|
||||
private:
|
||||
|
||||
int mWidth;
|
||||
int mHeight;
|
||||
int m_width;
|
||||
int m_height;
|
||||
float m_dpi;
|
||||
|
||||
// The AppDelegate for the Cocos2D app
|
||||
AppDelegate* mApp;
|
||||
AppDelegate* m_app;
|
||||
Platform::Agile<Windows::UI::Core::CoreDispatcher> m_dispatcher;
|
||||
Platform::Agile<Windows::UI::Xaml::Controls::Panel> m_panel;
|
||||
};
|
||||
|
|
|
@ -47,7 +47,8 @@ OpenGLESPage::OpenGLESPage(OpenGLES* openGLES) :
|
|||
mRenderSurface(EGL_NO_SURFACE),
|
||||
mCustomRenderSurfaceSize(0,0),
|
||||
mUseCustomRenderSurfaceSize(false),
|
||||
m_coreInput(nullptr)
|
||||
m_coreInput(nullptr),
|
||||
m_dpi(0.0f)
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
|
@ -225,6 +226,9 @@ void OpenGLESPage::StartRenderLoop()
|
|||
return;
|
||||
}
|
||||
|
||||
DisplayInformation^ currentDisplayInformation = DisplayInformation::GetForCurrentView();
|
||||
m_dpi = currentDisplayInformation->LogicalDpi;
|
||||
|
||||
auto dispatcher = Windows::UI::Xaml::Window::Current->CoreWindow->Dispatcher;
|
||||
|
||||
// Create a task for rendering that will be run on a background thread.
|
||||
|
@ -238,16 +242,18 @@ void OpenGLESPage::StartRenderLoop()
|
|||
GLsizei panelHeight = 0;
|
||||
GetSwapChainPanelSize(&panelWidth, &panelHeight);
|
||||
|
||||
|
||||
|
||||
if (m_renderer.get() == nullptr)
|
||||
{
|
||||
m_renderer = std::make_shared<Cocos2dRenderer>(panelWidth, panelHeight, dispatcher, swapChainPanel);
|
||||
m_renderer = std::make_shared<Cocos2dRenderer>(panelWidth, panelHeight, m_dpi, dispatcher, swapChainPanel);
|
||||
}
|
||||
|
||||
while (action->Status == Windows::Foundation::AsyncStatus::Started)
|
||||
{
|
||||
|
||||
GetSwapChainPanelSize(&panelWidth, &panelHeight);
|
||||
m_renderer.get()->Draw(panelWidth, panelHeight);
|
||||
m_renderer.get()->Draw(panelWidth, panelHeight, m_dpi);
|
||||
|
||||
// The call to eglSwapBuffers might not be successful (i.e. due to Device Lost)
|
||||
// If the call fails, then we must reinitialize EGL and the GL resources.
|
||||
|
|
|
@ -67,5 +67,7 @@ namespace cocos2d
|
|||
void OnPointerPressed(Platform::Object^ sender, Windows::UI::Core::PointerEventArgs^ e);
|
||||
void OnPointerMoved(Platform::Object^ sender, Windows::UI::Core::PointerEventArgs^ e);
|
||||
void OnPointerReleased(Platform::Object^ sender, Windows::UI::Core::PointerEventArgs^ e);
|
||||
|
||||
float m_dpi;
|
||||
};
|
||||
}
|
||||
|
|
|
@ -42,8 +42,14 @@ CCFreeTypeFont sFT;
|
|||
|
||||
int Device::getDPI()
|
||||
{
|
||||
#if CC_TARGET_PLATFORM == CC_PLATFORM_WP8
|
||||
static const float dipsPerInch = 96.0f;
|
||||
return floor(DisplayProperties::LogicalDpi / dipsPerInch + 0.5f); // Round to nearest integer.
|
||||
#elif defined WP8_SHADER_COMPILER
|
||||
return 0;
|
||||
#else
|
||||
return cocos2d::GLViewImpl::sharedOpenGLView()->GetDPI();
|
||||
#endif
|
||||
}
|
||||
|
||||
static Accelerometer^ sAccelerometer = nullptr;
|
||||
|
|
|
@ -33,6 +33,7 @@ THE SOFTWARE.
|
|||
#include "deprecated/CCNotificationCenter.h"
|
||||
|
||||
using namespace Platform;
|
||||
using namespace Concurrency;
|
||||
using namespace Windows::Foundation;
|
||||
using namespace Windows::Foundation::Collections;
|
||||
using namespace Windows::Graphics::Display;
|
||||
|
@ -107,9 +108,10 @@ bool GLViewImpl::initWithFullScreen(const std::string& viewName)
|
|||
}
|
||||
|
||||
|
||||
bool GLViewImpl::Create(float width, float height, DisplayOrientations orientation)
|
||||
bool GLViewImpl::Create(float width, float height, float dpi, DisplayOrientations orientation)
|
||||
{
|
||||
m_orientation = orientation;
|
||||
m_dpi = dpi;
|
||||
UpdateForWindowSizeChange(width, height);
|
||||
return true;
|
||||
}
|
||||
|
@ -454,33 +456,27 @@ void GLViewImpl::setScissorInPoints(float x , float y , float w , float h)
|
|||
|
||||
void GLViewImpl::QueueBackKeyPress()
|
||||
{
|
||||
std::lock_guard<std::mutex> guard(mMutex);
|
||||
std::shared_ptr<BackButtonEvent> e(new BackButtonEvent());
|
||||
mInputEvents.push(e);
|
||||
}
|
||||
|
||||
void GLViewImpl::QueuePointerEvent(PointerEventType type, PointerEventArgs^ args)
|
||||
{
|
||||
std::lock_guard<std::mutex> guard(mMutex);
|
||||
std::shared_ptr<PointerEvent> e(new PointerEvent(type, args));
|
||||
mInputEvents.push(e);
|
||||
}
|
||||
|
||||
void GLViewImpl::QueueEvent(std::shared_ptr<InputEvent>& event)
|
||||
{
|
||||
std::lock_guard<std::mutex> guard(mMutex);
|
||||
mInputEvents.push(event);
|
||||
}
|
||||
|
||||
void GLViewImpl::ProcessEvents()
|
||||
{
|
||||
std::lock_guard<std::mutex> guard(mMutex);
|
||||
|
||||
while (!mInputEvents.empty())
|
||||
std::shared_ptr<InputEvent> e;
|
||||
while (mInputEvents.try_pop(e))
|
||||
{
|
||||
InputEvent* e = mInputEvents.front().get();
|
||||
e->execute();
|
||||
mInputEvents.pop();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -33,10 +33,10 @@ THE SOFTWARE.
|
|||
|
||||
|
||||
#include <agile.h>
|
||||
#include <concurrent_queue.h>
|
||||
#include <string>
|
||||
#include <memory>
|
||||
#include <wrl/client.h>
|
||||
#include <mutex>
|
||||
#include <queue>
|
||||
#include <Keyboard-winrt.h>
|
||||
|
||||
NS_CC_BEGIN
|
||||
|
@ -61,7 +61,7 @@ public:
|
|||
virtual void setIMEKeyboardState(bool bOpen);
|
||||
virtual void setIMEKeyboardState(bool bOpen, std::string str);
|
||||
|
||||
virtual bool Create(float width, float height ,Windows::Graphics::Display::DisplayOrientations orientation);
|
||||
virtual bool Create(float width, float height, float dpi, Windows::Graphics::Display::DisplayOrientations orientation);
|
||||
|
||||
void setDispatcher(Windows::UI::Core::CoreDispatcher^ dispatcher);
|
||||
Windows::UI::Core::CoreDispatcher^ getDispatcher() {return m_dispatcher.Get();}
|
||||
|
@ -97,8 +97,11 @@ public:
|
|||
void centerWindow();
|
||||
|
||||
void UpdateOrientation(Windows::Graphics::Display::DisplayOrientations orientation);
|
||||
void UpdateForWindowSizeChange(float width, float height);
|
||||
|
||||
void UpdateForWindowSizeChange(float width, float height);
|
||||
|
||||
void SetDPI(float dpi) { m_dpi = dpi; }
|
||||
float GetDPI() { return m_dpi; }
|
||||
|
||||
// static function
|
||||
/**
|
||||
@brief get the shared main open gl window
|
||||
|
@ -141,6 +144,7 @@ private:
|
|||
|
||||
float m_width;
|
||||
float m_height;
|
||||
float m_dpi;
|
||||
|
||||
Windows::Graphics::Display::DisplayOrientations m_orientation;
|
||||
Windows::Foundation::Rect m_keyboardRect;
|
||||
|
@ -156,8 +160,7 @@ private:
|
|||
Cocos2dMessageBoxDelegate^ m_messageBoxDelegate;
|
||||
Cocos2dEditBoxDelegate^ m_editBoxDelegate;
|
||||
|
||||
std::queue<std::shared_ptr<InputEvent>> mInputEvents;
|
||||
std::mutex mMutex;
|
||||
Concurrency::concurrent_queue<std::shared_ptr<InputEvent>> mInputEvents;
|
||||
|
||||
Platform::Agile<Windows::UI::Core::CoreDispatcher> m_dispatcher;
|
||||
Platform::Agile<Windows::UI::Xaml::Controls::Panel> m_panel;
|
||||
|
|
|
@ -192,7 +192,7 @@ bool CCPrecompiledShaders::addProgram(GLuint program, const std::string& id)
|
|||
return true;
|
||||
}
|
||||
|
||||
#if (CC_TARGET_PLATFORM == CC_PLATFORM_WINRT)
|
||||
#if (CC_TARGET_PLATFORM == CC_PLATFORM_WINRT) && defined(WP8_SHADER_COMPILER)
|
||||
|
||||
void CCPrecompiledShaders::savePrecompiledPrograms(Windows::Storage::StorageFolder^ folder)
|
||||
{
|
||||
|
|
|
@ -48,14 +48,6 @@ typedef struct _CompiledProgram
|
|||
int length;
|
||||
} CompiledProgram;
|
||||
|
||||
#if 0
|
||||
|
||||
const unsigned char gKey[] = "hello";
|
||||
const unsigned char gProgram[] = "world";
|
||||
PrecompiledShader gFoo = {gKey, gProgram, 100};
|
||||
|
||||
PrecompiledShader shaders[] = {gFoo, gFoo};
|
||||
#endif
|
||||
|
||||
class CC_DLL CCPrecompiledShaders
|
||||
{
|
||||
|
@ -63,7 +55,6 @@ public:
|
|||
CCPrecompiledShaders();
|
||||
virtual ~CCPrecompiledShaders();
|
||||
|
||||
|
||||
/**
|
||||
@brief Get current precompiled shaders instance.
|
||||
@return Current precompiled shaders instance pointer.
|
||||
|
@ -77,7 +68,7 @@ public:
|
|||
bool loadProgram(GLuint program, const GLchar* vShaderByteArray, const GLchar* fShaderByteArray);
|
||||
|
||||
|
||||
#if (CC_TARGET_PLATFORM == CC_PLATFORM_WINRT)
|
||||
#if (CC_TARGET_PLATFORM == CC_PLATFORM_WINRT) && defined(WP8_SHADER_COMPILER)
|
||||
void savePrecompiledShaders();
|
||||
#endif
|
||||
|
||||
|
|
|
@ -531,33 +531,27 @@ void GLViewImpl::setScissorInPoints(float x , float y , float w , float h)
|
|||
|
||||
void GLViewImpl::QueueBackKeyPress()
|
||||
{
|
||||
std::lock_guard<std::mutex> guard(mMutex);
|
||||
std::shared_ptr<BackButtonEvent> e(new BackButtonEvent());
|
||||
mInputEvents.push(e);
|
||||
}
|
||||
|
||||
void GLViewImpl::QueuePointerEvent(PointerEventType type, PointerEventArgs^ args)
|
||||
{
|
||||
std::lock_guard<std::mutex> guard(mMutex);
|
||||
std::shared_ptr<PointerEvent> e(new PointerEvent(type, args));
|
||||
mInputEvents.push(e);
|
||||
}
|
||||
|
||||
void GLViewImpl::QueueEvent(std::shared_ptr<InputEvent>& event)
|
||||
{
|
||||
std::lock_guard<std::mutex> guard(mMutex);
|
||||
mInputEvents.push(event);
|
||||
}
|
||||
|
||||
void GLViewImpl::ProcessEvents()
|
||||
{
|
||||
std::lock_guard<std::mutex> guard(mMutex);
|
||||
|
||||
while (!mInputEvents.empty())
|
||||
std::shared_ptr<InputEvent> e;
|
||||
while (mInputEvents.try_pop(e))
|
||||
{
|
||||
InputEvent* e = mInputEvents.front().get();
|
||||
e->execute();
|
||||
mInputEvents.pop();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -36,8 +36,7 @@ THE SOFTWARE.
|
|||
|
||||
#include <wrl/client.h>
|
||||
#include <d3d11_1.h>
|
||||
#include <mutex>
|
||||
#include <queue>
|
||||
#include <concurrent_queue.h>
|
||||
|
||||
#include <agile.h>
|
||||
#include <DirectXMath.h>
|
||||
|
@ -182,9 +181,7 @@ private:
|
|||
Cocos2dMessageBoxDelegate^ m_messageBoxDelegate;
|
||||
Cocos2dEditBoxDelegate^ m_editBoxDelegate;
|
||||
|
||||
std::queue<std::shared_ptr<InputEvent>> mInputEvents;
|
||||
std::mutex mMutex;
|
||||
|
||||
Concurrency::concurrent_queue<std::shared_ptr<InputEvent>> mInputEvents;
|
||||
};
|
||||
|
||||
NS_CC_END
|
||||
|
|
|
@ -86,7 +86,7 @@ const unsigned char s_133478C5A874C1E6F59B418CE6C7C39F1AE0F873[] = {
|
|||
120, 116, 117, 114, 101, 48, 0, 0,
|
||||
0, 0, 1, 0, 0, 0, 248, 3,
|
||||
0, 0, 4, 5, 0, 0, 0, 0,
|
||||
0, 0, 182, 139, 0, 0, 0, 0,
|
||||
0, 0, 235, 143, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 68, 88, 66, 67, 11, 95,
|
||||
74, 206, 145, 124, 32, 219, 67, 19,
|
||||
|
@ -456,7 +456,7 @@ const unsigned char s_13E33F532157A58EC77EDE3B3112560A89D272B2[] = {
|
|||
116, 114, 105, 120, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 204, 2, 0, 0,
|
||||
164, 4, 0, 0, 0, 0, 0, 0,
|
||||
182, 139, 0, 0, 0, 0, 0, 0,
|
||||
235, 143, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
68, 88, 66, 67, 127, 145, 81, 72,
|
||||
216, 190, 16, 61, 245, 231, 235, 249,
|
||||
|
@ -800,7 +800,7 @@ const unsigned char s_1A69A7CC77C7C8FC62799B0513816EA41FBF3BFE[] = {
|
|||
116, 67, 111, 108, 111, 114, 0, 0,
|
||||
0, 0, 3, 0, 0, 0, 208, 7,
|
||||
0, 0, 4, 5, 0, 0, 0, 0,
|
||||
0, 0, 182, 139, 0, 0, 0, 0,
|
||||
0, 0, 235, 143, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 68, 88, 66, 67, 65, 106,
|
||||
69, 173, 111, 248, 97, 165, 186, 90,
|
||||
|
@ -1462,7 +1462,7 @@ const unsigned char s_2CF9793879165058483EFB4AD6FA9746ECD7DD2A[] = {
|
|||
99, 111, 108, 111, 114, 0, 0, 0,
|
||||
0, 16, 0, 0, 0, 236, 16, 0,
|
||||
0, 124, 10, 0, 0, 0, 0, 0,
|
||||
0, 182, 139, 0, 0, 0, 0, 0,
|
||||
0, 235, 143, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 68, 88, 66, 67, 39, 224, 169,
|
||||
185, 116, 156, 41, 157, 187, 9, 222,
|
||||
|
@ -2430,7 +2430,7 @@ const unsigned char s_53938AB67AD93ABA0DDB87F3C9889304284E011E[] = {
|
|||
120, 116, 117, 114, 101, 48, 0, 0,
|
||||
0, 0, 1, 0, 0, 0, 24, 4,
|
||||
0, 0, 4, 5, 0, 0, 0, 0,
|
||||
0, 0, 182, 139, 0, 0, 0, 0,
|
||||
0, 0, 235, 143, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 68, 88, 66, 67, 200, 5,
|
||||
103, 205, 248, 30, 69, 65, 32, 117,
|
||||
|
@ -2804,7 +2804,7 @@ const unsigned char s_67837675F2BB48C0E926316F505FC1538228E0FA[] = {
|
|||
86, 80, 77, 97, 116, 114, 105, 120,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
16, 4, 0, 0, 48, 5, 0, 0,
|
||||
0, 0, 0, 0, 182, 139, 0, 0,
|
||||
0, 0, 0, 0, 235, 143, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 68, 88, 66, 67,
|
||||
79, 226, 72, 124, 94, 252, 37, 157,
|
||||
|
@ -3968,7 +3968,7 @@ const unsigned char s_77D0755E06AA7AF59FAA6B003CA2363EDEB25C4C[] = {
|
|||
99, 111, 108, 111, 114, 0, 0, 0,
|
||||
0, 17, 0, 0, 0, 236, 16, 0,
|
||||
0, 232, 19, 0, 0, 0, 0, 0,
|
||||
0, 182, 139, 0, 0, 0, 0, 0,
|
||||
0, 235, 143, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 68, 88, 66, 67, 39, 224, 169,
|
||||
185, 116, 156, 41, 157, 187, 9, 222,
|
||||
|
@ -5245,7 +5245,7 @@ const unsigned char s_78250E25D1929D4A842050738140787BE42541C6[] = {
|
|||
108, 112, 104, 97, 95, 118, 97, 108,
|
||||
117, 101, 0, 0, 0, 0, 2, 0,
|
||||
0, 0, 36, 5, 0, 0, 4, 5,
|
||||
0, 0, 0, 0, 0, 0, 182, 139,
|
||||
0, 0, 0, 0, 0, 0, 235, 143,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 68, 88,
|
||||
66, 67, 100, 113, 175, 29, 164, 71,
|
||||
|
@ -5660,7 +5660,7 @@ const unsigned char s_7B67DD242152D35ACC079265FAD9D03DC98182DE[] = {
|
|||
67, 95, 84, 101, 120, 116, 117, 114,
|
||||
101, 48, 0, 0, 0, 0, 1, 0,
|
||||
0, 0, 248, 3, 0, 0, 0, 5,
|
||||
0, 0, 0, 0, 0, 0, 182, 139,
|
||||
0, 0, 0, 0, 0, 0, 235, 143,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 68, 88,
|
||||
66, 67, 11, 95, 74, 206, 145, 124,
|
||||
|
@ -6044,7 +6044,7 @@ const unsigned char s_7CE5EE84ACB6110F7FA29152ECE3344CB6D6620D[] = {
|
|||
99, 111, 108, 111, 114, 0, 0, 0,
|
||||
0, 2, 0, 0, 0, 96, 4, 0,
|
||||
0, 192, 4, 0, 0, 0, 0, 0,
|
||||
0, 182, 139, 0, 0, 0, 0, 0,
|
||||
0, 235, 143, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 68, 88, 66, 67, 157, 116, 105,
|
||||
89, 118, 135, 249, 239, 42, 226, 184,
|
||||
|
@ -6425,7 +6425,7 @@ const unsigned char s_7E1EEF397305D0BC2DCDBA4F2DAFBCBA1534E45C[] = {
|
|||
117, 95, 99, 111, 108, 111, 114, 0,
|
||||
0, 0, 0, 1, 0, 0, 0, 52,
|
||||
3, 0, 0, 40, 4, 0, 0, 0,
|
||||
0, 0, 0, 182, 139, 0, 0, 0,
|
||||
0, 0, 0, 235, 143, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 68, 88, 66, 67, 153,
|
||||
8, 62, 201, 202, 170, 111, 182, 149,
|
||||
|
@ -6759,7 +6759,7 @@ const unsigned char s_847DBFDDA6EC09C57E4ED43012AE2FB5CAC7D8D5[] = {
|
|||
111, 108, 111, 114, 0, 0, 0, 0,
|
||||
2, 0, 0, 0, 240, 4, 0, 0,
|
||||
4, 5, 0, 0, 0, 0, 0, 0,
|
||||
182, 139, 0, 0, 0, 0, 0, 0,
|
||||
235, 143, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
68, 88, 66, 67, 134, 66, 128, 226,
|
||||
107, 172, 247, 161, 241, 207, 89, 240,
|
||||
|
@ -7176,7 +7176,7 @@ const unsigned char s_92BE325B516F887D2C928EDE20ADF428DB01C038[] = {
|
|||
95, 118, 97, 108, 117, 101, 0, 0,
|
||||
0, 0, 2, 0, 0, 0, 36, 5,
|
||||
0, 0, 0, 5, 0, 0, 0, 0,
|
||||
0, 0, 182, 139, 0, 0, 0, 0,
|
||||
0, 0, 235, 143, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 68, 88, 66, 67, 100, 113,
|
||||
175, 29, 164, 71, 177, 78, 120, 99,
|
||||
|
@ -7744,7 +7744,7 @@ const unsigned char s_93D31E1668075AE4941C53441D7A9D0DE8F76331[] = {
|
|||
117, 95, 99, 111, 108, 111, 114, 0,
|
||||
0, 0, 0, 15, 0, 0, 0, 200,
|
||||
15, 0, 0, 216, 9, 0, 0, 0,
|
||||
0, 0, 0, 182, 139, 0, 0, 0,
|
||||
0, 0, 0, 235, 143, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 68, 88, 66, 67, 136,
|
||||
158, 207, 210, 174, 144, 71, 116, 248,
|
||||
|
@ -9277,7 +9277,7 @@ const unsigned char s_A130FCE93CA2E5D68468367D88D1D7BE357912E5[] = {
|
|||
99, 111, 108, 111, 114, 0, 0, 0,
|
||||
0, 3, 0, 0, 0, 96, 4, 0,
|
||||
0, 192, 13, 0, 0, 0, 0, 0,
|
||||
0, 182, 139, 0, 0, 0, 0, 0,
|
||||
0, 235, 143, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 68, 88, 66, 67, 157, 116, 105,
|
||||
89, 118, 135, 249, 239, 42, 226, 184,
|
||||
|
@ -9954,7 +9954,7 @@ const unsigned char s_A2377A827972A5466DA8637681045D32DA8A817D[] = {
|
|||
99, 111, 108, 111, 114, 0, 0, 0,
|
||||
0, 2, 0, 0, 0, 96, 4, 0,
|
||||
0, 144, 4, 0, 0, 0, 0, 0,
|
||||
0, 182, 139, 0, 0, 0, 0, 0,
|
||||
0, 235, 143, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 68, 88, 66, 67, 157, 116, 105,
|
||||
89, 118, 135, 249, 239, 42, 226, 184,
|
||||
|
@ -10339,7 +10339,7 @@ const unsigned char s_B5E27B4F3CF7236633255B28CBA530D6EE5CED86[] = {
|
|||
111, 108, 111, 114, 0, 0, 0, 0,
|
||||
2, 0, 0, 0, 240, 5, 0, 0,
|
||||
4, 5, 0, 0, 0, 0, 0, 0,
|
||||
182, 139, 0, 0, 0, 0, 0, 0,
|
||||
235, 143, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
68, 88, 66, 67, 223, 173, 203, 80,
|
||||
172, 13, 170, 215, 168, 128, 228, 5,
|
||||
|
@ -10771,7 +10771,7 @@ const unsigned char s_E2C7CE1244DE9C76688EFA9463B2A130B6A08893[] = {
|
|||
77, 97, 116, 114, 105, 120, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 204, 2,
|
||||
0, 0, 144, 4, 0, 0, 0, 0,
|
||||
0, 0, 182, 139, 0, 0, 0, 0,
|
||||
0, 0, 235, 143, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 68, 88, 66, 67, 127, 145,
|
||||
81, 72, 216, 190, 16, 61, 245, 231,
|
||||
|
@ -11101,8 +11101,8 @@ const unsigned char s_E2D56227712263272BD5218FEA117CD06180F81B[] = {
|
|||
117, 95, 112, 111, 105, 110, 116, 83,
|
||||
105, 122, 101, 0, 0, 0, 0, 2,
|
||||
0, 0, 0, 204, 2, 0, 0, 208,
|
||||
4, 0, 0, 0, 0, 0, 0, 182,
|
||||
139, 0, 0, 0, 0, 0, 0, 0,
|
||||
4, 0, 0, 0, 0, 0, 0, 235,
|
||||
143, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 68,
|
||||
88, 66, 67, 127, 145, 81, 72, 216,
|
||||
190, 16, 61, 245, 231, 235, 249, 125,
|
||||
|
@ -11452,7 +11452,7 @@ const unsigned char s_F46558C274182079784898CF4968CF431593D5E2[] = {
|
|||
116, 67, 111, 108, 111, 114, 0, 0,
|
||||
0, 0, 3, 0, 0, 0, 108, 6,
|
||||
0, 0, 4, 5, 0, 0, 0, 0,
|
||||
0, 0, 182, 139, 0, 0, 0, 0,
|
||||
0, 0, 235, 143, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 68, 88, 66, 67, 47, 220,
|
||||
115, 183, 137, 174, 141, 96, 204, 60,
|
||||
|
@ -11908,7 +11908,7 @@ const unsigned char s_F6BA4519AF2653A53D57FB5D5508F0D8617105D6[] = {
|
|||
101, 120, 116, 117, 114, 101, 48, 0,
|
||||
0, 0, 0, 1, 0, 0, 0, 156,
|
||||
3, 0, 0, 144, 4, 0, 0, 0,
|
||||
0, 0, 0, 182, 139, 0, 0, 0,
|
||||
0, 0, 0, 235, 143, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 68, 88, 66, 67, 203,
|
||||
117, 183, 110, 154, 52, 220, 70, 125,
|
||||
|
|
|
@ -181,6 +181,7 @@ void GLProgramCache::loadDefaultGLPrograms()
|
|||
loadDefaultGLProgram(p, kShaderType_PositionLengthTexureColor);
|
||||
_programs.insert( std::make_pair(GLProgram::SHADER_NAME_POSITION_LENGTH_TEXTURE_COLOR, p) );
|
||||
|
||||
#if CC_TARGET_PLATFORM != CC_PLATFORM_WP8
|
||||
p = new (std::nothrow) GLProgram();
|
||||
loadDefaultGLProgram(p, kShaderType_LabelDistanceFieldNormal);
|
||||
_programs.insert( std::make_pair(GLProgram::SHADER_NAME_LABEL_DISTANCEFIELD_NORMAL, p) );
|
||||
|
@ -188,6 +189,7 @@ void GLProgramCache::loadDefaultGLPrograms()
|
|||
p = new (std::nothrow) GLProgram();
|
||||
loadDefaultGLProgram(p, kShaderType_LabelDistanceFieldGlow);
|
||||
_programs.insert( std::make_pair(GLProgram::SHADER_NAME_LABEL_DISTANCEFIELD_GLOW, p) );
|
||||
#endif
|
||||
|
||||
p = new (std::nothrow) GLProgram();
|
||||
loadDefaultGLProgram(p, kShaderType_LabelNormal);
|
||||
|
@ -293,6 +295,7 @@ void GLProgramCache::reloadDefaultGLPrograms()
|
|||
p->reset();
|
||||
loadDefaultGLProgram(p, kShaderType_PositionLengthTexureColor);
|
||||
|
||||
#if CC_TARGET_PLATFORM != CC_PLATFORM_WP8
|
||||
p = getGLProgram(GLProgram::SHADER_NAME_LABEL_DISTANCEFIELD_NORMAL);
|
||||
p->reset();
|
||||
loadDefaultGLProgram(p, kShaderType_LabelDistanceFieldNormal);
|
||||
|
@ -300,6 +303,7 @@ void GLProgramCache::reloadDefaultGLPrograms()
|
|||
p = getGLProgram(GLProgram::SHADER_NAME_LABEL_DISTANCEFIELD_GLOW);
|
||||
p->reset();
|
||||
loadDefaultGLProgram(p, kShaderType_LabelDistanceFieldGlow);
|
||||
#endif
|
||||
|
||||
p = getGLProgram(GLProgram::SHADER_NAME_LABEL_NORMAL);
|
||||
p->reset();
|
||||
|
@ -372,12 +376,14 @@ void GLProgramCache::loadDefaultGLProgram(GLProgram *p, int type)
|
|||
case kShaderType_PositionLengthTexureColor:
|
||||
p->initWithByteArrays(ccPositionColorLengthTexture_vert, ccPositionColorLengthTexture_frag);
|
||||
break;
|
||||
#if CC_TARGET_PLATFORM != CC_PLATFORM_WP8
|
||||
case kShaderType_LabelDistanceFieldNormal:
|
||||
p->initWithByteArrays(ccLabel_vert, ccLabelDistanceFieldNormal_frag);
|
||||
break;
|
||||
case kShaderType_LabelDistanceFieldGlow:
|
||||
p->initWithByteArrays(ccLabel_vert, ccLabelDistanceFieldGlow_frag);
|
||||
break;
|
||||
#endif
|
||||
case kShaderType_LabelNormal:
|
||||
p->initWithByteArrays(ccLabel_vert, ccLabelNormal_frag);
|
||||
break;
|
||||
|
|
|
@ -35,39 +35,46 @@ using namespace Windows::Graphics::Display;
|
|||
USING_NS_CC;
|
||||
|
||||
|
||||
Cocos2dRenderer::Cocos2dRenderer(const int width, const int height, CoreDispatcher^ dispatcher, Panel^ panel)
|
||||
: mApp(nullptr)
|
||||
, mWidth(width)
|
||||
, mHeight(height)
|
||||
Cocos2dRenderer::Cocos2dRenderer(int width, int height, float dpi, CoreDispatcher^ dispatcher, Panel^ panel)
|
||||
: m_app(nullptr)
|
||||
, m_width(width)
|
||||
, m_height(height)
|
||||
, m_dpi(dpi)
|
||||
, m_dispatcher(dispatcher)
|
||||
, m_panel(panel)
|
||||
{
|
||||
mApp = new AppDelegate();
|
||||
m_app = new AppDelegate();
|
||||
auto director = cocos2d::Director::getInstance();
|
||||
|
||||
GLViewImpl* glview = GLViewImpl::create("Test Cpp");
|
||||
glview->setDispatcher(dispatcher);
|
||||
glview->setPanel(panel);
|
||||
glview->Create(static_cast<float>(width), static_cast<float>(height), DisplayOrientations::Landscape);
|
||||
glview->Create(static_cast<float>(width), static_cast<float>(height), dpi, DisplayOrientations::Landscape);
|
||||
director->setOpenGLView(glview);
|
||||
CCApplication::getInstance()->run();
|
||||
}
|
||||
|
||||
Cocos2dRenderer::~Cocos2dRenderer()
|
||||
{
|
||||
delete mApp;
|
||||
delete m_app;
|
||||
}
|
||||
|
||||
// Draws a basic triangle
|
||||
void Cocos2dRenderer::Draw(GLsizei width, GLsizei height)
|
||||
void Cocos2dRenderer::Draw(GLsizei width, GLsizei height, float dpi)
|
||||
{
|
||||
if (width != mWidth || height != mHeight)
|
||||
if (width != m_width || height != m_height)
|
||||
{
|
||||
mWidth = width;
|
||||
mHeight = height;
|
||||
m_width = width;
|
||||
m_height = height;
|
||||
GLViewImpl::sharedOpenGLView()->UpdateForWindowSizeChange(static_cast<float>(width), static_cast<float>(height));
|
||||
}
|
||||
|
||||
if (dpi != m_dpi)
|
||||
{
|
||||
m_dpi = dpi;
|
||||
GLViewImpl::sharedOpenGLView()->SetDPI(m_dpi);
|
||||
}
|
||||
|
||||
GLViewImpl::sharedOpenGLView()->ProcessEvents();
|
||||
GLViewImpl::sharedOpenGLView()->Render();
|
||||
}
|
||||
|
|
|
@ -29,18 +29,20 @@ namespace cocos2d
|
|||
class Cocos2dRenderer
|
||||
{
|
||||
public:
|
||||
Cocos2dRenderer(const int width, const int height, Windows::UI::Core::CoreDispatcher^ dispathcer, Windows::UI::Xaml::Controls::Panel^ panel);
|
||||
Cocos2dRenderer( int width, int height, float dpi, Windows::UI::Core::CoreDispatcher^ dispathcer, Windows::UI::Xaml::Controls::Panel^ panel);
|
||||
~Cocos2dRenderer();
|
||||
void Draw(GLsizei width, GLsizei height);
|
||||
void Draw(GLsizei width, GLsizei height, float dpi);
|
||||
void QueuePointerEvent(PointerEventType type, Windows::UI::Core::PointerEventArgs^ args);
|
||||
void QueueKeyBoardEvent(Cocos2dKeyEvent type, Windows::UI::Core::KeyEventArgs^ e);
|
||||
|
||||
private:
|
||||
|
||||
int mWidth;
|
||||
int mHeight;
|
||||
int m_width;
|
||||
int m_height;
|
||||
float m_dpi;
|
||||
|
||||
// The AppDelegate for the Cocos2D app
|
||||
AppDelegate* mApp;
|
||||
AppDelegate* m_app;
|
||||
Platform::Agile<Windows::UI::Core::CoreDispatcher> m_dispatcher;
|
||||
Platform::Agile<Windows::UI::Xaml::Controls::Panel> m_panel;
|
||||
};
|
||||
|
|
|
@ -47,7 +47,8 @@ OpenGLESPage::OpenGLESPage(OpenGLES* openGLES) :
|
|||
mRenderSurface(EGL_NO_SURFACE),
|
||||
mCustomRenderSurfaceSize(0,0),
|
||||
mUseCustomRenderSurfaceSize(false),
|
||||
m_coreInput(nullptr)
|
||||
m_coreInput(nullptr),
|
||||
m_dpi(0.0f)
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
|
@ -225,6 +226,9 @@ void OpenGLESPage::StartRenderLoop()
|
|||
return;
|
||||
}
|
||||
|
||||
DisplayInformation^ currentDisplayInformation = DisplayInformation::GetForCurrentView();
|
||||
m_dpi = currentDisplayInformation->LogicalDpi;
|
||||
|
||||
auto dispatcher = Windows::UI::Xaml::Window::Current->CoreWindow->Dispatcher;
|
||||
|
||||
// Create a task for rendering that will be run on a background thread.
|
||||
|
@ -238,16 +242,18 @@ void OpenGLESPage::StartRenderLoop()
|
|||
GLsizei panelHeight = 0;
|
||||
GetSwapChainPanelSize(&panelWidth, &panelHeight);
|
||||
|
||||
|
||||
|
||||
if (m_renderer.get() == nullptr)
|
||||
{
|
||||
m_renderer = std::make_shared<Cocos2dRenderer>(panelWidth, panelHeight, dispatcher, swapChainPanel);
|
||||
m_renderer = std::make_shared<Cocos2dRenderer>(panelWidth, panelHeight, m_dpi, dispatcher, swapChainPanel);
|
||||
}
|
||||
|
||||
while (action->Status == Windows::Foundation::AsyncStatus::Started)
|
||||
{
|
||||
|
||||
GetSwapChainPanelSize(&panelWidth, &panelHeight);
|
||||
m_renderer.get()->Draw(panelWidth, panelHeight);
|
||||
m_renderer.get()->Draw(panelWidth, panelHeight, m_dpi);
|
||||
|
||||
// The call to eglSwapBuffers might not be successful (i.e. due to Device Lost)
|
||||
// If the call fails, then we must reinitialize EGL and the GL resources.
|
||||
|
|
|
@ -67,5 +67,7 @@ namespace cocos2d
|
|||
void OnPointerPressed(Platform::Object^ sender, Windows::UI::Core::PointerEventArgs^ e);
|
||||
void OnPointerMoved(Platform::Object^ sender, Windows::UI::Core::PointerEventArgs^ e);
|
||||
void OnPointerReleased(Platform::Object^ sender, Windows::UI::Core::PointerEventArgs^ e);
|
||||
|
||||
float m_dpi;
|
||||
};
|
||||
}
|
||||
|
|
|
@ -78,9 +78,7 @@ Controller g_aTestNames[] = {
|
|||
{ "Node: Sprite", [](){return new SpriteTestScene(); } },
|
||||
{ "Node: Sprite3D", [](){ return new Sprite3DTestScene(); }},
|
||||
{ "Node: TileMap", [](){return new TileMapTestScene(); } },
|
||||
#if CC_TARGET_PLATFORM != CC_PLATFORM_WP8
|
||||
{ "Node: FastTileMap", [](){return new TileMapTestSceneNew(); } },
|
||||
#endif
|
||||
{ "Node: Text Input", [](){return new TextInputTestScene(); } },
|
||||
{ "Node: UI", [](){ return new UITestScene(); }},
|
||||
{ "Mouse", []() { return new MouseTestScene(); } },
|
||||
|
|
Loading…
Reference in New Issue