mirror of https://github.com/axmolengine/axmol.git
Unify CC_COMPAT_GL to control renderer backend
win32: google angle mac: NSGL ios: GLES
This commit is contained in:
parent
8b4b39bc7a
commit
108399ede3
|
@ -103,9 +103,13 @@ function(use_cocos2dx_compile_define target)
|
||||||
if(APPLE)
|
if(APPLE)
|
||||||
target_compile_definitions(${target} PUBLIC __APPLE__)
|
target_compile_definitions(${target} PUBLIC __APPLE__)
|
||||||
target_compile_definitions(${target} PUBLIC USE_FILE32API)
|
target_compile_definitions(${target} PUBLIC USE_FILE32API)
|
||||||
if(IOS AND CC_FORCE_USE_GLES)
|
if(CC_COMPAT_GL)
|
||||||
target_compile_definitions(${target} PUBLIC CC_FORCE_USE_GLES=1)
|
target_compile_definitions(${target}
|
||||||
|
PUBLIC CC_COMPAT_GL=1
|
||||||
|
PUBLIC GL_SILENCE_DEPRECATION=1
|
||||||
|
)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
elseif(LINUX)
|
elseif(LINUX)
|
||||||
target_compile_definitions(${target} PUBLIC LINUX)
|
target_compile_definitions(${target} PUBLIC LINUX)
|
||||||
target_compile_definitions(${target} PUBLIC _GNU_SOURCE)
|
target_compile_definitions(${target} PUBLIC _GNU_SOURCE)
|
||||||
|
@ -113,8 +117,8 @@ function(use_cocos2dx_compile_define target)
|
||||||
target_compile_definitions(${target} PUBLIC ANDROID)
|
target_compile_definitions(${target} PUBLIC ANDROID)
|
||||||
target_compile_definitions(${target} PUBLIC USE_FILE32API)
|
target_compile_definitions(${target} PUBLIC USE_FILE32API)
|
||||||
elseif(WINDOWS)
|
elseif(WINDOWS)
|
||||||
if(CC_FORCE_USE_GLES)
|
if(CC_COMPAT_GL)
|
||||||
target_compile_definitions(${target} PUBLIC CC_FORCE_USE_GLES=1)
|
target_compile_definitions(${target} PUBLIC CC_COMPAT_GL=1)
|
||||||
endif()
|
endif()
|
||||||
target_compile_definitions(${target}
|
target_compile_definitions(${target}
|
||||||
PUBLIC WIN32
|
PUBLIC WIN32
|
||||||
|
|
|
@ -65,8 +65,8 @@ if(NOT DEFINED ENGINEX_CORE_LIB)
|
||||||
set(ENGINEX_CORE_LIB cocos2d CACHE INTERNAL "The engine-x core lib name" )
|
set(ENGINEX_CORE_LIB cocos2d CACHE INTERNAL "The engine-x core lib name" )
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (NOT DEFINED CC_FORCE_USE_GLES)
|
if (NOT DEFINED CC_COMPAT_GL)
|
||||||
set(CC_FORCE_USE_GLES FALSE CACHE INTERNAL "Force use GLES" )
|
set(CC_COMPAT_GL FALSE CACHE INTERNAL "Enabling CC_COMPAT_GL" )
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
project(cocos2d_libs)
|
project(cocos2d_libs)
|
||||||
|
|
|
@ -36,9 +36,15 @@ THE SOFTWARE.
|
||||||
#include "platform/win32/CCGL-win32.h"
|
#include "platform/win32/CCGL-win32.h"
|
||||||
#elif CC_TARGET_PLATFORM == CC_PLATFORM_LINUX
|
#elif CC_TARGET_PLATFORM == CC_PLATFORM_LINUX
|
||||||
#include "platform/linux/CCGL-linux.h"
|
#include "platform/linux/CCGL-linux.h"
|
||||||
#elif CC_TARGET_PLATFORM == CC_PLATFORM_IOS && !defined(CC_USE_METAL)
|
#elif CC_TARGET_PLATFORM == CC_PLATFORM_IOS
|
||||||
|
#if CC_COMPAT_GL
|
||||||
#include "platform/ios/CCGL-ios.h"
|
#include "platform/ios/CCGL-ios.h"
|
||||||
#endif
|
#endif
|
||||||
|
#elif CC_TARGET_PLATFORM == CC_PLATFORM_MAC
|
||||||
|
#if CC_COMPAT_GL
|
||||||
|
#include "platform/mac/CCGL-mac.h"
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
/// @endcond
|
/// @endcond
|
||||||
#endif /* __PLATFORM_CCPLATFORMDEFINE_H__*/
|
#endif /* __PLATFORM_CCPLATFORMDEFINE_H__*/
|
||||||
|
|
|
@ -104,11 +104,12 @@ THE SOFTWARE.
|
||||||
#endif // CC_PLATFORM_WIN32
|
#endif // CC_PLATFORM_WIN32
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Windows: https://github.com/google/angle
|
windows: https://github.com/google/angle
|
||||||
* iOS: Use Apple GLES
|
mac: GL
|
||||||
|
iOS: GLES
|
||||||
*/
|
*/
|
||||||
#ifndef CC_FORCE_USE_GLES
|
#ifndef CC_COMPAT_GL
|
||||||
#define CC_FORCE_USE_GLES 0
|
#define CC_COMPAT_GL 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if ((CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID) || (CC_TARGET_PLATFORM == CC_PLATFORM_IOS))
|
#if ((CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID) || (CC_TARGET_PLATFORM == CC_PLATFORM_IOS))
|
||||||
|
@ -118,21 +119,27 @@ THE SOFTWARE.
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if (CC_TARGET_PLATFORM == CC_PLATFORM_MAC)
|
#if (CC_TARGET_PLATFORM == CC_PLATFORM_MAC)
|
||||||
|
#if !CC_COMPAT_GL
|
||||||
#define CC_USE_METAL
|
#define CC_USE_METAL
|
||||||
|
#else
|
||||||
|
#define CC_USE_GL
|
||||||
|
#endif
|
||||||
#elif (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
|
#elif (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
|
||||||
#if !CC_FORCE_USE_GLES
|
#if !CC_COMPAT_GL
|
||||||
#define CC_USE_METAL
|
#define CC_USE_METAL
|
||||||
#else
|
#else
|
||||||
#define CC_USE_GLES
|
#define CC_USE_GLES
|
||||||
#endif
|
#endif
|
||||||
#elif (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
|
#elif (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
|
||||||
#define CC_USE_GLES
|
#define CC_USE_GLES
|
||||||
#else
|
#elif (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32)
|
||||||
#if !CC_FORCE_USE_GLES
|
#if !CC_COMPAT_GL
|
||||||
#define CC_USE_GL
|
#define CC_USE_GL
|
||||||
#else
|
#else
|
||||||
#define CC_USE_GLES
|
#define CC_USE_GLES
|
||||||
#endif
|
#endif
|
||||||
|
#else
|
||||||
|
#error "Unsupported platform!"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/// @endcond
|
/// @endcond
|
||||||
|
|
|
@ -101,7 +101,7 @@ elseif(APPLE)
|
||||||
platform/ios/CCInputView-ios.mm
|
platform/ios/CCInputView-ios.mm
|
||||||
)
|
)
|
||||||
|
|
||||||
if(CC_FORCE_USE_GLES)
|
if(NOT CC_COMPAT_GL)
|
||||||
set(COCOS_PLATFORM_SPECIFIC_HEADER
|
set(COCOS_PLATFORM_SPECIFIC_HEADER
|
||||||
${COCOS_PLATFORM_SPECIFIC_HEADER}
|
${COCOS_PLATFORM_SPECIFIC_HEADER}
|
||||||
platform/ios/CCES2Renderer-ios.h
|
platform/ios/CCES2Renderer-ios.h
|
||||||
|
|
|
@ -0,0 +1,113 @@
|
||||||
|
/****************************************************************************
|
||||||
|
Copyright (c) 2010-2012 cocos2d-x.org
|
||||||
|
Copyright (c) 2013-2016 Chukong Technologies Inc.
|
||||||
|
Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd.
|
||||||
|
|
||||||
|
http://www.cocos2d-x.org
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in
|
||||||
|
all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
THE SOFTWARE.
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#ifndef __PLATFORM_MAC_CCGL_H__
|
||||||
|
#define __PLATFORM_MAC_CCGL_H__
|
||||||
|
|
||||||
|
#include "platform/CCPlatformConfig.h"
|
||||||
|
#if CC_TARGET_PLATFORM == CC_PLATFORM_MAC
|
||||||
|
|
||||||
|
#import <OpenGL/gl.h>
|
||||||
|
#import <OpenGL/glu.h>
|
||||||
|
#import <OpenGL/glext.h>
|
||||||
|
|
||||||
|
#define CC_GL_DEPTH24_STENCIL8 -1
|
||||||
|
|
||||||
|
|
||||||
|
#define glDeleteVertexArrays glDeleteVertexArraysAPPLE
|
||||||
|
#define glGenVertexArrays glGenVertexArraysAPPLE
|
||||||
|
#define glBindVertexArray glBindVertexArrayAPPLE
|
||||||
|
#define glClearDepthf glClearDepth
|
||||||
|
#define glDepthRangef glDepthRange
|
||||||
|
#define glReleaseShaderCompiler(xxx)
|
||||||
|
|
||||||
|
// GLES macros, only for compiling compatible
|
||||||
|
#if !defined(GL_ETC1_RGB8_OES)
|
||||||
|
#define GL_ETC1_RGB8_OES 0x8D64
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if !defined(GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG)
|
||||||
|
#define GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG 0x8C00
|
||||||
|
#define GL_COMPRESSED_RGB_PVRTC_2BPPV1_IMG 0x8C01
|
||||||
|
#define GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG 0x8C02
|
||||||
|
#define GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG 0x8C03
|
||||||
|
#define GL_COMPRESSED_RGBA_PVRTC_2BPPV2_IMG 0x9137
|
||||||
|
#define GL_COMPRESSED_RGBA_PVRTC_4BPPV2_IMG 0x9138
|
||||||
|
#define GL_COMPRESSED_SRGB_PVRTC_2BPPV1_EXT 0x8A54
|
||||||
|
#define GL_COMPRESSED_SRGB_PVRTC_4BPPV1_EXT 0x8A55
|
||||||
|
#define GL_COMPRESSED_SRGB_ALPHA_PVRTC_2BPPV1_EXT 0x8A56
|
||||||
|
#define GL_COMPRESSED_SRGB_ALPHA_PVRTC_4BPPV1_EXT 0x8A57
|
||||||
|
#define GL_COMPRESSED_SRGB_ALPHA_PVRTC_2BPPV2_IMG 0x93F0
|
||||||
|
#define GL_COMPRESSED_SRGB_ALPHA_PVRTC_4BPPV2_IMG 0x93F1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if !defined(GL_COMPRESSED_RGB8_ETC2)
|
||||||
|
#define GL_COMPRESSED_RGB8_ETC2 0x9274
|
||||||
|
#define GL_COMPRESSED_SRGB8_ETC2 0x9275
|
||||||
|
#define GL_COMPRESSED_RGBA8_ETC2_EAC 0x9278
|
||||||
|
#define GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC 0x9279
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if !defined(GL_ATC_RGB_AMD)
|
||||||
|
#define GL_ATC_RGB_AMD 0x8C92
|
||||||
|
#define GL_ATC_RGBA_EXPLICIT_ALPHA_AMD 0x8C93
|
||||||
|
#define GL_ATC_RGBA_INTERPOLATED_ALPHA_AMD 0x87EE
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if !defined(GL_COMPRESSED_RGBA_ASTC_4x4_KHR)
|
||||||
|
#define GL_COMPRESSED_RGBA_ASTC_4x4_KHR 0x93B0
|
||||||
|
#define GL_COMPRESSED_RGBA_ASTC_5x4_KHR 0x93B1
|
||||||
|
#define GL_COMPRESSED_RGBA_ASTC_5x5_KHR 0x93B2
|
||||||
|
#define GL_COMPRESSED_RGBA_ASTC_6x5_KHR 0x93B3
|
||||||
|
#define GL_COMPRESSED_RGBA_ASTC_6x6_KHR 0x93B4
|
||||||
|
#define GL_COMPRESSED_RGBA_ASTC_8x5_KHR 0x93B5
|
||||||
|
#define GL_COMPRESSED_RGBA_ASTC_8x6_KHR 0x93B6
|
||||||
|
#define GL_COMPRESSED_RGBA_ASTC_8x8_KHR 0x93B7
|
||||||
|
#define GL_COMPRESSED_RGBA_ASTC_10x5_KHR 0x93B8
|
||||||
|
#define GL_COMPRESSED_RGBA_ASTC_10x6_KHR 0x93B9
|
||||||
|
#define GL_COMPRESSED_RGBA_ASTC_10x8_KHR 0x93BA
|
||||||
|
#define GL_COMPRESSED_RGBA_ASTC_10x10_KHR 0x93BB
|
||||||
|
#define GL_COMPRESSED_RGBA_ASTC_12x10_KHR 0x93BC
|
||||||
|
#define GL_COMPRESSED_RGBA_ASTC_12x12_KHR 0x93BD
|
||||||
|
#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR 0x93D0
|
||||||
|
#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR 0x93D1
|
||||||
|
#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR 0x93D2
|
||||||
|
#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR 0x93D3
|
||||||
|
#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR 0x93D4
|
||||||
|
#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR 0x93D5
|
||||||
|
#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR 0x93D6
|
||||||
|
#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR 0x93D7
|
||||||
|
#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR 0x93D8
|
||||||
|
#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR 0x93D9
|
||||||
|
#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR 0x93DA
|
||||||
|
#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR 0x93DB
|
||||||
|
#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR 0x93DC
|
||||||
|
#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR 0x93DD
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif // __PLATFORM_MAC_CCGL_H__
|
||||||
|
|
||||||
|
#endif //s CC_TARGET_PLATFORM == CC_PLATFORM_MAC
|
|
@ -379,8 +379,10 @@ bool GLViewImpl::initWithRect(const std::string& viewName, Rect rect, float fram
|
||||||
|
|
||||||
glfwWindowHint(GLFW_SAMPLES, _glContextAttrs.multisamplingCount);
|
glfwWindowHint(GLFW_SAMPLES, _glContextAttrs.multisamplingCount);
|
||||||
|
|
||||||
|
#if defined(CC_USE_METAL)
|
||||||
// Don't create gl context.
|
// Don't create gl context.
|
||||||
glfwWindowHint(GLFW_CLIENT_API, GLFW_NO_API);
|
glfwWindowHint(GLFW_CLIENT_API, GLFW_NO_API);
|
||||||
|
#endif
|
||||||
|
|
||||||
int neededWidth = rect.size.width * _frameZoomFactor;
|
int neededWidth = rect.size.width * _frameZoomFactor;
|
||||||
int neededHeight = rect.size.height * _frameZoomFactor;
|
int neededHeight = rect.size.height * _frameZoomFactor;
|
||||||
|
@ -408,6 +410,7 @@ bool GLViewImpl::initWithRect(const std::string& viewName, Rect rect, float fram
|
||||||
size.width = static_cast<CGFloat>(fbWidth);
|
size.width = static_cast<CGFloat>(fbWidth);
|
||||||
size.height = static_cast<CGFloat>(fbHeight);
|
size.height = static_cast<CGFloat>(fbHeight);
|
||||||
|
|
||||||
|
#if defined(CC_USE_METAL)
|
||||||
// Initialize device.
|
// Initialize device.
|
||||||
id<MTLDevice> device = MTLCreateSystemDefaultDevice();
|
id<MTLDevice> device = MTLCreateSystemDefaultDevice();
|
||||||
if (!device)
|
if (!device)
|
||||||
|
@ -425,6 +428,7 @@ bool GLViewImpl::initWithRect(const std::string& viewName, Rect rect, float fram
|
||||||
[layer setDrawableSize:size];
|
[layer setDrawableSize:size];
|
||||||
[contentView setLayer:layer];
|
[contentView setLayer:layer];
|
||||||
backend::DeviceMTL::setCAMetalLayer(layer);
|
backend::DeviceMTL::setCAMetalLayer(layer);
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Note that the created window and context may differ from what you requested,
|
* Note that the created window and context may differ from what you requested,
|
||||||
|
@ -447,6 +451,10 @@ bool GLViewImpl::initWithRect(const std::string& viewName, Rect rect, float fram
|
||||||
rect.size.height = realH / _frameZoomFactor;
|
rect.size.height = realH / _frameZoomFactor;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if defined(CC_USE_GL)
|
||||||
|
glfwMakeContextCurrent(_mainWindow);
|
||||||
|
#endif
|
||||||
|
|
||||||
glfwSetMouseButtonCallback(_mainWindow, GLFWEventHandler::onGLFWMouseCallBack);
|
glfwSetMouseButtonCallback(_mainWindow, GLFWEventHandler::onGLFWMouseCallBack);
|
||||||
glfwSetCursorPosCallback(_mainWindow, GLFWEventHandler::onGLFWMouseMoveCallBack);
|
glfwSetCursorPosCallback(_mainWindow, GLFWEventHandler::onGLFWMouseMoveCallBack);
|
||||||
glfwSetScrollCallback(_mainWindow, GLFWEventHandler::onGLFWMouseScrollCallback);
|
glfwSetScrollCallback(_mainWindow, GLFWEventHandler::onGLFWMouseScrollCallback);
|
||||||
|
@ -507,8 +515,10 @@ void GLViewImpl::end()
|
||||||
|
|
||||||
void GLViewImpl::swapBuffers()
|
void GLViewImpl::swapBuffers()
|
||||||
{
|
{
|
||||||
// if(_mainWindow)
|
#if defined(CC_USE_GL)
|
||||||
// glfwSwapBuffers(_mainWindow);
|
if(_mainWindow)
|
||||||
|
glfwSwapBuffers(_mainWindow);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GLViewImpl::windowShouldClose()
|
bool GLViewImpl::windowShouldClose()
|
||||||
|
@ -984,10 +994,12 @@ void GLViewImpl::onGLFWWindowSizeCallback(GLFWwindow* /*window*/, int width, int
|
||||||
Director::getInstance()->setViewport();
|
Director::getInstance()->setViewport();
|
||||||
Director::getInstance()->getEventDispatcher()->dispatchCustomEvent(GLViewImpl::EVENT_WINDOW_RESIZED, nullptr);
|
Director::getInstance()->getEventDispatcher()->dispatchCustomEvent(GLViewImpl::EVENT_WINDOW_RESIZED, nullptr);
|
||||||
|
|
||||||
|
#if defined(CC_USE_METAL)
|
||||||
//update metal attachment texture size.
|
//update metal attachment texture size.
|
||||||
int fbWidth, fbHeight;
|
int fbWidth, fbHeight;
|
||||||
glfwGetFramebufferSize(_mainWindow, &fbWidth, &fbHeight);
|
glfwGetFramebufferSize(_mainWindow, &fbWidth, &fbHeight);
|
||||||
backend::UtilsMTL::resizeDefaultAttachmentTexture(fbWidth, fbHeight);
|
backend::UtilsMTL::resizeDefaultAttachmentTexture(fbWidth, fbHeight);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -76,7 +76,7 @@ set(COCOS_RENDERER_SRC
|
||||||
renderer/backend/RenderPassParams.cpp
|
renderer/backend/RenderPassParams.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
if(ANDROID OR WINDOWS OR LINUX OR (IOS AND CC_FORCE_USE_GLES))
|
if(ANDROID OR WINDOWS OR LINUX OR CC_COMPAT_GL)
|
||||||
|
|
||||||
list(APPEND COCOS_RENDERER_HEADER
|
list(APPEND COCOS_RENDERER_HEADER
|
||||||
renderer/backend/opengl/BufferGL.h
|
renderer/backend/opengl/BufferGL.h
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,5 +1,5 @@
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
* GLFW 3.3 - www.glfw.org
|
* GLFW 3.4 - www.glfw.org
|
||||||
* A library for OpenGL, window and input
|
* A library for OpenGL, window and input
|
||||||
*------------------------------------------------------------------------
|
*------------------------------------------------------------------------
|
||||||
* Copyright (c) 2002-2006 Marcus Geelnard
|
* Copyright (c) 2002-2006 Marcus Geelnard
|
||||||
|
@ -94,7 +94,7 @@ extern "C" {
|
||||||
#if defined(__OBJC__)
|
#if defined(__OBJC__)
|
||||||
#import <Cocoa/Cocoa.h>
|
#import <Cocoa/Cocoa.h>
|
||||||
#else
|
#else
|
||||||
//#include <ApplicationServices/ApplicationServices.h>
|
#include <ApplicationServices/ApplicationServices.h>
|
||||||
typedef void* id;
|
typedef void* id;
|
||||||
#endif
|
#endif
|
||||||
#elif defined(GLFW_EXPOSE_NATIVE_X11) || defined(GLFW_EXPOSE_NATIVE_GLX)
|
#elif defined(GLFW_EXPOSE_NATIVE_X11) || defined(GLFW_EXPOSE_NATIVE_GLX)
|
||||||
|
@ -200,7 +200,7 @@ GLFWAPI HGLRC glfwGetWGLContext(GLFWwindow* window);
|
||||||
*
|
*
|
||||||
* @ingroup native
|
* @ingroup native
|
||||||
*/
|
*/
|
||||||
//GLFWAPI CGDirectDisplayID glfwGetCocoaMonitor(GLFWmonitor* monitor);
|
GLFWAPI CGDirectDisplayID glfwGetCocoaMonitor(GLFWmonitor* monitor);
|
||||||
|
|
||||||
/*! @brief Returns the `NSWindow` of the specified window.
|
/*! @brief Returns the `NSWindow` of the specified window.
|
||||||
*
|
*
|
||||||
|
|
Binary file not shown.
|
@ -80,7 +80,7 @@ bool AppDelegate::applicationDidFinishLaunching()
|
||||||
// Set the design resolution
|
// Set the design resolution
|
||||||
glview->setDesignResolutionSize(designResolutionSize.width, designResolutionSize.height, ResolutionPolicy::NO_BORDER);
|
glview->setDesignResolutionSize(designResolutionSize.width, designResolutionSize.height, ResolutionPolicy::NO_BORDER);
|
||||||
|
|
||||||
Size frameSize = glview->getFrameSize();
|
auto frameSize = glview->getFrameSize();
|
||||||
|
|
||||||
vector<string> searchPath;
|
vector<string> searchPath;
|
||||||
|
|
||||||
|
|
|
@ -85,7 +85,7 @@ bool HelloWorld::init()
|
||||||
drawNode->setPosition(Vec2(0, 0));
|
drawNode->setPosition(Vec2(0, 0));
|
||||||
addChild(drawNode);
|
addChild(drawNode);
|
||||||
|
|
||||||
Rect safeArea = Director::getInstance()->getSafeAreaRect();
|
auto safeArea = Director::getInstance()->getSafeAreaRect();
|
||||||
drawNode->drawRect(safeArea.origin, safeArea.origin + safeArea.size, Color4F::BLUE);
|
drawNode->drawRect(safeArea.origin, safeArea.origin + safeArea.size, Color4F::BLUE);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
Loading…
Reference in New Issue