GLView Hook

This commit is contained in:
huangshiwu 2014-07-31 00:53:04 +08:00
parent 7bd68c35d0
commit ef69faf3ba
52 changed files with 322 additions and 287 deletions

View File

@ -867,8 +867,8 @@
503DD8E91926736A00CD74DD /* CCES2Renderer.m in Sources */ = {isa = PBXBuildFile; fileRef = 503DD8D71926736A00CD74DD /* CCES2Renderer.m */; };
503DD8EA1926736A00CD74DD /* CCESRenderer.h in Headers */ = {isa = PBXBuildFile; fileRef = 503DD8D81926736A00CD74DD /* CCESRenderer.h */; };
503DD8EB1926736A00CD74DD /* CCGL.h in Headers */ = {isa = PBXBuildFile; fileRef = 503DD8D91926736A00CD74DD /* CCGL.h */; };
503DD8EC1926736A00CD74DD /* CCGLView.h in Headers */ = {isa = PBXBuildFile; fileRef = 503DD8DA1926736A00CD74DD /* CCGLView.h */; };
503DD8ED1926736A00CD74DD /* CCGLView.mm in Sources */ = {isa = PBXBuildFile; fileRef = 503DD8DB1926736A00CD74DD /* CCGLView.mm */; };
503DD8EC1926736A00CD74DD /* CCGLViewImpl.h in Headers */ = {isa = PBXBuildFile; fileRef = 503DD8DA1926736A00CD74DD /* CCGLViewImpl.h */; };
503DD8ED1926736A00CD74DD /* CCGLViewImpl.mm in Sources */ = {isa = PBXBuildFile; fileRef = 503DD8DB1926736A00CD74DD /* CCGLViewImpl.mm */; };
503DD8EE1926736A00CD74DD /* CCImage.mm in Sources */ = {isa = PBXBuildFile; fileRef = 503DD8DC1926736A00CD74DD /* CCImage.mm */; };
503DD8EF1926736A00CD74DD /* CCPlatformDefine.h in Headers */ = {isa = PBXBuildFile; fileRef = 503DD8DD1926736A00CD74DD /* CCPlatformDefine.h */; };
503DD8F01926736A00CD74DD /* CCStdC.h in Headers */ = {isa = PBXBuildFile; fileRef = 503DD8DE1926736A00CD74DD /* CCStdC.h */; };
@ -1193,10 +1193,10 @@
50ABC00E1926664800A911A9 /* CCFileUtils.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 50ABBF231926664700A911A9 /* CCFileUtils.cpp */; };
50ABC00F1926664800A911A9 /* CCFileUtils.h in Headers */ = {isa = PBXBuildFile; fileRef = 50ABBF241926664700A911A9 /* CCFileUtils.h */; };
50ABC0101926664800A911A9 /* CCFileUtils.h in Headers */ = {isa = PBXBuildFile; fileRef = 50ABBF241926664700A911A9 /* CCFileUtils.h */; };
50ABC0111926664800A911A9 /* CCGLViewProtocol.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 50ABBF251926664700A911A9 /* CCGLViewProtocol.cpp */; };
50ABC0121926664800A911A9 /* CCGLViewProtocol.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 50ABBF251926664700A911A9 /* CCGLViewProtocol.cpp */; };
50ABC0131926664800A911A9 /* CCGLViewProtocol.h in Headers */ = {isa = PBXBuildFile; fileRef = 50ABBF261926664700A911A9 /* CCGLViewProtocol.h */; };
50ABC0141926664800A911A9 /* CCGLViewProtocol.h in Headers */ = {isa = PBXBuildFile; fileRef = 50ABBF261926664700A911A9 /* CCGLViewProtocol.h */; };
50ABC0111926664800A911A9 /* CCGLView.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 50ABBF251926664700A911A9 /* CCGLView.cpp */; };
50ABC0121926664800A911A9 /* CCGLView.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 50ABBF251926664700A911A9 /* CCGLView.cpp */; };
50ABC0131926664800A911A9 /* CCGLView.h in Headers */ = {isa = PBXBuildFile; fileRef = 50ABBF261926664700A911A9 /* CCGLView.h */; };
50ABC0141926664800A911A9 /* CCGLView.h in Headers */ = {isa = PBXBuildFile; fileRef = 50ABBF261926664700A911A9 /* CCGLView.h */; };
50ABC0151926664800A911A9 /* CCImage.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 50ABBF271926664700A911A9 /* CCImage.cpp */; };
50ABC0161926664800A911A9 /* CCImage.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 50ABBF271926664700A911A9 /* CCImage.cpp */; };
50ABC0171926664800A911A9 /* CCImage.h in Headers */ = {isa = PBXBuildFile; fileRef = 50ABBF281926664700A911A9 /* CCImage.h */; };
@ -1209,8 +1209,8 @@
50ABC01E1926664800A911A9 /* CCThread.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 50ABBF2B1926664700A911A9 /* CCThread.cpp */; };
50ABC01F1926664800A911A9 /* CCThread.h in Headers */ = {isa = PBXBuildFile; fileRef = 50ABBF2C1926664700A911A9 /* CCThread.h */; };
50ABC0201926664800A911A9 /* CCThread.h in Headers */ = {isa = PBXBuildFile; fileRef = 50ABBF2C1926664700A911A9 /* CCThread.h */; };
50ABC0211926664800A911A9 /* CCGLView.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 50ABBF2E1926664700A911A9 /* CCGLView.cpp */; };
50ABC0231926664800A911A9 /* CCGLView.h in Headers */ = {isa = PBXBuildFile; fileRef = 50ABBF2F1926664700A911A9 /* CCGLView.h */; };
50ABC0211926664800A911A9 /* CCGLViewImpl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 50ABBF2E1926664700A911A9 /* CCGLViewImpl.cpp */; };
50ABC0231926664800A911A9 /* CCGLViewImpl.h in Headers */ = {isa = PBXBuildFile; fileRef = 50ABBF2F1926664700A911A9 /* CCGLViewImpl.h */; };
50ABC05D1926664800A911A9 /* CCApplication.h in Headers */ = {isa = PBXBuildFile; fileRef = 50ABBF4F1926664700A911A9 /* CCApplication.h */; };
50ABC05F1926664800A911A9 /* CCApplication.mm in Sources */ = {isa = PBXBuildFile; fileRef = 50ABBF501926664700A911A9 /* CCApplication.mm */; };
50ABC0611926664800A911A9 /* CCCommon.mm in Sources */ = {isa = PBXBuildFile; fileRef = 50ABBF511926664700A911A9 /* CCCommon.mm */; };
@ -2642,8 +2642,8 @@
503DD8D71926736A00CD74DD /* CCES2Renderer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CCES2Renderer.m; sourceTree = "<group>"; };
503DD8D81926736A00CD74DD /* CCESRenderer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCESRenderer.h; sourceTree = "<group>"; };
503DD8D91926736A00CD74DD /* CCGL.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCGL.h; sourceTree = "<group>"; };
503DD8DA1926736A00CD74DD /* CCGLView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCGLView.h; sourceTree = "<group>"; };
503DD8DB1926736A00CD74DD /* CCGLView.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = CCGLView.mm; sourceTree = "<group>"; };
503DD8DA1926736A00CD74DD /* CCGLViewImpl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCGLViewImpl.h; sourceTree = "<group>"; };
503DD8DB1926736A00CD74DD /* CCGLViewImpl.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = CCGLViewImpl.mm; sourceTree = "<group>"; };
503DD8DC1926736A00CD74DD /* CCImage.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = CCImage.mm; sourceTree = "<group>"; };
503DD8DD1926736A00CD74DD /* CCPlatformDefine.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCPlatformDefine.h; sourceTree = "<group>"; };
503DD8DE1926736A00CD74DD /* CCStdC.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCStdC.h; sourceTree = "<group>"; };
@ -2815,16 +2815,16 @@
50ABBF221926664700A911A9 /* CCDevice.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCDevice.h; sourceTree = "<group>"; };
50ABBF231926664700A911A9 /* CCFileUtils.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CCFileUtils.cpp; sourceTree = "<group>"; };
50ABBF241926664700A911A9 /* CCFileUtils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCFileUtils.h; sourceTree = "<group>"; };
50ABBF251926664700A911A9 /* CCGLViewProtocol.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CCGLViewProtocol.cpp; sourceTree = "<group>"; };
50ABBF261926664700A911A9 /* CCGLViewProtocol.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCGLViewProtocol.h; sourceTree = "<group>"; };
50ABBF251926664700A911A9 /* CCGLView.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CCGLView.cpp; sourceTree = "<group>"; };
50ABBF261926664700A911A9 /* CCGLView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCGLView.h; sourceTree = "<group>"; };
50ABBF271926664700A911A9 /* CCImage.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CCImage.cpp; sourceTree = "<group>"; };
50ABBF281926664700A911A9 /* CCImage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCImage.h; sourceTree = "<group>"; };
50ABBF291926664700A911A9 /* CCSAXParser.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CCSAXParser.cpp; sourceTree = "<group>"; };
50ABBF2A1926664700A911A9 /* CCSAXParser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCSAXParser.h; sourceTree = "<group>"; };
50ABBF2B1926664700A911A9 /* CCThread.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CCThread.cpp; sourceTree = "<group>"; };
50ABBF2C1926664700A911A9 /* CCThread.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCThread.h; sourceTree = "<group>"; };
50ABBF2E1926664700A911A9 /* CCGLView.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CCGLView.cpp; sourceTree = "<group>"; };
50ABBF2F1926664700A911A9 /* CCGLView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCGLView.h; sourceTree = "<group>"; };
50ABBF2E1926664700A911A9 /* CCGLViewImpl.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CCGLViewImpl.cpp; sourceTree = "<group>"; };
50ABBF2F1926664700A911A9 /* CCGLViewImpl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCGLViewImpl.h; sourceTree = "<group>"; };
50ABBF4F1926664700A911A9 /* CCApplication.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCApplication.h; sourceTree = "<group>"; };
50ABBF501926664700A911A9 /* CCApplication.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = CCApplication.mm; sourceTree = "<group>"; };
50ABBF511926664700A911A9 /* CCCommon.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = CCCommon.mm; sourceTree = "<group>"; };
@ -4871,8 +4871,8 @@
503DD8D71926736A00CD74DD /* CCES2Renderer.m */,
503DD8D81926736A00CD74DD /* CCESRenderer.h */,
503DD8D91926736A00CD74DD /* CCGL.h */,
503DD8DA1926736A00CD74DD /* CCGLView.h */,
503DD8DB1926736A00CD74DD /* CCGLView.mm */,
503DD8DA1926736A00CD74DD /* CCGLViewImpl.h */,
503DD8DB1926736A00CD74DD /* CCGLViewImpl.mm */,
503DD8DC1926736A00CD74DD /* CCImage.mm */,
503DD8DD1926736A00CD74DD /* CCPlatformDefine.h */,
503DD8DE1926736A00CD74DD /* CCStdC.h */,
@ -4893,8 +4893,8 @@
50ABBF221926664700A911A9 /* CCDevice.h */,
50ABBF231926664700A911A9 /* CCFileUtils.cpp */,
50ABBF241926664700A911A9 /* CCFileUtils.h */,
50ABBF251926664700A911A9 /* CCGLViewProtocol.cpp */,
50ABBF261926664700A911A9 /* CCGLViewProtocol.h */,
50ABBF251926664700A911A9 /* CCGLView.cpp */,
50ABBF261926664700A911A9 /* CCGLView.h */,
50ABBF271926664700A911A9 /* CCImage.cpp */,
50ABBF281926664700A911A9 /* CCImage.h */,
50ABBF291926664700A911A9 /* CCSAXParser.cpp */,
@ -4921,8 +4921,8 @@
50ABBF2D1926664700A911A9 /* desktop */ = {
isa = PBXGroup;
children = (
50ABBF2E1926664700A911A9 /* CCGLView.cpp */,
50ABBF2F1926664700A911A9 /* CCGLView.h */,
50ABBF2E1926664700A911A9 /* CCGLViewImpl.cpp */,
50ABBF2F1926664700A911A9 /* CCGLViewImpl.h */,
);
path = desktop;
sourceTree = "<group>";
@ -5291,7 +5291,7 @@
50ABBD5A1925AB0000A911A9 /* Vec2.h in Headers */,
B24AA987195A675C007B4522 /* CCFastTMXLayer.h in Headers */,
50ABBEBD1925AB6F00A911A9 /* ccUtils.h in Headers */,
50ABC0231926664800A911A9 /* CCGLView.h in Headers */,
50ABC0231926664800A911A9 /* CCGLViewImpl.h in Headers */,
50ABBFFD1926664800A911A9 /* CCFileUtilsApple.h in Headers */,
5034CA41191D591100CE6051 /* ccShader_Position_uColor.frag in Headers */,
50ABBE7F1925AB6F00A911A9 /* CCEventTouch.h in Headers */,
@ -5317,7 +5317,7 @@
B29594B61926D5EC003EEF37 /* CCMeshCommand.h in Headers */,
50ABBE371925AB6F00A911A9 /* CCConsole.h in Headers */,
50ABC00B1926664800A911A9 /* CCDevice.h in Headers */,
50ABC0131926664800A911A9 /* CCGLViewProtocol.h in Headers */,
50ABC0131926664800A911A9 /* CCGLView.h in Headers */,
50ABBDB31925AB4100A911A9 /* ccShaders.h in Headers */,
50ABBDAB1925AB4100A911A9 /* CCRenderCommandPool.h in Headers */,
5034CA45191D591100CE6051 /* ccShader_Label_outline.frag in Headers */,
@ -5504,7 +5504,7 @@
50ABBECA1925AB6F00A911A9 /* firePngData.h in Headers */,
50ABBE401925AB6F00A911A9 /* CCDataVisitor.h in Headers */,
1A570064180BC5A10088DEC7 /* CCAction.h in Headers */,
503DD8EC1926736A00CD74DD /* CCGLView.h in Headers */,
503DD8EC1926736A00CD74DD /* CCGLViewImpl.h in Headers */,
50ABBEBA1925AB6F00A911A9 /* ccUTF8.h in Headers */,
1A570068180BC5A10088DEC7 /* CCActionCamera.h in Headers */,
1A57006C180BC5A10088DEC7 /* CCActionCatmullRom.h in Headers */,
@ -5525,7 +5525,7 @@
B37510861823ACA100B3BA6A /* CCPhysicsWorldInfo_chipmunk.h in Headers */,
1A570080180BC5A10088DEC7 /* CCActionInterval.h in Headers */,
1A570084180BC5A10088DEC7 /* CCActionManager.h in Headers */,
50ABC0141926664800A911A9 /* CCGLViewProtocol.h in Headers */,
50ABC0141926664800A911A9 /* CCGLView.h in Headers */,
1A570088180BC5A10088DEC7 /* CCActionPageTurn3D.h in Headers */,
50ABBD9E1925AB4100A911A9 /* ccGLStateCache.h in Headers */,
1A57008C180BC5A10088DEC7 /* CCActionProgressTimer.h in Headers */,
@ -6700,7 +6700,7 @@
50ABBE351925AB6F00A911A9 /* CCConsole.cpp in Sources */,
50ABBEAF1925AB6F00A911A9 /* CCUserDefault.cpp in Sources */,
50ABBE791925AB6F00A911A9 /* CCEventMouse.cpp in Sources */,
50ABC0111926664800A911A9 /* CCGLViewProtocol.cpp in Sources */,
50ABC0111926664800A911A9 /* CCGLView.cpp in Sources */,
B29594C21926D61F003EEF37 /* CCMesh.cpp in Sources */,
50ABBE3D1925AB6F00A911A9 /* CCDataVisitor.cpp in Sources */,
1A5702C8180BCE370088DEC7 /* CCTextFieldTTF.cpp in Sources */,
@ -6762,7 +6762,7 @@
50ABBDBD1925AB4100A911A9 /* CCTextureCache.cpp in Sources */,
B29594CE1926D61F003EEF37 /* CCSprite3DMaterial.cpp in Sources */,
299754F4193EC95400A54AC3 /* ObjectFactory.cpp in Sources */,
50ABC0211926664800A911A9 /* CCGLView.cpp in Sources */,
50ABC0211926664800A911A9 /* CCGLViewImpl.cpp in Sources */,
50ABC00D1926664800A911A9 /* CCFileUtils.cpp in Sources */,
50ABBE4D1925AB6F00A911A9 /* CCEventCustom.cpp in Sources */,
50ABBE9F1925AB6F00A911A9 /* CCScheduler.cpp in Sources */,
@ -7013,7 +7013,7 @@
1A570203180BCBD40088DEC7 /* CCClippingNode.cpp in Sources */,
1A570209180BCBDF0088DEC7 /* CCMotionStreak.cpp in Sources */,
1A570211180BCBF40088DEC7 /* CCProgressTimer.cpp in Sources */,
503DD8ED1926736A00CD74DD /* CCGLView.mm in Sources */,
503DD8ED1926736A00CD74DD /* CCGLViewImpl.mm in Sources */,
1A570215180BCBF40088DEC7 /* CCRenderTexture.cpp in Sources */,
1A570222180BCC1A0088DEC7 /* CCParticleBatchNode.cpp in Sources */,
1A570226180BCC1A0088DEC7 /* CCParticleExamples.cpp in Sources */,
@ -7085,7 +7085,7 @@
50ABBE361925AB6F00A911A9 /* CCConsole.cpp in Sources */,
503DD8E51926736A00CD74DD /* CCDirectorCaller.mm in Sources */,
50ABBD5D1925AB0000A911A9 /* Vec3.cpp in Sources */,
50ABC0121926664800A911A9 /* CCGLViewProtocol.cpp in Sources */,
50ABC0121926664800A911A9 /* CCGLView.cpp in Sources */,
50ABC0021926664800A911A9 /* CCLock.cpp in Sources */,
50ABBEBC1925AB6F00A911A9 /* ccUtils.cpp in Sources */,
50ABBE721925AB6F00A911A9 /* CCEventListenerMouse.cpp in Sources */,

View File

@ -26,7 +26,6 @@ THE SOFTWARE.
#include "CCTextFieldTTF.h"
#include "base/CCDirector.h"
#include "CCGLView.h"
NS_CC_BEGIN
@ -140,7 +139,7 @@ bool TextFieldTTF::attachWithIME()
if (ret)
{
// open keyboard
GLView * pGlView = Director::getInstance()->getOpenGLView();
auto pGlView = Director::getInstance()->getOpenGLView();
if (pGlView)
{
pGlView->setIMEKeyboardState(true);
@ -155,7 +154,7 @@ bool TextFieldTTF::detachWithIME()
if (ret)
{
// close keyboard
GLView * glView = Director::getInstance()->getOpenGLView();
auto glView = Director::getInstance()->getOpenGLView();
if (glView)
{
glView->setIMEKeyboardState(false);

View File

@ -263,11 +263,11 @@ xcopy /Y /Q "$(ProjectDir)..\..\external\win32-specific\gles\prebuilt\*.*" "$(Ou
<ClCompile Include="..\physics\chipmunk\CCPhysicsShapeInfo_chipmunk.cpp" />
<ClCompile Include="..\physics\chipmunk\CCPhysicsWorldInfo_chipmunk.cpp" />
<ClCompile Include="..\platform\CCFileUtils.cpp" />
<ClCompile Include="..\platform\CCGLViewProtocol.cpp" />
<ClCompile Include="..\platform\CCGLView.cpp" />
<ClCompile Include="..\platform\CCImage.cpp" />
<ClCompile Include="..\platform\CCSAXParser.cpp" />
<ClCompile Include="..\platform\CCThread.cpp" />
<ClCompile Include="..\platform\desktop\CCGLView.cpp" />
<ClCompile Include="..\platform\desktop\CCGLViewImpl.cpp" />
<ClCompile Include="..\platform\win32\CCApplication.cpp" />
<ClCompile Include="..\platform\win32\CCCommon.cpp" />
<ClCompile Include="..\platform\win32\CCDevice.cpp" />
@ -468,11 +468,11 @@ xcopy /Y /Q "$(ProjectDir)..\..\external\win32-specific\gles\prebuilt\*.*" "$(Ou
<ClInclude Include="..\platform\CCCommon.h" />
<ClInclude Include="..\platform\CCDevice.h" />
<ClInclude Include="..\platform\CCFileUtils.h" />
<ClInclude Include="..\platform\CCGLViewProtocol.h" />
<ClInclude Include="..\platform\CCGLView.h" />
<ClInclude Include="..\platform\CCImage.h" />
<ClInclude Include="..\platform\CCSAXParser.h" />
<ClInclude Include="..\platform\CCThread.h" />
<ClInclude Include="..\platform\desktop\CCGLView.h" />
<ClInclude Include="..\platform\desktop\CCGLViewImpl.h" />
<ClInclude Include="..\platform\win32\CCApplication.h" />
<ClInclude Include="..\platform\win32\CCFileUtilsWin32.h" />
<ClInclude Include="..\platform\win32\CCGL.h" />

View File

@ -475,9 +475,6 @@
<ClCompile Include="..\renderer\CCTextureCache.cpp">
<Filter>renderer</Filter>
</ClCompile>
<ClCompile Include="..\platform\desktop\CCGLView.cpp">
<Filter>platform\desktop</Filter>
</ClCompile>
<ClCompile Include="..\platform\win32\CCApplication.cpp">
<Filter>platform\win32</Filter>
</ClCompile>
@ -526,9 +523,6 @@
<ClCompile Include="..\platform\CCFileUtils.cpp">
<Filter>platform</Filter>
</ClCompile>
<ClCompile Include="..\platform\CCGLViewProtocol.cpp">
<Filter>platform</Filter>
</ClCompile>
<ClCompile Include="..\platform\CCImage.cpp">
<Filter>platform</Filter>
</ClCompile>
@ -595,6 +589,12 @@
<ClCompile Include="..\storage\local-storage\LocalStorage.cpp">
<Filter>storage</Filter>
</ClCompile>
<ClCompile Include="..\platform\desktop\CCGLViewImpl.cpp">
<Filter>platform\desktop</Filter>
</ClCompile>
<ClCompile Include="..\platform\CCGLView.cpp">
<Filter>platform</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\physics\CCPhysicsBody.h">
@ -1063,9 +1063,6 @@
<ClInclude Include="..\renderer\CCTextureCache.h">
<Filter>renderer</Filter>
</ClInclude>
<ClInclude Include="..\platform\desktop\CCGLView.h">
<Filter>platform\desktop</Filter>
</ClInclude>
<ClInclude Include="..\platform\win32\compat\stdint.h">
<Filter>platform\win32\compat</Filter>
</ClInclude>
@ -1132,9 +1129,6 @@
<ClInclude Include="..\platform\CCFileUtils.h">
<Filter>platform</Filter>
</ClInclude>
<ClInclude Include="..\platform\CCGLViewProtocol.h">
<Filter>platform</Filter>
</ClInclude>
<ClInclude Include="..\platform\CCImage.h">
<Filter>platform</Filter>
</ClInclude>
@ -1210,6 +1204,12 @@
<ClInclude Include="..\storage\local-storage\LocalStorage.h">
<Filter>storage</Filter>
</ClInclude>
<ClInclude Include="..\platform\desktop\CCGLViewImpl.h">
<Filter>platform\desktop</Filter>
</ClInclude>
<ClInclude Include="..\platform\CCGLView.h">
<Filter>platform</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<None Include="..\math\Mat4.inl">

View File

@ -82,7 +82,7 @@ cocos2d.cpp \
3d/CCSprite3DMaterial.cpp \
3d/CCObjLoader.cpp \
3d/CCSprite3D.cpp \
platform/CCGLViewProtocol.cpp \
platform/CCGLView.cpp \
platform/CCFileUtils.cpp \
platform/CCSAXParser.cpp \
platform/CCThread.cpp \

View File

@ -61,7 +61,6 @@
#include "2d/CCScene.h"
#include "platform/CCFileUtils.h"
#include "renderer/CCTextureCache.h"
#include "CCGLView.h"
#include "base/base64.h"
#include "base/ccUtils.h"
NS_CC_BEGIN

View File

@ -61,7 +61,6 @@ THE SOFTWARE.
#include "base/CCNS.h"
#include "math/CCMath.h"
#include "CCApplication.h"
#include "CCGLView.h"
/**
Position of the FPS
@ -263,7 +262,7 @@ void Director::drawScene()
if (_openGLView)
{
_openGLView->pollInputEvents();
_openGLView->pollEvents();
}
//tick before glClear: issue #533

View File

@ -39,6 +39,7 @@ THE SOFTWARE.
#include "2d/CCScene.h"
#include <stack>
#include "math/CCMath.h"
#include "platform/CCGLView.h"
NS_CC_BEGIN
@ -442,7 +443,8 @@ protected:
/* delta time since last tick to main loop */
float _deltaTime;
/* The GLView, where everything is rendered */
/* The _openGLView, where everything is rendered, GLView is a abstract class,cocos2d-x provide GLViewImpl
which inherit from it as default renderer context,you can have your own by inherit from it*/
GLView *_openGLView;
//texture cache belongs to this director
@ -509,8 +511,8 @@ protected:
Console *_console;
#endif
// GLViewProtocol will recreate stats labels to fit visible rect
friend class GLViewProtocol;
// GLView will recreate stats labels to fit visible rect
friend class GLView;
};
/**

View File

@ -60,7 +60,7 @@ private:
EventCode _eventCode;
std::vector<Touch*> _touches;
friend class GLViewProtocol;
friend class GLView;
};

View File

@ -32,7 +32,6 @@ THE SOFTWARE.
#include "renderer/CCRenderer.h"
#include "platform/CCImage.h"
#include "platform/CCFileUtils.h"
#include "CCGLView.h"
NS_CC_BEGIN

View File

@ -173,49 +173,49 @@ THE SOFTWARE.
#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
#include "platform/ios/CCApplication.h"
#include "platform/ios/CCGLView.h"
#include "platform/ios/CCGLViewImpl.h"
#include "platform/ios/CCGL.h"
#include "platform/ios/CCStdC.h"
#endif // CC_TARGET_PLATFORM == CC_PLATFORM_IOS
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
#include "platform/android/CCApplication.h"
#include "platform/android/CCGLView.h"
#include "platform/android/CCGLViewImpl.h"
#include "platform/android/CCGL.h"
#include "platform/android/CCStdC.h"
#endif // CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID
#if (CC_TARGET_PLATFORM == CC_PLATFORM_BLACKBERRY)
#include "platform/blackberry/CCApplication.h"
#include "platform/blackberry/CCGLView.h"
#include "platform/blackberry/CCGLViewImpl.h"
#include "platform/blackberry/CCGL.h"
#include "platform/blackberry/CCStdC.h"
#endif // CC_TARGET_PLATFORM == CC_PLATFORM_BLACKBERRY
#if (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32)
#include "platform/win32/CCApplication.h"
#include "platform/desktop/CCGLView.h"
#include "platform/desktop/CCGLViewImpl.h"
#include "platform/win32/CCGL.h"
#include "platform/win32/CCStdC.h"
#endif // CC_TARGET_PLATFORM == CC_PLATFORM_WIN32
#if (CC_TARGET_PLATFORM == CC_PLATFORM_MAC)
#include "platform/mac/CCApplication.h"
#include "platform/desktop/CCGLView.h"
#include "platform/desktop/CCGLViewImpl.h"
#include "platform/mac/CCGL.h"
#include "platform/mac/CCStdC.h"
#endif // CC_TARGET_PLATFORM == CC_PLATFORM_MAC
#if (CC_TARGET_PLATFORM == CC_PLATFORM_LINUX)
#include "platform/linux/CCApplication.h"
#include "platform/desktop/CCGLView.h"
#include "platform/desktop/CCGLViewImpl.h"
#include "platform/linux/CCGL.h"
#include "platform/linux/CCStdC.h"
#endif // CC_TARGET_PLATFORM == CC_PLATFORM_LINUX
#if (CC_TARGET_PLATFORM == CC_PLATFORM_WINRT)
#include "platform/winrt/CCApplication.h"
#include "platform/winrt/CCGLView.h"
#include "platform/winrt/CCGLViewImpl.h"
#include "platform/winrt/CCGL.h"
#include "platform/winrt/CCStdC.h"
#include "platform/winrt/CCPrecompiledShaders.h"
@ -223,7 +223,7 @@ THE SOFTWARE.
#if (CC_TARGET_PLATFORM == CC_PLATFORM_WP8)
#include "platform/winrt/CCApplication.h"
#include "platform/wp8/CCGLView.h"
#include "platform/wp8/CCGLViewImpl.h"
#include "platform/winrt/CCGL.h"
#include "platform/winrt/CCStdC.h"
#include "platform/winrt/CCPrecompiledShaders.h"

View File

@ -23,7 +23,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
#include "platform/CCGLViewProtocol.h"
#include "platform/CCGLView.h"
#include "base/CCTouch.h"
#include "base/CCDirector.h"
@ -70,24 +70,28 @@ namespace {
}
GLViewProtocol::GLViewProtocol()
GLView::GLView()
: _scaleX(1.0f)
, _scaleY(1.0f)
, _resolutionPolicy(ResolutionPolicy::UNKNOWN)
{
}
GLViewProtocol::~GLViewProtocol()
GLView::~GLView()
{
}
void GLViewProtocol::pollInputEvents()
void GLView::pollInputEvents()
{
pollEvents();
}
void GLView::pollEvents()
{
}
void GLViewProtocol::updateDesignResolutionSize()
void GLView::updateDesignResolutionSize()
{
if (_screenSize.width > 0 && _screenSize.height > 0
&& _designResolutionSize.width > 0 && _designResolutionSize.height > 0)
@ -129,7 +133,7 @@ void GLViewProtocol::updateDesignResolutionSize()
}
}
void GLViewProtocol::setDesignResolutionSize(float width, float height, ResolutionPolicy resolutionPolicy)
void GLView::setDesignResolutionSize(float width, float height, ResolutionPolicy resolutionPolicy)
{
CCASSERT(resolutionPolicy != ResolutionPolicy::UNKNOWN, "should set resolutionPolicy");
@ -144,22 +148,22 @@ void GLViewProtocol::setDesignResolutionSize(float width, float height, Resoluti
updateDesignResolutionSize();
}
const Size& GLViewProtocol::getDesignResolutionSize() const
const Size& GLView::getDesignResolutionSize() const
{
return _designResolutionSize;
}
const Size& GLViewProtocol::getFrameSize() const
const Size& GLView::getFrameSize() const
{
return _screenSize;
}
void GLViewProtocol::setFrameSize(float width, float height)
void GLView::setFrameSize(float width, float height)
{
_designResolutionSize = _screenSize = Size(width, height);
}
Rect GLViewProtocol::getVisibleRect() const
Rect GLView::getVisibleRect() const
{
Rect ret;
ret.size = getVisibleSize();
@ -167,7 +171,7 @@ Rect GLViewProtocol::getVisibleRect() const
return ret;
}
Size GLViewProtocol::getVisibleSize() const
Size GLView::getVisibleSize() const
{
if (_resolutionPolicy == ResolutionPolicy::NO_BORDER)
{
@ -179,7 +183,7 @@ Size GLViewProtocol::getVisibleSize() const
}
}
Vec2 GLViewProtocol::getVisibleOrigin() const
Vec2 GLView::getVisibleOrigin() const
{
if (_resolutionPolicy == ResolutionPolicy::NO_BORDER)
{
@ -192,7 +196,7 @@ Vec2 GLViewProtocol::getVisibleOrigin() const
}
}
void GLViewProtocol::setViewPortInPoints(float x , float y , float w , float h)
void GLView::setViewPortInPoints(float x , float y , float w , float h)
{
glViewport((GLint)(x * _scaleX + _viewPortRect.origin.x),
(GLint)(y * _scaleY + _viewPortRect.origin.y),
@ -200,7 +204,7 @@ void GLViewProtocol::setViewPortInPoints(float x , float y , float w , float h)
(GLsizei)(h * _scaleY));
}
void GLViewProtocol::setScissorInPoints(float x , float y , float w , float h)
void GLView::setScissorInPoints(float x , float y , float w , float h)
{
glScissor((GLint)(x * _scaleX + _viewPortRect.origin.x),
(GLint)(y * _scaleY + _viewPortRect.origin.y),
@ -208,12 +212,12 @@ void GLViewProtocol::setScissorInPoints(float x , float y , float w , float h)
(GLsizei)(h * _scaleY));
}
bool GLViewProtocol::isScissorEnabled()
bool GLView::isScissorEnabled()
{
return (GL_FALSE == glIsEnabled(GL_SCISSOR_TEST)) ? false : true;
}
Rect GLViewProtocol::getScissorRect() const
Rect GLView::getScissorRect() const
{
GLfloat params[4];
glGetFloatv(GL_SCISSOR_BOX, params);
@ -224,17 +228,17 @@ Rect GLViewProtocol::getScissorRect() const
return Rect(x, y, w, h);
}
void GLViewProtocol::setViewName(const std::string& viewname )
void GLView::setViewName(const std::string& viewname )
{
_viewName = viewname;
}
const std::string& GLViewProtocol::getViewName() const
const std::string& GLView::getViewName() const
{
return _viewName;
}
void GLViewProtocol::handleTouchesBegin(int num, intptr_t ids[], float xs[], float ys[])
void GLView::handleTouchesBegin(int num, intptr_t ids[], float xs[], float ys[])
{
intptr_t id = 0;
float x = 0.0f;
@ -283,7 +287,7 @@ void GLViewProtocol::handleTouchesBegin(int num, intptr_t ids[], float xs[], flo
dispatcher->dispatchEvent(&touchEvent);
}
void GLViewProtocol::handleTouchesMove(int num, intptr_t ids[], float xs[], float ys[])
void GLView::handleTouchesMove(int num, intptr_t ids[], float xs[], float ys[])
{
intptr_t id = 0;
float x = 0.0f;
@ -331,7 +335,7 @@ void GLViewProtocol::handleTouchesMove(int num, intptr_t ids[], float xs[], floa
dispatcher->dispatchEvent(&touchEvent);
}
void GLViewProtocol::handleTouchesOfEndOrCancel(EventTouch::EventCode eventCode, int num, intptr_t ids[], float xs[], float ys[])
void GLView::handleTouchesOfEndOrCancel(EventTouch::EventCode eventCode, int num, intptr_t ids[], float xs[], float ys[])
{
intptr_t id = 0;
float x = 0.0f;
@ -391,27 +395,27 @@ void GLViewProtocol::handleTouchesOfEndOrCancel(EventTouch::EventCode eventCode,
}
}
void GLViewProtocol::handleTouchesEnd(int num, intptr_t ids[], float xs[], float ys[])
void GLView::handleTouchesEnd(int num, intptr_t ids[], float xs[], float ys[])
{
handleTouchesOfEndOrCancel(EventTouch::EventCode::ENDED, num, ids, xs, ys);
}
void GLViewProtocol::handleTouchesCancel(int num, intptr_t ids[], float xs[], float ys[])
void GLView::handleTouchesCancel(int num, intptr_t ids[], float xs[], float ys[])
{
handleTouchesOfEndOrCancel(EventTouch::EventCode::CANCELLED, num, ids, xs, ys);
}
const Rect& GLViewProtocol::getViewPortRect() const
const Rect& GLView::getViewPortRect() const
{
return _viewPortRect;
}
float GLViewProtocol::getScaleX() const
float GLView::getScaleX() const
{
return _scaleX;
}
float GLViewProtocol::getScaleY() const
float GLView::getScaleY() const
{
return _scaleY;
}

View File

@ -23,14 +23,22 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
#ifndef __CCGLVIEWPROTOCOL_H__
#define __CCGLVIEWPROTOCOL_H__
#ifndef __CCGLVIEW_H__
#define __CCGLVIEW_H__
#include "base/ccTypes.h"
#include "base/CCEventTouch.h"
#include <vector>
#if (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32)
#include <windows.h>
#endif /* (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32) */
#if (CC_TARGET_PLATFORM == CC_PLATFORM_MAC)
typedef void* id;
#endif /* (CC_TARGET_PLATFORM == CC_PLATFORM_MAC) */
enum class ResolutionPolicy
{
// The entire application is visible in the specified area without trying to preserve the original aspect ratio.
@ -63,18 +71,18 @@ NS_CC_BEGIN
* @{
*/
class CC_DLL GLViewProtocol
class CC_DLL GLView : public Ref
{
public:
/**
* @js ctor
*/
GLViewProtocol();
GLView();
/**
* @js NA
* @lua NA
*/
virtual ~GLViewProtocol();
virtual ~GLView();
/** Force destroying EGL view, subclass must implement this method. */
virtual void end() = 0;
@ -87,12 +95,16 @@ public:
/** Open or close IME keyboard , subclass must implement this method. */
virtual void setIMEKeyboardState(bool open) = 0;
virtual bool windowShouldClose() { return false; };
/**
* Polls input events. Subclass must implement methods if platform
* does not provide event callbacks.
*/
virtual void pollInputEvents();
CC_DEPRECATED_ATTRIBUTE virtual void pollInputEvents();
virtual void pollEvents();
/**
* Get the frame size of EGL view.
@ -105,6 +117,20 @@ public:
*/
virtual void setFrameSize(float width, float height);
virtual float getFrameZoomFactor() const { return 1.0; }
/** Get retina factor */
virtual int getRetinaFactor() const { return 1; }
virtual float getContentScaleFactor() const { return 1.0; }
/** returns whether or not the view is in Retina Display mode */
virtual bool isRetinaDisplay() const { return false; }
#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
virtual void* getEAGLView() const { return nullptr; }
#endif /* (CC_TARGET_PLATFORM == CC_PLATFORM_IOS) */
/**
* Get the visible area size of opengl viewport.
*/
@ -183,6 +209,14 @@ public:
/** returns the current Resolution policy */
ResolutionPolicy getResolutionPolicy() const { return _resolutionPolicy; }
#if (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32)
virtual HWND getWin32Window() = 0;
#endif /* (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32) */
#if (CC_TARGET_PLATFORM == CC_PLATFORM_MAC)
virtual id getCocoaWindow() = 0;
#endif /* (CC_TARGET_PLATFORM == CC_PLATFORM_MAC) */
protected:
void updateDesignResolutionSize();
@ -207,4 +241,4 @@ protected:
NS_CC_END
#endif /* __CCGLVIEWPROTOCOL_H__ */
#endif /* __CCGLVIEW_H__ */

View File

@ -31,10 +31,10 @@ include_directories(
set(COCOS_PLATFORM_SRC
platform/CCSAXParser.cpp
platform/CCThread.cpp
platform/CCGLViewProtocol.cpp
platform/CCGLView.cpp
platform/CCFileUtils.cpp
platform/CCImage.cpp
platform/desktop/CCGLView.cpp
platform/desktop/CCGLViewImpl.cpp
../external/edtaa3func/edtaa3func.cpp
../external/ConvertUTF/ConvertUTFWrapper.cpp
../external/ConvertUTF/ConvertUTF.c

View File

@ -10,7 +10,7 @@ LOCAL_SRC_FILES := \
CCApplication.cpp \
CCCommon.cpp \
CCDevice.cpp \
CCGLView.cpp \
CCGLViewImpl.cpp \
CCFileUtilsAndroid.cpp \
javaactivity.cpp \
jni/DPIJni.cpp \

View File

@ -30,7 +30,6 @@ THE SOFTWARE.
#include "jni/Java_org_cocos2dx_lib_Cocos2dxHelper.h"
#include "CCApplication.h"
#include "base/CCDirector.h"
#include "CCGLView.h"
#include <android/log.h>
#include <jni.h>
#include <cstring>

View File

@ -26,7 +26,7 @@ THE SOFTWARE.
#include "base/CCPlatformConfig.h"
#if CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID
#include "CCGLView.h"
#include "CCGLViewImpl.h"
#include "base/CCDirector.h"
#include "base/ccMacros.h"
#include "jni/IMEJni.h"
@ -51,9 +51,9 @@ void initExtensions() {
NS_CC_BEGIN
GLView* GLView::createWithRect(const std::string& viewName, Rect rect, float frameZoomFactor)
GLViewImpl* GLViewImpl::createWithRect(const std::string& viewName, Rect rect, float frameZoomFactor)
{
auto ret = new GLView;
auto ret = new GLViewImpl;
if(ret && ret->initWithRect(viewName, rect, frameZoomFactor)) {
ret->autorelease();
return ret;
@ -62,9 +62,9 @@ GLView* GLView::createWithRect(const std::string& viewName, Rect rect, float fra
return nullptr;
}
GLView* GLView::create(const std::string& viewName)
GLViewImpl* GLViewImpl::create(const std::string& viewName)
{
auto ret = new GLView;
auto ret = new GLViewImpl;
if(ret && ret->initWithFullScreen(viewName)) {
ret->autorelease();
return ret;
@ -73,9 +73,9 @@ GLView* GLView::create(const std::string& viewName)
return nullptr;
}
GLView* GLView::createWithFullScreen(const std::string& viewName)
GLViewImpl* GLViewImpl::createWithFullScreen(const std::string& viewName)
{
auto ret = new GLView();
auto ret = new GLViewImpl();
if(ret && ret->initWithFullScreen(viewName)) {
ret->autorelease();
return ret;
@ -84,42 +84,42 @@ GLView* GLView::createWithFullScreen(const std::string& viewName)
return nullptr;
}
GLView::GLView()
GLViewImpl::GLViewImpl()
{
initExtensions();
}
GLView::~GLView()
GLViewImpl::~GLViewImpl()
{
}
bool GLView::initWithRect(const std::string& viewName, Rect rect, float frameZoomFactor)
bool GLViewImpl::initWithRect(const std::string& viewName, Rect rect, float frameZoomFactor)
{
return true;
}
bool GLView::initWithFullScreen(const std::string& viewName)
bool GLViewImpl::initWithFullScreen(const std::string& viewName)
{
return true;
}
bool GLView::isOpenGLReady()
bool GLViewImpl::isOpenGLReady()
{
return (_screenSize.width != 0 && _screenSize.height != 0);
}
void GLView::end()
void GLViewImpl::end()
{
terminateProcessJNI();
}
void GLView::swapBuffers()
void GLViewImpl::swapBuffers()
{
}
void GLView::setIMEKeyboardState(bool bOpen)
void GLViewImpl::setIMEKeyboardState(bool bOpen)
{
setKeyboardStateJNI((int)bOpen);
}

View File

@ -23,26 +23,26 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
#ifndef __CC_EGLVIEW_ANDROID_H__
#define __CC_EGLVIEW_ANDROID_H__
#ifndef __CC_EGLVIEWIMPL_ANDROID_H__
#define __CC_EGLVIEWIMPL_ANDROID_H__
#include "base/CCPlatformConfig.h"
#if CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID
#include "base/CCRef.h"
#include "math/CCGeometry.h"
#include "platform/CCGLViewProtocol.h"
#include "platform/CCGLView.h"
NS_CC_BEGIN
class CC_DLL GLView : public GLViewProtocol, public Ref
class CC_DLL GLViewImpl : public GLView
{
public:
// static function
static GLView* create(const std::string &viewname);
static GLView* createWithRect(const std::string& viewName, Rect rect, float frameZoomFactor = 1.0f);
static GLView* createWithFullScreen(const std::string& viewName);
static GLViewImpl* create(const std::string &viewname);
static GLViewImpl* createWithRect(const std::string& viewName, Rect rect, float frameZoomFactor = 1.0f);
static GLViewImpl* createWithFullScreen(const std::string& viewName);
bool isOpenGLReady() override;
void end() override;
@ -50,8 +50,8 @@ public:
void setIMEKeyboardState(bool bOpen) override;
protected:
GLView();
virtual ~GLView();
GLViewImpl();
virtual ~GLViewImpl();
bool initWithRect(const std::string& viewName, Rect rect, float frameZoomFactor);
bool initWithFullScreen(const std::string& viewName);
@ -61,5 +61,5 @@ NS_CC_END
#endif // CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID
#endif // end of __CC_EGLVIEW_ANDROID_H__
#endif // end of __CC_EGLVIEWIMPL_ANDROID_H__

View File

@ -32,7 +32,7 @@ THE SOFTWARE.
#include "renderer/CCGLProgramCache.h"
#include "renderer/CCTextureCache.h"
#include "2d/CCDrawingPrimitives.h"
#include "CCGLView.h"
#include "CCGLViewImpl.h"
#include "platform/android/jni/JniHelper.h"
#include <android/log.h>
#include <jni.h>
@ -60,7 +60,7 @@ void Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeInit(JNIEnv* env, jobject thi
auto glview = director->getOpenGLView();
if (!glview)
{
glview = cocos2d::GLView::create("Android app");
glview = cocos2d::GLViewImpl::create("Android app");
glview->setFrameSize(w, h);
director->setOpenGLView(glview);

View File

@ -23,7 +23,7 @@ THE SOFTWARE.
****************************************************************************/
#include "base/CCDirector.h"
#include "base/CCEventKeyboard.h"
#include "CCGLView.h"
#include "CCGLViewImpl.h"
#include <android/log.h>
#include <jni.h>

View File

@ -23,7 +23,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
#include "CCGLView.h"
#include "CCGLViewImpl.h"
#include "base/CCDirector.h"
#include "base/CCTouch.h"
#include "base/CCEventDispatcher.h"
@ -95,16 +95,16 @@ public:
_view->onGLFWWindowSizeFunCallback(window, width, height);
}
static void setGLView(GLView* view)
static void setGLViewImpl(GLViewImpl* view)
{
_view = view;
}
private:
static GLView* _view;
static GLViewImpl* _view;
};
GLView* GLFWEventHandler::_view = nullptr;
GLViewImpl* GLFWEventHandler::_view = nullptr;
////////////////////////////////////////////////////
@ -247,11 +247,11 @@ static keyCodeItem g_keyCodeStructArray[] = {
};
//////////////////////////////////////////////////////////////////////////
// implement GLView
// implement GLViewImpl
//////////////////////////////////////////////////////////////////////////
GLView::GLView()
GLViewImpl::GLViewImpl()
: _captured(false)
, _supportTouch(false)
, _isInRetinaMonitor(false)
@ -270,22 +270,22 @@ GLView::GLView()
g_keyCodeMap[item.glfwKeyCode] = item.keyCode;
}
GLFWEventHandler::setGLView(this);
GLFWEventHandler::setGLViewImpl(this);
glfwSetErrorCallback(GLFWEventHandler::onGLFWError);
glfwInit();
}
GLView::~GLView()
GLViewImpl::~GLViewImpl()
{
CCLOGINFO("deallocing GLView: %p", this);
GLFWEventHandler::setGLView(nullptr);
CCLOGINFO("deallocing GLViewImpl: %p", this);
GLFWEventHandler::setGLViewImpl(nullptr);
glfwTerminate();
}
GLView* GLView::create(const std::string& viewName)
GLViewImpl* GLViewImpl::create(const std::string& viewName)
{
auto ret = new GLView;
auto ret = new GLViewImpl;
if(ret && ret->initWithRect(viewName, Rect(0, 0, 960, 640), 1)) {
ret->autorelease();
return ret;
@ -294,9 +294,9 @@ GLView* GLView::create(const std::string& viewName)
return nullptr;
}
GLView* GLView::createWithRect(const std::string& viewName, Rect rect, float frameZoomFactor)
GLViewImpl* GLViewImpl::createWithRect(const std::string& viewName, Rect rect, float frameZoomFactor)
{
auto ret = new GLView;
auto ret = new GLViewImpl;
if(ret && ret->initWithRect(viewName, rect, frameZoomFactor)) {
ret->autorelease();
return ret;
@ -305,9 +305,9 @@ GLView* GLView::createWithRect(const std::string& viewName, Rect rect, float fra
return nullptr;
}
GLView* GLView::createWithFullScreen(const std::string& viewName)
GLViewImpl* GLViewImpl::createWithFullScreen(const std::string& viewName)
{
auto ret = new GLView();
auto ret = new GLViewImpl();
if(ret && ret->initWithFullScreen(viewName)) {
ret->autorelease();
return ret;
@ -316,9 +316,9 @@ GLView* GLView::createWithFullScreen(const std::string& viewName)
return nullptr;
}
GLView* GLView::createWithFullScreen(const std::string& viewName, const GLFWvidmode &videoMode, GLFWmonitor *monitor)
GLViewImpl* GLViewImpl::createWithFullScreen(const std::string& viewName, const GLFWvidmode &videoMode, GLFWmonitor *monitor)
{
auto ret = new GLView();
auto ret = new GLViewImpl();
if(ret && ret->initWithFullscreen(viewName, videoMode, monitor)) {
ret->autorelease();
return ret;
@ -328,7 +328,7 @@ GLView* GLView::createWithFullScreen(const std::string& viewName, const GLFWvidm
}
bool GLView::initWithRect(const std::string& viewName, Rect rect, float frameZoomFactor)
bool GLViewImpl::initWithRect(const std::string& viewName, Rect rect, float frameZoomFactor)
{
setViewName(viewName);
@ -375,7 +375,7 @@ bool GLView::initWithRect(const std::string& viewName, Rect rect, float frameZoo
return true;
}
bool GLView::initWithFullScreen(const std::string& viewName)
bool GLViewImpl::initWithFullScreen(const std::string& viewName)
{
//Create fullscreen window on primary monitor at its current video mode.
_monitor = glfwGetPrimaryMonitor();
@ -386,7 +386,7 @@ bool GLView::initWithFullScreen(const std::string& viewName)
return initWithRect(viewName, Rect(0, 0, videoMode->width, videoMode->height), 1.0f);
}
bool GLView::initWithFullscreen(const std::string &viewname, const GLFWvidmode &videoMode, GLFWmonitor *monitor)
bool GLViewImpl::initWithFullscreen(const std::string &viewname, const GLFWvidmode &videoMode, GLFWmonitor *monitor)
{
//Create fullscreen on specified monitor at the specified video mode.
_monitor = monitor;
@ -402,29 +402,29 @@ bool GLView::initWithFullscreen(const std::string &viewname, const GLFWvidmode &
return initWithRect(viewname, Rect(0, 0, videoMode.width, videoMode.height), 1.0f);
}
bool GLView::isOpenGLReady()
bool GLViewImpl::isOpenGLReady()
{
return nullptr != _mainWindow;
}
void GLView::end()
void GLViewImpl::end()
{
if(_mainWindow)
{
glfwSetWindowShouldClose(_mainWindow,1);
_mainWindow = nullptr;
}
// Release self. Otherwise, GLView could not be freed.
// Release self. Otherwise, GLViewImpl could not be freed.
release();
}
void GLView::swapBuffers()
void GLViewImpl::swapBuffers()
{
if(_mainWindow)
glfwSwapBuffers(_mainWindow);
}
bool GLView::windowShouldClose()
bool GLViewImpl::windowShouldClose()
{
if(_mainWindow)
return glfwWindowShouldClose(_mainWindow) ? true : false;
@ -432,13 +432,12 @@ bool GLView::windowShouldClose()
return true;
}
void GLView::pollEvents()
void GLViewImpl::pollEvents()
{
glfwPollEvents();
}
void GLView::enableRetina(bool enabled)
void GLViewImpl::enableRetina(bool enabled)
{
#if (CC_TARGET_PLATFORM == CC_PLATFORM_MAC)
_isRetinaEnabled = enabled;
@ -455,12 +454,12 @@ void GLView::enableRetina(bool enabled)
}
void GLView::setIMEKeyboardState(bool /*bOpen*/)
void GLViewImpl::setIMEKeyboardState(bool /*bOpen*/)
{
}
void GLView::setFrameZoomFactor(float zoomFactor)
void GLViewImpl::setFrameZoomFactor(float zoomFactor)
{
CCASSERT(zoomFactor > 0.0f, "zoomFactor must be larger than 0");
@ -473,12 +472,12 @@ void GLView::setFrameZoomFactor(float zoomFactor)
updateFrameSize();
}
float GLView::getFrameZoomFactor()
float GLViewImpl::getFrameZoomFactor() const
{
return _frameZoomFactor;
}
void GLView::updateFrameSize()
void GLViewImpl::updateFrameSize()
{
if (_screenSize.width > 0 && _screenSize.height > 0)
{
@ -515,13 +514,13 @@ void GLView::updateFrameSize()
}
}
void GLView::setFrameSize(float width, float height)
void GLViewImpl::setFrameSize(float width, float height)
{
GLViewProtocol::setFrameSize(width, height);
GLView::setFrameSize(width, height);
updateFrameSize();
}
void GLView::setViewPortInPoints(float x , float y , float w , float h)
void GLViewImpl::setViewPortInPoints(float x , float y , float w , float h)
{
glViewport((GLint)(x * _scaleX * _retinaFactor * _frameZoomFactor + _viewPortRect.origin.x * _retinaFactor * _frameZoomFactor),
(GLint)(y * _scaleY * _retinaFactor * _frameZoomFactor + _viewPortRect.origin.y * _retinaFactor * _frameZoomFactor),
@ -529,7 +528,7 @@ void GLView::setViewPortInPoints(float x , float y , float w , float h)
(GLsizei)(h * _scaleY * _retinaFactor * _frameZoomFactor));
}
void GLView::setScissorInPoints(float x , float y , float w , float h)
void GLViewImpl::setScissorInPoints(float x , float y , float w , float h)
{
glScissor((GLint)(x * _scaleX * _retinaFactor * _frameZoomFactor + _viewPortRect.origin.x * _retinaFactor * _frameZoomFactor),
(GLint)(y * _scaleY * _retinaFactor * _frameZoomFactor + _viewPortRect.origin.y * _retinaFactor * _frameZoomFactor),
@ -537,12 +536,12 @@ void GLView::setScissorInPoints(float x , float y , float w , float h)
(GLsizei)(h * _scaleY * _retinaFactor * _frameZoomFactor));
}
void GLView::onGLFWError(int errorID, const char* errorDesc)
void GLViewImpl::onGLFWError(int errorID, const char* errorDesc)
{
CCLOGERROR("GLFWError #%d Happen, %s\n", errorID, errorDesc);
}
void GLView::onGLFWMouseCallBack(GLFWwindow* window, int button, int action, int modify)
void GLViewImpl::onGLFWMouseCallBack(GLFWwindow* window, int button, int action, int modify)
{
if(GLFW_MOUSE_BUTTON_LEFT == button)
{
@ -586,7 +585,7 @@ void GLView::onGLFWMouseCallBack(GLFWwindow* window, int button, int action, int
}
}
void GLView::onGLFWMouseMoveCallBack(GLFWwindow* window, double x, double y)
void GLViewImpl::onGLFWMouseMoveCallBack(GLFWwindow* window, double x, double y)
{
_mouseX = (float)x;
_mouseY = (float)y;
@ -631,7 +630,7 @@ void GLView::onGLFWMouseMoveCallBack(GLFWwindow* window, double x, double y)
Director::getInstance()->getEventDispatcher()->dispatchEvent(&event);
}
void GLView::onGLFWMouseScrollCallback(GLFWwindow* window, double x, double y)
void GLViewImpl::onGLFWMouseScrollCallback(GLFWwindow* window, double x, double y)
{
EventMouse event(EventMouse::MouseEventType::MOUSE_SCROLL);
//Because OpenGL and cocos2d-x uses different Y axis, we need to convert the coordinate here
@ -640,7 +639,7 @@ void GLView::onGLFWMouseScrollCallback(GLFWwindow* window, double x, double y)
Director::getInstance()->getEventDispatcher()->dispatchEvent(&event);
}
void GLView::onGLFWKeyCallback(GLFWwindow *window, int key, int scancode, int action, int mods)
void GLViewImpl::onGLFWKeyCallback(GLFWwindow *window, int key, int scancode, int action, int mods)
{
if (GLFW_REPEAT != action)
{
@ -653,17 +652,17 @@ void GLView::onGLFWKeyCallback(GLFWwindow *window, int key, int scancode, int ac
}
}
void GLView::onGLFWCharCallback(GLFWwindow *window, unsigned int character)
void GLViewImpl::onGLFWCharCallback(GLFWwindow *window, unsigned int character)
{
IMEDispatcher::sharedDispatcher()->dispatchInsertText((const char*) &character, 1);
}
void GLView::onGLFWWindowPosCallback(GLFWwindow *windows, int x, int y)
void GLViewImpl::onGLFWWindowPosCallback(GLFWwindow *windows, int x, int y)
{
Director::getInstance()->setViewport();
}
void GLView::onGLFWframebuffersize(GLFWwindow* window, int w, int h)
void GLViewImpl::onGLFWframebuffersize(GLFWwindow* window, int w, int h)
{
float frameSizeW = _screenSize.width;
float frameSizeH = _screenSize.height;
@ -692,7 +691,7 @@ void GLView::onGLFWframebuffersize(GLFWwindow* window, int w, int h)
}
}
void GLView::onGLFWWindowSizeFunCallback(GLFWwindow *window, int width, int height)
void GLViewImpl::onGLFWWindowSizeFunCallback(GLFWwindow *window, int width, int height)
{
if (_resolutionPolicy != ResolutionPolicy::UNKNOWN)
{
@ -766,7 +765,7 @@ static bool glew_dynamic_binding()
#endif
// helper
bool GLView::initGlew()
bool GLViewImpl::initGlew()
{
#if (CC_TARGET_PLATFORM != CC_PLATFORM_MAC)
GLenum GlewInitResult = glewInit();

View File

@ -23,23 +23,43 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
#ifndef __CC_EGLVIEW_DESKTOP_H__
#define __CC_EGLVIEW_DESKTOP_H__
#ifndef __CC_EGLViewIMPL_DESKTOP_H__
#define __CC_EGLViewIMPL_DESKTOP_H__
#include "base/CCRef.h"
#include "platform/CCCommon.h"
#include "platform/CCGLViewProtocol.h"
#include "platform/CCGLView.h"
#include "glfw3.h"
#if (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32)
#ifndef GLFW_EXPOSE_NATIVE_WIN32
#define GLFW_EXPOSE_NATIVE_WIN32
#endif
#ifndef GLFW_EXPOSE_NATIVE_WGL
#define GLFW_EXPOSE_NATIVE_WGL
#endif
#include "glfw3native.h"
#endif /* (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32) */
#if (CC_TARGET_PLATFORM == CC_PLATFORM_MAC)
#ifndef GLFW_EXPOSE_NATIVE_NSGL
#define GLFW_EXPOSE_NATIVE_NSGL
#endif
#ifndef GLFW_EXPOSE_NATIVE_COCOA
#define GLFW_EXPOSE_NATIVE_COCOA
#endif
#include "glfw3native.h"
#endif // #if (CC_TARGET_PLATFORM == CC_PLATFORM_MAC)
NS_CC_BEGIN
class CC_DLL GLView : public GLViewProtocol, public Ref
class CC_DLL GLViewImpl : public GLView
{
public:
static GLView* create(const std::string& viewName);
static GLView* createWithRect(const std::string& viewName, Rect size, float frameZoomFactor = 1.0f);
static GLView* createWithFullScreen(const std::string& viewName);
static GLView* createWithFullScreen(const std::string& viewName, const GLFWvidmode &videoMode, GLFWmonitor *monitor);
static GLViewImpl* create(const std::string& viewName);
static GLViewImpl* createWithRect(const std::string& viewName, Rect size, float frameZoomFactor = 1.0f);
static GLViewImpl* createWithFullScreen(const std::string& viewName);
static GLViewImpl* createWithFullScreen(const std::string& viewName, const GLFWvidmode &videoMode, GLFWmonitor *monitor);
/*
*frameZoomFactor for frame. This method is for debugging big resolution (e.g.new ipad) app on desktop.
@ -47,7 +67,7 @@ public:
//void resize(int width, int height);
float getFrameZoomFactor();
float getFrameZoomFactor() const;
//void centerWindow();
virtual void setViewPortInPoints(float x , float y , float w , float h);
@ -79,10 +99,18 @@ public:
/** Get retina factor */
int getRetinaFactor() const { return _retinaFactor; }
#if (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32)
HWND getWin32Window() { return glfwGetWin32Window(_mainWindow); }
#endif /* (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32) */
#if (CC_TARGET_PLATFORM == CC_PLATFORM_MAC)
id getCocoaWindow() { return glfwGetCocoaWindow(_mainWindow); }
#endif // #if (CC_TARGET_PLATFORM == CC_PLATFORM_MAC)
protected:
GLView();
virtual ~GLView();
GLViewImpl();
virtual ~GLViewImpl();
bool initWithRect(const std::string& viewName, Rect rect, float frameZoomFactor);
bool initWithFullScreen(const std::string& viewName);
@ -120,9 +148,9 @@ protected:
friend class GLFWEventHandler;
private:
CC_DISALLOW_COPY_AND_ASSIGN(GLView);
CC_DISALLOW_COPY_AND_ASSIGN(GLViewImpl);
};
NS_CC_END // end of namespace cocos2d
#endif // end of __CC_EGLVIEW_DESKTOP_H__
#endif // end of __CC_EGLViewImpl_DESKTOP_H__

View File

@ -30,7 +30,6 @@
#import <OpenGLES/EAGL.h>
#import "CCDirectorCaller.h"
#import "CCDirector.h"
#import "CCGLView.h"
#import "CCEAGLView.h"
static id s_sharedDirectorCaller;

View File

@ -65,7 +65,7 @@ Copyright (C) 2008 Apple Inc. All Rights Reserved.
#if CC_TARGET_PLATFORM == CC_PLATFORM_IOS
#import <QuartzCore/QuartzCore.h>
#import "CCGLView.h"
#import "CCGLViewImpl.h"
#import "CCEAGLView.h"
#import "CCES2Renderer.h"
#import "CCDirector.h"
@ -73,7 +73,6 @@ Copyright (C) 2008 Apple Inc. All Rights Reserved.
#import "CCTouch.h"
#import "CCIMEDispatcher.h"
#import "OpenGL_Internal.h"
#import "CCGLView.h"
//CLASS IMPLEMENTATIONS:
#define IOS_MAX_TOUCHES_COUNT 10

View File

@ -23,35 +23,35 @@
THE SOFTWARE.
****************************************************************************/
#ifndef __CC_EGLVIEW_IPHONE_H__
#define __CC_EGLVIEW_IPHONE_H__
#ifndef __CC_EGLVIEWIMPL_IPHONE_H__
#define __CC_EGLVIEWIMPL_IPHONE_H__
#include "base/CCPlatformConfig.h"
#if CC_TARGET_PLATFORM == CC_PLATFORM_IOS
#include "base/CCRef.h"
#include "platform/CCCommon.h"
#include "platform/CCGLViewProtocol.h"
#include "platform/CCGLView.h"
NS_CC_BEGIN
/** Class that represent the OpenGL View
*/
class CC_DLL GLView : public GLViewProtocol, public Ref
class CC_DLL GLViewImpl : public GLView
{
public:
/** creates a GLView with a objective-c CCEAGLView instance */
static GLView* createWithEAGLView(void* eaglview);
/** creates a GLViewImpl with a objective-c CCEAGLViewImpl instance */
static GLViewImpl* createWithEAGLView(void* eaGLView);
/** creates a GLView with a title name in fullscreen mode */
static GLView* create(const std::string& viewName);
/** creates a GLViewImpl with a title name in fullscreen mode */
static GLViewImpl* create(const std::string& viewName);
/** creates a GLView with a title name, a rect and the zoom factor */
static GLView* createWithRect(const std::string& viewName, Rect rect, float frameZoomFactor = 1.0f);
/** creates a GLViewImpl with a title name, a rect and the zoom factor */
static GLViewImpl* createWithRect(const std::string& viewName, Rect rect, float frameZoomFactor = 1.0f);
/** creates a GLView with a name in fullscreen mode */
static GLView* createWithFullScreen(const std::string& viewName);
/** creates a GLViewImpl with a name in fullscreen mode */
static GLViewImpl* createWithFullScreen(const std::string& viewName);
/** sets the content scale factor */
bool setContentScaleFactor(float contentScaleFactor);
@ -72,10 +72,10 @@ public:
virtual void setIMEKeyboardState(bool bOpen) override;
protected:
GLView();
virtual ~GLView();
GLViewImpl();
virtual ~GLViewImpl();
bool initWithEAGLView(void* eaglview);
bool initWithEAGLView(void* eaGLView);
bool initWithRect(const std::string& viewName, Rect rect, float frameZoomFactor);
bool initWithFullScreen(const std::string& viewName);
@ -87,4 +87,4 @@ NS_CC_END
#endif // CC_PLATFORM_IOS
#endif // end of __CC_EGLVIEW_IPHONE_H__
#endif // end of __CC_EGLViewImpl_IPHONE_H__

View File

@ -30,15 +30,15 @@
#include "CCEAGLView.h"
#include "CCDirectorCaller.h"
#include "CCGLView.h"
#include "CCGLViewImpl.h"
#include "CCSet.h"
#include "base/CCTouch.h"
NS_CC_BEGIN
GLView* GLView::createWithEAGLView(void *eaglview)
GLViewImpl* GLViewImpl::createWithEAGLView(void *eaglview)
{
auto ret = new GLView;
auto ret = new GLViewImpl;
if(ret && ret->initWithEAGLView(eaglview)) {
ret->autorelease();
return ret;
@ -47,9 +47,9 @@ GLView* GLView::createWithEAGLView(void *eaglview)
return nullptr;
}
GLView* GLView::create(const std::string& viewName)
GLViewImpl* GLViewImpl::create(const std::string& viewName)
{
auto ret = new GLView;
auto ret = new GLViewImpl;
if(ret && ret->initWithFullScreen(viewName)) {
ret->autorelease();
return ret;
@ -58,9 +58,9 @@ GLView* GLView::create(const std::string& viewName)
return nullptr;
}
GLView* GLView::createWithRect(const std::string& viewName, Rect rect, float frameZoomFactor)
GLViewImpl* GLViewImpl::createWithRect(const std::string& viewName, Rect rect, float frameZoomFactor)
{
auto ret = new GLView;
auto ret = new GLViewImpl;
if(ret && ret->initWithRect(viewName, rect, frameZoomFactor)) {
ret->autorelease();
return ret;
@ -69,9 +69,9 @@ GLView* GLView::createWithRect(const std::string& viewName, Rect rect, float fra
return nullptr;
}
GLView* GLView::createWithFullScreen(const std::string& viewName)
GLViewImpl* GLViewImpl::createWithFullScreen(const std::string& viewName)
{
auto ret = new GLView();
auto ret = new GLViewImpl();
if(ret && ret->initWithFullScreen(viewName)) {
ret->autorelease();
return ret;
@ -80,17 +80,17 @@ GLView* GLView::createWithFullScreen(const std::string& viewName)
return nullptr;
}
GLView::GLView()
GLViewImpl::GLViewImpl()
{
}
GLView::~GLView()
GLViewImpl::~GLViewImpl()
{
CCEAGLView *glview = (CCEAGLView*) _eaglview;
[glview release];
}
bool GLView::initWithEAGLView(void *eaglview)
bool GLViewImpl::initWithEAGLView(void *eaglview)
{
_eaglview = eaglview;
CCEAGLView *glview = (CCEAGLView*) _eaglview;
@ -102,7 +102,7 @@ bool GLView::initWithEAGLView(void *eaglview)
return true;
}
bool GLView::initWithRect(const std::string& viewName, Rect rect, float frameZoomFactor)
bool GLViewImpl::initWithRect(const std::string& viewName, Rect rect, float frameZoomFactor)
{
CGRect r = CGRectMake(rect.origin.x, rect.origin.y, rect.size.width, rect.size.height);
CCEAGLView *eaglview = [CCEAGLView viewWithFrame: r
@ -123,7 +123,7 @@ bool GLView::initWithRect(const std::string& viewName, Rect rect, float frameZoo
return true;
}
bool GLView::initWithFullScreen(const std::string& viewName)
bool GLViewImpl::initWithFullScreen(const std::string& viewName)
{
CGRect rect = [[UIScreen mainScreen] bounds];
Rect r;
@ -135,12 +135,12 @@ bool GLView::initWithFullScreen(const std::string& viewName)
return initWithRect(viewName, r, 1);
}
bool GLView::isOpenGLReady()
bool GLViewImpl::isOpenGLReady()
{
return _eaglview != nullptr;
}
bool GLView::setContentScaleFactor(float contentScaleFactor)
bool GLViewImpl::setContentScaleFactor(float contentScaleFactor)
{
CC_ASSERT(_resolutionPolicy == ResolutionPolicy::UNKNOWN); // cannot enable retina mode
_scaleX = _scaleY = contentScaleFactor;
@ -151,7 +151,7 @@ bool GLView::setContentScaleFactor(float contentScaleFactor)
return true;
}
float GLView::getContentScaleFactor() const
float GLViewImpl::getContentScaleFactor() const
{
CCEAGLView *eaglview = (CCEAGLView*) _eaglview;
@ -162,7 +162,7 @@ float GLView::getContentScaleFactor() const
return scaleFactor;
}
void GLView::end()
void GLViewImpl::end()
{
[CCDirectorCaller destroy];
@ -174,13 +174,13 @@ void GLView::end()
}
void GLView::swapBuffers()
void GLViewImpl::swapBuffers()
{
CCEAGLView *eaglview = (CCEAGLView*) _eaglview;
[eaglview swapBuffers];
}
void GLView::setIMEKeyboardState(bool open)
void GLViewImpl::setIMEKeyboardState(bool open)
{
CCEAGLView *eaglview = (CCEAGLView*) _eaglview;

View File

@ -32,7 +32,6 @@ THE SOFTWARE.
#include <string>
#include "base/CCDirector.h"
#include "platform/CCFileUtils.h"
#include "CCGLView.h"
NS_CC_BEGIN

View File

@ -34,7 +34,6 @@ THE SOFTWARE.
#include "platform/CCFileUtils.h"
#include "math/CCGeometry.h"
#include "base/CCDirector.h"
#include "CCGLView.h"
NS_CC_BEGIN

View File

@ -29,11 +29,6 @@ THE SOFTWARE.
#include "platform/CCCommon.h"
#include "base/CCDirector.h"
#include "CCGLView.h"
#define GLFW_EXPOSE_NATIVE_NSGL
#define GLFW_EXPOSE_NATIVE_COCOA
#include "glfw3native.h"
#include <stdarg.h>
#include <stdio.h>
@ -58,8 +53,8 @@ void MessageBox(const char * msg, const char * title)
[alert setInformativeText:tmpTitle];
[alert setAlertStyle:NSWarningAlertStyle];
GLView* glview = Director::getInstance()->getOpenGLView();
id window = glfwGetCocoaWindow(glview->getWindow());
auto glview = Director::getInstance()->getOpenGLView();
id window = glview->getCocoaWindow();
[alert beginSheetModalForWindow:window
modalDelegate:[window delegate]
didEndSelector:nil

View File

@ -27,7 +27,6 @@ THE SOFTWARE.
#if CC_TARGET_PLATFORM == CC_PLATFORM_WIN32
#include "CCApplication.h"
#include "CCGLView.h"
#include "base/CCDirector.h"
#include <algorithm>
#include "platform/CCFileUtils.h"

View File

@ -33,7 +33,6 @@ THE SOFTWARE.
#include "ui/UILayoutManager.h"
#include "2d/CCDrawNode.h"
#include "2d/CCLayer.h"
#include "CCGLView.h"
#include "2d/CCSprite.h"
#include "base/CCEventFocus.h"

View File

@ -31,7 +31,6 @@
#include <string>
#include "jni/JniHelper.h"
#include "base/CCDirector.h"
#include "CCGLView.h"
#include "base/CCEventListenerKeyboard.h"
//-----------------------------------------------------------------------------------------------------------

View File

@ -29,7 +29,6 @@
using namespace cocos2d::experimental::ui;
//-------------------------------------------------------------------------------------
#include "CCEAGLView.h"
#include "CCGLView.h"
#import <MediaPlayer/MediaPlayer.h>
#include "base/CCDirector.h"

View File

@ -29,9 +29,6 @@
#if (CC_TARGET_PLATFORM == CC_PLATFORM_MAC)
#include "CCEditBox.h"
#define GLFW_EXPOSE_NATIVE_NSGL
#define GLFW_EXPOSE_NATIVE_COCOA
#include "glfw3native.h"
#define getEditBoxImplMac() ((cocos2d::extension::EditBoxImplMac*)editBox_)
@ -49,7 +46,7 @@
- (id) getNSWindow
{
auto glview = cocos2d::Director::getInstance()->getOpenGLView();
return glfwGetCocoaWindow(glview->getWindow());
return glview->getCocoaWindow();
}
- (void)dealloc
@ -287,7 +284,7 @@ void EditBoxImplMac::doAnimationWhenKeyboardMove(float duration, float distance)
bool EditBoxImplMac::initWithSize(const Size& size)
{
GLViewProtocol* eglView = Director::getInstance()->getOpenGLView();
GLView* eglView = Director::getInstance()->getOpenGLView();
NSRect rect = NSMakeRect(0, 0, size.width * eglView->getScaleX(),size.height * eglView->getScaleY());
@ -437,7 +434,7 @@ NSPoint EditBoxImplMac::convertDesignCoordToScreenCoord(const Vec2& designCoord,
NSRect frame = [_sysEdit.textField frame];
CGFloat height = frame.size.height;
GLViewProtocol* eglView = Director::getInstance()->getOpenGLView();
GLView* eglView = Director::getInstance()->getOpenGLView();
Vec2 visiblePos = Vec2(designCoord.x * eglView->getScaleX(), designCoord.y * eglView->getScaleY());
Vec2 screenGLPos = visiblePos + eglView->getViewPortRect().origin;

View File

@ -26,17 +26,8 @@
#if (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32)
#ifndef GLFW_EXPOSE_NATIVE_WIN32
#define GLFW_EXPOSE_NATIVE_WIN32
#endif
#ifndef GLFW_EXPOSE_NATIVE_WGL
#define GLFW_EXPOSE_NATIVE_WGL
#endif
#include "CCEditBox.h"
#include "proj.win32/Win32InputBox.h"
#include "glfw3native.h"
NS_CC_EXT_BEGIN
@ -257,9 +248,8 @@ void EditBoxImplWin::openKeyboard()
std::string text = getText();
if (text.length())
strncpy(pText, text.c_str(), 100);
GLView *glView = Director::getInstance()->getOpenGLView();
GLFWwindow *glfwWindow = glView->getWindow();
HWND hwnd = glfwGetWin32Window(glfwWindow);
auto glView = Director::getInstance()->getOpenGLView();
HWND hwnd = glView->getWin32Window();
bool didChange = CWin32InputBox::InputBox("Input", placeHolder.c_str(), pText, 100, false, hwnd) == IDOK;
if (didChange)

View File

@ -24,7 +24,6 @@
****************************************************************************/
#include "CCScrollView.h"
#include "CCGLView.h"
#include "platform/CCDevice.h"
#include "2d/CCActionInstant.h"
#include "2d/CCActionInterval.h"

View File

@ -719,8 +719,8 @@
"cocos/platform/CCDevice.h",
"cocos/platform/CCFileUtils.cpp",
"cocos/platform/CCFileUtils.h",
"cocos/platform/CCGLViewProtocol.cpp",
"cocos/platform/CCGLViewProtocol.h",
"cocos/platform/CCGLView.cpp",
"cocos/platform/CCGLView.h",
"cocos/platform/CCImage.cpp",
"cocos/platform/CCImage.h",
"cocos/platform/CCSAXParser.cpp",
@ -736,8 +736,8 @@
"cocos/platform/android/CCFileUtilsAndroid.cpp",
"cocos/platform/android/CCFileUtilsAndroid.h",
"cocos/platform/android/CCGL.h",
"cocos/platform/android/CCGLView.cpp",
"cocos/platform/android/CCGLView.h",
"cocos/platform/android/CCGLViewImpl.cpp",
"cocos/platform/android/CCGLViewImpl.h",
"cocos/platform/android/CCPlatformDefine.h",
"cocos/platform/android/CCStdC.h",
"cocos/platform/android/ControllerManualAdapter/.classpath",
@ -806,8 +806,8 @@
"cocos/platform/apple/CCLock.cpp",
"cocos/platform/apple/CCLock.h",
"cocos/platform/apple/CCThread.mm",
"cocos/platform/desktop/CCGLView.cpp",
"cocos/platform/desktop/CCGLView.h",
"cocos/platform/desktop/CCGLViewImpl.cpp",
"cocos/platform/desktop/CCGLViewImpl.h",
"cocos/platform/ios/CCApplication.h",
"cocos/platform/ios/CCApplication.mm",
"cocos/platform/ios/CCCommon.mm",
@ -820,8 +820,8 @@
"cocos/platform/ios/CCES2Renderer.m",
"cocos/platform/ios/CCESRenderer.h",
"cocos/platform/ios/CCGL.h",
"cocos/platform/ios/CCGLView.h",
"cocos/platform/ios/CCGLView.mm",
"cocos/platform/ios/CCGLViewImpl.h",
"cocos/platform/ios/CCGLViewImpl.mm",
"cocos/platform/ios/CCImage.mm",
"cocos/platform/ios/CCPlatformDefine.h",
"cocos/platform/ios/CCStdC.h",

View File

@ -16,7 +16,7 @@ bool AppDelegate::applicationDidFinishLaunching() {
auto director = Director::getInstance();
auto glview = director->getOpenGLView();
if(!glview) {
glview = GLView::create("My Game");
glview = GLViewImpl::create("My Game");
director->setOpenGLView(glview);
}

View File

@ -74,7 +74,7 @@ static AppDelegate s_sharedApplication;
[[UIApplication sharedApplication] setStatusBarHidden:true];
// IMPORTANT: Setting the GLView should be done after creating the RootViewController
cocos2d::GLView *glview = cocos2d::GLView::createWithEAGLView(eaglView);
cocos2d::GLView *glview = cocos2d::GLViewImpl::createWithEAGLView(eaglView);
cocos2d::Director::getInstance()->setOpenGLView(glview);
cocos2d::Application::getInstance()->run();

View File

@ -72,7 +72,7 @@
- (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation {
[super didRotateFromInterfaceOrientation:fromInterfaceOrientation];
cocos2d::GLView *glview = cocos2d::Director::getInstance()->getOpenGLView();
auto glview = cocos2d::Director::getInstance()->getOpenGLView();
if (glview)
{

View File

@ -22,7 +22,7 @@ bool AppDelegate::applicationDidFinishLaunching() {
auto director = Director::getInstance();
auto glview = director->getOpenGLView();
if(!glview) {
glview = GLView::create("Cpp Empty Test");
glview = GLViewImpl::create("Cpp Empty Test");
director->setOpenGLView(glview);
}

View File

@ -72,7 +72,7 @@ static AppDelegate s_sharedApplication;
[[UIApplication sharedApplication] setStatusBarHidden: YES];
// IMPORTANT: Setting the GLView should be done after creating the RootViewController
cocos2d::GLView *glview = cocos2d::GLView::createWithEAGLView(eaglView);
cocos2d::GLViewImpl *glview = cocos2d::GLViewImpl::createWithEAGLView(eaglView);
cocos2d::Director::getInstance()->setOpenGLView(glview);
cocos2d::Application *app = cocos2d::Application::getInstance();

View File

@ -54,7 +54,7 @@ bool AppDelegate::applicationDidFinishLaunching()
auto director = Director::getInstance();
auto glview = director->getOpenGLView();
if(!glview) {
glview = GLView::create("Cpp Tests");
glview = GLViewImpl::create("Cpp Tests");
director->setOpenGLView(glview);
}

View File

@ -81,7 +81,7 @@ static AppDelegate s_sharedApplication;
[[UIApplication sharedApplication] setStatusBarHidden:true];
// IMPORTANT: Setting the GLView should be done after creating the RootViewController
cocos2d::GLView *glview = cocos2d::GLView::createWithEAGLView(eaglView);
cocos2d::GLView *glview = cocos2d::GLViewImpl::createWithEAGLView(eaglView);
cocos2d::Director::getInstance()->setOpenGLView(glview);
app->run();

View File

@ -21,7 +21,7 @@ bool AppDelegate::applicationDidFinishLaunching() {
auto director = Director::getInstance();
auto glview = director->getOpenGLView();
if(!glview) {
glview = GLView::create("Game Controller Test");
glview = GLViewImpl::create("Game Controller Test");
director->setOpenGLView(glview);
}

View File

@ -72,7 +72,7 @@ static AppDelegate s_sharedApplication;
[[UIApplication sharedApplication] setStatusBarHidden: YES];
// IMPORTANT: Setting the GLView should be done after creating the RootViewController
cocos2d::GLView *glview = cocos2d::GLView::createWithEAGLView(eaglView);
cocos2d::GLView *glview = cocos2d::GLViewImpl::createWithEAGLView(eaglView);
cocos2d::Director::getInstance()->setOpenGLView(glview);
cocos2d::Application *app = cocos2d::Application::getInstance();

View File

@ -73,7 +73,7 @@ static AppDelegate s_sharedApplication;
[[UIApplication sharedApplication] setStatusBarHidden: YES];
// IMPORTANT: Setting the GLView should be done after creating the RootViewController
cocos2d::GLView *glview = cocos2d::GLView::createWithEAGLView(eaglView);
cocos2d::GLView *glview = cocos2d::GLViewImpl::createWithEAGLView(eaglView);
cocos2d::Director::getInstance()->setOpenGLView(glview);
cocos2d::Application *app = cocos2d::Application::getInstance();

View File

@ -18,7 +18,7 @@ local function initGLView()
local director = cc.Director:getInstance()
local glView = director:getOpenGLView()
if nil == glView then
glView = cc.GLView:create("Lua Empty Test")
glView = cc.GLViewImpl:create("Lua Empty Test")
director:setOpenGLView(glView)
end

View File

@ -73,7 +73,7 @@ static AppDelegate s_sharedApplication;
[[UIApplication sharedApplication] setStatusBarHidden: YES];
// IMPORTANT: Setting the GLView should be done after creating the RootViewController
cocos2d::GLView *glview = cocos2d::GLView::createWithEAGLView(eaglView);
cocos2d::GLView *glview = cocos2d::GLViewImpl::createWithEAGLView(eaglView);
cocos2d::Director::getInstance()->setOpenGLView(glview);
cocos2d::Application *app = cocos2d::Application::getInstance();

View File

@ -76,7 +76,7 @@ static AppDelegate s_sharedApplication;
// IMPORTANT: Setting the GLView should be done after creating the RootViewController
cocos2d::GLView *glview = cocos2d::GLView::createWithEAGLView(eaglView);
cocos2d::GLView *glview = cocos2d::GLViewImpl::createWithEAGLView(eaglView);
cocos2d::Director::getInstance()->setOpenGLView(glview);
cocos2d::Application::getInstance()->run();

View File

@ -9,7 +9,7 @@ collectgarbage("setstepmul", 5000)
local director = cc.Director:getInstance()
local glView = director:getOpenGLView()
if nil == glView then
glView = cc.GLView:createWithRect("Lua Tests", cc.rect(0,0,900,640))
glView = cc.GLViewImpl:createWithRect("Lua Tests", cc.rect(0,0,900,640))
director:setOpenGLView(glView)
end

View File

@ -26,7 +26,7 @@ headers = %(cocosdir)s/cocos/cocos2d.h %(cocosdir)s/cocos/audio/include/SimpleAu
# what classes to produce code for. You can use regular expressions here. When testing the regular
# expression, it will be enclosed in "^$", like this: "^Menu*$".
classes = New.* Sprite.* Scene Node.* Director Layer.* Menu.* Touch .*Action.* Move.* Rotate.* Blink.* Tint.* Sequence Repeat.* Fade.* Ease.* Scale.* Transition.* Spawn Animat.* Flip.* Delay.* Skew.* Jump.* Place.* Show.* Progress.* PointArray ToggleVisibility.* RemoveSelf Hide Particle.* Label.* Atlas.* TextureCache.* Texture2D Cardinal.* CatmullRom.* ParallaxNode TileMap.* .*TMX.* CallFunc RenderTexture GridAction Grid3DAction GridBase$ .+Grid Shaky3D Waves3D FlipX3D FlipY3D Speed ActionManager Set SimpleAudioEngine Scheduler Timer Orbit.* Follow.* Bezier.* CardinalSpline.* Camera.* DrawNode .*3D$ Liquid$ Waves$ ShuffleTiles$ TurnOffTiles$ Split.* Twirl$ FileUtils$ GLProgram ShaderCache Application ClippingNode MotionStreak ^Ref$ UserDefault GLViewProtocol GLView Image Event(?!.*(Physics).*).* Component ProtectedNode Console Mesh GLProgramCache GLProgramState
classes = New.* Sprite.* Scene Node.* Director Layer.* Menu.* Touch .*Action.* Move.* Rotate.* Blink.* Tint.* Sequence Repeat.* Fade.* Ease.* Scale.* Transition.* Spawn Animat.* Flip.* Delay.* Skew.* Jump.* Place.* Show.* Progress.* PointArray ToggleVisibility.* RemoveSelf Hide Particle.* Label.* Atlas.* TextureCache.* Texture2D Cardinal.* CatmullRom.* ParallaxNode TileMap.* .*TMX.* CallFunc RenderTexture GridAction Grid3DAction GridBase$ .+Grid Shaky3D Waves3D FlipX3D FlipY3D Speed ActionManager Set SimpleAudioEngine Scheduler Timer Orbit.* Follow.* Bezier.* CardinalSpline.* Camera.* DrawNode .*3D$ Liquid$ Waves$ ShuffleTiles$ TurnOffTiles$ Split.* Twirl$ FileUtils$ GLProgram ShaderCache Application ClippingNode MotionStreak ^Ref$ UserDefault GLViewImpl GLView Image Event(?!.*(Physics).*).* Component ProtectedNode Console Mesh GLProgramCache GLProgramState
# what should we skip? in the format ClassName::[function function]
# ClassName is a regular expression, but will be used like this: "^ClassName$" functions are also
@ -108,8 +108,8 @@ skip = Node::[setGLServerState description getUserObject .*UserData getGLServerS
ccFontDefinition::[*],
Ref::[autorelease isEqual acceptVisitor update],
UserDefault::[getInstance (s|g)etDataForKey],
GLViewProtocol::[setTouchDelegate],
GLView::[end swapBuffers],
GLView::[setTouchDelegate],
GLViewImpl::[end swapBuffers],
NewTextureAtlas::[*],
DisplayLinkDirector::[mainLoop setAnimationInterval startAnimation stopAnimation],
RenderTexture::[listenToBackground listenToForeground],
@ -162,7 +162,7 @@ base_classes_to_skip = Clonable
# classes that create no constructor
# Set is special and we will use a hand-written constructor
abstract_classes = Action FiniteTimeAction ActionInterval ActionEase EaseRateAction EaseElastic EaseBounce ActionInstant GridAction Grid3DAction TiledGrid3DAction Director SpriteFrameCache TransitionEaseScene Set SimpleAudioEngine FileUtils Application ClippingNode Label GLViewProtocol GLView EventAcceleration DisplayLinkDirector Component Console
abstract_classes = Action FiniteTimeAction ActionInterval ActionEase EaseRateAction EaseElastic EaseBounce ActionInstant GridAction Grid3DAction TiledGrid3DAction Director SpriteFrameCache TransitionEaseScene Set SimpleAudioEngine FileUtils Application ClippingNode Label GLViewImpl GLView EventAcceleration DisplayLinkDirector Component Console
# Determining whether to use script object(js object) to control the lifecycle of native(cpp) object or the other way around. Supported values are 'yes' or 'no'.
script_control_cpp = no