mirror of https://github.com/axmolengine/axmol.git
Updates includes path to 'desktop/CCEGLView.h'. And added windows relevant codes.
This commit is contained in:
parent
9b02f97217
commit
19062d716d
|
@ -175,7 +175,7 @@ THE SOFTWARE.
|
||||||
|
|
||||||
#if (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32)
|
#if (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32)
|
||||||
#include "platform/win32/CCApplication.h"
|
#include "platform/win32/CCApplication.h"
|
||||||
#include "platform/win32/CCEGLView.h"
|
#include "platform/desktop/CCEGLView.h"
|
||||||
#include "platform/win32/CCGL.h"
|
#include "platform/win32/CCGL.h"
|
||||||
#include "platform/win32/CCStdC.h"
|
#include "platform/win32/CCStdC.h"
|
||||||
#endif // CC_TARGET_PLATFORM == CC_PLATFORM_WIN32
|
#endif // CC_TARGET_PLATFORM == CC_PLATFORM_WIN32
|
||||||
|
|
|
@ -112,6 +112,9 @@
|
||||||
<Filter Include="renderer">
|
<Filter Include="renderer">
|
||||||
<UniqueIdentifier>{cba0f362-878c-438b-ad0f-43d287516357}</UniqueIdentifier>
|
<UniqueIdentifier>{cba0f362-878c-438b-ad0f-43d287516357}</UniqueIdentifier>
|
||||||
</Filter>
|
</Filter>
|
||||||
|
<Filter Include="platform\desktop">
|
||||||
|
<UniqueIdentifier>{32373f63-2c2d-4eab-bc4a-21745ba0b3fb}</UniqueIdentifier>
|
||||||
|
</Filter>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClCompile Include="..\physics\CCPhysicsBody.cpp">
|
<ClCompile Include="..\physics\CCPhysicsBody.cpp">
|
||||||
|
@ -351,9 +354,6 @@
|
||||||
<ClCompile Include="platform\win32\CCDevice.cpp">
|
<ClCompile Include="platform\win32\CCDevice.cpp">
|
||||||
<Filter>platform\win32</Filter>
|
<Filter>platform\win32</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="platform\win32\CCEGLView.cpp">
|
|
||||||
<Filter>platform\win32</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="platform\win32\CCFileUtilsWin32.cpp">
|
<ClCompile Include="platform\win32\CCFileUtilsWin32.cpp">
|
||||||
<Filter>platform\win32</Filter>
|
<Filter>platform\win32</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
@ -595,6 +595,9 @@
|
||||||
<ClCompile Include="CCFontCharMap.cpp">
|
<ClCompile Include="CCFontCharMap.cpp">
|
||||||
<Filter>label_nodes</Filter>
|
<Filter>label_nodes</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
<ClCompile Include="platform\desktop\CCEGLView.cpp">
|
||||||
|
<Filter>platform\desktop</Filter>
|
||||||
|
</ClCompile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClInclude Include="..\physics\CCPhysicsBody.h">
|
<ClInclude Include="..\physics\CCPhysicsBody.h">
|
||||||
|
@ -852,9 +855,6 @@
|
||||||
<ClInclude Include="platform\win32\CCApplication.h">
|
<ClInclude Include="platform\win32\CCApplication.h">
|
||||||
<Filter>platform\win32</Filter>
|
<Filter>platform\win32</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="platform\win32\CCEGLView.h">
|
|
||||||
<Filter>platform\win32</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="platform\win32\CCFileUtilsWin32.h">
|
<ClInclude Include="platform\win32\CCFileUtilsWin32.h">
|
||||||
<Filter>platform\win32</Filter>
|
<Filter>platform\win32</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
@ -1198,5 +1198,8 @@
|
||||||
<ClInclude Include="CCFontCharMap.h">
|
<ClInclude Include="CCFontCharMap.h">
|
||||||
<Filter>label_nodes</Filter>
|
<Filter>label_nodes</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
<ClInclude Include="platform\desktop\CCEGLView.h">
|
||||||
|
<Filter>platform\desktop</Filter>
|
||||||
|
</ClInclude>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
|
@ -7,7 +7,7 @@
|
||||||
<PropertyGroup />
|
<PropertyGroup />
|
||||||
<ItemDefinitionGroup>
|
<ItemDefinitionGroup>
|
||||||
<ClCompile>
|
<ClCompile>
|
||||||
<AdditionalIncludeDirectories>$(EngineRoot)cocos\2d;$(EngineRoot)cocos\2d\renderer;$(EngineRoot)cocos\gui;$(EngineRoot)cocos\base;$(EngineRoot)cocos\physics;$(EngineRoot)cocos\math\kazmath\include;$(EngineRoot)cocos\2d\platform\win32;$(EngineRoot)external\glfw3\include\win32;$(EngineRoot)external\win32-specific\gles\include\OGLES</AdditionalIncludeDirectories>
|
<AdditionalIncludeDirectories>$(EngineRoot)cocos\2d;$(EngineRoot)cocos\2d\renderer;$(EngineRoot)cocos\gui;$(EngineRoot)cocos\base;$(EngineRoot)cocos\physics;$(EngineRoot)cocos\math\kazmath\include;$(EngineRoot)cocos\2d\platform\win32;$(EngineRoot)cocos\2d\platform\desktop;$(EngineRoot)external\glfw3\include\win32;$(EngineRoot)external\win32-specific\gles\include\OGLES</AdditionalIncludeDirectories>
|
||||||
<PreprocessorDefinitions>_VARIADIC_MAX=10;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>_VARIADIC_MAX=10;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
|
|
|
@ -43,7 +43,7 @@ struct keyCodeItem
|
||||||
EventKeyboard::KeyCode keyCode;
|
EventKeyboard::KeyCode keyCode;
|
||||||
};
|
};
|
||||||
|
|
||||||
static std::map<int, EventKeyboard::KeyCode> g_keyCodeMap;
|
static std::unordered_map<int, EventKeyboard::KeyCode> g_keyCodeMap;
|
||||||
|
|
||||||
static keyCodeItem g_keyCodeStructArray[] = {
|
static keyCodeItem g_keyCodeStructArray[] = {
|
||||||
/* The unknown key */
|
/* The unknown key */
|
||||||
|
@ -505,10 +505,74 @@ EGLView* EGLView::sharedOpenGLView()
|
||||||
return EGLView::getInstance();
|
return EGLView::getInstance();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32)
|
||||||
|
static bool glew_dynamic_binding()
|
||||||
|
{
|
||||||
|
const char *gl_extensions = (const char*)glGetString(GL_EXTENSIONS);
|
||||||
|
|
||||||
|
// If the current opengl driver doesn't have framebuffers methods, check if an extension exists
|
||||||
|
if (glGenFramebuffers == NULL)
|
||||||
|
{
|
||||||
|
log("OpenGL: glGenFramebuffers is NULL, try to detect an extension");
|
||||||
|
if (strstr(gl_extensions, "ARB_framebuffer_object"))
|
||||||
|
{
|
||||||
|
log("OpenGL: ARB_framebuffer_object is supported");
|
||||||
|
|
||||||
|
glIsRenderbuffer = (PFNGLISRENDERBUFFERPROC) wglGetProcAddress("glIsRenderbuffer");
|
||||||
|
glBindRenderbuffer = (PFNGLBINDRENDERBUFFERPROC) wglGetProcAddress("glBindRenderbuffer");
|
||||||
|
glDeleteRenderbuffers = (PFNGLDELETERENDERBUFFERSPROC) wglGetProcAddress("glDeleteRenderbuffers");
|
||||||
|
glGenRenderbuffers = (PFNGLGENRENDERBUFFERSPROC) wglGetProcAddress("glGenRenderbuffers");
|
||||||
|
glRenderbufferStorage = (PFNGLRENDERBUFFERSTORAGEPROC) wglGetProcAddress("glRenderbufferStorage");
|
||||||
|
glGetRenderbufferParameteriv = (PFNGLGETRENDERBUFFERPARAMETERIVPROC) wglGetProcAddress("glGetRenderbufferParameteriv");
|
||||||
|
glIsFramebuffer = (PFNGLISFRAMEBUFFERPROC) wglGetProcAddress("glIsFramebuffer");
|
||||||
|
glBindFramebuffer = (PFNGLBINDFRAMEBUFFERPROC) wglGetProcAddress("glBindFramebuffer");
|
||||||
|
glDeleteFramebuffers = (PFNGLDELETEFRAMEBUFFERSPROC) wglGetProcAddress("glDeleteFramebuffers");
|
||||||
|
glGenFramebuffers = (PFNGLGENFRAMEBUFFERSPROC) wglGetProcAddress("glGenFramebuffers");
|
||||||
|
glCheckFramebufferStatus = (PFNGLCHECKFRAMEBUFFERSTATUSPROC) wglGetProcAddress("glCheckFramebufferStatus");
|
||||||
|
glFramebufferTexture1D = (PFNGLFRAMEBUFFERTEXTURE1DPROC) wglGetProcAddress("glFramebufferTexture1D");
|
||||||
|
glFramebufferTexture2D = (PFNGLFRAMEBUFFERTEXTURE2DPROC) wglGetProcAddress("glFramebufferTexture2D");
|
||||||
|
glFramebufferTexture3D = (PFNGLFRAMEBUFFERTEXTURE3DPROC) wglGetProcAddress("glFramebufferTexture3D");
|
||||||
|
glFramebufferRenderbuffer = (PFNGLFRAMEBUFFERRENDERBUFFERPROC) wglGetProcAddress("glFramebufferRenderbuffer");
|
||||||
|
glGetFramebufferAttachmentParameteriv = (PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROC) wglGetProcAddress("glGetFramebufferAttachmentParameteriv");
|
||||||
|
glGenerateMipmap = (PFNGLGENERATEMIPMAPPROC) wglGetProcAddress("glGenerateMipmap");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
if (strstr(gl_extensions, "EXT_framebuffer_object"))
|
||||||
|
{
|
||||||
|
log("OpenGL: EXT_framebuffer_object is supported");
|
||||||
|
glIsRenderbuffer = (PFNGLISRENDERBUFFERPROC) wglGetProcAddress("glIsRenderbufferEXT");
|
||||||
|
glBindRenderbuffer = (PFNGLBINDRENDERBUFFERPROC) wglGetProcAddress("glBindRenderbufferEXT");
|
||||||
|
glDeleteRenderbuffers = (PFNGLDELETERENDERBUFFERSPROC) wglGetProcAddress("glDeleteRenderbuffersEXT");
|
||||||
|
glGenRenderbuffers = (PFNGLGENRENDERBUFFERSPROC) wglGetProcAddress("glGenRenderbuffersEXT");
|
||||||
|
glRenderbufferStorage = (PFNGLRENDERBUFFERSTORAGEPROC) wglGetProcAddress("glRenderbufferStorageEXT");
|
||||||
|
glGetRenderbufferParameteriv = (PFNGLGETRENDERBUFFERPARAMETERIVPROC) wglGetProcAddress("glGetRenderbufferParameterivEXT");
|
||||||
|
glIsFramebuffer = (PFNGLISFRAMEBUFFERPROC) wglGetProcAddress("glIsFramebufferEXT");
|
||||||
|
glBindFramebuffer = (PFNGLBINDFRAMEBUFFERPROC) wglGetProcAddress("glBindFramebufferEXT");
|
||||||
|
glDeleteFramebuffers = (PFNGLDELETEFRAMEBUFFERSPROC) wglGetProcAddress("glDeleteFramebuffersEXT");
|
||||||
|
glGenFramebuffers = (PFNGLGENFRAMEBUFFERSPROC) wglGetProcAddress("glGenFramebuffersEXT");
|
||||||
|
glCheckFramebufferStatus = (PFNGLCHECKFRAMEBUFFERSTATUSPROC) wglGetProcAddress("glCheckFramebufferStatusEXT");
|
||||||
|
glFramebufferTexture1D = (PFNGLFRAMEBUFFERTEXTURE1DPROC) wglGetProcAddress("glFramebufferTexture1DEXT");
|
||||||
|
glFramebufferTexture2D = (PFNGLFRAMEBUFFERTEXTURE2DPROC) wglGetProcAddress("glFramebufferTexture2DEXT");
|
||||||
|
glFramebufferTexture3D = (PFNGLFRAMEBUFFERTEXTURE3DPROC) wglGetProcAddress("glFramebufferTexture3DEXT");
|
||||||
|
glFramebufferRenderbuffer = (PFNGLFRAMEBUFFERRENDERBUFFERPROC) wglGetProcAddress("glFramebufferRenderbufferEXT");
|
||||||
|
glGetFramebufferAttachmentParameteriv = (PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROC) wglGetProcAddress("glGetFramebufferAttachmentParameterivEXT");
|
||||||
|
glGenerateMipmap = (PFNGLGENERATEMIPMAPPROC) wglGetProcAddress("glGenerateMipmapEXT");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
log("OpenGL: No framebuffers extension is supported");
|
||||||
|
log("OpenGL: Any call to Fbo will crash!");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
// helper
|
// helper
|
||||||
bool EGLView::initGlew()
|
bool EGLView::initGlew()
|
||||||
{
|
{
|
||||||
#if CC_TARGET_PLATFORM == CC_PLATFORM_LINUX
|
#if (CC_TARGET_PLATFORM != CC_PLATFORM_MAC)
|
||||||
GLenum GlewInitResult = glewInit();
|
GLenum GlewInitResult = glewInit();
|
||||||
if (GLEW_OK != GlewInitResult)
|
if (GLEW_OK != GlewInitResult)
|
||||||
{
|
{
|
||||||
|
@ -534,13 +598,18 @@ bool EGLView::initGlew()
|
||||||
log("OpenGL 2.0 not supported");
|
log("OpenGL 2.0 not supported");
|
||||||
}
|
}
|
||||||
|
|
||||||
// if(glew_dynamic_binding() == false)
|
#if (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32)
|
||||||
// {
|
if(glew_dynamic_binding() == false)
|
||||||
// MessageBox("No OpenGL framebuffer support. Please upgrade the driver of your video card.", "OpenGL error");
|
{
|
||||||
// return false;
|
MessageBox("No OpenGL framebuffer support. Please upgrade the driver of your video card.", "OpenGL error");
|
||||||
// }
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
#endif // Linux
|
// Enable point size by default on windows.
|
||||||
|
glEnable(GL_VERTEX_PROGRAM_POINT_SIZE);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif // (CC_TARGET_PLATFORM != CC_PLATFORM_MAC)
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue