mirror of
https://github.com/smallmain/cocos-enhance-kit.git
synced 2025-10-09 15:25:24 +00:00
初始化
This commit is contained in:
334
cocos2d-x/cocos/platform/mac/CCApplication-mac.mm
Normal file
334
cocos2d-x/cocos/platform/mac/CCApplication-mac.mm
Normal file
@@ -0,0 +1,334 @@
|
||||
/****************************************************************************
|
||||
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.
|
||||
****************************************************************************/
|
||||
#include "platform/CCApplication.h"
|
||||
#import <Cocoa/Cocoa.h>
|
||||
#include <algorithm>
|
||||
#include <mutex>
|
||||
#include "base/CCScheduler.h"
|
||||
#include "base/CCAutoreleasePool.h"
|
||||
#include "base/CCGLUtils.h"
|
||||
#include "base/CCConfiguration.h"
|
||||
#include "platform/desktop/CCGLView-desktop.h"
|
||||
#include "scripting/js-bindings/event/EventDispatcher.h"
|
||||
#include "scripting/js-bindings/jswrapper/SeApi.h"
|
||||
#include "base/CCGLUtils.h"
|
||||
#include "audio/include/AudioEngine.h"
|
||||
#include "cocos/renderer/gfx/DeviceGraphics.h"
|
||||
|
||||
NS_CC_BEGIN
|
||||
|
||||
namespace
|
||||
{
|
||||
bool setCanvasCallback(se::Object* global)
|
||||
{
|
||||
auto viewSize = Application::getInstance()->getViewSize();
|
||||
se::ScriptEngine* se = se::ScriptEngine::getInstance();
|
||||
char commandBuf[200] = {0};
|
||||
int devicePixelRatio = Application::getInstance()->getScreenScale();
|
||||
//set window.innerWidth/innerHeight in CSS pixel units, not physical pixel units.
|
||||
sprintf(commandBuf, "window.innerWidth = %d; window.innerHeight = %d;",
|
||||
(int)(viewSize.x / devicePixelRatio),
|
||||
(int)(viewSize.y / devicePixelRatio));
|
||||
se->evalString(commandBuf);
|
||||
|
||||
glDepthMask(GL_TRUE);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
Application* Application::_instance = nullptr;
|
||||
std::shared_ptr<Scheduler> Application::_scheduler = nullptr;
|
||||
|
||||
#define CAST_VIEW(view) ((GLView*)view)
|
||||
|
||||
Application::Application(const std::string& name, int width, int height)
|
||||
{
|
||||
Application::_instance = this;
|
||||
|
||||
createView(name, width, height);
|
||||
|
||||
Configuration::getInstance();
|
||||
|
||||
_renderTexture = new RenderTexture(width, height);
|
||||
_scheduler = std::make_shared<Scheduler>();
|
||||
|
||||
EventDispatcher::init();
|
||||
se::ScriptEngine::getInstance();
|
||||
}
|
||||
|
||||
Application::~Application()
|
||||
{
|
||||
|
||||
#if USE_AUDIO
|
||||
AudioEngine::end();
|
||||
#endif
|
||||
|
||||
EventDispatcher::destroy();
|
||||
se::ScriptEngine::destroyInstance();
|
||||
|
||||
delete CAST_VIEW(_view);
|
||||
_view = nullptr;
|
||||
|
||||
delete _renderTexture;
|
||||
_renderTexture = nullptr;
|
||||
|
||||
Application::_instance = nullptr;
|
||||
}
|
||||
|
||||
const cocos2d::Vec2& Application::getViewSize() const
|
||||
{
|
||||
return _viewSize;
|
||||
}
|
||||
|
||||
void Application::updateViewSize(int width, int height)
|
||||
{
|
||||
_viewSize.x = width;
|
||||
_viewSize.y = height;
|
||||
}
|
||||
|
||||
void Application::start()
|
||||
{
|
||||
if (!_view)
|
||||
return;
|
||||
|
||||
float dt = 0.f;
|
||||
long long actualInternal = 0; // actual frame internal
|
||||
long long desiredInterval = 0; // desired frame internal, 1 / fps
|
||||
|
||||
std::chrono::steady_clock::time_point prev;
|
||||
std::chrono::steady_clock::time_point now;
|
||||
|
||||
prev = std::chrono::steady_clock::now();
|
||||
|
||||
se::ScriptEngine* se = se::ScriptEngine::getInstance();
|
||||
|
||||
while (!CAST_VIEW(_view)->windowShouldClose())
|
||||
{
|
||||
desiredInterval = 1.0 / _fps * 1000000;
|
||||
if (!_isStarted)
|
||||
{
|
||||
auto scheduler = Application::getInstance()->getScheduler();
|
||||
scheduler->removeAllFunctionsToBePerformedInCocosThread();
|
||||
scheduler->unscheduleAll();
|
||||
|
||||
se::ScriptEngine::getInstance()->cleanup();
|
||||
cocos2d::PoolManager::getInstance()->getCurrentPool()->clear();
|
||||
cocos2d::EventDispatcher::init();
|
||||
|
||||
ccInvalidateStateCache();
|
||||
se->addRegisterCallback(setCanvasCallback);
|
||||
|
||||
if(!applicationDidFinishLaunching())
|
||||
return;
|
||||
|
||||
_isStarted = true;
|
||||
}
|
||||
|
||||
// should be invoked at the begin of rendering a frame
|
||||
if (_isDownsampleEnabled)
|
||||
_renderTexture->prepare();
|
||||
|
||||
CAST_VIEW(_view)->pollEvents();
|
||||
|
||||
if (_isStarted)
|
||||
{
|
||||
now = std::chrono::steady_clock::now();
|
||||
actualInternal = std::chrono::duration_cast<std::chrono::microseconds>(now - prev).count();
|
||||
if (actualInternal >= desiredInterval)
|
||||
{
|
||||
prev = now;
|
||||
dt = (float)actualInternal / 1000000.f;
|
||||
_scheduler->update(dt);
|
||||
|
||||
EventDispatcher::dispatchTickEvent(dt);
|
||||
|
||||
if (_isDownsampleEnabled)
|
||||
_renderTexture->draw();
|
||||
|
||||
CAST_VIEW(_view)->swapBuffers();
|
||||
PoolManager::getInstance()->getCurrentPool()->clear();
|
||||
}
|
||||
else
|
||||
{
|
||||
// sleep 3ms may make a sleep of 4ms
|
||||
std::this_thread::sleep_for(std::chrono::microseconds(desiredInterval - actualInternal - 1000));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
std::this_thread::sleep_for(std::chrono::microseconds(desiredInterval));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Application::restart()
|
||||
{
|
||||
_isStarted = false;
|
||||
}
|
||||
|
||||
void Application::end()
|
||||
{
|
||||
glfwSetWindowShouldClose(CAST_VIEW(_view)->getGLFWWindow(), 1);
|
||||
}
|
||||
|
||||
void Application::setPreferredFramesPerSecond(int fps)
|
||||
{
|
||||
_fps = fps;
|
||||
}
|
||||
|
||||
Application::Platform Application::getPlatform() const
|
||||
{
|
||||
return Platform::MAC;
|
||||
}
|
||||
|
||||
std::string Application::getCurrentLanguageCode() const
|
||||
{
|
||||
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
|
||||
NSArray *languages = [defaults objectForKey:@"AppleLanguages"];
|
||||
NSString *currentLanguage = [languages objectAtIndex:0];
|
||||
return [currentLanguage UTF8String];
|
||||
}
|
||||
|
||||
bool Application::isDisplayStats() {
|
||||
se::AutoHandleScope hs;
|
||||
se::Value ret;
|
||||
char commandBuf[100] = "cc.debug.isDisplayStats();";
|
||||
se::ScriptEngine::getInstance()->evalString(commandBuf, 100, &ret);
|
||||
return ret.toBoolean();
|
||||
}
|
||||
|
||||
void Application::setDisplayStats(bool isShow) {
|
||||
se::AutoHandleScope hs;
|
||||
char commandBuf[100] = {0};
|
||||
sprintf(commandBuf, "cc.debug.setDisplayStats(%s);", isShow ? "true" : "false");
|
||||
se::ScriptEngine::getInstance()->evalString(commandBuf);
|
||||
}
|
||||
|
||||
Application::LanguageType Application::getCurrentLanguage() const
|
||||
{
|
||||
// get the current language and country config
|
||||
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
|
||||
NSArray *languages = [defaults objectForKey:@"AppleLanguages"];
|
||||
NSString *currentLanguage = [languages objectAtIndex:0];
|
||||
|
||||
// get the current language code.(such as English is "en", Chinese is "zh" and so on)
|
||||
NSDictionary* temp = [NSLocale componentsFromLocaleIdentifier:currentLanguage];
|
||||
NSString * languageCode = [temp objectForKey:NSLocaleLanguageCode];
|
||||
|
||||
if ([languageCode isEqualToString:@"zh"]) return LanguageType::CHINESE;
|
||||
if ([languageCode isEqualToString:@"en"]) return LanguageType::ENGLISH;
|
||||
if ([languageCode isEqualToString:@"fr"]) return LanguageType::FRENCH;
|
||||
if ([languageCode isEqualToString:@"it"]) return LanguageType::ITALIAN;
|
||||
if ([languageCode isEqualToString:@"de"]) return LanguageType::GERMAN;
|
||||
if ([languageCode isEqualToString:@"es"]) return LanguageType::SPANISH;
|
||||
if ([languageCode isEqualToString:@"nl"]) return LanguageType::DUTCH;
|
||||
if ([languageCode isEqualToString:@"ru"]) return LanguageType::RUSSIAN;
|
||||
if ([languageCode isEqualToString:@"ko"]) return LanguageType::KOREAN;
|
||||
if ([languageCode isEqualToString:@"ja"]) return LanguageType::JAPANESE;
|
||||
if ([languageCode isEqualToString:@"hu"]) return LanguageType::HUNGARIAN;
|
||||
if ([languageCode isEqualToString:@"pt"]) return LanguageType::PORTUGUESE;
|
||||
if ([languageCode isEqualToString:@"ar"]) return LanguageType::ARABIC;
|
||||
if ([languageCode isEqualToString:@"nb"]) return LanguageType::NORWEGIAN;
|
||||
if ([languageCode isEqualToString:@"pl"]) return LanguageType::POLISH;
|
||||
if ([languageCode isEqualToString:@"tr"]) return LanguageType::TURKISH;
|
||||
if ([languageCode isEqualToString:@"uk"]) return LanguageType::UKRAINIAN;
|
||||
if ([languageCode isEqualToString:@"ro"]) return LanguageType::ROMANIAN;
|
||||
if ([languageCode isEqualToString:@"bg"]) return LanguageType::BULGARIAN;
|
||||
return LanguageType::ENGLISH;
|
||||
}
|
||||
|
||||
float Application::getScreenScale() const
|
||||
{
|
||||
return CAST_VIEW(_view)->getScale();
|
||||
}
|
||||
|
||||
GLint Application::getMainFBO() const
|
||||
{
|
||||
return CAST_VIEW(_view)->getMainFBO();
|
||||
}
|
||||
|
||||
bool Application::openURL(const std::string &url)
|
||||
{
|
||||
NSString* msg = [NSString stringWithCString:url.c_str() encoding:NSUTF8StringEncoding];
|
||||
NSURL* nsUrl = [NSURL URLWithString:msg];
|
||||
return [[NSWorkspace sharedWorkspace] openURL:nsUrl];
|
||||
}
|
||||
|
||||
void Application::copyTextToClipboard(const std::string &text)
|
||||
{
|
||||
NSPasteboard *pasteboard = [NSPasteboard generalPasteboard];
|
||||
[pasteboard clearContents];
|
||||
NSString* tmp = [NSString stringWithCString:text.c_str() encoding:NSUTF8StringEncoding];
|
||||
[pasteboard setString:tmp forType:NSStringPboardType];
|
||||
}
|
||||
|
||||
bool Application::applicationDidFinishLaunching()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
void Application::onPause()
|
||||
{
|
||||
}
|
||||
|
||||
void Application::onResume()
|
||||
{
|
||||
}
|
||||
|
||||
void Application::setMultitouch(bool)
|
||||
{
|
||||
}
|
||||
|
||||
void Application::onCreateView(PixelFormat& pixelformat, DepthFormat& depthFormat, int& multisamplingCount)
|
||||
{
|
||||
pixelformat = PixelFormat::RGBA8;
|
||||
depthFormat = DepthFormat::DEPTH24_STENCIL8;
|
||||
|
||||
multisamplingCount = 0;
|
||||
}
|
||||
|
||||
void Application::createView(const std::string& name, int width, int height)
|
||||
{
|
||||
int multisamplingCount = 0;
|
||||
PixelFormat pixelformat;
|
||||
DepthFormat depthFormat;
|
||||
|
||||
onCreateView(pixelformat,
|
||||
depthFormat,
|
||||
multisamplingCount);
|
||||
|
||||
_view = new GLView(this, name, 0, 0, width, height, pixelformat, depthFormat, multisamplingCount);
|
||||
}
|
||||
|
||||
std::string Application::getSystemVersion()
|
||||
{
|
||||
NSOperatingSystemVersion v = NSProcessInfo.processInfo.operatingSystemVersion;
|
||||
char version[50] = {0};
|
||||
snprintf(version, sizeof(version), "%d.%d.%d", (int)v.majorVersion, (int)v.minorVersion, (int)v.patchVersion);
|
||||
return version;
|
||||
}
|
||||
|
||||
NS_CC_END
|
128
cocos2d-x/cocos/platform/mac/CCDevice-mac.mm
Normal file
128
cocos2d-x/cocos/platform/mac/CCDevice-mac.mm
Normal file
@@ -0,0 +1,128 @@
|
||||
/****************************************************************************
|
||||
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.
|
||||
****************************************************************************/
|
||||
|
||||
#include "platform/CCPlatformConfig.h"
|
||||
#if CC_TARGET_PLATFORM == CC_PLATFORM_MAC
|
||||
|
||||
#include "platform/CCDevice.h"
|
||||
#include "platform/apple/CCDevice-apple.h"
|
||||
#include "base/ccTypes.h"
|
||||
#include "CCReachability.h"
|
||||
|
||||
#include <Foundation/Foundation.h>
|
||||
#include <Cocoa/Cocoa.h>
|
||||
#include <sys/utsname.h>
|
||||
#include <string>
|
||||
|
||||
NS_CC_BEGIN
|
||||
|
||||
int Device::getDPI()
|
||||
{
|
||||
NSScreen *screen = [NSScreen mainScreen];
|
||||
NSDictionary *description = [screen deviceDescription];
|
||||
NSSize displayPixelSize = [[description objectForKey:NSDeviceSize] sizeValue];
|
||||
CGSize displayPhysicalSize = CGDisplayScreenSize([[description objectForKey:@"NSScreenNumber"] unsignedIntValue]);
|
||||
|
||||
return ((displayPixelSize.width / displayPhysicalSize.width) * 25.4f);
|
||||
}
|
||||
|
||||
void Device::setAccelerometerEnabled(bool isEnabled)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void Device::setAccelerometerInterval(float interval)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
const Device::MotionValue& Device::getDeviceMotionValue()
|
||||
{
|
||||
static MotionValue __motionValue;
|
||||
return __motionValue;
|
||||
}
|
||||
|
||||
Device::Rotation Device::getDeviceRotation()
|
||||
{
|
||||
return Device::Rotation::_0;
|
||||
}
|
||||
|
||||
std::string Device::getDeviceModel()
|
||||
{
|
||||
struct utsname systemInfo;
|
||||
uname(&systemInfo);
|
||||
return systemInfo.machine;
|
||||
}
|
||||
|
||||
void Device::setKeepScreenOn(bool value)
|
||||
{
|
||||
CC_UNUSED_PARAM(value);
|
||||
}
|
||||
|
||||
void Device::vibrate(float duration)
|
||||
{
|
||||
CC_UNUSED_PARAM(duration);
|
||||
}
|
||||
|
||||
float Device::getBatteryLevel()
|
||||
{
|
||||
return 1.0f;
|
||||
}
|
||||
|
||||
Device::NetworkType Device::getNetworkType()
|
||||
{
|
||||
static Reachability* __reachability = nullptr;
|
||||
if (__reachability == nullptr)
|
||||
{
|
||||
__reachability = Reachability::createForInternetConnection();
|
||||
__reachability->retain();
|
||||
}
|
||||
|
||||
NetworkType ret = NetworkType::NONE;
|
||||
Reachability::NetworkStatus status = __reachability->getCurrentReachabilityStatus();
|
||||
switch (status) {
|
||||
case Reachability::NetworkStatus::REACHABLE_VIA_WIFI:
|
||||
ret = NetworkType::LAN;
|
||||
break;
|
||||
case Reachability::NetworkStatus::REACHABLE_VIA_WWAN:
|
||||
ret = NetworkType::WWAN;
|
||||
default:
|
||||
ret = NetworkType::NONE;
|
||||
break;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
cocos2d::Vec4 Device::getSafeAreaEdge()
|
||||
{
|
||||
// no SafeArea concept on mac, return ZERO Vec4.
|
||||
return cocos2d::Vec4();
|
||||
}
|
||||
|
||||
NS_CC_END
|
||||
|
||||
#endif // CC_TARGET_PLATFORM == CC_PLATFORM_MAC
|
51
cocos2d-x/cocos/platform/mac/CCGL-mac.h
Normal file
51
cocos2d-x/cocos/platform/mac/CCGL-mac.h
Normal file
@@ -0,0 +1,51 @@
|
||||
/****************************************************************************
|
||||
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)
|
||||
|
||||
|
||||
#endif // __PLATFORM_MAC_CCGL_H__
|
||||
|
||||
#endif //s CC_TARGET_PLATFORM == CC_PLATFORM_MAC
|
||||
|
@@ -0,0 +1,6 @@
|
||||
// Configuration settings file format documentation can be found at:
|
||||
// https://help.apple.com/xcode/#/dev745c5c974
|
||||
// Module setting for engine
|
||||
|
||||
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) USE_SOCKET=1 USE_DRAGONBONES=1 USE_SPINE=1 USE_AUDIO=1 USE_EDIT_BOX=1 USE_WEB_VIEW=1 USE_VIDEO=1
|
||||
|
@@ -0,0 +1,6 @@
|
||||
// Configuration settings file format documentation can be found at:
|
||||
// https://help.apple.com/xcode/#/dev745c5c974
|
||||
// Module setting for engine
|
||||
|
||||
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) USE_SOCKET=1 USE_DRAGONBONES=1 USE_SPINE=1 USE_AUDIO=1 USE_EDIT_BOX=1 USE_WEB_VIEW=1 USE_VIDEO=1
|
||||
|
61
cocos2d-x/cocos/platform/mac/CCPlatformDefine-mac.h
Normal file
61
cocos2d-x/cocos/platform/mac/CCPlatformDefine-mac.h
Normal file
@@ -0,0 +1,61 @@
|
||||
/****************************************************************************
|
||||
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 __CCPLATFORMDEFINE_H__
|
||||
#define __CCPLATFORMDEFINE_H__
|
||||
|
||||
#include "platform/CCPlatformConfig.h"
|
||||
#if CC_TARGET_PLATFORM == CC_PLATFORM_MAC
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
#ifdef _USRDLL
|
||||
#define CC_DLL __attribute__ ((visibility("default")))
|
||||
#else
|
||||
#define CC_DLL
|
||||
#endif
|
||||
|
||||
#if CC_DISABLE_ASSERT > 0
|
||||
#define CC_ASSERT(cond)
|
||||
#else
|
||||
#define CC_ASSERT(cond) assert(cond)
|
||||
#endif
|
||||
|
||||
#define CC_UNUSED_PARAM(unusedparam) (void)unusedparam
|
||||
|
||||
/* Define NULL pointer value */
|
||||
#ifndef NULL
|
||||
#ifdef __cplusplus
|
||||
#define NULL 0
|
||||
#else
|
||||
#define NULL ((void *)0)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif // CC_TARGET_PLATFORM == CC_PLATFORM_MAC
|
||||
|
||||
#endif /* __CCPLATFORMDEFINE_H__*/
|
||||
|
39
cocos2d-x/cocos/platform/mac/cocos2d-prefix.pch
Normal file
39
cocos2d-x/cocos/platform/mac/cocos2d-prefix.pch
Normal file
@@ -0,0 +1,39 @@
|
||||
//
|
||||
// Prefix header for all source files of the 'cocos2dx' target in the 'cocos2dx' project
|
||||
//
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <limits.h>
|
||||
#include <float.h>
|
||||
#include <math.h>
|
||||
#include <stdio.h>
|
||||
#include <time.h>
|
||||
#include <stdint.h>
|
||||
#include <assert.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/select.h>
|
||||
#import <OpenGL/gl.h>
|
||||
#import <OpenGL/glu.h>
|
||||
#import <OpenGL/glext.h>
|
||||
|
||||
#ifdef __OBJC__
|
||||
#import <Cocoa/Cocoa.h>
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
#include <vector>
|
||||
#include <string>
|
||||
#include <map>
|
||||
#include <list>
|
||||
#include <memory>
|
||||
#include <functional>
|
||||
#include <thread>
|
||||
#include <mutex>
|
||||
#include <unordered_map>
|
||||
#include <list>
|
||||
#include <algorithm>
|
||||
#include <cstdint>
|
||||
#include <stack>
|
||||
#endif
|
Reference in New Issue
Block a user