初始化

This commit is contained in:
SmallMain
2022-06-25 00:23:03 +08:00
commit ef0589e8e5
2264 changed files with 617829 additions and 0 deletions

View File

@@ -0,0 +1,4 @@
{
"has_native": true,
"project_type": "lua"
}

View File

@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>Simulator</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
</buildSpec>
<natures>
<nature>org.ccdt.cocosproject</nature>
<nature>org.eclipse.koneki.ldt.nature</nature>
</natures>
</projectDescription>

View File

@@ -0,0 +1,96 @@
{
"init_cfg":{
"isLandscape": true,
"isWindowTop": false,
"waitForConnect": false,
"name": "Simulator",
"width": 960,
"height": 640,
"entry": "main.js",
"consolePort": 6050,
"uploadPort": 6060,
"debugPort": 5086
},
"simulator_screen_size": [
{
"title": "Apple iPhone 5 (640x1136)",
"width": 640,
"height": 1136
},
{
"title": "Apple iPhone 6 (750x1334)",
"width": 750,
"height": 1334
},
{
"title": "Apple iPhone 6Plus (1080x1920)",
"width": 1080,
"height": 1920
},
{
"title": "Apple iPhone 7 (750x1334)",
"width": 750,
"height": 1334
},
{
"title": "Apple iPhone 7Plus (1080x1920)",
"width": 1080,
"height": 1920
},
{
"title": "Apple iPhone X (1125x2436)",
"width": 1125,
"height": 2436
},
{
"title": "Apple iPad (2048x1536)",
"width": 2048,
"height": 1536
},
{
"title": "Apple iPad Air 2 (1536x2048)",
"width": 1536,
"height": 2048
},
{
"title": "Apple iPad Pro 10.5-inch (1668x2224)",
"width": 1668,
"height": 2224
},
{
"title": "Apple iPad Pro 12.9-inch (2048x2732)",
"width": 2048,
"height": 2732
},
{
"title": "Huawei P9 (1080x1920)",
"width": 1080,
"height": 1920
},
{
"title": "Huawei Mate9 Pro (1440x2560)",
"width": 1440,
"height": 2560
},
{
"title": "Google Nexus 5 (1080x2880)",
"width": 1080,
"height": 2880
},
{
"title": "Google Nexus 5X (1079x1919)",
"width": 1079,
"height": 1919
},
{
"title": "Google Nexus 6 (1442x2562)",
"width": 1442,
"height": 2562
},
{
"title": "Google Nexus 7 (1920x1200)",
"width": 1920,
"height": 1200
}
]
}

View File

@@ -0,0 +1,73 @@
/****************************************************************************
Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd.
http://www.cocos.com
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated engine source code (the "Software"), a limited,
worldwide, royalty-free, non-assignable, revocable and non-exclusive license
to use Cocos Creator solely to develop games on your target platforms. You shall
not use Cocos Creator software for developing other software or tools that's
used for developing games. You are not granted to publish, distribute,
sublicense, and/or sell copies of Cocos Creator.
The software or tools in this License Agreement are licensed, not sold.
Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
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 "AppDelegate.h"
#include "cocos2d.h"
#include "cocos/scripting/js-bindings/event/EventDispatcher.h"
#include "ide-support/CodeIDESupport.h"
#include "runtime/Runtime.h"
#include "ide-support/RuntimeJsImpl.h"
USING_NS_CC;
using namespace std;
AppDelegate::AppDelegate(const std::string& name, int width, int height) : Application(name, width, height)
{
}
AppDelegate::~AppDelegate()
{
// NOTE:Please don't remove this call if you want to debug with Cocos Code IDE
RuntimeEngine::getInstance()->end();
}
bool AppDelegate::applicationDidFinishLaunching()
{
// set default FPS
Application::getInstance()->setPreferredFramesPerSecond(60);
auto runtimeEngine = RuntimeEngine::getInstance();
runtimeEngine->setEventTrackingEnable(true);
auto jsRuntime = RuntimeJsImpl::create();
runtimeEngine->addRuntime(jsRuntime, kRuntimeEngineJs);
runtimeEngine->start();
// Runtime end
cocos2d::log("iShow!");
return true;
}
// This function will be called when the app is inactive. When comes a phone call,it's be invoked too
void AppDelegate::onPause()
{
EventDispatcher::dispatchOnPauseEvent();
}
// this function will be called when the app is active again
void AppDelegate::onResume()
{
EventDispatcher::dispatchOnResumeEvent();
}

View File

@@ -0,0 +1,57 @@
/****************************************************************************
Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd.
http://www.cocos.com
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated engine source code (the "Software"), a limited,
worldwide, royalty-free, non-assignable, revocable and non-exclusive license
to use Cocos Creator solely to develop games on your target platforms. You shall
not use Cocos Creator software for developing other software or tools that's
used for developing games. You are not granted to publish, distribute,
sublicense, and/or sell copies of Cocos Creator.
The software or tools in this License Agreement are licensed, not sold.
Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
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.
****************************************************************************/
#pragma once
#include "platform/CCApplication.h"
/**
@brief The cocos2d Application.
The reason for implement as private inheritance is to hide some interface call by Director.
*/
class AppDelegate : public cocos2d::Application
{
public:
AppDelegate(const std::string& name, int width, int height);
virtual ~AppDelegate();
/**
@brief Implement Director and Scene init code here.
@return true Initialize success, app continue.
@return false Initialize failed, app terminate.
*/
virtual bool applicationDidFinishLaunching() override;
/**
@brief The function be called when the application is paused
*/
virtual void onPause() override;
/**
@brief The function be called when the application is resumed
*/
virtual void onResume() override;
};

View File

@@ -0,0 +1,32 @@
/****************************************************************************
Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd.
http://www.cocos.com
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated engine source code (the "Software"), a limited,
worldwide, royalty-free, non-assignable, revocable and non-exclusive license
to use Cocos Creator solely to develop games on your target platforms. You shall
not use Cocos Creator software for developing other software or tools that's
used for developing games. You are not granted to publish, distribute,
sublicense, and/or sell copies of Cocos Creator.
The software or tools in this License Agreement are licensed, not sold.
Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
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 __CODE_IDE_SUPPORT_H__
#define __CODE_IDE_SUPPORT_H__
// define 1 to open Cocos Code IDE support, 0 to disable
#define CC_CODE_IDE_DEBUG_SUPPORT 1
#endif /* __CODE_IDE_SUPPORT_H__ */

View File

@@ -0,0 +1,285 @@
/****************************************************************************
Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd.
http://www.cocos.com
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated engine source code (the "Software"), a limited,
worldwide, royalty-free, non-assignable, revocable and non-exclusive license
to use Cocos Creator solely to develop games on your target platforms. You shall
not use Cocos Creator software for developing other software or tools that's
used for developing games. You are not granted to publish, distribute,
sublicense, and/or sell copies of Cocos Creator.
The software or tools in this License Agreement are licensed, not sold.
Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
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.
****************************************************************************/
//
// RuntimeJsImpl.cpp
// Simulator
//
//
#include "RuntimeJsImpl.h"
#if (CC_CODE_IDE_DEBUG_SUPPORT > 0)
#include "runtime/ConfigParser.h" // config
#include "runtime/Runtime.h"
#include "runtime/FileServer.h"
#include "runtime/ConfigParser.h"
// js
#include "cocos/scripting/js-bindings/jswrapper/SeApi.h"
#include "cocos/scripting/js-bindings/auto/jsb_cocos2dx_auto.hpp"
#include "cocos/scripting/js-bindings/manual/jsb_classtype.hpp"
#include "cocos/scripting/js-bindings/manual/jsb_conversions.cpp"
#include "cocos/scripting/js-bindings/manual/jsb_module_register.hpp"
#include "cocos/scripting/js-bindings/manual/jsb_global.h"
static bool reloadScript(const string& file)
{
CCLOG("------------------------------------------------");
CCLOG("RELOAD Js FILE: %s", file.c_str());
CCLOG("------------------------------------------------");
se::ScriptEngine::getInstance()->cleanup();
string modulefile = file;
if (modulefile.empty())
{
modulefile = ConfigParser::getInstance()->getEntryFile().c_str();
}
return jsb_run_script(modulefile.c_str());
}
static bool runtime_FileUtils_addSearchPath(se::State& s)
{
const auto& args = s.args();
int argc = (int)args.size();
bool ok = true;
cocos2d::FileUtils* cobj = (cocos2d::FileUtils *)s.nativeThisObject();
if (argc == 1 || argc == 2) {
std::string arg0;
bool arg1 = false;
ok &= seval_to_std_string(args[0], &arg0);
SE_PRECONDITION2(ok, false, "Error processing arguments");
if (argc == 2)
{
arg1 = args[1].isBoolean() ? args[1].toBoolean() : false;
}
if (! cocos2d::FileUtils::getInstance()->isAbsolutePath(arg0))
{
// add write path to search path
if (FileServer::getShareInstance()->getIsUsingWritePath())
{
cobj->addSearchPath(FileServer::getShareInstance()->getWritePath() + arg0, arg1);
} else
{
cobj->addSearchPath(arg0, arg1);
}
#if(CC_TARGET_PLATFORM == CC_PLATFORM_MAC || CC_TARGET_PLATFORM == CC_PLATFORM_WIN32)
// add project path to search path
cobj->addSearchPath(RuntimeEngine::getInstance()->getRuntime()->getProjectPath() + arg0, arg1);
#endif
}
return true;
}
SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", argc, 1);
return false;
}
SE_BIND_FUNC(runtime_FileUtils_addSearchPath)
static bool runtime_FileUtils_setSearchPaths(se::State& s)
{
const auto& args = s.args();
int argc = (int)args.size();
bool ok = true;
cocos2d::FileUtils* cobj = (cocos2d::FileUtils *)s.nativeThisObject();
if (argc == 1) {
std::vector<std::string> vecPaths, writePaths;
ok &= seval_to_std_vector_string(args[0], &vecPaths);
SE_PRECONDITION2(ok, false, "Error processing arguments");
std::vector<std::string> originPath; // for IOS platform.
std::vector<std::string> projPath; // for Desktop platform.
for (int i = 0; i < vecPaths.size(); i++)
{
if (!cocos2d::FileUtils::getInstance()->isAbsolutePath(vecPaths[i]))
{
originPath.push_back(vecPaths[i]); // for IOS platform.
projPath.push_back(RuntimeEngine::getInstance()->getRuntime()->getProjectPath()+vecPaths[i]); //for Desktop platform.
writePaths.push_back(FileServer::getShareInstance()->getWritePath() + vecPaths[i]);
}
}
#if(CC_TARGET_PLATFORM == CC_PLATFORM_MAC || CC_TARGET_PLATFORM == CC_PLATFORM_WIN32)
vecPaths.insert(vecPaths.end(), projPath.begin(), projPath.end());
#endif
if (FileServer::getShareInstance()->getIsUsingWritePath())
{
vecPaths.insert(vecPaths.end(), writePaths.begin(), writePaths.end());
} else
{
vecPaths.insert(vecPaths.end(), originPath.begin(), originPath.end());
}
cobj->setSearchPaths(vecPaths);
return true;
}
SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", argc, 1);
return false;
}
SE_BIND_FUNC(runtime_FileUtils_setSearchPaths)
static bool register_FileUtils(se::Object* obj)
{
__jsb_cocos2d_FileUtils_proto->defineFunction("addSearchPath", _SE(runtime_FileUtils_addSearchPath));
__jsb_cocos2d_FileUtils_proto->defineFunction("setSearchPaths", _SE(runtime_FileUtils_setSearchPaths));
return true;
}
RuntimeJsImpl* RuntimeJsImpl::create()
{
RuntimeJsImpl *instance = new RuntimeJsImpl();
return instance;
}
bool RuntimeJsImpl::initJsEnv()
{
if (se::ScriptEngine::getInstance()->isValid())
{
return true;
}
auto se = se::ScriptEngine::getInstance();
jsb_set_xxtea_key("");
jsb_init_file_operation_delegate();
#if defined(COCOS2D_DEBUG) && (COCOS2D_DEBUG > 0)
// Enable debugger here
auto parser = ConfigParser::getInstance();
jsb_enable_debugger("0.0.0.0", parser->getDebugPort(), parser->isWaitForConnect());
#endif
se->setExceptionCallback([](const char* location, const char* message, const char* stack){
// Send exception information to server like Tencent Bugly.
});
jsb_register_all_modules();
se->addRegisterCallback(register_FileUtils);
se->start();
return true;
}
bool RuntimeJsImpl::startWithDebugger()
{
initJsEnv();
return true;
}
void RuntimeJsImpl::startScript(const std::string& path)
{
loadScriptFile(path);
}
void RuntimeJsImpl::onStartDebuger(const rapidjson::Document& dArgParse, rapidjson::Document& dReplyParse)
{
if (loadScriptFile(ConfigParser::getInstance()->getEntryFile()))
{
dReplyParse.AddMember("code",0,dReplyParse.GetAllocator());
}
else
{
dReplyParse.AddMember("code",1,dReplyParse.GetAllocator());
}
}
void RuntimeJsImpl::onClearCompile(const rapidjson::Document& dArgParse, rapidjson::Document& dReplyParse)
{
}
void RuntimeJsImpl::onPrecompile(const rapidjson::Document& dArgParse, rapidjson::Document& dReplyParse)
{
}
void RuntimeJsImpl::onReload(const rapidjson::Document &dArgParse, rapidjson::Document &dReplyParse)
{
if (dArgParse.HasMember("modulefiles")){
auto& allocator = dReplyParse.GetAllocator();
rapidjson::Value bodyvalue(rapidjson::kObjectType);
const rapidjson::Value& objectfiles = dArgParse["modulefiles"];
for (rapidjson::SizeType i = 0; i < objectfiles.Size(); i++){
if (!reloadScript(objectfiles[i].GetString())) {
bodyvalue.AddMember(rapidjson::Value(objectfiles[i].GetString(), allocator)
, rapidjson::Value(1)
, allocator);
}
}
if (0 == objectfiles.Size())
{
reloadScript("");
}
dReplyParse.AddMember("body", bodyvalue, dReplyParse.GetAllocator());
}else
{
reloadScript("");
}
dReplyParse.AddMember("code", 0, dReplyParse.GetAllocator());
}
void RuntimeJsImpl::onRemove(const std::string &filename)
{
}
void RuntimeJsImpl::end()
{
se::ScriptEngine::getInstance()->destroyInstance();
RuntimeProtocol::end();
}
// private
RuntimeJsImpl::RuntimeJsImpl()
{
}
bool RuntimeJsImpl::loadScriptFile(const std::string& path)
{
std::string filepath = path;
if (filepath.empty())
{
filepath = ConfigParser::getInstance()->getEntryFile();
}
CCLOG("------------------------------------------------");
CCLOG("LOAD Js FILE: %s", filepath.c_str());
CCLOG("------------------------------------------------");
initJsEnv();
this->startWithDebugger();
return jsb_run_script(filepath);
}
#endif // (COCOS2D_DEBUG > 0) && (CC_CODE_IDE_DEBUG_SUPPORT > 0)

View File

@@ -0,0 +1,62 @@
/****************************************************************************
Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd.
http://www.cocos.com
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated engine source code (the "Software"), a limited,
worldwide, royalty-free, non-assignable, revocable and non-exclusive license
to use Cocos Creator solely to develop games on your target platforms. You shall
not use Cocos Creator software for developing other software or tools that's
used for developing games. You are not granted to publish, distribute,
sublicense, and/or sell copies of Cocos Creator.
The software or tools in this License Agreement are licensed, not sold.
Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
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.
****************************************************************************/
//
// RuntimeJsImpl.h
// Simulator
//
//
#ifndef __Simulator__RuntimeJsImpl__
#define __Simulator__RuntimeJsImpl__
#include "ide-support/CodeIDESupport.h"
#if (CC_CODE_IDE_DEBUG_SUPPORT > 0)
#include "runtime/RuntimeProtocol.h"
class RuntimeJsImpl : public RuntimeProtocol
{
public:
static RuntimeJsImpl* create();
void startScript(const std::string& file);
void onStartDebuger(const rapidjson::Document& dArgParse, rapidjson::Document& dReplyParse);
void onClearCompile(const rapidjson::Document& dArgParse, rapidjson::Document& dReplyParse);
void onPrecompile(const rapidjson::Document& dArgParse, rapidjson::Document& dReplyParse);
void onReload(const rapidjson::Document& dArgParse, rapidjson::Document& dReplyParse);
void onRemove(const std::string &filename);
void end();
bool startWithDebugger();
private:
RuntimeJsImpl();
bool initJsEnv();
bool loadScriptFile(const std::string& file);
};
#endif // (COCOS2D_DEBUG > 0) && (CC_CODE_IDE_DEBUG_SUPPORT > 0)
#endif /* defined(__Simulator__RuntimeLua__) */

View File

@@ -0,0 +1,32 @@
{
"zh-CN": {
"View": "视图(&V)",
"Exit": "退出(&X)",
"File": "文件(&F)",
"Portrait": "竖屏",
"Landscape": "横屏",
"Refresh": "刷新(重启)",
"Zoom Out": "缩放",
"Simulator": "模拟器",
"Open File": "打开文件",
"Open Project": "打开工程",
"Error": "错误",
"Help": "帮助(&H)",
"About": "关于(&A)",
"Show FPS": "显示FPS",
"Hide FPS": "隐藏FPS"
},
"zh-Hans": {
"View": "视图",
"Exit": "退出",
"File": "文件",
"Portrait": "竖屏",
"Landscape": "横屏",
"Refresh": "刷新(重启)",
"Zoom Out": "缩放",
"Simulator": "模拟器",
"Help": "帮助(&H)",
"About": "关于(&A)"
}
}

View File

@@ -0,0 +1,37 @@
/****************************************************************************
Copyright (c) 2010-2013 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.
****************************************************************************/
#import <UIKit/UIKit.h>
@class RootViewController;
@interface AppController : NSObject <UIApplicationDelegate>
{
}
@property(nonatomic, readonly) RootViewController* viewController;
@end

View File

@@ -0,0 +1,145 @@
/****************************************************************************
Copyright (c) 2010-2013 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.
****************************************************************************/
#import "AppController.h"
#import "cocos2d.h"
#import "AppDelegate.h"
#import "RootViewController.h"
#import "platform/ios/CCEAGLView-ios.h"
@implementation AppController
using namespace cocos2d;
Application* app = nullptr;
@synthesize window;
#pragma mark -
#pragma mark Application lifecycle
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
// Add the view controller's view to the window and display.
float scale = [[UIScreen mainScreen] scale];
CGRect bounds = [[UIScreen mainScreen] bounds];
window = [[UIWindow alloc] initWithFrame: bounds];
// cocos2d application instance
app = new AppDelegate("Cocos Simulator",bounds.size.width * scale, bounds.size.height * scale);
app->setMultitouch(true);
// Use RootViewController to manage CCEAGLView
_viewController = [[RootViewController alloc]init];
_viewController.wantsFullScreenLayout = YES;
// Set RootViewController to window
if ( [[UIDevice currentDevice].systemVersion floatValue] < 6.0)
{
// warning: addSubView doesn't work on iOS6
[window addSubview: _viewController.view];
}
else
{
// use this method on ios6
[window setRootViewController:_viewController];
}
[window makeKeyAndVisible];
[[UIApplication sharedApplication] setStatusBarHidden: YES];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(statusBarOrientationChanged:)
name:UIApplicationDidChangeStatusBarOrientationNotification object:nil];
app->start();
return YES;
}
- (void)statusBarOrientationChanged:(NSNotification *)notification {
CGRect bounds = [UIScreen mainScreen].bounds;
float scale = [[UIScreen mainScreen] scale];
float width = bounds.size.width * scale;
float height = bounds.size.height * scale;
Application::getInstance()->updateViewSize(width, height);
}
- (void)applicationWillResignActive:(UIApplication *)application {
/*
Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
*/
}
- (void)applicationDidBecomeActive:(UIApplication *)application {
/*
Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
*/
}
- (void)applicationDidEnterBackground:(UIApplication *)application {
/*
Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
If your application supports background execution, called instead of applicationWillTerminate: when the user quits.
*/
cocos2d::Application::getInstance()->applicationDidEnterBackground();
}
- (void)applicationWillEnterForeground:(UIApplication *)application {
/*
Called as part of transition from the background to the inactive state: here you can undo many of the changes made on entering the background.
*/
cocos2d::Application::getInstance()->applicationWillEnterForeground();
}
- (void)applicationWillTerminate:(UIApplication *)application {
/*
Called when the application is about to terminate.
See also applicationDidEnterBackground:.
*/
}
#pragma mark -
#pragma mark Memory management
- (void)applicationDidReceiveMemoryWarning:(UIApplication *)application {
/*
Free up as much memory as possible by purging cached data objects that can be recreated (or reloaded from disk) later.
*/
}
- (void)dealloc {
[window release];
[_viewController release];
[super dealloc];
}
@end

Binary file not shown.

After

Width:  |  Height:  |  Size: 189 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 747 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 574 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 87 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 567 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

View File

@@ -0,0 +1,157 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleDisplayName</key>
<string>${PRODUCT_NAME}</string>
<key>CFBundleExecutable</key>
<string>${EXECUTABLE_NAME}</string>
<key>CFBundleIconFile</key>
<string></string>
<key>CFBundleIconFiles</key>
<array>
<string>Icon-80</string>
<string>Icon-58</string>
<string>Icon-29</string>
<string>Icon-120</string>
<string>Icon-57.png</string>
<string>Icon-114.png</string>
<string>Icon-72.png</string>
<string>Icon-144.png</string>
</array>
<key>CFBundleIconFiles~ipad</key>
<array>
<string>Icon-58</string>
<string>Icon-29</string>
<string>Icon-80</string>
<string>Icon-40</string>
<string>Icon-100</string>
<string>Icon-50</string>
<string>Icon-152</string>
<string>Icon-76</string>
<string>Icon-120</string>
<string>Icon-57.png</string>
<string>Icon-114.png</string>
<string>Icon-72.png</string>
<string>Icon-144.png</string>
</array>
<key>CFBundleIdentifier</key>
<string>com.cocos.apps.simulator</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>simulator</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>3.5rc0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>20150314</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>UILaunchImages</key>
<array>
<dict>
<key>UILaunchImageMinimumOSVersion</key>
<string>8.0</string>
<key>UILaunchImageName</key>
<string>Default</string>
<key>UILaunchImageOrientation</key>
<string>Portrait</string>
<key>UILaunchImageSize</key>
<string>{320, 480}</string>
</dict>
<dict>
<key>UILaunchImageMinimumOSVersion</key>
<string>8.0</string>
<key>UILaunchImageName</key>
<string>Default</string>
<key>UILaunchImageOrientation</key>
<string>Landscape</string>
<key>UILaunchImageSize</key>
<string>{320, 480}</string>
</dict>
<dict>
<key>UILaunchImageMinimumOSVersion</key>
<string>8.0</string>
<key>UILaunchImageName</key>
<string>Default-568h</string>
<key>UILaunchImageOrientation</key>
<string>Portrait</string>
<key>UILaunchImageSize</key>
<string>{320, 568}</string>
</dict>
<dict>
<key>UILaunchImageMinimumOSVersion</key>
<string>8.0</string>
<key>UILaunchImageName</key>
<string>Default-568h</string>
<key>UILaunchImageOrientation</key>
<string>Landscape</string>
<key>UILaunchImageSize</key>
<string>{320, 568}</string>
</dict>
<dict>
<key>UILaunchImageMinimumOSVersion</key>
<string>8.0</string>
<key>UILaunchImageName</key>
<string>Default-667h</string>
<key>UILaunchImageOrientation</key>
<string>Portrait</string>
<key>UILaunchImageSize</key>
<string>{375, 667}</string>
</dict>
<dict>
<key>UILaunchImageMinimumOSVersion</key>
<string>8.0</string>
<key>UILaunchImageName</key>
<string>Default-667h</string>
<key>UILaunchImageOrientation</key>
<string>Landscape</string>
<key>UILaunchImageSize</key>
<string>{375, 667}</string>
</dict>
<dict>
<key>UILaunchImageMinimumOSVersion</key>
<string>8.0</string>
<key>UILaunchImageName</key>
<string>Default-736h</string>
<key>UILaunchImageOrientation</key>
<string>Portrait</string>
<key>UILaunchImageSize</key>
<string>{414, 736}</string>
</dict>
<dict>
<key>UILaunchImageMinimumOSVersion</key>
<string>8.0</string>
<key>UILaunchImageName</key>
<string>Default-736h</string>
<key>UILaunchImageOrientation</key>
<string>Landscape</string>
<key>UILaunchImageSize</key>
<string>{414, 736}</string>
</dict>
</array>
<key>UIPrerenderedIcon</key>
<true/>
<key>UIRequiredDeviceCapabilities</key>
<dict>
<key>accelerometer</key>
<true/>
<key>opengles-1</key>
<true/>
</dict>
<key>UIStatusBarHidden</key>
<true/>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
</dict>
</plist>

View File

@@ -0,0 +1,8 @@
//
// Prefix header for all source files of the 'simulator' target in the 'simulator' project
//
#ifdef __OBJC__
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
#endif

View File

@@ -0,0 +1,35 @@
/****************************************************************************
Copyright (c) 2010-2011 cocos2d-x.org
Copyright (c) 2010 Ricardo Quesada
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.
****************************************************************************/
#import <UIKit/UIKit.h>
@interface RootViewController : UIViewController {
}
- (BOOL)prefersStatusBarHidden;
@end

View File

@@ -0,0 +1,119 @@
/****************************************************************************
Copyright (c) 2010-2011 cocos2d-x.org
Copyright (c) 2010 Ricardo Quesada
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.
****************************************************************************/
#import "RootViewController.h"
#import "cocos2d.h"
#include "platform/CCApplication.h"
#include "platform/ios/CCEAGLView-ios.h"
#include "runtime/ConfigParser.h"
@implementation RootViewController
/*
// The designated initializer. Override if you create the controller programmatically and want to perform customization that is not appropriate for viewDidLoad.
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
if ((self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil])) {
// Custom initialization
}
return self;
}
*/
// Implement loadView to create a view hierarchy programmatically, without using a nib.
- (void)loadView {
// Set EAGLView as view of RootViewController
self.view = (__bridge CCEAGLView *)cocos2d::Application::getInstance()->getView();
}
/*
// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
- (void)viewDidLoad {
[super viewDidLoad];
}
*/
// Override to allow orientations other than the default portrait orientation.
// This method is deprecated on ios6
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
if (ConfigParser::getInstance()->isLanscape()) {
return UIInterfaceOrientationIsLandscape( interfaceOrientation );
}else{
return UIInterfaceOrientationIsPortrait( interfaceOrientation );
}
}
// For ios6, use supportedInterfaceOrientations & shouldAutorotate instead
- (NSUInteger) supportedInterfaceOrientations{
#ifdef __IPHONE_6_0
if (ConfigParser::getInstance()->isLanscape()) {
return UIInterfaceOrientationMaskLandscape;
}else{
return UIInterfaceOrientationMaskPortraitUpsideDown;
}
#endif
}
- (BOOL) shouldAutorotate {
if (ConfigParser::getInstance()->isLanscape()) {
return YES;
}else{
return NO;
}
}
//fix not hide status on ios7
- (BOOL)prefersStatusBarHidden
{
return YES;
}
// Controls the application's preferred home indicator auto-hiding when this view controller is shown.
- (BOOL)prefersHomeIndicatorAutoHidden {
return YES;
}
- (void)didReceiveMemoryWarning {
// Releases the view if it doesn't have a superview.
[super didReceiveMemoryWarning];
// Release any cached data, images, etc that aren't in use.
}
- (void)viewDidUnload {
[super viewDidUnload];
// Release any retained subviews of the main view.
// e.g. self.myOutlet = nil;
}
- (void)dealloc {
[super dealloc];
}
@end

View File

@@ -0,0 +1,6 @@
{
"remove_res" : [
"src",
"res"
]
}

View File

@@ -0,0 +1,16 @@
//
// main.m
// simulator
//
// Copyright __MyCompanyName__ 2011. All rights reserved.
//
#import <UIKit/UIKit.h>
int main(int argc, char *argv[]) {
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
int retVal = UIApplicationMain(argc, argv, nil, @"AppController");
[pool release];
return retVal;
}

View File

@@ -0,0 +1,110 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="6254" systemVersion="14B25" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
<dependencies>
<deployment identifier="macosx"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="6254"/>
</dependencies>
<objects>
<customObject id="-2" userLabel="File's Owner" customClass="ConsoleWindowController">
<connections>
<outlet property="checkScroll" destination="50" id="70"/>
<outlet property="textView" destination="6" id="20"/>
<outlet property="topCheckBox" destination="60" id="69"/>
<outlet property="window" destination="1" id="3"/>
</connections>
</customObject>
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
<customObject id="-3" userLabel="Application" customClass="NSObject"/>
<window title="Console" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" oneShot="NO" animationBehavior="default" id="1">
<windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES" resizable="YES"/>
<windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/>
<rect key="contentRect" x="40" y="40" width="854" height="400"/>
<rect key="screenRect" x="0.0" y="0.0" width="2560" height="1417"/>
<view key="contentView" id="2">
<rect key="frame" x="0.0" y="0.0" width="854" height="400"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<scrollView horizontalLineScroll="10" horizontalPageScroll="10" verticalLineScroll="10" verticalPageScroll="10" hasHorizontalScroller="NO" usesPredominantAxisScrolling="NO" translatesAutoresizingMaskIntoConstraints="NO" id="5">
<rect key="frame" x="-1" y="-1" width="854" height="371"/>
<clipView key="contentView" id="ddW-qo-Qe9">
<rect key="frame" x="1" y="1" width="837" height="369"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<textView editable="NO" importsGraphics="NO" richText="NO" findStyle="panel" verticallyResizable="YES" allowsNonContiguousLayout="YES" id="6">
<rect key="frame" x="0.0" y="0.0" width="837" height="369"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<size key="minSize" width="837" height="369"/>
<size key="maxSize" width="888" height="10000000"/>
<color key="insertionPointColor" white="0.0" alpha="1" colorSpace="calibratedWhite"/>
<size key="minSize" width="837" height="369"/>
<size key="maxSize" width="888" height="10000000"/>
</textView>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
</clipView>
<scroller key="horizontalScroller" hidden="YES" verticalHuggingPriority="750" doubleValue="1" horizontal="YES" id="7">
<rect key="frame" x="-100" y="-100" width="87" height="18"/>
<autoresizingMask key="autoresizingMask"/>
</scroller>
<scroller key="verticalScroller" verticalHuggingPriority="750" doubleValue="1" horizontal="NO" id="8">
<rect key="frame" x="838" y="1" width="15" height="369"/>
<autoresizingMask key="autoresizingMask"/>
</scroller>
</scrollView>
<button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="46">
<rect key="frame" x="-1" y="367" width="73" height="32"/>
<buttonCell key="cell" type="push" title="Clear" bezelStyle="rounded" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="47">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="system"/>
</buttonCell>
<connections>
<action selector="onClear:" target="-2" id="57"/>
</connections>
</button>
<button translatesAutoresizingMaskIntoConstraints="NO" id="50">
<rect key="frame" x="731" y="376" width="113" height="18"/>
<constraints>
<constraint firstAttribute="width" constant="109" id="56"/>
</constraints>
<buttonCell key="cell" type="check" title="scroll bottom" bezelStyle="regularSquare" imagePosition="left" state="on" inset="2" id="51">
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
<font key="font" metaFont="system"/>
</buttonCell>
<connections>
<action selector="onScrollChange:" target="-2" id="59"/>
</connections>
</button>
<button translatesAutoresizingMaskIntoConstraints="NO" id="60">
<rect key="frame" x="632" y="375" width="95" height="18"/>
<constraints>
<constraint firstAttribute="width" constant="91" id="64"/>
</constraints>
<buttonCell key="cell" type="check" title="always top" bezelStyle="regularSquare" imagePosition="left" inset="2" id="61">
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
<font key="font" metaFont="system"/>
</buttonCell>
<connections>
<action selector="onTopChange:" target="-2" id="67"/>
</connections>
</button>
</subviews>
<constraints>
<constraint firstAttribute="trailing" secondItem="5" secondAttribute="trailing" constant="1" id="41"/>
<constraint firstAttribute="bottom" secondItem="5" secondAttribute="bottom" constant="-1" id="42"/>
<constraint firstItem="5" firstAttribute="top" secondItem="2" secondAttribute="top" constant="30" id="43"/>
<constraint firstItem="5" firstAttribute="leading" secondItem="2" secondAttribute="leading" constant="-1" id="44"/>
<constraint firstItem="46" firstAttribute="leading" secondItem="2" secondAttribute="leading" constant="5" id="49"/>
<constraint firstItem="50" firstAttribute="baseline" secondItem="46" secondAttribute="baseline" id="52"/>
<constraint firstAttribute="trailing" secondItem="50" secondAttribute="trailing" constant="12" id="53"/>
<constraint firstItem="5" firstAttribute="top" secondItem="50" secondAttribute="bottom" constant="8" symbolic="YES" id="54"/>
<constraint firstItem="60" firstAttribute="centerY" secondItem="46" secondAttribute="centerY" id="63"/>
<constraint firstItem="50" firstAttribute="leading" secondItem="60" secondAttribute="trailing" constant="8" symbolic="YES" id="66"/>
</constraints>
</view>
<connections>
<outlet property="delegate" destination="-2" id="4"/>
</connections>
</window>
</objects>
</document>

View File

@@ -0,0 +1,201 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="6254" systemVersion="14B25" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none">
<dependencies>
<deployment version="1080" identifier="macosx"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="6254"/>
</dependencies>
<objects>
<customObject id="-2" userLabel="File's Owner" customClass="AppController">
<connections>
<outlet property="delegate" destination="536" id="537"/>
<outlet property="menu" destination="29" id="650"/>
</connections>
</customObject>
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
<customObject id="-3" userLabel="Application" customClass="NSObject"/>
<menu title="AMainMenu" systemMenu="main" id="29">
<items>
<menuItem title="Simulator" id="56">
<menu key="submenu" title="Simulator" systemMenu="apple" id="57">
<items>
<menuItem title="About simulator" id="58">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="orderFrontStandardAboutPanel:" target="-2" id="142"/>
</connections>
</menuItem>
<menuItem isSeparatorItem="YES" id="236">
<modifierMask key="keyEquivalentModifierMask" command="YES"/>
</menuItem>
<menuItem title="Preferences…" keyEquivalent="," id="129"/>
<menuItem isSeparatorItem="YES" id="143">
<modifierMask key="keyEquivalentModifierMask" command="YES"/>
</menuItem>
<menuItem title="Services" id="131">
<menu key="submenu" title="Services" systemMenu="services" id="130"/>
</menuItem>
<menuItem isSeparatorItem="YES" id="144">
<modifierMask key="keyEquivalentModifierMask" command="YES"/>
</menuItem>
<menuItem title="Hide simulator" keyEquivalent="h" id="134">
<connections>
<action selector="hide:" target="-1" id="367"/>
</connections>
</menuItem>
<menuItem title="Hide Others" keyEquivalent="h" id="145">
<modifierMask key="keyEquivalentModifierMask" option="YES" command="YES"/>
<connections>
<action selector="hideOtherApplications:" target="-1" id="368"/>
</connections>
</menuItem>
<menuItem title="Show All" id="150">
<connections>
<action selector="unhideAllApplications:" target="-1" id="370"/>
</connections>
</menuItem>
<menuItem isSeparatorItem="YES" id="149">
<modifierMask key="keyEquivalentModifierMask" command="YES"/>
</menuItem>
<menuItem title="Quit simulator" keyEquivalent="q" id="136">
<connections>
<action selector="onFileClose:" target="-1" id="UyZ-bV-2zL"/>
</connections>
</menuItem>
</items>
</menu>
</menuItem>
<menuItem title="Edit" id="Sqe-GR-erP">
<modifierMask key="keyEquivalentModifierMask"/>
<menu key="submenu" title="Edit" id="k0V-hR-upN">
<items>
<menuItem title="Undo" keyEquivalent="z" id="Ueo-Yj-fzm">
<connections>
<action selector="undo:" target="-1" id="Ex2-6U-hZI"/>
</connections>
</menuItem>
<menuItem title="Redo" keyEquivalent="Z" id="x6z-iQ-VK2">
<connections>
<action selector="redo:" target="-1" id="KEx-Aj-tYn"/>
</connections>
</menuItem>
<menuItem isSeparatorItem="YES" id="COi-E7-7M4"/>
<menuItem title="Cut" keyEquivalent="x" id="NAk-12-pg4">
<connections>
<action selector="cut:" target="-1" id="Owu-Ie-Kfg"/>
</connections>
</menuItem>
<menuItem title="Copy" keyEquivalent="c" id="XOY-ya-lNt">
<connections>
<action selector="copy:" target="-1" id="aIB-pV-N2w"/>
</connections>
</menuItem>
<menuItem title="Paste" keyEquivalent="v" id="ul0-51-Ibd">
<connections>
<action selector="paste:" target="-1" id="7rk-Tb-7hI"/>
</connections>
</menuItem>
<menuItem title="Paste and Match Style" keyEquivalent="V" id="Zvy-7g-x4q">
<modifierMask key="keyEquivalentModifierMask" option="YES" command="YES"/>
<connections>
<action selector="pasteAsPlainText:" target="-1" id="oM4-kj-hTQ"/>
</connections>
</menuItem>
<menuItem title="Delete" id="Xyz-QC-wlG">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="delete:" target="-1" id="idJ-aN-6bB"/>
</connections>
</menuItem>
<menuItem title="Select All" keyEquivalent="a" id="4fT-JL-N6e">
<connections>
<action selector="selectAll:" target="-1" id="pAH-rW-PaD"/>
</connections>
</menuItem>
<menuItem isSeparatorItem="YES" id="osB-R6-2jE"/>
<menuItem title="Find" id="bms-8x-7Yb">
<modifierMask key="keyEquivalentModifierMask"/>
<menu key="submenu" title="Find" id="AXr-4L-lcV">
<items>
<menuItem title="Find…" tag="1" keyEquivalent="f" id="GS8-y9-yQY">
<connections>
<action selector="performFindPanelAction:" target="-1" id="jVT-dG-Frl"/>
</connections>
</menuItem>
<menuItem title="Find Next" tag="2" keyEquivalent="g" id="RJc-P7-Ibq">
<connections>
<action selector="performFindPanelAction:" target="-1" id="yLp-2a-Nuk"/>
</connections>
</menuItem>
<menuItem title="Find Previous" tag="3" keyEquivalent="G" id="f5k-Su-hK0">
<connections>
<action selector="performFindPanelAction:" target="-1" id="uoF-9Z-ef7"/>
</connections>
</menuItem>
<menuItem title="Use Selection for Find" tag="7" keyEquivalent="e" id="9Zj-Be-aBN">
<connections>
<action selector="performFindPanelAction:" target="-1" id="8hs-AK-0U8"/>
</connections>
</menuItem>
<menuItem title="Jump to Selection" keyEquivalent="j" id="4tD-ef-pd8">
<connections>
<action selector="centerSelectionInVisibleArea:" target="-1" id="8xc-J0-7iQ"/>
</connections>
</menuItem>
</items>
</menu>
</menuItem>
</items>
</menu>
</menuItem>
<menuItem title="File" id="83"/>
<menuItem title="Player" id="633">
<modifierMask key="keyEquivalentModifierMask"/>
</menuItem>
<menuItem title="Screen" id="295"/>
<menuItem title="Window" id="19">
<menu key="submenu" title="Window" systemMenu="window" id="XuB-dT-g0h">
<items>
<menuItem title="Minimize" keyEquivalent="m" id="YrK-j5-jxq">
<connections>
<action selector="performMiniaturize:" target="-1" id="3wr-0O-cTq"/>
</connections>
</menuItem>
<menuItem isSeparatorItem="YES" id="0NY-jh-tsl">
<modifierMask key="keyEquivalentModifierMask" command="YES"/>
</menuItem>
<menuItem title="Bring All to Front" id="opb-EX-EXV">
<connections>
<action selector="arrangeInFront:" target="-1" id="oT1-07-BON"/>
</connections>
</menuItem>
<menuItem title="Always On Top" keyEquivalent="a" id="nXh-Uq-d6d">
<modifierMask key="keyEquivalentModifierMask" option="YES" command="YES"/>
<connections>
<action selector="onWindowAlwaysOnTop:" target="-1" id="IM6-Km-MGj"/>
</connections>
</menuItem>
</items>
</menu>
</menuItem>
<menuItem title="Help" id="490">
<modifierMask key="keyEquivalentModifierMask"/>
<menu key="submenu" title="Help" systemMenu="help" id="UaO-03-xh1">
<items>
<menuItem title="simulator Help" keyEquivalent="?" id="StN-Og-Ms8">
<connections>
<action selector="showHelp:" target="-1" id="l0h-I0-XAk"/>
</connections>
</menuItem>
</items>
</menu>
</menuItem>
</items>
</menu>
<customObject id="420" customClass="NSFontManager"/>
<customObject id="536" customClass="AppController">
<connections>
<outlet property="menu" destination="29" id="550"/>
</connections>
</customObject>
</objects>
</document>

View File

@@ -0,0 +1,48 @@
/****************************************************************************
Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd.
http://www.cocos.com
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated engine source code (the "Software"), a limited,
worldwide, royalty-free, non-assignable, revocable and non-exclusive license
to use Cocos Creator solely to develop games on your target platforms. You shall
not use Cocos Creator software for developing other software or tools that's
used for developing games. You are not granted to publish, distribute,
sublicense, and/or sell copies of Cocos Creator.
The software or tools in this License Agreement are licensed, not sold.
Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
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.
****************************************************************************/
#import <Cocoa/Cocoa.h>
@interface ConsoleWindowController : NSWindowController
{
NSTextView *textView;
IBOutlet NSButton *checkScroll;
IBOutlet NSButton *topCheckBox;
NSMutableArray *linesCount;
NSUInteger traceCount;
}
@property (assign) IBOutlet NSTextView *textView;
- (void) trace:(NSString*)msg;
- (IBAction)onClear:(id)sender;
- (IBAction)onScrollChange:(id)sender;
- (IBAction)onTopChange:(id)sender;
@end

View File

@@ -0,0 +1,100 @@
#import "ConsoleWindowController.h"
@interface ConsoleWindowController ()
@end
#define SKIP_LINES_COUNT 3
#define MAX_LINE_LEN 4096
#define MAX_LINES_COUNT 200
@implementation ConsoleWindowController
@synthesize textView;
- (id)initWithWindow:(NSWindow *)window
{
self = [super initWithWindow:window];
if (self)
{
// Initialization code here.
linesCount = [[NSMutableArray arrayWithCapacity:MAX_LINES_COUNT + 1] retain];
}
return self;
}
- (void)dealloc
{
[linesCount release];
[super dealloc];
}
- (void)windowDidLoad
{
[super windowDidLoad];
// Implement this method to handle any initialization after your window controller's window has been loaded from its nib file.
}
- (void) trace:(NSString*)msg
{
if (traceCount >= SKIP_LINES_COUNT && [msg length] > MAX_LINE_LEN)
{
msg = [NSString stringWithFormat:@"%@ ...", [msg substringToIndex:MAX_LINE_LEN - 4]];
}
traceCount++;
NSFont *font = [NSFont fontWithName:@"Monaco" size:12.0];
NSDictionary *attrsDictionary = [NSDictionary dictionaryWithObject:font forKey:NSFontAttributeName];
NSAttributedString *string = [[NSAttributedString alloc] initWithString:msg attributes:attrsDictionary];
NSNumber *len = [NSNumber numberWithUnsignedInteger:[string length]];
[linesCount addObject:len];
NSTextStorage *storage = [textView textStorage];
[storage beginEditing];
[storage appendAttributedString:string];
if ([linesCount count] >= MAX_LINES_COUNT)
{
len = [linesCount objectAtIndex:0];
[storage deleteCharactersInRange:NSMakeRange(0, [len unsignedIntegerValue])];
[linesCount removeObjectAtIndex:0];
}
[storage endEditing];
[self changeScroll];
}
- (void) changeScroll
{
BOOL scroll = [checkScroll state] == NSOnState;
if(scroll)
{
[self.textView scrollRangeToVisible: NSMakeRange(self.textView.string.length, 0)];
}
}
- (IBAction)onClear:(id)sender
{
NSTextStorage *storage = [textView textStorage];
[storage setAttributedString:[[[NSAttributedString alloc] initWithString:@""] autorelease]];
}
- (IBAction)onScrollChange:(id)sender
{
[self changeScroll];
}
- (IBAction)onTopChange:(id)sender
{
BOOL isTop = [topCheckBox state] == NSOnState;
if(isTop)
{
[self.window setLevel:NSFloatingWindowLevel];
}
else
{
[self.window setLevel:NSNormalWindowLevel];
}
}
@end

View File

@@ -0,0 +1,65 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleDocumentTypes</key>
<array>
<dict>
<key>CFBundleTypeName</key>
<string>Folder</string>
<key>CFBundleTypeOSTypes</key>
<array>
<string>folder</string>
</array>
<key>CFBundleTypeRole</key>
<string>Viewer</string>
</dict>
<dict>
<key>CFBundleTypeExtensions</key>
<array>
<string>csd</string>
<string>csb</string>
</array>
<key>CFBundleTypeName</key>
<string>Cocos Studio Project</string>
<key>CFBundleTypeRole</key>
<string>Viewer</string>
</dict>
</array>
<key>CFBundleExecutable</key>
<string>${EXECUTABLE_NAME}</string>
<key>CFBundleIconFile</key>
<string>Icon</string>
<key>CFBundleIdentifier</key>
<string>com.cocos.apps.simulator</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>Cocos Simulator</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>3.10</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>20151106</string>
<key>LSApplicationCategoryType</key>
<string>public.app-category.utilities</string>
<key>LSMinimumSystemVersion</key>
<string>${MACOSX_DEPLOYMENT_TARGET}</string>
<key>NSHumanReadableCopyright</key>
<string>Copyright © 2015. All rights reserved.</string>
<key>NSMainNibFile</key>
<string>MainMenu</string>
<key>NSPrincipalClass</key>
<string>NSApplication</string>
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>
</dict>
</plist>

View File

@@ -0,0 +1,7 @@
//
// Prefix header for all source files of the 'Paralaxer' target in the 'Paralaxer' project
//
#ifdef __OBJC__
#import <Cocoa/Cocoa.h>
#endif

View File

@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>com.apple.security.get-task-allow</key>
<true/>
</dict>
</plist>

View File

@@ -0,0 +1,61 @@
/****************************************************************************
Copyright (c) 2010 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 <string>
#import <Cocoa/Cocoa.h>
#import "ConsoleWindowController.h"
#include "ProjectConfig/ProjectConfig.h"
#include "ProjectConfig/SimulatorConfig.h"
#include "AppDelegate.h"
@interface AppController : NSObject <NSApplicationDelegate, NSWindowDelegate, NSFileManagerDelegate>
{
NSWindow *_window;
NSMenu *menu;
AppDelegate *_app;
ProjectConfig _project;
int _debugLogFile;
std::string _entryPath;
//log file
ConsoleWindowController *_consoleController;
NSFileHandle *_fileHandle;
//console pipe
NSPipe *_pipe;
NSFileHandle *_pipeReadHandle;
}
@property (nonatomic, assign) IBOutlet NSMenu* menu;
-(BOOL)application:(NSApplication*)app openFile:(NSString*)path;
-(IBAction)onFileClose:(id)sender;
-(IBAction)onWindowAlwaysOnTop:(id)sender;
@end

View File

@@ -0,0 +1,698 @@
/****************************************************************************
Copyright (c) 2010 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 <sys/stat.h>
#include <stdio.h>
#include <fcntl.h>
#include <string>
#include <vector>
#import "SimulatorApp.h"
#include "AppDelegate.h"
#include "glfw3.h"
#include "glfw3native.h"
#include "runtime/Runtime.h"
#include "runtime/ConfigParser.h"
#include "cocos2d.h"
#include "base/CCConfiguration.h"
#include "ide-support/CodeIDESupport.h"
#include "platform/desktop/CCGLView-desktop.h"
#include "platform/mac/PlayerMac.h"
#include "AppEvent.h"
#include "AppLang.h"
#if (GLFW_VERSION_MAJOR >= 3) && (GLFW_VERSION_MINOR >= 1)
#define PLAYER_SUPPORT_DROP 1
#else
#define PLAYER_SUPPORT_DROP 0
#endif
using namespace std;
using namespace cocos2d;
static id SIMULATOR = nullptr;
@implementation AppController
@synthesize menu;
std::string getCurAppPath(void)
{
return [[[NSBundle mainBundle] bundlePath] UTF8String];
}
std::string getCurAppName(void)
{
string appName = [[[NSProcessInfo processInfo] processName] UTF8String];
int found = appName.find(" ");
if (found!=std::string::npos)
appName = appName.substr(0,found);
return appName;
}
-(void) dealloc
{
delete _app;
_app = nullptr;
player::PlayerProtocol::getInstance()->purgeInstance();
[super dealloc];
}
#pragma mark -
#pragma delegates
-(BOOL)application:(NSApplication*)app openFile:(NSString*)path
{
NSFileManager *fm = [NSFileManager defaultManager];
BOOL isDirectory = NO;
if (![fm fileExistsAtPath:path isDirectory:&isDirectory])
{
return NO;
}
if (isDirectory)
{
// check src folder
if ([fm fileExistsAtPath:[path stringByAppendingString:@"/src/main.js"]])
{
_project.setProjectDir([path cStringUsingEncoding:NSUTF8StringEncoding]);
_entryPath = "$(PROJDIR)/src/main.js";
}
}
else
{
_project.setProjectDir([path cStringUsingEncoding:NSUTF8StringEncoding]);
_entryPath = [path cStringUsingEncoding:NSUTF8StringEncoding];
}
return YES;
}
-(void)applicationDidFinishLaunching:(NSNotification *)aNotification
{
SIMULATOR = self;
player::PlayerMac::create();
_debugLogFile = 0;
[self parseCocosProjectConfig:&_project];
[self updateProjectFromCommandLineArgs:&_project];
if (_entryPath.length())
{
_project.setScriptFile(_entryPath);
}
[self createWindowAndGLView];
[self startup];
}
#pragma mark -
#pragma mark functions
- (BOOL) windowShouldClose:(id)sender
{
return YES;
}
- (void) windowWillClose:(NSNotification *)notification
{
[[NSRunningApplication currentApplication] terminate];
}
- (BOOL) applicationShouldTerminateAfterLastWindowClosed:(NSApplication*)theApplication
{
return YES;
}
- (NSMutableArray*) makeCommandLineArgsFromProjectConfig
{
return [self makeCommandLineArgsFromProjectConfig:kProjectConfigAll];
}
- (NSMutableArray*) makeCommandLineArgsFromProjectConfig:(unsigned int)mask
{
_project.setWindowOffset(Vec2(_window.frame.origin.x, _window.frame.origin.y));
vector<string> args = _project.makeCommandLineVector();
NSMutableArray *commandArray = [NSMutableArray arrayWithCapacity:args.size()];
for (auto &path : args)
{
[commandArray addObject:[NSString stringWithUTF8String:path.c_str()]];
}
return commandArray;
}
- (void) parseCocosProjectConfig:(ProjectConfig*)config
{
// get project directory
ProjectConfig tmpConfig;
NSArray *nsargs = [[NSProcessInfo processInfo] arguments];
long n = [nsargs count];
if (n >= 2)
{
vector<string> args;
for (int i = 0; i < [nsargs count]; ++i)
{
string arg = [[nsargs objectAtIndex:i] cStringUsingEncoding:NSUTF8StringEncoding];
if (arg.length()) args.push_back(arg);
}
if (args.size() && args.at(1).at(0) == '/')
{
// IDEA:
// for Code IDE before RC2
tmpConfig.setProjectDir(args.at(1));
}
tmpConfig.parseCommandLine(args);
}
// set project directory as search root path
string solutionDir = tmpConfig.getProjectDir();
string spath = solutionDir;
if (!solutionDir.empty())
{
for (int i = 0; i < solutionDir.size(); ++i)
{
if (solutionDir[i] == '\\')
{
solutionDir[i] = '/';
}
}
spath = solutionDir;
if (spath[spath.length() - 1] == '/') {
spath = spath.substr(0, spath.length() - 1);
}
string strExtention = FileUtils::getInstance()->getFileExtension(spath);
int pos = -1;
if(strExtention.compare(".csd") == 0)
{
pos = spath.rfind('/');
if(pos > 0)
spath = spath.substr(0, pos);
}
pos = spath.rfind('/');
if(pos > 0)
spath = spath.substr(0, pos+1);
FileUtils::getInstance()->addSearchPath(spath);
FileUtils::getInstance()->setDefaultResourceRootPath(solutionDir);
FileUtils::getInstance()->addSearchPath(solutionDir);
FileUtils::getInstance()->addSearchPath(tmpConfig.getProjectDir());
}
else
{
FileUtils::getInstance()->setDefaultResourceRootPath(tmpConfig.getProjectDir());
}
// parse config.json
auto parser = ConfigParser::getInstance();
auto configPath = spath.append(CONFIG_FILE);
if(!FileUtils::getInstance()->isFileExist(configPath))
configPath = solutionDir.append(CONFIG_FILE);
parser->readConfig(configPath);
// set information
config->setConsolePort(parser->getConsolePort());
config->setFileUploadPort(parser->getUploadPort());
config->setFrameSize(parser->getInitViewSize());
if (parser->isLanscape())
{
config->changeFrameOrientationToLandscape();
}
else
{
config->changeFrameOrientationToPortait();
}
config->setScriptFile(parser->getEntryFile());
}
- (void) updateProjectFromCommandLineArgs:(ProjectConfig*)config
{
NSArray *nsargs = [[NSProcessInfo processInfo] arguments];
long n = [nsargs count];
if (n >= 2)
{
vector<string> args;
for (int i = 0; i < [nsargs count]; ++i)
{
string arg = [[nsargs objectAtIndex:i] cStringUsingEncoding:NSUTF8StringEncoding];
if (arg.length()) args.push_back(arg);
}
if (args.size() && args.at(1).at(0) == '/')
{
// for Code IDE before RC2
config->setProjectDir(args.at(1));
config->setDebuggerType(kCCRuntimeDebuggerCodeIDE);
}
config->parseCommandLine(args);
}
}
- (bool) launch:(NSArray*)args
{
NSURL *url = [NSURL fileURLWithPath:[[NSBundle mainBundle] bundlePath]];
NSMutableDictionary *configuration = [NSMutableDictionary dictionaryWithObject:args forKey:NSWorkspaceLaunchConfigurationArguments];
NSError *error = nil;
[[NSWorkspace sharedWorkspace] launchApplicationAtURL:url
options:NSWorkspaceLaunchNewInstance
configuration:configuration
error:&error];
if (error.code != 0)
{
NSLog(@"Failed to launch app: %@", [error localizedDescription]);
}
return (error.code==0);
}
- (void) relaunch:(NSArray*)args
{
if ([self launch:args])
{
[[NSApplication sharedApplication] terminate:self];
}
else
{
NSLog(@"RELAUNCH: %@", args);
}
}
- (void) relaunch
{
[self relaunch:[self makeCommandLineArgsFromProjectConfig]];
}
- (float) titleBarHeight
{
NSRect frame = NSMakeRect (0, 0, 100, 100);
NSRect contentRect;
contentRect = [NSWindow contentRectForFrameRect: frame
styleMask: NSTitledWindowMask];
return (frame.size.height - contentRect.size.height);
}
- (void) createWindowAndGLView
{
// create console window **MUST** before create opengl view
#if (CC_CODE_IDE_DEBUG_SUPPORT == 1)
if (_project.isShowConsole())
{
[self openConsoleWindow];
}
#endif
float frameScale = _project.getFrameScale();
// get frame size
cocos2d::Size frameSize = _project.getFrameSize();
ConfigParser::getInstance()->setInitViewSize(frameSize);
// check screen workarea size
NSRect workarea = [NSScreen mainScreen].visibleFrame;
float workareaWidth = workarea.size.width;
float workareaHeight = workarea.size.height - [self titleBarHeight];
CCLOG("WORKAREA WIDTH %0.2f, HEIGHT %0.2f", workareaWidth, workareaHeight);
while (true && frameScale > 0.25f)
{
if (frameSize.width * frameScale > workareaWidth || frameSize.height * frameScale > workareaHeight)
{
frameScale = frameScale - 0.25f;
}
else
{
break;
}
}
if (frameScale < 0.25f) frameScale = 0.25f;
_project.setFrameScale(frameScale);
CCLOG("FRAME SCALE = %0.2f", frameScale);
// check window offset
Vec2 pos = _project.getWindowOffset();
if (pos.x < 0) pos.x = 0;
if (pos.y < 0) pos.y = 0;
// get app name
std::stringstream title;
title << "Cocos Simulator (" << _project.getFrameScale() * 100 << "%)";
// create opengl view, and init app
_app = new AppDelegate(title.str(), _project.getFrameScale() * frameSize.width, _project.getFrameScale() * frameSize.height);
// this **MUST** be called after create opengl view, or crash will occur at 'gatherGPUInfo'
CCLOG("%s\n",Configuration::getInstance()->getInfo().c_str());
auto glfwWindow = ((GLView*)_app->getView())->getGLFWWindow();
_window = glfwGetCocoaWindow((GLFWwindow*)glfwWindow);
[_window center];
[self setZoom:_project.getFrameScale()];
if (pos.x != 0 && pos.y != 0)
{
[_window setFrameOrigin:NSMakePoint(pos.x, pos.y)];
}
}
- (void) adjustEditMenuIndex
{
NSApplication *thisApp = [NSApplication sharedApplication];
NSMenu *mainMenu = [thisApp mainMenu];
NSMenuItem *editMenuItem = [mainMenu itemWithTitle:@"Edit"];
if (editMenuItem)
{
NSUInteger index = 2;
if (index > [mainMenu itemArray].count)
index = [mainMenu itemArray].count;
[[editMenuItem menu] removeItem:editMenuItem];
[mainMenu insertItem:editMenuItem atIndex:index];
}
}
- (void) startup
{
FileUtils::getInstance()->setPopupNotify(false);
_project.dump();
const string projectDir = _project.getProjectDir();
if (projectDir.length())
{
FileUtils::getInstance()->setDefaultResourceRootPath(projectDir);
if (_project.isWriteDebugLogToFile())
{
[self writeDebugLogToFile:_project.getDebugLogFilePath()];
}
}
const string writablePath = _project.getWritableRealPath();
if (writablePath.length())
{
FileUtils::getInstance()->setWritablePath(writablePath.c_str());
}
// path for looking Lang file, Studio Default images
NSString *resourcePath = [[NSBundle mainBundle] resourcePath];
FileUtils::getInstance()->addSearchPath(resourcePath.UTF8String);
[self setupUI];
[self adjustEditMenuIndex];
RuntimeEngine::getInstance()->setProjectConfig(_project);
_app->start();
// After run, application needs to be terminated immediately.
[[NSApplication sharedApplication] terminate:self];
}
- (void) setupUI
{
auto menuBar = player::PlayerProtocol::getInstance()->getMenuService();
// VIEW
menuBar->addItem("VIEW_MENU", tr("View"));
SimulatorConfig *config = SimulatorConfig::getInstance();
int current = config->checkScreenSize(_project.getFrameSize());
for (int i = 0; i < config->getScreenSizeCount(); i++)
{
SimulatorScreenSize size = config->getScreenSize(i);
std::stringstream menuId;
menuId << "VIEWSIZE_ITEM_MENU_" << i;
auto menuItem = menuBar->addItem(menuId.str(), size.title.c_str(), "VIEW_MENU");
if (i == current)
{
menuItem->setChecked(true);
}
}
menuBar->addItem("DIRECTION_MENU_SEP", "-", "VIEW_MENU");
menuBar->addItem("DIRECTION_PORTRAIT_MENU", tr("Portrait"), "VIEW_MENU")
->setChecked(_project.isPortraitFrame());
menuBar->addItem("DIRECTION_LANDSCAPE_MENU", tr("Landscape"), "VIEW_MENU")
->setChecked(_project.isLandscapeFrame());
menuBar->addItem("VIEW_SCALE_MENU_SEP", "-", "VIEW_MENU");
bool displayStats = true; // asume creator default show FPS
string fpsItemName = displayStats ? tr("Hide FPS") : tr("Show FPS");
menuBar->addItem("VIEW_SHOW_FPS", fpsItemName, "VIEW_MENU");
menuBar->addItem("VIEW_SHOW_FPS_SEP", "-", "VIEW_MENU");
std::vector<player::PlayerMenuItem*> scaleMenuVector;
auto scale100Menu = menuBar->addItem("VIEW_SCALE_MENU_100", tr("Zoom Out").append(" (100%)"), "VIEW_MENU");
scale100Menu->setShortcut("super+0");
auto scale75Menu = menuBar->addItem("VIEW_SCALE_MENU_75", tr("Zoom Out").append(" (75%)"), "VIEW_MENU");
scale75Menu->setShortcut("super+7");
auto scale50Menu = menuBar->addItem("VIEW_SCALE_MENU_50", tr("Zoom Out").append(" (50%)"), "VIEW_MENU");
scale50Menu->setShortcut("super+6");
auto scale25Menu = menuBar->addItem("VIEW_SCALE_MENU_25", tr("Zoom Out").append(" (25%)"), "VIEW_MENU");
scale25Menu->setShortcut("super+5");
int frameScale = int(_project.getFrameScale() * 100);
if (frameScale == 100)
{
scale100Menu->setChecked(true);
}
else if (frameScale == 75)
{
scale75Menu->setChecked(true);
}
else if (frameScale == 50)
{
scale50Menu->setChecked(true);
}
else if (frameScale == 25)
{
scale25Menu->setChecked(true);
}
else
{
scale100Menu->setChecked(true);
}
scaleMenuVector.push_back(scale100Menu);
scaleMenuVector.push_back(scale75Menu);
scaleMenuVector.push_back(scale50Menu);
scaleMenuVector.push_back(scale25Menu);
menuBar->addItem("REFRESH_MENU_SEP", "-", "VIEW_MENU");
menuBar->addItem("REFRESH_MENU", tr("Refresh"), "VIEW_MENU")->setShortcut("super+r");
ProjectConfig &project = _project;
EventDispatcher::CustomEventListener listener = [self, &project, scaleMenuVector](const CustomEvent& event){
auto menuEvent = dynamic_cast<const AppEvent&>(event);
rapidjson::Document dArgParse;
dArgParse.Parse<0>(menuEvent.getDataString().c_str());
if (dArgParse.HasMember("name"))
{
string strcmd = dArgParse["name"].GetString();
if (strcmd == "menuClicked")
{
player::PlayerMenuItem *menuItem = static_cast<player::PlayerMenuItem*>(menuEvent.args[0].ptrVal);
if (menuItem)
{
if (menuItem->isChecked())
{
return ;
}
string data = dArgParse["data"].GetString();
if ((data == "CLOSE_MENU") || (data == "EXIT_MENU"))
{
_app->end();
}
else if (data == "REFRESH_MENU")
{
[SIMULATOR relaunch];
}
else if (data.find("VIEW_SCALE_MENU_") == 0) // begin with VIEW_SCALE_MENU_
{
string tmp = data.erase(0, strlen("VIEW_SCALE_MENU_"));
float scale = atof(tmp.c_str()) / 100.0f;
[SIMULATOR setZoom:scale];
// update scale menu state
for (auto &it : scaleMenuVector)
{
it->setChecked(false);
}
menuItem->setChecked(true);
[SIMULATOR relaunch];
}
else if (data.find("VIEWSIZE_ITEM_MENU_") == 0) // begin with VIEWSIZE_ITEM_MENU_
{
string tmp = data.erase(0, strlen("VIEWSIZE_ITEM_MENU_"));
int index = atoi(tmp.c_str());
SimulatorScreenSize size = SimulatorConfig::getInstance()->getScreenSize(index);
if (project.isLandscapeFrame())
{
std::swap(size.width, size.height);
}
project.setFrameSize(cocos2d::Size(size.width, size.height));
[SIMULATOR relaunch];
}
else if (data == "DIRECTION_PORTRAIT_MENU")
{
project.changeFrameOrientationToPortait();
[SIMULATOR relaunch];
}
else if (data == "DIRECTION_LANDSCAPE_MENU")
{
project.changeFrameOrientationToLandscape();
[SIMULATOR relaunch];
}
else if (data == "VIEW_SHOW_FPS")
{
bool displayStats = !_app->isDisplayStats();
_app->setDisplayStats(displayStats);
menuItem->setTitle(displayStats ? tr("Hide FPS") : tr("Show FPS"));
}
}
}
}
};
EventDispatcher::addCustomEventListener(kAppEventName, listener);
}
- (void) openConsoleWindow
{
if (!_consoleController)
{
_consoleController = [[ConsoleWindowController alloc] initWithWindowNibName:@"ConsoleWindow"];
}
[_consoleController.window orderFrontRegardless];
//set console pipe
_pipe = [NSPipe pipe] ;
_pipeReadHandle = [_pipe fileHandleForReading] ;
int outfd = [[_pipe fileHandleForWriting] fileDescriptor];
if (dup2(outfd, fileno(stderr)) != fileno(stderr) || dup2(outfd, fileno(stdout)) != fileno(stdout))
{
perror("Unable to redirect output");
}
else
{
[[NSNotificationCenter defaultCenter] addObserver: self selector: @selector(handleNotification:) name: NSFileHandleReadCompletionNotification object: _pipeReadHandle] ;
[_pipeReadHandle readInBackgroundAndNotify] ;
}
}
- (bool) writeDebugLogToFile:(const string)path
{
if (_debugLogFile) return true;
//log to file
if(_fileHandle) return true;
NSString *fPath = [NSString stringWithCString:path.c_str() encoding:[NSString defaultCStringEncoding]];
[[NSFileManager defaultManager] createFileAtPath:fPath contents:nil attributes:nil] ;
_fileHandle = [NSFileHandle fileHandleForWritingAtPath:fPath];
[_fileHandle retain];
return true;
}
- (void)handleNotification:(NSNotification *)note
{
//NSLog(@"Received notification: %@", note);
[_pipeReadHandle readInBackgroundAndNotify] ;
NSData *data = [[note userInfo] objectForKey:NSFileHandleNotificationDataItem];
NSString *str = [[[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding] autorelease];
if (str)
{
//show log to console
[_consoleController trace:str];
if(_fileHandle!=nil)
{
[_fileHandle writeData:[str dataUsingEncoding:NSUTF8StringEncoding]];
}
}
}
- (void) setZoom:(float)scale
{
_project.setFrameScale(scale);
std::stringstream title;
title << "Cocos " << tr("Simulator") << " (" << _project.getFrameScale() * 100 << "%)";
[_window setTitle:[NSString stringWithUTF8String:title.str().c_str()]];
}
- (BOOL) applicationShouldHandleReopen:(NSApplication *)sender hasVisibleWindows:(BOOL)flag
{
return NO;
}
#pragma mark -
-(IBAction)onFileClose:(id)sender
{
_app->end();
[[NSApplication sharedApplication] terminate:self];
}
-(IBAction)onWindowAlwaysOnTop:(id)sender
{
NSInteger state = [sender state];
if (state == NSOffState)
{
[_window setLevel:NSFloatingWindowLevel];
[sender setState:NSOnState];
}
else
{
[_window setLevel:NSNormalWindowLevel];
[sender setState:NSOffState];
}
}
- (void)applicationWillTerminate:(NSNotification *)notification
{
CC_SAFE_DELETE(_app);
}
@end

View File

@@ -0,0 +1,4 @@
// Configuration settings file format documentation can be found at:
// https://help.apple.com/xcode/#/dev745c5c974
#include "../../../../../../cocos/platform/mac/CCModuleConfigMac.release.xcconfig"

View File

@@ -0,0 +1,4 @@
// Configuration settings file format documentation can be found at:
// https://help.apple.com/xcode/#/dev745c5c974
#include "../../../../../../cocos/platform/mac/CCModuleConfigMac.release.xcconfig"

View File

@@ -0,0 +1,7 @@
{
"remove_res" : [
"src",
"res",
"config.json"
]
}

View File

@@ -0,0 +1,887 @@
<?xml version="1.0" encoding="UTF-8"?>
<archive type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="8.00">
<data>
<int key="IBDocument.SystemTarget">1060</int>
<string key="IBDocument.SystemVersion">13D65</string>
<string key="IBDocument.InterfaceBuilderVersion">5056</string>
<string key="IBDocument.AppKitVersion">1265.20</string>
<string key="IBDocument.HIToolboxVersion">698.00</string>
<object class="NSMutableDictionary" key="IBDocument.PluginVersions">
<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="NS.object.0">5056</string>
</object>
<array key="IBDocument.IntegratedClassDependencies">
<string>NSCustomObject</string>
<string>NSMenu</string>
<string>NSMenuItem</string>
</array>
<array key="IBDocument.PluginDependencies">
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
</array>
<object class="NSMutableDictionary" key="IBDocument.Metadata">
<string key="NS.key.0">PluginDependencyRecalculationVersion</string>
<integer value="1" key="NS.object.0"/>
</object>
<array class="NSMutableArray" key="IBDocument.RootObjects" id="504381850">
<object class="NSCustomObject" id="421466433">
<string key="NSClassName">AppController</string>
</object>
<object class="NSCustomObject" id="37508903">
<string key="NSClassName">FirstResponder</string>
</object>
<object class="NSCustomObject" id="622080690">
<string key="NSClassName">NSApplication</string>
</object>
<object class="NSMenu" id="126992598">
<string key="NSTitle">AMainMenu</string>
<array class="NSMutableArray" key="NSMenuItems">
<object class="NSMenuItem" id="511312888">
<reference key="NSMenu" ref="126992598"/>
<string key="NSTitle">Cocos-player</string>
<string key="NSKeyEquiv"/>
<int key="NSKeyEquivModMask">1048576</int>
<int key="NSMnemonicLoc">2147483647</int>
<object class="NSCustomResource" key="NSOnImage" id="415077826">
<string key="NSClassName">NSImage</string>
<string key="NSResourceName">NSMenuCheckmark</string>
</object>
<object class="NSCustomResource" key="NSMixedImage" id="266121528">
<string key="NSClassName">NSImage</string>
<string key="NSResourceName">NSMenuMixedState</string>
</object>
<string key="NSAction">submenuAction:</string>
<reference key="NSTarget" ref="120407948"/>
<object class="NSMenu" key="NSSubmenu" id="120407948">
<string key="NSTitle">Cocos-player</string>
<array class="NSMutableArray" key="NSMenuItems">
<object class="NSMenuItem" id="556105195">
<reference key="NSMenu" ref="120407948"/>
<string key="NSTitle">About Cocos-player</string>
<string key="NSKeyEquiv"/>
<int key="NSMnemonicLoc">2147483647</int>
<reference key="NSOnImage" ref="415077826"/>
<reference key="NSMixedImage" ref="266121528"/>
</object>
<object class="NSMenuItem" id="985155827">
<reference key="NSMenu" ref="120407948"/>
<bool key="NSIsDisabled">YES</bool>
<bool key="NSIsSeparator">YES</bool>
<string key="NSTitle"/>
<string key="NSKeyEquiv"/>
<int key="NSKeyEquivModMask">1048576</int>
<int key="NSMnemonicLoc">2147483647</int>
<reference key="NSOnImage" ref="415077826"/>
<reference key="NSMixedImage" ref="266121528"/>
</object>
<object class="NSMenuItem" id="904425014">
<reference key="NSMenu" ref="120407948"/>
<string key="NSTitle">Services</string>
<string key="NSKeyEquiv"/>
<int key="NSKeyEquivModMask">1048576</int>
<int key="NSMnemonicLoc">2147483647</int>
<reference key="NSOnImage" ref="415077826"/>
<reference key="NSMixedImage" ref="266121528"/>
<string key="NSAction">submenuAction:</string>
<reference key="NSTarget" ref="730822112"/>
<object class="NSMenu" key="NSSubmenu" id="730822112">
<string key="NSTitle">Services</string>
<array class="NSMutableArray" key="NSMenuItems"/>
<string key="NSName">_NSServicesMenu</string>
</object>
</object>
<object class="NSMenuItem" id="982249582">
<reference key="NSMenu" ref="120407948"/>
<bool key="NSIsDisabled">YES</bool>
<bool key="NSIsSeparator">YES</bool>
<string key="NSTitle"/>
<string key="NSKeyEquiv"/>
<int key="NSKeyEquivModMask">1048576</int>
<int key="NSMnemonicLoc">2147483647</int>
<reference key="NSOnImage" ref="415077826"/>
<reference key="NSMixedImage" ref="266121528"/>
</object>
<object class="NSMenuItem" id="880160621">
<reference key="NSMenu" ref="120407948"/>
<string key="NSTitle">Hide Cocos-player</string>
<string key="NSKeyEquiv">h</string>
<int key="NSKeyEquivModMask">1048576</int>
<int key="NSMnemonicLoc">2147483647</int>
<reference key="NSOnImage" ref="415077826"/>
<reference key="NSMixedImage" ref="266121528"/>
</object>
<object class="NSMenuItem" id="925141027">
<reference key="NSMenu" ref="120407948"/>
<string key="NSTitle">Hide Others</string>
<string key="NSKeyEquiv">h</string>
<int key="NSKeyEquivModMask">1572864</int>
<int key="NSMnemonicLoc">2147483647</int>
<reference key="NSOnImage" ref="415077826"/>
<reference key="NSMixedImage" ref="266121528"/>
</object>
<object class="NSMenuItem" id="1041874958">
<reference key="NSMenu" ref="120407948"/>
<string key="NSTitle">Show All</string>
<string key="NSKeyEquiv"/>
<int key="NSKeyEquivModMask">1048576</int>
<int key="NSMnemonicLoc">2147483647</int>
<reference key="NSOnImage" ref="415077826"/>
<reference key="NSMixedImage" ref="266121528"/>
</object>
<object class="NSMenuItem" id="686832216">
<reference key="NSMenu" ref="120407948"/>
<bool key="NSIsDisabled">YES</bool>
<bool key="NSIsSeparator">YES</bool>
<string key="NSTitle"/>
<string key="NSKeyEquiv"/>
<int key="NSKeyEquivModMask">1048576</int>
<int key="NSMnemonicLoc">2147483647</int>
<reference key="NSOnImage" ref="415077826"/>
<reference key="NSMixedImage" ref="266121528"/>
</object>
<object class="NSMenuItem" id="389366042">
<reference key="NSMenu" ref="120407948"/>
<string key="NSTitle">Quit Cocos-player</string>
<string key="NSKeyEquiv">q</string>
<int key="NSKeyEquivModMask">1048576</int>
<int key="NSMnemonicLoc">2147483647</int>
<reference key="NSOnImage" ref="415077826"/>
<reference key="NSMixedImage" ref="266121528"/>
</object>
</array>
<string key="NSName">_NSAppleMenu</string>
</object>
</object>
<object class="NSMenuItem" id="131023520">
<reference key="NSMenu" ref="126992598"/>
<string key="NSTitle">File</string>
<string key="NSKeyEquiv"/>
<int key="NSKeyEquivModMask">1048576</int>
<int key="NSMnemonicLoc">2147483647</int>
<reference key="NSOnImage" ref="415077826"/>
<reference key="NSMixedImage" ref="266121528"/>
<string key="NSAction">submenuAction:</string>
<reference key="NSTarget" ref="775420212"/>
<object class="NSMenu" key="NSSubmenu" id="775420212">
<string key="NSTitle">File</string>
<array class="NSMutableArray" key="NSMenuItems">
<object class="NSMenuItem" id="908501198">
<reference key="NSMenu" ref="775420212"/>
<string key="NSTitle">Close</string>
<string key="NSKeyEquiv">w</string>
<int key="NSKeyEquivModMask">1048576</int>
<int key="NSMnemonicLoc">2147483647</int>
<reference key="NSOnImage" ref="415077826"/>
<reference key="NSMixedImage" ref="266121528"/>
</object>
</array>
</object>
</object>
<object class="NSMenuItem" id="570079000">
<reference key="NSMenu" ref="126992598"/>
<string key="NSTitle">View</string>
<string key="NSKeyEquiv"/>
<int key="NSKeyEquivModMask">1048576</int>
<int key="NSMnemonicLoc">2147483647</int>
<reference key="NSOnImage" ref="415077826"/>
<reference key="NSMixedImage" ref="266121528"/>
<string key="NSAction">submenuAction:</string>
<reference key="NSTarget" ref="449964678"/>
<object class="NSMenu" key="NSSubmenu" id="449964678">
<string key="NSTitle">View</string>
<array class="NSMutableArray" key="NSMenuItems">
<object class="NSMenuItem" id="280645869">
<reference key="NSMenu" ref="449964678"/>
<bool key="NSIsDisabled">YES</bool>
<bool key="NSIsSeparator">YES</bool>
<string key="NSTitle"/>
<string key="NSKeyEquiv"/>
<int key="NSMnemonicLoc">2147483647</int>
<reference key="NSOnImage" ref="415077826"/>
<reference key="NSMixedImage" ref="266121528"/>
</object>
<object class="NSMenuItem" id="381124347">
<reference key="NSMenu" ref="449964678"/>
<string key="NSTitle">Portait</string>
<string key="NSKeyEquiv"/>
<int key="NSMnemonicLoc">2147483647</int>
<int key="NSState">1</int>
<reference key="NSOnImage" ref="415077826"/>
<reference key="NSMixedImage" ref="266121528"/>
</object>
<object class="NSMenuItem" id="243422072">
<reference key="NSMenu" ref="449964678"/>
<string key="NSTitle">Landscape</string>
<string key="NSKeyEquiv"/>
<int key="NSMnemonicLoc">2147483647</int>
<reference key="NSOnImage" ref="415077826"/>
<reference key="NSMixedImage" ref="266121528"/>
</object>
<object class="NSMenuItem" id="109890915">
<reference key="NSMenu" ref="449964678"/>
<bool key="NSIsDisabled">YES</bool>
<bool key="NSIsSeparator">YES</bool>
<string key="NSTitle"/>
<string key="NSKeyEquiv"/>
<int key="NSMnemonicLoc">2147483647</int>
<reference key="NSOnImage" ref="415077826"/>
<reference key="NSMixedImage" ref="266121528"/>
</object>
<object class="NSMenuItem" id="797118978">
<reference key="NSMenu" ref="449964678"/>
<string key="NSTitle">Actual (100%)</string>
<string key="NSKeyEquiv">0</string>
<int key="NSKeyEquivModMask">1048576</int>
<int key="NSMnemonicLoc">2147483647</int>
<int key="NSState">1</int>
<reference key="NSOnImage" ref="415077826"/>
<reference key="NSMixedImage" ref="266121528"/>
<int key="NSTag">100</int>
</object>
<object class="NSMenuItem" id="794026245">
<reference key="NSMenu" ref="449964678"/>
<string key="NSTitle">Zoom Out (75%)</string>
<string key="NSKeyEquiv">6</string>
<int key="NSKeyEquivModMask">1048576</int>
<int key="NSMnemonicLoc">2147483647</int>
<reference key="NSOnImage" ref="415077826"/>
<reference key="NSMixedImage" ref="266121528"/>
<int key="NSTag">75</int>
</object>
<object class="NSMenuItem" id="1065433476">
<reference key="NSMenu" ref="449964678"/>
<string key="NSTitle">Zoom Out (50%)</string>
<string key="NSKeyEquiv">5</string>
<int key="NSKeyEquivModMask">1048576</int>
<int key="NSMnemonicLoc">2147483647</int>
<reference key="NSOnImage" ref="415077826"/>
<reference key="NSMixedImage" ref="266121528"/>
<int key="NSTag">50</int>
</object>
<object class="NSMenuItem" id="267605560">
<reference key="NSMenu" ref="449964678"/>
<string key="NSTitle">Zoom Out (25%)</string>
<string key="NSKeyEquiv">4</string>
<int key="NSKeyEquivModMask">1048576</int>
<int key="NSMnemonicLoc">2147483647</int>
<reference key="NSOnImage" ref="415077826"/>
<reference key="NSMixedImage" ref="266121528"/>
<int key="NSTag">25</int>
</object>
</array>
</object>
</object>
<object class="NSMenuItem" id="638304486">
<reference key="NSMenu" ref="126992598"/>
<string key="NSTitle">Control</string>
<string key="NSKeyEquiv"/>
<int key="NSMnemonicLoc">2147483647</int>
<reference key="NSOnImage" ref="415077826"/>
<reference key="NSMixedImage" ref="266121528"/>
<string key="NSAction">submenuAction:</string>
<reference key="NSTarget" ref="201383158"/>
<object class="NSMenu" key="NSSubmenu" id="201383158">
<string key="NSTitle">Control</string>
<array class="NSMutableArray" key="NSMenuItems">
<object class="NSMenuItem" id="675525235">
<reference key="NSMenu" ref="201383158"/>
<string key="NSTitle">Relaunch</string>
<string key="NSKeyEquiv">r</string>
<int key="NSKeyEquivModMask">1048576</int>
<int key="NSMnemonicLoc">2147483647</int>
<reference key="NSOnImage" ref="415077826"/>
<reference key="NSMixedImage" ref="266121528"/>
</object>
<object class="NSMenuItem" id="834755239">
<reference key="NSMenu" ref="201383158"/>
<string key="NSTitle">Keep Window Top</string>
<string key="NSKeyEquiv"/>
<int key="NSMnemonicLoc">2147483647</int>
<reference key="NSOnImage" ref="415077826"/>
<reference key="NSMixedImage" ref="266121528"/>
</object>
</array>
</object>
</object>
<object class="NSMenuItem" id="251430468">
<reference key="NSMenu" ref="126992598"/>
<string key="NSTitle">Help</string>
<string key="NSKeyEquiv"/>
<int key="NSMnemonicLoc">2147483647</int>
<reference key="NSOnImage" ref="415077826"/>
<reference key="NSMixedImage" ref="266121528"/>
<string key="NSAction">submenuAction:</string>
<reference key="NSTarget" ref="119598072"/>
<object class="NSMenu" key="NSSubmenu" id="119598072">
<string key="NSTitle">Help</string>
<array class="NSMutableArray" key="NSMenuItems"/>
<string key="NSName">_NSHelpMenu</string>
</object>
</object>
</array>
<string key="NSName">_NSMainMenu</string>
</object>
<object class="NSCustomObject" id="806429288">
<string key="NSClassName">NSFontManager</string>
</object>
<object class="NSCustomObject" id="234942004">
<string key="NSClassName">AppController</string>
</object>
</array>
<object class="IBObjectContainer" key="IBDocument.Objects">
<bool key="usesAutoincrementingIDs">NO</bool>
<array class="NSMutableArray" key="connectionRecords">
<object class="IBConnectionRecord">
<object class="IBActionConnection" key="connection">
<string key="label">hide:</string>
<reference key="source" ref="622080690"/>
<reference key="destination" ref="880160621"/>
</object>
<string key="id">SGN-0p-7lH</string>
</object>
<object class="IBConnectionRecord">
<object class="IBActionConnection" key="connection">
<string key="label">hideOtherApplications:</string>
<reference key="source" ref="622080690"/>
<reference key="destination" ref="925141027"/>
</object>
<string key="id">iJd-Ba-eXG</string>
</object>
<object class="IBConnectionRecord">
<object class="IBActionConnection" key="connection">
<string key="label">unhideAllApplications:</string>
<reference key="source" ref="622080690"/>
<reference key="destination" ref="1041874958"/>
</object>
<string key="id">DR8-By-ymv</string>
</object>
<object class="IBConnectionRecord">
<object class="IBActionConnection" key="connection">
<string key="label">terminate:</string>
<reference key="source" ref="622080690"/>
<reference key="destination" ref="389366042"/>
</object>
<string key="id">DyL-yF-GYq</string>
</object>
<object class="IBConnectionRecord">
<object class="IBOutletConnection" key="connection">
<string key="label">delegate</string>
<reference key="source" ref="421466433"/>
<reference key="destination" ref="234942004"/>
</object>
<string key="id">537</string>
</object>
<object class="IBConnectionRecord">
<object class="IBOutletConnection" key="connection">
<string key="label">menu</string>
<reference key="source" ref="421466433"/>
<reference key="destination" ref="126992598"/>
</object>
<string key="id">650</string>
</object>
<object class="IBConnectionRecord">
<object class="IBActionConnection" key="connection">
<string key="label">orderFrontStandardAboutPanel:</string>
<reference key="source" ref="37508903"/>
<reference key="destination" ref="556105195"/>
</object>
<string key="id">tSA-7z-LPk</string>
</object>
<object class="IBConnectionRecord">
<object class="IBActionConnection" key="connection">
<string key="label">onFileClose:</string>
<reference key="source" ref="37508903"/>
<reference key="destination" ref="908501198"/>
</object>
<string key="id">661</string>
</object>
<object class="IBConnectionRecord">
<object class="IBActionConnection" key="connection">
<string key="label">onScreenPortait:</string>
<reference key="source" ref="37508903"/>
<reference key="destination" ref="381124347"/>
</object>
<string key="id">667</string>
</object>
<object class="IBConnectionRecord">
<object class="IBActionConnection" key="connection">
<string key="label">onScreenLandscape:</string>
<reference key="source" ref="37508903"/>
<reference key="destination" ref="243422072"/>
</object>
<string key="id">647</string>
</object>
<object class="IBConnectionRecord">
<object class="IBActionConnection" key="connection">
<string key="label">onScreenZoomOut:</string>
<reference key="source" ref="37508903"/>
<reference key="destination" ref="797118978"/>
</object>
<string key="id">yUj-fN-Rh7</string>
</object>
<object class="IBConnectionRecord">
<object class="IBActionConnection" key="connection">
<string key="label">onScreenZoomOut:</string>
<reference key="source" ref="37508903"/>
<reference key="destination" ref="794026245"/>
</object>
<string key="id">yps-LZ-egB</string>
</object>
<object class="IBConnectionRecord">
<object class="IBActionConnection" key="connection">
<string key="label">onScreenZoomOut:</string>
<reference key="source" ref="37508903"/>
<reference key="destination" ref="1065433476"/>
</object>
<string key="id">654</string>
</object>
<object class="IBConnectionRecord">
<object class="IBActionConnection" key="connection">
<string key="label">onScreenZoomOut:</string>
<reference key="source" ref="37508903"/>
<reference key="destination" ref="267605560"/>
</object>
<string key="id">DSu-if-D2T</string>
</object>
<object class="IBConnectionRecord">
<object class="IBActionConnection" key="connection">
<string key="label">onRelaunch:</string>
<reference key="source" ref="37508903"/>
<reference key="destination" ref="675525235"/>
</object>
<string key="id">XXg-eJ-YSn</string>
</object>
<object class="IBConnectionRecord">
<object class="IBActionConnection" key="connection">
<string key="label">onSetTop:</string>
<reference key="source" ref="37508903"/>
<reference key="destination" ref="834755239"/>
</object>
<string key="id">jvv-x1-KeN</string>
</object>
<object class="IBConnectionRecord">
<object class="IBOutletConnection" key="connection">
<string key="label">menu</string>
<reference key="source" ref="234942004"/>
<reference key="destination" ref="126992598"/>
</object>
<string key="id">550</string>
</object>
</array>
<object class="IBMutableOrderedSet" key="objectRecords">
<array key="orderedObjects">
<object class="IBObjectRecord">
<string key="id">0</string>
<array key="object" id="0"/>
<reference key="children" ref="504381850"/>
<nil key="parent"/>
</object>
<object class="IBObjectRecord">
<string key="id">-2</string>
<reference key="object" ref="421466433"/>
<reference key="parent" ref="0"/>
<string key="objectName">File's Owner</string>
</object>
<object class="IBObjectRecord">
<string key="id">-1</string>
<reference key="object" ref="37508903"/>
<reference key="parent" ref="0"/>
<string key="objectName">First Responder</string>
</object>
<object class="IBObjectRecord">
<string key="id">-3</string>
<reference key="object" ref="622080690"/>
<reference key="parent" ref="0"/>
<string key="objectName">Application</string>
</object>
<object class="IBObjectRecord">
<string key="id">29</string>
<reference key="object" ref="126992598"/>
<array class="NSMutableArray" key="children">
<reference ref="511312888"/>
<reference ref="131023520"/>
<reference ref="570079000"/>
<reference ref="638304486"/>
<reference ref="251430468"/>
</array>
<reference key="parent" ref="0"/>
</object>
<object class="IBObjectRecord">
<string key="id">GS6-Lb-ftA</string>
<reference key="object" ref="511312888"/>
<array class="NSMutableArray" key="children">
<reference ref="120407948"/>
</array>
<reference key="parent" ref="126992598"/>
</object>
<object class="IBObjectRecord">
<string key="id">YN2-V8-ty0</string>
<reference key="object" ref="120407948"/>
<array class="NSMutableArray" key="children">
<reference ref="556105195"/>
<reference ref="985155827"/>
<reference ref="904425014"/>
<reference ref="982249582"/>
<reference ref="880160621"/>
<reference ref="925141027"/>
<reference ref="1041874958"/>
<reference ref="686832216"/>
<reference ref="389366042"/>
</array>
<reference key="parent" ref="511312888"/>
</object>
<object class="IBObjectRecord">
<string key="id">HhF-Es-coQ</string>
<reference key="object" ref="556105195"/>
<reference key="parent" ref="120407948"/>
</object>
<object class="IBObjectRecord">
<string key="id">OzD-Nm-tPt</string>
<reference key="object" ref="985155827"/>
<reference key="parent" ref="120407948"/>
</object>
<object class="IBObjectRecord">
<string key="id">TOj-vg-cDm</string>
<reference key="object" ref="904425014"/>
<array class="NSMutableArray" key="children">
<reference ref="730822112"/>
</array>
<reference key="parent" ref="120407948"/>
</object>
<object class="IBObjectRecord">
<string key="id">e98-We-UX5</string>
<reference key="object" ref="730822112"/>
<reference key="parent" ref="904425014"/>
</object>
<object class="IBObjectRecord">
<string key="id">muN-Hw-eeZ</string>
<reference key="object" ref="982249582"/>
<reference key="parent" ref="120407948"/>
</object>
<object class="IBObjectRecord">
<string key="id">sH6-na-PTL</string>
<reference key="object" ref="880160621"/>
<reference key="parent" ref="120407948"/>
</object>
<object class="IBObjectRecord">
<string key="id">XG8-CE-veT</string>
<reference key="object" ref="925141027"/>
<reference key="parent" ref="120407948"/>
</object>
<object class="IBObjectRecord">
<string key="id">IqD-3v-zQT</string>
<reference key="object" ref="1041874958"/>
<reference key="parent" ref="120407948"/>
</object>
<object class="IBObjectRecord">
<string key="id">GU5-eI-OTq</string>
<reference key="object" ref="686832216"/>
<reference key="parent" ref="120407948"/>
</object>
<object class="IBObjectRecord">
<string key="id">7Z7-ot-jqY</string>
<reference key="object" ref="389366042"/>
<reference key="parent" ref="120407948"/>
</object>
<object class="IBObjectRecord">
<string key="id">83</string>
<reference key="object" ref="131023520"/>
<array class="NSMutableArray" key="children">
<reference ref="775420212"/>
</array>
<reference key="parent" ref="126992598"/>
</object>
<object class="IBObjectRecord">
<string key="id">81</string>
<reference key="object" ref="775420212"/>
<array class="NSMutableArray" key="children">
<reference ref="908501198"/>
</array>
<reference key="parent" ref="131023520"/>
</object>
<object class="IBObjectRecord">
<string key="id">611</string>
<reference key="object" ref="908501198"/>
<reference key="parent" ref="775420212"/>
</object>
<object class="IBObjectRecord">
<string key="id">295</string>
<reference key="object" ref="570079000"/>
<array class="NSMutableArray" key="children">
<reference ref="449964678"/>
</array>
<reference key="parent" ref="126992598"/>
<string key="objectName">Menu Item - View</string>
</object>
<object class="IBObjectRecord">
<string key="id">296</string>
<reference key="object" ref="449964678"/>
<array class="NSMutableArray" key="children">
<reference ref="280645869"/>
<reference ref="381124347"/>
<reference ref="243422072"/>
<reference ref="109890915"/>
<reference ref="797118978"/>
<reference ref="794026245"/>
<reference ref="1065433476"/>
<reference ref="267605560"/>
</array>
<reference key="parent" ref="570079000"/>
<string key="objectName">Menu - View</string>
</object>
<object class="IBObjectRecord">
<string key="id">579</string>
<reference key="object" ref="280645869"/>
<reference key="parent" ref="449964678"/>
</object>
<object class="IBObjectRecord">
<string key="id">592</string>
<reference key="object" ref="381124347"/>
<reference key="parent" ref="449964678"/>
</object>
<object class="IBObjectRecord">
<string key="id">593</string>
<reference key="object" ref="243422072"/>
<reference key="parent" ref="449964678"/>
</object>
<object class="IBObjectRecord">
<string key="id">594</string>
<reference key="object" ref="109890915"/>
<reference key="parent" ref="449964678"/>
</object>
<object class="IBObjectRecord">
<string key="id">595</string>
<reference key="object" ref="797118978"/>
<reference key="parent" ref="449964678"/>
</object>
<object class="IBObjectRecord">
<string key="id">pqR-xy-5ip</string>
<reference key="object" ref="794026245"/>
<reference key="parent" ref="449964678"/>
</object>
<object class="IBObjectRecord">
<string key="id">596</string>
<reference key="object" ref="1065433476"/>
<reference key="parent" ref="449964678"/>
</object>
<object class="IBObjectRecord">
<string key="id">QB8-6D-hAr</string>
<reference key="object" ref="267605560"/>
<reference key="parent" ref="449964678"/>
</object>
<object class="IBObjectRecord">
<string key="id">Heh-SD-KHE</string>
<reference key="object" ref="638304486"/>
<array class="NSMutableArray" key="children">
<reference ref="201383158"/>
</array>
<reference key="parent" ref="126992598"/>
</object>
<object class="IBObjectRecord">
<string key="id">ysx-9J-ekz</string>
<reference key="object" ref="201383158"/>
<array class="NSMutableArray" key="children">
<reference ref="675525235"/>
<reference ref="834755239"/>
</array>
<reference key="parent" ref="638304486"/>
</object>
<object class="IBObjectRecord">
<string key="id">hfu-OP-8X3</string>
<reference key="object" ref="675525235"/>
<reference key="parent" ref="201383158"/>
</object>
<object class="IBObjectRecord">
<string key="id">490</string>
<reference key="object" ref="251430468"/>
<array class="NSMutableArray" key="children">
<reference ref="119598072"/>
</array>
<reference key="parent" ref="126992598"/>
</object>
<object class="IBObjectRecord">
<string key="id">491</string>
<reference key="object" ref="119598072"/>
<reference key="parent" ref="251430468"/>
</object>
<object class="IBObjectRecord">
<string key="id">420</string>
<reference key="object" ref="806429288"/>
<reference key="parent" ref="0"/>
</object>
<object class="IBObjectRecord">
<string key="id">536</string>
<reference key="object" ref="234942004"/>
<reference key="parent" ref="0"/>
</object>
<object class="IBObjectRecord">
<string key="id">CXy-V7-NaY</string>
<reference key="object" ref="834755239"/>
<reference key="parent" ref="201383158"/>
</object>
</array>
</object>
<dictionary class="NSMutableDictionary" key="flattenedProperties">
<string key="-1.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<boolean value="NO" key="-1.showNotes"/>
<string key="-2.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<boolean value="NO" key="-2.showNotes"/>
<string key="-3.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<boolean value="NO" key="-3.showNotes"/>
<string key="29.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<boolean value="NO" key="29.showNotes"/>
<string key="295.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<boolean value="NO" key="295.showNotes"/>
<string key="296.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<boolean value="NO" key="296.showNotes"/>
<string key="420.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<boolean value="NO" key="420.showNotes"/>
<string key="490.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<boolean value="NO" key="490.showNotes"/>
<string key="491.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<boolean value="NO" key="491.showNotes"/>
<string key="536.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<boolean value="NO" key="536.showNotes"/>
<string key="579.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<boolean value="NO" key="579.showNotes"/>
<string key="592.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<boolean value="NO" key="592.showNotes"/>
<string key="593.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<boolean value="NO" key="593.showNotes"/>
<string key="594.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<boolean value="NO" key="594.showNotes"/>
<string key="595.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<boolean value="NO" key="595.showNotes"/>
<string key="596.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<boolean value="NO" key="596.showNotes"/>
<string key="611.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<boolean value="NO" key="611.showNotes"/>
<string key="7Z7-ot-jqY.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<boolean value="NO" key="7Z7-ot-jqY.showNotes"/>
<string key="81.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<boolean value="NO" key="81.showNotes"/>
<string key="83.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<boolean value="NO" key="83.showNotes"/>
<string key="CXy-V7-NaY.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="GS6-Lb-ftA.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<boolean value="NO" key="GS6-Lb-ftA.showNotes"/>
<string key="GU5-eI-OTq.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<boolean value="NO" key="GU5-eI-OTq.showNotes"/>
<string key="Heh-SD-KHE.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<boolean value="NO" key="Heh-SD-KHE.showNotes"/>
<string key="HhF-Es-coQ.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<boolean value="NO" key="HhF-Es-coQ.showNotes"/>
<string key="IqD-3v-zQT.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<boolean value="NO" key="IqD-3v-zQT.showNotes"/>
<string key="OzD-Nm-tPt.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<boolean value="NO" key="OzD-Nm-tPt.showNotes"/>
<string key="QB8-6D-hAr.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<boolean value="NO" key="QB8-6D-hAr.showNotes"/>
<string key="TOj-vg-cDm.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<boolean value="NO" key="TOj-vg-cDm.showNotes"/>
<string key="XG8-CE-veT.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<boolean value="NO" key="XG8-CE-veT.showNotes"/>
<string key="YN2-V8-ty0.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<boolean value="NO" key="YN2-V8-ty0.showNotes"/>
<string key="e98-We-UX5.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<boolean value="NO" key="e98-We-UX5.showNotes"/>
<string key="hfu-OP-8X3.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<boolean value="NO" key="hfu-OP-8X3.showNotes"/>
<string key="muN-Hw-eeZ.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<boolean value="NO" key="muN-Hw-eeZ.showNotes"/>
<string key="pqR-xy-5ip.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<boolean value="NO" key="pqR-xy-5ip.showNotes"/>
<string key="sH6-na-PTL.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<boolean value="NO" key="sH6-na-PTL.showNotes"/>
<string key="ysx-9J-ekz.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<boolean value="NO" key="ysx-9J-ekz.showNotes"/>
</dictionary>
<dictionary class="NSMutableDictionary" key="unlocalizedProperties"/>
<nil key="activeLocalization"/>
<dictionary class="NSMutableDictionary" key="localizations"/>
<nil key="sourceID"/>
</object>
<object class="IBClassDescriber" key="IBDocument.Classes">
<array class="NSMutableArray" key="referencedPartialClassDescriptions">
<object class="IBPartialClassDescription">
<string key="className">AppController</string>
<string key="superclassName">NSObject</string>
<dictionary class="NSMutableDictionary" key="actions">
<string key="onFileClose:">id</string>
<string key="onRelaunch:">id</string>
<string key="onScreenLandscape:">id</string>
<string key="onScreenPortait:">id</string>
<string key="onScreenZoomOut:">id</string>
<string key="onSetTop:">id</string>
<string key="onViewChangeFrameSize:">id</string>
</dictionary>
<dictionary class="NSMutableDictionary" key="actionInfosByName">
<object class="IBActionInfo" key="onFileClose:">
<string key="name">onFileClose:</string>
<string key="candidateClassName">id</string>
</object>
<object class="IBActionInfo" key="onRelaunch:">
<string key="name">onRelaunch:</string>
<string key="candidateClassName">id</string>
</object>
<object class="IBActionInfo" key="onScreenLandscape:">
<string key="name">onScreenLandscape:</string>
<string key="candidateClassName">id</string>
</object>
<object class="IBActionInfo" key="onScreenPortait:">
<string key="name">onScreenPortait:</string>
<string key="candidateClassName">id</string>
</object>
<object class="IBActionInfo" key="onScreenZoomOut:">
<string key="name">onScreenZoomOut:</string>
<string key="candidateClassName">id</string>
</object>
<object class="IBActionInfo" key="onSetTop:">
<string key="name">onSetTop:</string>
<string key="candidateClassName">id</string>
</object>
<object class="IBActionInfo" key="onViewChangeFrameSize:">
<string key="name">onViewChangeFrameSize:</string>
<string key="candidateClassName">id</string>
</object>
</dictionary>
<object class="NSMutableDictionary" key="outlets">
<string key="NS.key.0">menu</string>
<string key="NS.object.0">NSMenu</string>
</object>
<object class="NSMutableDictionary" key="toOneOutletInfosByName">
<string key="NS.key.0">menu</string>
<object class="IBToOneOutletInfo" key="NS.object.0">
<string key="name">menu</string>
<string key="candidateClassName">NSMenu</string>
</object>
</object>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBProjectSource</string>
<string key="minorKey">./Classes/AppController.h</string>
</object>
</object>
</array>
</object>
<int key="IBDocument.localizationMode">0</int>
<string key="IBDocument.TargetRuntimeIdentifier">IBCocoaFramework</string>
<bool key="IBDocument.previouslyAttemptedUpgradeToXcode5">YES</bool>
<object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDependencies">
<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin.macosx</string>
<real value="1060" key="NS.object.0"/>
</object>
<object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDependencyDefaults">
<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin.macosx</string>
<real value="1080" key="NS.object.0"/>
</object>
<object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDevelopmentDependencies">
<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin.InterfaceBuilder3</string>
<integer value="4600" key="NS.object.0"/>
</object>
<bool key="IBDocument.PluginDeclaredDependenciesTrackSystemTargetVersion">YES</bool>
<int key="IBDocument.defaultPropertyAccessControl">3</int>
<dictionary class="NSMutableDictionary" key="IBDocument.LastKnownImageSizes">
<string key="NSMenuCheckmark">{11, 11}</string>
<string key="NSMenuMixedState">{10, 3}</string>
</dictionary>
</data>
</archive>

View File

@@ -0,0 +1,7 @@
#import <Cocoa/Cocoa.h>
int main(int argc, char *argv[])
{
return NSApplicationMain(argc, (const char **)argv);
}

View File

@@ -0,0 +1,12 @@
/* Class = "NSWindow"; title = "Console"; ObjectID = "1"; */
"1.title" = "控制台";
/* Class = "NSButtonCell"; title = "Clear"; ObjectID = "47"; */
"47.title" = "清除";
/* Class = "NSButtonCell"; title = "scroll bottom"; ObjectID = "51"; */
"51.title" = "自动滚动";
/* Class = "NSButtonCell"; title = "always top"; ObjectID = "61"; */
"61.title" = "总在最前方";

View File

@@ -0,0 +1,197 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="6254" systemVersion="14B25" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none">
<dependencies>
<deployment version="1080" identifier="macosx"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="6254"/>
</dependencies>
<objects>
<customObject id="-2" userLabel="File's Owner" customClass="AppController">
<connections>
<outlet property="delegate" destination="536" id="537"/>
<outlet property="menu" destination="29" id="650"/>
</connections>
</customObject>
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
<customObject id="-3" userLabel="Application" customClass="NSObject"/>
<menu title="AMainMenu" systemMenu="main" id="29">
<items>
<menuItem title="模拟器" id="56">
<menu key="submenu" title="模拟器" systemMenu="apple" id="57">
<items>
<menuItem title="关于 模拟器" id="58">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="orderFrontStandardAboutPanel:" target="-2" id="142"/>
</connections>
</menuItem>
<menuItem isSeparatorItem="YES" id="143">
<modifierMask key="keyEquivalentModifierMask" command="YES"/>
</menuItem>
<menuItem title="服务" id="131">
<menu key="submenu" title="服务" systemMenu="services" id="130"/>
</menuItem>
<menuItem isSeparatorItem="YES" id="144">
<modifierMask key="keyEquivalentModifierMask" command="YES"/>
</menuItem>
<menuItem title="隐藏 模拟器" keyEquivalent="h" id="134">
<connections>
<action selector="hide:" target="-1" id="367"/>
</connections>
</menuItem>
<menuItem title="隐藏其他窗口" keyEquivalent="h" id="145">
<modifierMask key="keyEquivalentModifierMask" option="YES" command="YES"/>
<connections>
<action selector="hideOtherApplications:" target="-1" id="368"/>
</connections>
</menuItem>
<menuItem title="全部显示" id="150">
<connections>
<action selector="unhideAllApplications:" target="-1" id="370"/>
</connections>
</menuItem>
<menuItem isSeparatorItem="YES" id="149">
<modifierMask key="keyEquivalentModifierMask" command="YES"/>
</menuItem>
<menuItem title="退出 模拟器" keyEquivalent="q" id="136">
<connections>
<action selector="onFileClose:" target="-1" id="UyZ-bV-2zL"/>
</connections>
</menuItem>
</items>
</menu>
</menuItem>
<menuItem title="编辑" id="Sqe-GR-erP">
<modifierMask key="keyEquivalentModifierMask"/>
<menu key="submenu" title="编辑" id="k0V-hR-upN">
<items>
<menuItem title="撤销" keyEquivalent="z" id="Ueo-Yj-fzm">
<connections>
<action selector="undo:" target="-1" id="Ex2-6U-hZI"/>
</connections>
</menuItem>
<menuItem title="重做" keyEquivalent="Z" id="x6z-iQ-VK2">
<connections>
<action selector="redo:" target="-1" id="KEx-Aj-tYn"/>
</connections>
</menuItem>
<menuItem isSeparatorItem="YES" id="COi-E7-7M4"/>
<menuItem title="剪切" keyEquivalent="x" id="NAk-12-pg4">
<connections>
<action selector="cut:" target="-1" id="Owu-Ie-Kfg"/>
</connections>
</menuItem>
<menuItem title="拷贝" keyEquivalent="c" id="XOY-ya-lNt">
<connections>
<action selector="copy:" target="-1" id="aIB-pV-N2w"/>
</connections>
</menuItem>
<menuItem title="粘贴" keyEquivalent="v" id="ul0-51-Ibd">
<connections>
<action selector="paste:" target="-1" id="7rk-Tb-7hI"/>
</connections>
</menuItem>
<menuItem title="粘贴并匹配样式" keyEquivalent="V" id="Zvy-7g-x4q">
<modifierMask key="keyEquivalentModifierMask" option="YES" command="YES"/>
<connections>
<action selector="pasteAsPlainText:" target="-1" id="oM4-kj-hTQ"/>
</connections>
</menuItem>
<menuItem title="删除" id="Xyz-QC-wlG">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="delete:" target="-1" id="idJ-aN-6bB"/>
</connections>
</menuItem>
<menuItem title="选择全部" keyEquivalent="a" id="4fT-JL-N6e">
<connections>
<action selector="selectAll:" target="-1" id="pAH-rW-PaD"/>
</connections>
</menuItem>
<menuItem isSeparatorItem="YES" id="osB-R6-2jE"/>
<menuItem title="查找" id="bms-8x-7Yb">
<modifierMask key="keyEquivalentModifierMask"/>
<menu key="submenu" title="查找" id="AXr-4L-lcV">
<items>
<menuItem title="查找" tag="1" keyEquivalent="f" id="GS8-y9-yQY">
<connections>
<action selector="performFindPanelAction:" target="-1" id="jVT-dG-Frl"/>
</connections>
</menuItem>
<menuItem title="查找下一个" tag="2" keyEquivalent="g" id="RJc-P7-Ibq">
<connections>
<action selector="performFindPanelAction:" target="-1" id="yLp-2a-Nuk"/>
</connections>
</menuItem>
<menuItem title="查找上一个" tag="3" keyEquivalent="G" id="f5k-Su-hK0">
<connections>
<action selector="performFindPanelAction:" target="-1" id="uoF-9Z-ef7"/>
</connections>
</menuItem>
<menuItem title="使用查找选择" tag="7" keyEquivalent="e" id="9Zj-Be-aBN">
<connections>
<action selector="performFindPanelAction:" target="-1" id="8hs-AK-0U8"/>
</connections>
</menuItem>
<menuItem title="跳转到选择" keyEquivalent="j" id="4tD-ef-pd8">
<connections>
<action selector="centerSelectionInVisibleArea:" target="-1" id="8xc-J0-7iQ"/>
</connections>
</menuItem>
</items>
</menu>
</menuItem>
</items>
</menu>
</menuItem>
<menuItem title="File" id="83"/>
<menuItem title="Player" id="633">
<modifierMask key="keyEquivalentModifierMask"/>
</menuItem>
<menuItem title="Screen" id="295"/>
<menuItem title="窗口" id="19">
<menu key="submenu" title="窗口" systemMenu="window" id="XuB-dT-g0h">
<items>
<menuItem title="最小化" keyEquivalent="m" id="YrK-j5-jxq">
<connections>
<action selector="performMiniaturize:" target="-1" id="3wr-0O-cTq"/>
</connections>
</menuItem>
<menuItem isSeparatorItem="YES" id="0NY-jh-tsl">
<modifierMask key="keyEquivalentModifierMask" command="YES"/>
</menuItem>
<menuItem title="移到最上层" id="opb-EX-EXV">
<connections>
<action selector="arrangeInFront:" target="-1" id="oT1-07-BON"/>
</connections>
</menuItem>
<menuItem title="置顶" keyEquivalent="a" id="nXh-Uq-d6d">
<modifierMask key="keyEquivalentModifierMask" option="YES" command="YES"/>
<connections>
<action selector="onWindowAlwaysOnTop:" target="-1" id="IM6-Km-MGj"/>
</connections>
</menuItem>
</items>
</menu>
</menuItem>
<menuItem title="帮助" id="490">
<modifierMask key="keyEquivalentModifierMask"/>
<menu key="submenu" title="帮助" systemMenu="help" id="UaO-03-xh1">
<items>
<menuItem title="帮助文档" keyEquivalent="?" id="StN-Og-Ms8">
<connections>
<action selector="showHelp:" target="-1" id="l0h-I0-XAk"/>
</connections>
</menuItem>
</items>
</menu>
</menuItem>
</items>
</menu>
<customObject id="420" customClass="NSFontManager"/>
<customObject id="536" customClass="AppController">
<connections>
<outlet property="menu" destination="29" id="550"/>
</connections>
</customObject>
</objects>
</document>

View File

@@ -0,0 +1,911 @@
// !$*UTF8*$!
{
archiveVersion = 1;
classes = {
};
objectVersion = 46;
objects = {
/* Begin PBXBuildFile section */
15427CD3198F221400DC375D /* libcocos2d iOS.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 15A8A4251834BDA200142BE0 /* libcocos2d iOS.a */; };
15427CEE198F24AF00DC375D /* libcocos2d Mac.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 15A8A4171834BDA200142BE0 /* libcocos2d Mac.a */; };
15A8A4491834C64F00142BE0 /* Icon-114.png in Resources */ = {isa = PBXBuildFile; fileRef = 5023810C17EBBCAC00990C9B /* Icon-114.png */; };
15A8A4881834C90F00142BE0 /* libcurl.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 15A8A4871834C90E00142BE0 /* libcurl.dylib */; };
1A16779D1F540F7400294BB1 /* JavaScriptCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1A16779C1F540F7400294BB1 /* JavaScriptCore.framework */; };
1A16779F1F540F7C00294BB1 /* JavaScriptCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1A16779E1F540F7C00294BB1 /* JavaScriptCore.framework */; };
1A1677BA1F54218200294BB1 /* CFNetwork.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3EB51526195187AF006966AA /* CFNetwork.framework */; };
1A1677BC1F54218800294BB1 /* CFNetwork.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1A1677BB1F54218800294BB1 /* CFNetwork.framework */; };
1A1677BE1F54219E00294BB1 /* libicucore.A.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 1A1677BD1F54219E00294BB1 /* libicucore.A.tbd */; };
1AF4C403178663F200122817 /* libz.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 1AF4C402178663F200122817 /* libz.dylib */; };
3EEEDB61197107C0006A9FF8 /* MediaPlayer.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3EEEDB60197107C0006A9FF8 /* MediaPlayer.framework */; };
403ACAD520CE435000BB433D /* config.json in Resources */ = {isa = PBXBuildFile; fileRef = 403ACAD420CE435000BB433D /* config.json */; };
403ACAD620CE435000BB433D /* config.json in Resources */ = {isa = PBXBuildFile; fileRef = 403ACAD420CE435000BB433D /* config.json */; };
404B24FC20D0AD5E0025EC55 /* SystemConfiguration.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 404B24FB20D0AD5D0025EC55 /* SystemConfiguration.framework */; };
40CEAEBC20CFE034007A3281 /* SystemConfiguration.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 40CEAEBB20CFE033007A3281 /* SystemConfiguration.framework */; };
4D558C851F95B3B00083B43B /* jsb_module_register.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4D558C841F95B3B00083B43B /* jsb_module_register.cpp */; };
4D558C861F95B3BC0083B43B /* jsb_module_register.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4D558C841F95B3B00083B43B /* jsb_module_register.cpp */; };
5023811817EBBCAC00990C9B /* AppController.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5023810817EBBCAC00990C9B /* AppController.mm */; };
5023811917EBBCAC00990C9B /* Default-568h@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 5023810917EBBCAC00990C9B /* Default-568h@2x.png */; };
5023811A17EBBCAC00990C9B /* Default.png in Resources */ = {isa = PBXBuildFile; fileRef = 5023810A17EBBCAC00990C9B /* Default.png */; };
5023811B17EBBCAC00990C9B /* Default@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 5023810B17EBBCAC00990C9B /* Default@2x.png */; };
5023811D17EBBCAC00990C9B /* Icon-120.png in Resources */ = {isa = PBXBuildFile; fileRef = 5023810D17EBBCAC00990C9B /* Icon-120.png */; };
5023811E17EBBCAC00990C9B /* Icon-144.png in Resources */ = {isa = PBXBuildFile; fileRef = 5023810E17EBBCAC00990C9B /* Icon-144.png */; };
5023811F17EBBCAC00990C9B /* Icon-152.png in Resources */ = {isa = PBXBuildFile; fileRef = 5023810F17EBBCAC00990C9B /* Icon-152.png */; };
5023812017EBBCAC00990C9B /* Icon-57.png in Resources */ = {isa = PBXBuildFile; fileRef = 5023811017EBBCAC00990C9B /* Icon-57.png */; };
5023812117EBBCAC00990C9B /* Icon-72.png in Resources */ = {isa = PBXBuildFile; fileRef = 5023811117EBBCAC00990C9B /* Icon-72.png */; };
5023812217EBBCAC00990C9B /* Icon-76.png in Resources */ = {isa = PBXBuildFile; fileRef = 5023811217EBBCAC00990C9B /* Icon-76.png */; };
5023812417EBBCAC00990C9B /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 5023811417EBBCAC00990C9B /* main.m */; };
5023812517EBBCAC00990C9B /* RootViewController.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5023811717EBBCAC00990C9B /* RootViewController.mm */; };
5023813317EBBCE400990C9B /* AppDelegate.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F293BB7E15EB831F00256477 /* AppDelegate.cpp */; };
5023813717EBBCE400990C9B /* libz.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 1AF4C402178663F200122817 /* libz.dylib */; };
5023813E17EBBCE400990C9B /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F293B3CC15EB7BE500256477 /* QuartzCore.framework */; };
5023814017EBBCE400990C9B /* OpenAL.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F293B3D015EB7BE500256477 /* OpenAL.framework */; };
5023814117EBBCE400990C9B /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F293B3D215EB7BE500256477 /* AudioToolbox.framework */; };
5023814417EBBCE400990C9B /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F293B3D815EB7BE500256477 /* Foundation.framework */; };
5023814517EBBCE400990C9B /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F293B3DA15EB7BE500256477 /* CoreGraphics.framework */; };
5023817617EBBE3400990C9B /* Icon.icns in Resources */ = {isa = PBXBuildFile; fileRef = 5023817217EBBE3400990C9B /* Icon.icns */; };
5023817A17EBBE8300990C9B /* OpenGLES.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5023817917EBBE8300990C9B /* OpenGLES.framework */; };
50805AAF17EBBEAA004CFAD3 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 50805AAE17EBBEAA004CFAD3 /* UIKit.framework */; };
5091733617ECE17A00D62437 /* Icon-29.png in Resources */ = {isa = PBXBuildFile; fileRef = 5091733017ECE17A00D62437 /* Icon-29.png */; };
5091733717ECE17A00D62437 /* Icon-40.png in Resources */ = {isa = PBXBuildFile; fileRef = 5091733117ECE17A00D62437 /* Icon-40.png */; };
5091733817ECE17A00D62437 /* Icon-50.png in Resources */ = {isa = PBXBuildFile; fileRef = 5091733217ECE17A00D62437 /* Icon-50.png */; };
5091733917ECE17A00D62437 /* Icon-58.png in Resources */ = {isa = PBXBuildFile; fileRef = 5091733317ECE17A00D62437 /* Icon-58.png */; };
5091733A17ECE17A00D62437 /* Icon-80.png in Resources */ = {isa = PBXBuildFile; fileRef = 5091733417ECE17A00D62437 /* Icon-80.png */; };
5091733B17ECE17A00D62437 /* Icon-100.png in Resources */ = {isa = PBXBuildFile; fileRef = 5091733517ECE17A00D62437 /* Icon-100.png */; };
50D7C96C17EBBEDF005D0B91 /* OpenGL.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 50D7C96B17EBBEDF005D0B91 /* OpenGL.framework */; };
50D7C96E17EBBEE6005D0B91 /* AppKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 50D7C96D17EBBEE6005D0B91 /* AppKit.framework */; };
50D7C97017EBBEEC005D0B91 /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 50D7C96F17EBBEEC005D0B91 /* IOKit.framework */; };
5200BECA1A53D9A500AC45E4 /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5200BEC91A53D9A500AC45E4 /* Security.framework */; };
521A8E7019F0C3D200D177D7 /* Default-667h@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 521A8E6E19F0C3D200D177D7 /* Default-667h@2x.png */; };
521A8E7119F0C3D200D177D7 /* Default-736h@3x.png in Resources */ = {isa = PBXBuildFile; fileRef = 521A8E6F19F0C3D200D177D7 /* Default-736h@3x.png */; };
87A2EC1E1AB34BEE00513747 /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 87A2EC1D1AB34BEE00513747 /* Security.framework */; };
9FB5D5F91A691342002361CA /* libsqlite3.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 9FB5D5F81A691342002361CA /* libsqlite3.dylib */; };
9FB5D60A1A6917D8002361CA /* libsqlite3.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 9FB5D6091A6917D8002361CA /* libsqlite3.dylib */; };
9FD6FC0B1A5D27870028EDC6 /* libsimulator Mac.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 9FD6FC081A5D26580028EDC6 /* libsimulator Mac.a */; settings = {ATTRIBUTES = (Required, ); }; };
9FD6FC0C1A5D278E0028EDC6 /* libsimulator iOS.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 9FD6FC0A1A5D26580028EDC6 /* libsimulator iOS.a */; };
9FD6FC731A5D2A820028EDC6 /* ConsoleWindowController.m in Sources */ = {isa = PBXBuildFile; fileRef = 9FD6FC711A5D2A820028EDC6 /* ConsoleWindowController.m */; };
9FFC07361A4A764100AED399 /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 9FFC07341A4A764100AED399 /* MainMenu.xib */; };
BAC396D31F0F955800EB5F11 /* lang in Resources */ = {isa = PBXBuildFile; fileRef = BAC396D01F0F955800EB5F11 /* lang */; };
BAC396D41F0F955800EB5F11 /* lang in Resources */ = {isa = PBXBuildFile; fileRef = BAC396D01F0F955800EB5F11 /* lang */; };
BAC396D51F0F955800EB5F11 /* RuntimeJsImpl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BAC396D11F0F955800EB5F11 /* RuntimeJsImpl.cpp */; };
BAC396D61F0F955800EB5F11 /* RuntimeJsImpl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BAC396D11F0F955800EB5F11 /* RuntimeJsImpl.cpp */; };
C07828F818B4D72E00BD2287 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = C07828F418B4D72E00BD2287 /* main.m */; };
C07828FA18B4D72E00BD2287 /* SimulatorApp.mm in Sources */ = {isa = PBXBuildFile; fileRef = C07828F718B4D72E00BD2287 /* SimulatorApp.mm */; };
D6B061351803AC000077942B /* CoreMotion.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D6B061341803AC000077942B /* CoreMotion.framework */; };
DA96489E1A70F925001F41E8 /* ConsoleWindow.xib in Resources */ = {isa = PBXBuildFile; fileRef = DA9648A01A70F925001F41E8 /* ConsoleWindow.xib */; };
ED545A981B68A2D300C3958E /* libiconv.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = ED545A971B68A2D300C3958E /* libiconv.dylib */; };
ED545A9A1B68A2DA00C3958E /* libiconv.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = ED545A991B68A2DA00C3958E /* libiconv.dylib */; };
F293B3CD15EB7BE500256477 /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F293B3CC15EB7BE500256477 /* QuartzCore.framework */; };
F293B3D115EB7BE500256477 /* OpenAL.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F293B3D015EB7BE500256477 /* OpenAL.framework */; };
F293B3D315EB7BE500256477 /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F293B3D215EB7BE500256477 /* AudioToolbox.framework */; };
F293B3D515EB7BE500256477 /* AVFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F293B3D415EB7BE500256477 /* AVFoundation.framework */; };
F293B3D915EB7BE500256477 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F293B3D815EB7BE500256477 /* Foundation.framework */; };
F293B3DB15EB7BE500256477 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F293B3DA15EB7BE500256477 /* CoreGraphics.framework */; };
F293BB9C15EB831F00256477 /* AppDelegate.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F293BB7E15EB831F00256477 /* AppDelegate.cpp */; };
FA4634D91D34BD1100C40FDC /* CoreText.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA4634D81D34BD1100C40FDC /* CoreText.framework */; };
/* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */
15A8A4161834BDA200142BE0 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 15A8A4031834BDA200142BE0 /* cocos2d_libs.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = 1551A33F158F2AB200E66CFE;
remoteInfo = "cocos2dx Mac";
};
15A8A4241834BDA200142BE0 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 15A8A4031834BDA200142BE0 /* cocos2d_libs.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = A07A4D641783777C0073F6A7;
remoteInfo = "cocos2dx iOS";
};
15D1F3081994BBCA00302043 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 15A8A4031834BDA200142BE0 /* cocos2d_libs.xcodeproj */;
proxyType = 1;
remoteGlobalIDString = A07A4C241783777C0073F6A7;
remoteInfo = "libcocos2d iOS";
};
9FD6FC071A5D26580028EDC6 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 9FD6FC021A5D26580028EDC6 /* libsimulator.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = 9F7214351A5C271F00DAED06;
remoteInfo = libsimulator;
};
9FD6FC091A5D26580028EDC6 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 9FD6FC021A5D26580028EDC6 /* libsimulator.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = 9F7214851A5C28BA00DAED06;
remoteInfo = libsimulator_iOS;
};
9FF504CB1A5EB19500AFDA55 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 9FD6FC021A5D26580028EDC6 /* libsimulator.xcodeproj */;
proxyType = 1;
remoteGlobalIDString = 9F7214841A5C28BA00DAED06;
remoteInfo = libsimulator_iOS;
};
9FF504CF1A5EB19900AFDA55 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 9FD6FC021A5D26580028EDC6 /* libsimulator.xcodeproj */;
proxyType = 1;
remoteGlobalIDString = 9F7214341A5C271F00DAED06;
remoteInfo = libsimulator;
};
C0A2F04018975FF80072A7AB /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 15A8A4031834BDA200142BE0 /* cocos2d_libs.xcodeproj */;
proxyType = 1;
remoteGlobalIDString = 1551A33E158F2AB200E66CFE;
remoteInfo = "cocos2dx Mac";
};
/* End PBXContainerItemProxy section */
/* Begin PBXFileReference section */
15A8A4031834BDA200142BE0 /* cocos2d_libs.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = cocos2d_libs.xcodeproj; path = ../../../../../build/cocos2d_libs.xcodeproj; sourceTree = "<group>"; };
15A8A4871834C90E00142BE0 /* libcurl.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libcurl.dylib; path = usr/lib/libcurl.dylib; sourceTree = SDKROOT; };
1A16779C1F540F7400294BB1 /* JavaScriptCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = JavaScriptCore.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS10.3.sdk/System/Library/Frameworks/JavaScriptCore.framework; sourceTree = DEVELOPER_DIR; };
1A16779E1F540F7C00294BB1 /* JavaScriptCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = JavaScriptCore.framework; path = System/Library/Frameworks/JavaScriptCore.framework; sourceTree = SDKROOT; };
1A1677BB1F54218800294BB1 /* CFNetwork.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CFNetwork.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS10.3.sdk/System/Library/Frameworks/CFNetwork.framework; sourceTree = DEVELOPER_DIR; };
1A1677BD1F54219E00294BB1 /* libicucore.A.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libicucore.A.tbd; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS10.3.sdk/usr/lib/libicucore.A.tbd; sourceTree = DEVELOPER_DIR; };
1A719F531F8CB0480022549D /* Simulator.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = Simulator.entitlements; sourceTree = "<group>"; };
1AF4C402178663F200122817 /* libz.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libz.dylib; path = usr/lib/libz.dylib; sourceTree = SDKROOT; };
3EB51526195187AF006966AA /* CFNetwork.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CFNetwork.framework; path = System/Library/Frameworks/CFNetwork.framework; sourceTree = SDKROOT; };
3EEEDB60197107C0006A9FF8 /* MediaPlayer.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = MediaPlayer.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.1.sdk/System/Library/Frameworks/MediaPlayer.framework; sourceTree = DEVELOPER_DIR; };
403ACAD420CE435000BB433D /* config.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; name = config.json; path = ../../../config.json; sourceTree = "<group>"; };
404B24FB20D0AD5D0025EC55 /* SystemConfiguration.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SystemConfiguration.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS11.4.sdk/System/Library/Frameworks/SystemConfiguration.framework; sourceTree = DEVELOPER_DIR; };
40CEAEBB20CFE033007A3281 /* SystemConfiguration.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SystemConfiguration.framework; path = System/Library/Frameworks/SystemConfiguration.framework; sourceTree = SDKROOT; };
4D558C841F95B3B00083B43B /* jsb_module_register.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = jsb_module_register.cpp; path = "../../../../../cocos/scripting/js-bindings/manual/jsb_module_register.cpp"; sourceTree = "<group>"; };
5023810717EBBCAC00990C9B /* AppController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppController.h; sourceTree = "<group>"; };
5023810817EBBCAC00990C9B /* AppController.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = AppController.mm; sourceTree = "<group>"; };
5023810917EBBCAC00990C9B /* Default-568h@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default-568h@2x.png"; sourceTree = "<group>"; };
5023810A17EBBCAC00990C9B /* Default.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = Default.png; sourceTree = "<group>"; };
5023810B17EBBCAC00990C9B /* Default@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default@2x.png"; sourceTree = "<group>"; };
5023810C17EBBCAC00990C9B /* Icon-114.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Icon-114.png"; sourceTree = "<group>"; };
5023810D17EBBCAC00990C9B /* Icon-120.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Icon-120.png"; sourceTree = "<group>"; };
5023810E17EBBCAC00990C9B /* Icon-144.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Icon-144.png"; sourceTree = "<group>"; };
5023810F17EBBCAC00990C9B /* Icon-152.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Icon-152.png"; sourceTree = "<group>"; };
5023811017EBBCAC00990C9B /* Icon-57.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Icon-57.png"; sourceTree = "<group>"; };
5023811117EBBCAC00990C9B /* Icon-72.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Icon-72.png"; sourceTree = "<group>"; };
5023811217EBBCAC00990C9B /* Icon-76.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Icon-76.png"; sourceTree = "<group>"; };
5023811317EBBCAC00990C9B /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
5023811417EBBCAC00990C9B /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
5023811517EBBCAC00990C9B /* Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Prefix.pch; sourceTree = "<group>"; };
5023811617EBBCAC00990C9B /* RootViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RootViewController.h; sourceTree = "<group>"; };
5023811717EBBCAC00990C9B /* RootViewController.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = RootViewController.mm; sourceTree = "<group>"; };
5023816B17EBBCE400990C9B /* Simulator.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Simulator.app; sourceTree = BUILT_PRODUCTS_DIR; };
5023817217EBBE3400990C9B /* Icon.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; path = Icon.icns; sourceTree = "<group>"; };
5023817317EBBE3400990C9B /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
5023817517EBBE3400990C9B /* Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Prefix.pch; sourceTree = "<group>"; };
5023817917EBBE8300990C9B /* OpenGLES.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenGLES.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk/System/Library/Frameworks/OpenGLES.framework; sourceTree = DEVELOPER_DIR; };
50805AAE17EBBEAA004CFAD3 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk/System/Library/Frameworks/UIKit.framework; sourceTree = DEVELOPER_DIR; };
5091733017ECE17A00D62437 /* Icon-29.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Icon-29.png"; sourceTree = "<group>"; };
5091733117ECE17A00D62437 /* Icon-40.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Icon-40.png"; sourceTree = "<group>"; };
5091733217ECE17A00D62437 /* Icon-50.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Icon-50.png"; sourceTree = "<group>"; };
5091733317ECE17A00D62437 /* Icon-58.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Icon-58.png"; sourceTree = "<group>"; };
5091733417ECE17A00D62437 /* Icon-80.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Icon-80.png"; sourceTree = "<group>"; };
5091733517ECE17A00D62437 /* Icon-100.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Icon-100.png"; sourceTree = "<group>"; };
50D7C96B17EBBEDF005D0B91 /* OpenGL.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenGL.framework; path = System/Library/Frameworks/OpenGL.framework; sourceTree = SDKROOT; };
50D7C96D17EBBEE6005D0B91 /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = System/Library/Frameworks/AppKit.framework; sourceTree = SDKROOT; };
50D7C96F17EBBEEC005D0B91 /* IOKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = IOKit.framework; path = System/Library/Frameworks/IOKit.framework; sourceTree = SDKROOT; };
5200BEC91A53D9A500AC45E4 /* Security.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Security.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.1.sdk/System/Library/Frameworks/Security.framework; sourceTree = DEVELOPER_DIR; };
521A8E6E19F0C3D200D177D7 /* Default-667h@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default-667h@2x.png"; sourceTree = "<group>"; };
521A8E6F19F0C3D200D177D7 /* Default-736h@3x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default-736h@3x.png"; sourceTree = "<group>"; };
87A2EC1D1AB34BEE00513747 /* Security.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Security.framework; path = System/Library/Frameworks/Security.framework; sourceTree = SDKROOT; };
9FB5D5F81A691342002361CA /* libsqlite3.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libsqlite3.dylib; path = usr/lib/libsqlite3.dylib; sourceTree = SDKROOT; };
9FB5D6091A6917D8002361CA /* libsqlite3.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libsqlite3.dylib; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.1.sdk/usr/lib/libsqlite3.dylib; sourceTree = DEVELOPER_DIR; };
9FD6FC021A5D26580028EDC6 /* libsimulator.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = libsimulator.xcodeproj; path = ../../../libsimulator/proj.ios_mac/libsimulator.xcodeproj; sourceTree = "<group>"; };
9FD6FC701A5D2A820028EDC6 /* ConsoleWindowController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ConsoleWindowController.h; sourceTree = "<group>"; };
9FD6FC711A5D2A820028EDC6 /* ConsoleWindowController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ConsoleWindowController.m; sourceTree = "<group>"; };
9FFC07351A4A764100AED399 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/MainMenu.xib; sourceTree = "<group>"; };
9FFC07371A4A765100AED399 /* zh-Hans */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = "zh-Hans"; path = "zh-Hans.lproj/MainMenu.xib"; sourceTree = "<group>"; };
BAC396D01F0F955800EB5F11 /* lang */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = lang; path = "../Classes/ide-support/lang"; sourceTree = "<group>"; };
BAC396D11F0F955800EB5F11 /* RuntimeJsImpl.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = RuntimeJsImpl.cpp; path = "../Classes/ide-support/RuntimeJsImpl.cpp"; sourceTree = "<group>"; };
BAC396D21F0F955800EB5F11 /* RuntimeJsImpl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RuntimeJsImpl.h; path = "../Classes/ide-support/RuntimeJsImpl.h"; sourceTree = "<group>"; };
BAC396D71F0F973C00EB5F11 /* CodeIDESupport.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CodeIDESupport.h; path = "../Classes/ide-support/CodeIDESupport.h"; sourceTree = "<group>"; };
C07828F418B4D72E00BD2287 /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
C07828F618B4D72E00BD2287 /* SimulatorApp.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SimulatorApp.h; sourceTree = "<group>"; };
C07828F718B4D72E00BD2287 /* SimulatorApp.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = SimulatorApp.mm; sourceTree = "<group>"; };
D6B061341803AC000077942B /* CoreMotion.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreMotion.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk/System/Library/Frameworks/CoreMotion.framework; sourceTree = DEVELOPER_DIR; };
DA96489F1A70F925001F41E8 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/ConsoleWindow.xib; sourceTree = "<group>"; };
DA9648A31A70F93D001F41E8 /* zh-Hans */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hans"; path = "zh-Hans.lproj/ConsoleWindow.strings"; sourceTree = "<group>"; };
ED545A971B68A2D300C3958E /* libiconv.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libiconv.dylib; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.4.sdk/usr/lib/libiconv.dylib; sourceTree = DEVELOPER_DIR; };
ED545A991B68A2DA00C3958E /* libiconv.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libiconv.dylib; path = usr/lib/libiconv.dylib; sourceTree = SDKROOT; };
F293B3C815EB7BE500256477 /* Simulator.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Simulator.app; sourceTree = BUILT_PRODUCTS_DIR; };
F293B3CC15EB7BE500256477 /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; };
F293B3CE15EB7BE500256477 /* OpenGLES.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenGLES.framework; path = System/Library/Frameworks/OpenGLES.framework; sourceTree = SDKROOT; };
F293B3D015EB7BE500256477 /* OpenAL.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenAL.framework; path = System/Library/Frameworks/OpenAL.framework; sourceTree = SDKROOT; };
F293B3D215EB7BE500256477 /* AudioToolbox.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AudioToolbox.framework; path = System/Library/Frameworks/AudioToolbox.framework; sourceTree = SDKROOT; };
F293B3D415EB7BE500256477 /* AVFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AVFoundation.framework; path = System/Library/Frameworks/AVFoundation.framework; sourceTree = SDKROOT; };
F293B3D615EB7BE500256477 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; };
F293B3D815EB7BE500256477 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
F293B3DA15EB7BE500256477 /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; };
F293BB7E15EB831F00256477 /* AppDelegate.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = AppDelegate.cpp; path = ../Classes/AppDelegate.cpp; sourceTree = "<group>"; };
F293BB7F15EB831F00256477 /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AppDelegate.h; path = ../Classes/AppDelegate.h; sourceTree = "<group>"; };
FA4634D81D34BD1100C40FDC /* CoreText.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreText.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS9.3.sdk/System/Library/Frameworks/CoreText.framework; sourceTree = DEVELOPER_DIR; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
5023813617EBBCE400990C9B /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
40CEAEBC20CFE034007A3281 /* SystemConfiguration.framework in Frameworks */,
1A1677BA1F54218200294BB1 /* CFNetwork.framework in Frameworks */,
1A16779F1F540F7C00294BB1 /* JavaScriptCore.framework in Frameworks */,
ED545A9A1B68A2DA00C3958E /* libiconv.dylib in Frameworks */,
87A2EC1E1AB34BEE00513747 /* Security.framework in Frameworks */,
9FB5D5F91A691342002361CA /* libsqlite3.dylib in Frameworks */,
9FD6FC0B1A5D27870028EDC6 /* libsimulator Mac.a in Frameworks */,
15427CEE198F24AF00DC375D /* libcocos2d Mac.a in Frameworks */,
15A8A4881834C90F00142BE0 /* libcurl.dylib in Frameworks */,
50D7C97017EBBEEC005D0B91 /* IOKit.framework in Frameworks */,
50D7C96E17EBBEE6005D0B91 /* AppKit.framework in Frameworks */,
50D7C96C17EBBEDF005D0B91 /* OpenGL.framework in Frameworks */,
5023813717EBBCE400990C9B /* libz.dylib in Frameworks */,
5023813E17EBBCE400990C9B /* QuartzCore.framework in Frameworks */,
5023814017EBBCE400990C9B /* OpenAL.framework in Frameworks */,
5023814117EBBCE400990C9B /* AudioToolbox.framework in Frameworks */,
5023814417EBBCE400990C9B /* Foundation.framework in Frameworks */,
5023814517EBBCE400990C9B /* CoreGraphics.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
F293B3C515EB7BE500256477 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
404B24FC20D0AD5E0025EC55 /* SystemConfiguration.framework in Frameworks */,
1A1677BE1F54219E00294BB1 /* libicucore.A.tbd in Frameworks */,
1A1677BC1F54218800294BB1 /* CFNetwork.framework in Frameworks */,
1A16779D1F540F7400294BB1 /* JavaScriptCore.framework in Frameworks */,
FA4634D91D34BD1100C40FDC /* CoreText.framework in Frameworks */,
ED545A981B68A2D300C3958E /* libiconv.dylib in Frameworks */,
9FB5D60A1A6917D8002361CA /* libsqlite3.dylib in Frameworks */,
9FD6FC0C1A5D278E0028EDC6 /* libsimulator iOS.a in Frameworks */,
5200BECA1A53D9A500AC45E4 /* Security.framework in Frameworks */,
15427CD3198F221400DC375D /* libcocos2d iOS.a in Frameworks */,
3EEEDB61197107C0006A9FF8 /* MediaPlayer.framework in Frameworks */,
D6B061351803AC000077942B /* CoreMotion.framework in Frameworks */,
1AF4C403178663F200122817 /* libz.dylib in Frameworks */,
50805AAF17EBBEAA004CFAD3 /* UIKit.framework in Frameworks */,
5023817A17EBBE8300990C9B /* OpenGLES.framework in Frameworks */,
F293B3CD15EB7BE500256477 /* QuartzCore.framework in Frameworks */,
F293B3D115EB7BE500256477 /* OpenAL.framework in Frameworks */,
F293B3D315EB7BE500256477 /* AudioToolbox.framework in Frameworks */,
F293B3D515EB7BE500256477 /* AVFoundation.framework in Frameworks */,
F293B3D915EB7BE500256477 /* Foundation.framework in Frameworks */,
F293B3DB15EB7BE500256477 /* CoreGraphics.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
15A8A4041834BDA200142BE0 /* Products */ = {
isa = PBXGroup;
children = (
15A8A4171834BDA200142BE0 /* libcocos2d Mac.a */,
15A8A4251834BDA200142BE0 /* libcocos2d iOS.a */,
);
name = Products;
sourceTree = "<group>";
};
5023810617EBBCAC00990C9B /* ios */ = {
isa = PBXGroup;
children = (
521A8E6E19F0C3D200D177D7 /* Default-667h@2x.png */,
521A8E6F19F0C3D200D177D7 /* Default-736h@3x.png */,
5023810717EBBCAC00990C9B /* AppController.h */,
5023810817EBBCAC00990C9B /* AppController.mm */,
5023810917EBBCAC00990C9B /* Default-568h@2x.png */,
5023810A17EBBCAC00990C9B /* Default.png */,
5023810B17EBBCAC00990C9B /* Default@2x.png */,
5091734A17ECE18300D62437 /* Icons */,
5023811317EBBCAC00990C9B /* Info.plist */,
5023811417EBBCAC00990C9B /* main.m */,
5023811517EBBCAC00990C9B /* Prefix.pch */,
5023811617EBBCAC00990C9B /* RootViewController.h */,
5023811717EBBCAC00990C9B /* RootViewController.mm */,
);
path = ios;
sourceTree = "<group>";
};
5023817117EBBE3400990C9B /* mac */ = {
isa = PBXGroup;
children = (
1A719F531F8CB0480022549D /* Simulator.entitlements */,
DA9648A01A70F925001F41E8 /* ConsoleWindow.xib */,
9FD6FC701A5D2A820028EDC6 /* ConsoleWindowController.h */,
9FD6FC711A5D2A820028EDC6 /* ConsoleWindowController.m */,
5023817217EBBE3400990C9B /* Icon.icns */,
9FFC07341A4A764100AED399 /* MainMenu.xib */,
C07828F418B4D72E00BD2287 /* main.m */,
C07828F618B4D72E00BD2287 /* SimulatorApp.h */,
C07828F718B4D72E00BD2287 /* SimulatorApp.mm */,
5023817317EBBE3400990C9B /* Info.plist */,
5023817517EBBE3400990C9B /* Prefix.pch */,
);
path = mac;
sourceTree = "<group>";
};
5091734A17ECE18300D62437 /* Icons */ = {
isa = PBXGroup;
children = (
5091733017ECE17A00D62437 /* Icon-29.png */,
5091733117ECE17A00D62437 /* Icon-40.png */,
5091733217ECE17A00D62437 /* Icon-50.png */,
5091733317ECE17A00D62437 /* Icon-58.png */,
5091733417ECE17A00D62437 /* Icon-80.png */,
5091733517ECE17A00D62437 /* Icon-100.png */,
5023810C17EBBCAC00990C9B /* Icon-114.png */,
5023810D17EBBCAC00990C9B /* Icon-120.png */,
5023810E17EBBCAC00990C9B /* Icon-144.png */,
5023810F17EBBCAC00990C9B /* Icon-152.png */,
5023811017EBBCAC00990C9B /* Icon-57.png */,
5023811117EBBCAC00990C9B /* Icon-72.png */,
5023811217EBBCAC00990C9B /* Icon-76.png */,
);
name = Icons;
sourceTree = "<group>";
};
9FD6FC031A5D26580028EDC6 /* Products */ = {
isa = PBXGroup;
children = (
9FD6FC081A5D26580028EDC6 /* libsimulator Mac.a */,
9FD6FC0A1A5D26580028EDC6 /* libsimulator iOS.a */,
);
name = Products;
sourceTree = "<group>";
};
BAC396CF1F0F937800EB5F11 /* ide-support */ = {
isa = PBXGroup;
children = (
BAC396D71F0F973C00EB5F11 /* CodeIDESupport.h */,
BAC396D01F0F955800EB5F11 /* lang */,
BAC396D11F0F955800EB5F11 /* RuntimeJsImpl.cpp */,
BAC396D21F0F955800EB5F11 /* RuntimeJsImpl.h */,
);
name = "ide-support";
sourceTree = "<group>";
};
F293B3BD15EB7BE500256477 = {
isa = PBXGroup;
children = (
9FD6FC021A5D26580028EDC6 /* libsimulator.xcodeproj */,
15A8A4031834BDA200142BE0 /* cocos2d_libs.xcodeproj */,
5023810617EBBCAC00990C9B /* ios */,
5023817117EBBE3400990C9B /* mac */,
F293BB7C15EB830F00256477 /* Classes */,
F293B3CB15EB7BE500256477 /* Frameworks */,
F293B3C915EB7BE500256477 /* Products */,
403ACAD420CE435000BB433D /* config.json */,
);
sourceTree = "<group>";
};
F293B3C915EB7BE500256477 /* Products */ = {
isa = PBXGroup;
children = (
F293B3C815EB7BE500256477 /* Simulator.app */,
5023816B17EBBCE400990C9B /* Simulator.app */,
);
name = Products;
sourceTree = "<group>";
};
F293B3CB15EB7BE500256477 /* Frameworks */ = {
isa = PBXGroup;
children = (
40CEAEBB20CFE033007A3281 /* SystemConfiguration.framework */,
404B24FB20D0AD5D0025EC55 /* SystemConfiguration.framework */,
1A1677BD1F54219E00294BB1 /* libicucore.A.tbd */,
1A1677BB1F54218800294BB1 /* CFNetwork.framework */,
1A16779E1F540F7C00294BB1 /* JavaScriptCore.framework */,
1A16779C1F540F7400294BB1 /* JavaScriptCore.framework */,
FA4634D81D34BD1100C40FDC /* CoreText.framework */,
ED545A991B68A2DA00C3958E /* libiconv.dylib */,
ED545A971B68A2D300C3958E /* libiconv.dylib */,
87A2EC1D1AB34BEE00513747 /* Security.framework */,
9FB5D6091A6917D8002361CA /* libsqlite3.dylib */,
9FB5D5F81A691342002361CA /* libsqlite3.dylib */,
5200BEC91A53D9A500AC45E4 /* Security.framework */,
3EEEDB60197107C0006A9FF8 /* MediaPlayer.framework */,
3EB51526195187AF006966AA /* CFNetwork.framework */,
15A8A4871834C90E00142BE0 /* libcurl.dylib */,
D6B061341803AC000077942B /* CoreMotion.framework */,
50D7C96F17EBBEEC005D0B91 /* IOKit.framework */,
50D7C96D17EBBEE6005D0B91 /* AppKit.framework */,
50D7C96B17EBBEDF005D0B91 /* OpenGL.framework */,
50805AAE17EBBEAA004CFAD3 /* UIKit.framework */,
5023817917EBBE8300990C9B /* OpenGLES.framework */,
1AF4C402178663F200122817 /* libz.dylib */,
F293B3CC15EB7BE500256477 /* QuartzCore.framework */,
F293B3CE15EB7BE500256477 /* OpenGLES.framework */,
F293B3D015EB7BE500256477 /* OpenAL.framework */,
F293B3D215EB7BE500256477 /* AudioToolbox.framework */,
F293B3D415EB7BE500256477 /* AVFoundation.framework */,
F293B3D615EB7BE500256477 /* UIKit.framework */,
F293B3D815EB7BE500256477 /* Foundation.framework */,
F293B3DA15EB7BE500256477 /* CoreGraphics.framework */,
);
name = Frameworks;
sourceTree = "<group>";
};
F293BB7C15EB830F00256477 /* Classes */ = {
isa = PBXGroup;
children = (
4D558C841F95B3B00083B43B /* jsb_module_register.cpp */,
BAC396CF1F0F937800EB5F11 /* ide-support */,
F293BB7E15EB831F00256477 /* AppDelegate.cpp */,
F293BB7F15EB831F00256477 /* AppDelegate.h */,
);
name = Classes;
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
5023812617EBBCE400990C9B /* Simulator Mac */ = {
isa = PBXNativeTarget;
buildConfigurationList = 5023816817EBBCE400990C9B /* Build configuration list for PBXNativeTarget "Simulator Mac" */;
buildPhases = (
5023813117EBBCE400990C9B /* Sources */,
5023813617EBBCE400990C9B /* Frameworks */,
5023814617EBBCE400990C9B /* Resources */,
);
buildRules = (
);
dependencies = (
9FF504D01A5EB19900AFDA55 /* PBXTargetDependency */,
C0A2F04118975FF80072A7AB /* PBXTargetDependency */,
);
name = "Simulator Mac";
productName = simulator;
productReference = 5023816B17EBBCE400990C9B /* Simulator.app */;
productType = "com.apple.product-type.application";
};
F293B3C715EB7BE500256477 /* Simulator iOS */ = {
isa = PBXNativeTarget;
buildConfigurationList = F293B6C415EB7BEA00256477 /* Build configuration list for PBXNativeTarget "Simulator iOS" */;
buildPhases = (
F293B3C415EB7BE500256477 /* Sources */,
F293B3C515EB7BE500256477 /* Frameworks */,
F293B3C615EB7BE500256477 /* Resources */,
);
buildRules = (
);
dependencies = (
9FF504CC1A5EB19500AFDA55 /* PBXTargetDependency */,
15D1F3091994BBCA00302043 /* PBXTargetDependency */,
);
name = "Simulator iOS";
productName = simulator;
productReference = F293B3C815EB7BE500256477 /* Simulator.app */;
productType = "com.apple.product-type.application";
};
/* End PBXNativeTarget section */
/* Begin PBXProject section */
F293B3BF15EB7BE500256477 /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 0500;
};
buildConfigurationList = F293B3C215EB7BE500256477 /* Build configuration list for PBXProject "simulator" */;
compatibilityVersion = "Xcode 3.2";
developmentRegion = English;
hasScannedForEncodings = 0;
knownRegions = (
en,
Base,
"zh-Hans",
);
mainGroup = F293B3BD15EB7BE500256477;
productRefGroup = F293B3C915EB7BE500256477 /* Products */;
projectDirPath = "";
projectReferences = (
{
ProductGroup = 15A8A4041834BDA200142BE0 /* Products */;
ProjectRef = 15A8A4031834BDA200142BE0 /* cocos2d_libs.xcodeproj */;
},
{
ProductGroup = 9FD6FC031A5D26580028EDC6 /* Products */;
ProjectRef = 9FD6FC021A5D26580028EDC6 /* libsimulator.xcodeproj */;
},
);
projectRoot = "";
targets = (
F293B3C715EB7BE500256477 /* Simulator iOS */,
5023812617EBBCE400990C9B /* Simulator Mac */,
);
};
/* End PBXProject section */
/* Begin PBXReferenceProxy section */
15A8A4171834BDA200142BE0 /* libcocos2d Mac.a */ = {
isa = PBXReferenceProxy;
fileType = archive.ar;
path = "libcocos2d Mac.a";
remoteRef = 15A8A4161834BDA200142BE0 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
15A8A4251834BDA200142BE0 /* libcocos2d iOS.a */ = {
isa = PBXReferenceProxy;
fileType = archive.ar;
path = "libcocos2d iOS.a";
remoteRef = 15A8A4241834BDA200142BE0 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
9FD6FC081A5D26580028EDC6 /* libsimulator Mac.a */ = {
isa = PBXReferenceProxy;
fileType = archive.ar;
path = "libsimulator Mac.a";
remoteRef = 9FD6FC071A5D26580028EDC6 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
9FD6FC0A1A5D26580028EDC6 /* libsimulator iOS.a */ = {
isa = PBXReferenceProxy;
fileType = archive.ar;
path = "libsimulator iOS.a";
remoteRef = 9FD6FC091A5D26580028EDC6 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
/* End PBXReferenceProxy section */
/* Begin PBXResourcesBuildPhase section */
5023814617EBBCE400990C9B /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
BAC396D41F0F955800EB5F11 /* lang in Resources */,
DA96489E1A70F925001F41E8 /* ConsoleWindow.xib in Resources */,
403ACAD620CE435000BB433D /* config.json in Resources */,
5023817617EBBE3400990C9B /* Icon.icns in Resources */,
9FFC07361A4A764100AED399 /* MainMenu.xib in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
F293B3C615EB7BE500256477 /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
15A8A4491834C64F00142BE0 /* Icon-114.png in Resources */,
5023811D17EBBCAC00990C9B /* Icon-120.png in Resources */,
5091733B17ECE17A00D62437 /* Icon-100.png in Resources */,
5023811B17EBBCAC00990C9B /* Default@2x.png in Resources */,
5091733617ECE17A00D62437 /* Icon-29.png in Resources */,
5023811917EBBCAC00990C9B /* Default-568h@2x.png in Resources */,
5091733917ECE17A00D62437 /* Icon-58.png in Resources */,
5023811F17EBBCAC00990C9B /* Icon-152.png in Resources */,
5023812017EBBCAC00990C9B /* Icon-57.png in Resources */,
521A8E7019F0C3D200D177D7 /* Default-667h@2x.png in Resources */,
BAC396D31F0F955800EB5F11 /* lang in Resources */,
5023812217EBBCAC00990C9B /* Icon-76.png in Resources */,
5091733A17ECE17A00D62437 /* Icon-80.png in Resources */,
5091733717ECE17A00D62437 /* Icon-40.png in Resources */,
5023811E17EBBCAC00990C9B /* Icon-144.png in Resources */,
5023811A17EBBCAC00990C9B /* Default.png in Resources */,
5091733817ECE17A00D62437 /* Icon-50.png in Resources */,
403ACAD520CE435000BB433D /* config.json in Resources */,
5023812117EBBCAC00990C9B /* Icon-72.png in Resources */,
521A8E7119F0C3D200D177D7 /* Default-736h@3x.png in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXResourcesBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
5023813117EBBCE400990C9B /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
C07828FA18B4D72E00BD2287 /* SimulatorApp.mm in Sources */,
5023813317EBBCE400990C9B /* AppDelegate.cpp in Sources */,
4D558C861F95B3BC0083B43B /* jsb_module_register.cpp in Sources */,
9FD6FC731A5D2A820028EDC6 /* ConsoleWindowController.m in Sources */,
C07828F818B4D72E00BD2287 /* main.m in Sources */,
BAC396D61F0F955800EB5F11 /* RuntimeJsImpl.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
F293B3C415EB7BE500256477 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
5023812517EBBCAC00990C9B /* RootViewController.mm in Sources */,
F293BB9C15EB831F00256477 /* AppDelegate.cpp in Sources */,
4D558C851F95B3B00083B43B /* jsb_module_register.cpp in Sources */,
5023812417EBBCAC00990C9B /* main.m in Sources */,
5023811817EBBCAC00990C9B /* AppController.mm in Sources */,
BAC396D51F0F955800EB5F11 /* RuntimeJsImpl.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase section */
/* Begin PBXTargetDependency section */
15D1F3091994BBCA00302043 /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
name = "libcocos2d iOS";
targetProxy = 15D1F3081994BBCA00302043 /* PBXContainerItemProxy */;
};
9FF504CC1A5EB19500AFDA55 /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
name = libsimulator_iOS;
targetProxy = 9FF504CB1A5EB19500AFDA55 /* PBXContainerItemProxy */;
};
9FF504D01A5EB19900AFDA55 /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
name = libsimulator;
targetProxy = 9FF504CF1A5EB19900AFDA55 /* PBXContainerItemProxy */;
};
C0A2F04118975FF80072A7AB /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
name = "cocos2dx Mac";
targetProxy = C0A2F04018975FF80072A7AB /* PBXContainerItemProxy */;
};
/* End PBXTargetDependency section */
/* Begin PBXVariantGroup section */
9FFC07341A4A764100AED399 /* MainMenu.xib */ = {
isa = PBXVariantGroup;
children = (
9FFC07351A4A764100AED399 /* Base */,
9FFC07371A4A765100AED399 /* zh-Hans */,
);
name = MainMenu.xib;
sourceTree = "<group>";
};
DA9648A01A70F925001F41E8 /* ConsoleWindow.xib */ = {
isa = PBXVariantGroup;
children = (
DA96489F1A70F925001F41E8 /* Base */,
DA9648A31A70F93D001F41E8 /* zh-Hans */,
);
name = ConsoleWindow.xib;
sourceTree = "<group>";
};
/* End PBXVariantGroup section */
/* Begin XCBuildConfiguration section */
5023816917EBBCE400990C9B /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = YES;
ARCHS = "$(ARCHS_STANDARD_64_BIT)";
CODE_SIGN_ENTITLEMENTS = mac/Simulator.entitlements;
COMBINE_HIDPI_IMAGES = YES;
CONFIGURATION_BUILD_DIR = ../../../../../simulator/mac;
GCC_DYNAMIC_NO_PIC = NO;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = mac/Prefix.pch;
GCC_PREPROCESSOR_DEFINITIONS = (
"$(inherited)",
GLFW_EXPOSE_NATIVE_COCOA,
GLFW_EXPOSE_NATIVE_NSGL,
CC_TARGET_OS_MAC,
);
HEADER_SEARCH_PATHS = (
"$(SRCROOT)/../Classes",
"$(SRCROOT)/../../../libsimulator/lib",
"$(SRCROOT)/../../../libsimulator/lib/protobuf-lite",
);
INFOPLIST_FILE = mac/Info.plist;
LIBRARY_SEARCH_PATHS = "";
MACOSX_DEPLOYMENT_TARGET = 10.8;
OTHER_LDFLAGS = (
"-image_base",
100000000,
"-pagezero_size",
10000,
);
PRODUCT_NAME = Simulator;
SDKROOT = macosx;
USER_HEADER_SEARCH_PATHS = "$(inherited) $(SRCROOT)/../../../../../cocos/platform/mac $(SRCROOT)/../../../../../external/mac/include $(SRCROOT)/../../../../../external/mac/include/glfw3 $(SRCROOT)/../../../../../external/mac/include/spidermonkey $(SRCROOT)/../../../../../external/sources $(SRCROOT)/../../../../../external/mac/include/v8";
VALID_ARCHS = "$(ARCHS_STANDARD_64_BIT)";
};
name = Debug;
};
5023816A17EBBCE400990C9B /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = YES;
ARCHS = "$(ARCHS_STANDARD_64_BIT)";
CODE_SIGN_ENTITLEMENTS = mac/Simulator.entitlements;
COMBINE_HIDPI_IMAGES = YES;
CONFIGURATION_BUILD_DIR = ../../../../../simulator/mac;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = mac/Prefix.pch;
GCC_PREPROCESSOR_DEFINITIONS = (
"$(inherited)",
GLFW_EXPOSE_NATIVE_COCOA,
GLFW_EXPOSE_NATIVE_NSGL,
CC_TARGET_OS_MAC,
);
HEADER_SEARCH_PATHS = (
"$(SRCROOT)/../Classes",
"$(SRCROOT)/../../../libsimulator/lib",
"$(SRCROOT)/../../../libsimulator/lib/protobuf-lite",
);
INFOPLIST_FILE = mac/Info.plist;
LIBRARY_SEARCH_PATHS = "";
MACOSX_DEPLOYMENT_TARGET = 10.8;
OTHER_LDFLAGS = (
"-image_base",
100000000,
"-pagezero_size",
10000,
);
PRODUCT_NAME = Simulator;
SDKROOT = macosx;
USER_HEADER_SEARCH_PATHS = "$(inherited) $(SRCROOT)/../../../../../cocos/platform/mac $(SRCROOT)/../../../../../external/mac/include $(SRCROOT)/../../../../../external/mac/include/glfw3 $(SRCROOT)/../../../../../external/mac/include/spidermonkey $(SRCROOT)/../../../../../external/sources $(SRCROOT)/../../../../../external/mac/include/v8";
VALID_ARCHS = "$(ARCHS_STANDARD_64_BIT)";
};
name = Release;
};
F293B6C215EB7BEA00256477 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ARCHS = "$(ARCHS_STANDARD_64_BIT)";
CLANG_CXX_LANGUAGE_STANDARD = "c++0x";
CLANG_CXX_LIBRARY = "libc++";
COPY_PHASE_STRIP = NO;
GCC_C_LANGUAGE_STANDARD = c99;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PREPROCESSOR_DEFINITIONS = (
"COCOS2D_DEBUG=1",
USE_FILE32API,
"CC_LUA_ENGINE_ENABLED=1",
"CC_ENABLE_CHIPMUNK_INTEGRATION=1",
COCOS2D_JAVASCRIPT,
);
GCC_SYMBOLS_PRIVATE_EXTERN = NO;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
HEADER_SEARCH_PATHS = "";
IPHONEOS_DEPLOYMENT_TARGET = 5.1;
MACOSX_DEPLOYMENT_TARGET = 10.8;
ONLY_ACTIVE_ARCH = YES;
PRODUCT_NAME = "$(TARGET_NAME)";
USER_HEADER_SEARCH_PATHS = "$(SRCROOT)/../../../../../ $(SRCROOT)/../../../../../cocos $(SRCROOT)/../../../../../cocos/base $(SRCROOT)/../../../../../cocos/physics $(SRCROOT)/../../../../../cocos/math/kazmath $(SRCROOT)/../../../../../cocos/2d $(SRCROOT)/../../../../../cocos/ui $(SRCROOT)/../../../../../cocos/network $(SRCROOT)/../../../../../cocos/audio/include $(SRCROOT)/../../../../../cocos/editor-support $(SRCROOT)/../../../../../extensions $(SRCROOT)/../../../../../external $(SRCROOT)/../../../../../external/chipmunk/include/chipmunk $(SRCROOT)/../../../../../external/lua/luajit/include $(SRCROOT)/../../../../../external/lua/tolua $(SRCROOT)/../../../../../cocos/scripting/lua-bindings/manual $(SRCROOT)/../../../../../cocos/scripting/lua-bindings/auto $(SRCROOT)/../../../../../cocos/scripting/js-bindings/auto $(SRCROOT)/../../../../../cocos/scripting/js-bindings/manual $(SRCROOT)/../../../../../external/spidermonkey/include/mac";
VALID_ARCHS = "$(ARCHS_STANDARD_64_BIT)";
};
name = Debug;
};
F293B6C315EB7BEA00256477 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ARCHS = "$(ARCHS_STANDARD_64_BIT)";
CLANG_CXX_LANGUAGE_STANDARD = "c++0x";
CLANG_CXX_LIBRARY = "libc++";
GCC_C_LANGUAGE_STANDARD = c99;
GCC_PREPROCESSOR_DEFINITIONS = (
"COCOS2D_DEBUG=1",
USE_FILE32API,
"CC_LUA_ENGINE_ENABLED=1",
"CC_ENABLE_CHIPMUNK_INTEGRATION=1",
COCOS2D_JAVASCRIPT,
NDEBUG,
);
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
HEADER_SEARCH_PATHS = "";
IPHONEOS_DEPLOYMENT_TARGET = 5.1;
MACOSX_DEPLOYMENT_TARGET = 10.8;
OTHER_CFLAGS = "-DNS_BLOCK_ASSERTIONS=1";
PRODUCT_NAME = "$(TARGET_NAME)";
USER_HEADER_SEARCH_PATHS = "$(SRCROOT)/../../../../../ $(SRCROOT)/../../../../../cocos $(SRCROOT)/../../../../../cocos/base $(SRCROOT)/../../../../../cocos/physics $(SRCROOT)/../../../../../cocos/math/kazmath $(SRCROOT)/../../../../../cocos/2d $(SRCROOT)/../../../../../cocos/ui $(SRCROOT)/../../../../../cocos/network $(SRCROOT)/../../../../../cocos/audio/include $(SRCROOT)/../../../../../cocos/editor-support $(SRCROOT)/../../../../../extensions $(SRCROOT)/../../../../../external $(SRCROOT)/../../../../../external/chipmunk/include/chipmunk $(SRCROOT)/../../../../../external/lua/luajit/include $(SRCROOT)/../../../../../external/lua/tolua $(SRCROOT)/../../../../../cocos/scripting/lua-bindings/manual $(SRCROOT)/../../../../../cocos/scripting/lua-bindings/auto $(SRCROOT)/../../../../../cocos/scripting/js-bindings/auto $(SRCROOT)/../../../../../cocos/scripting/js-bindings/manual $(SRCROOT)/../../../../../external/spidermonkey/include/mac";
VALIDATE_PRODUCT = YES;
VALID_ARCHS = "$(ARCHS_STANDARD_64_BIT)";
};
name = Release;
};
F293B6C515EB7BEA00256477 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = YES;
ARCHS = (
armv7,
arm64,
);
CODE_SIGN_IDENTITY = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COMPRESS_PNG_FILES = NO;
DEVELOPMENT_TEAM = "";
ENABLE_BITCODE = NO;
GCC_DYNAMIC_NO_PIC = NO;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = ios/Prefix.pch;
GCC_PREPROCESSOR_DEFINITIONS = (
CC_TARGET_OS_IPHONE,
"$(inherited)",
);
HEADER_SEARCH_PATHS = (
"$(SRCROOT)/../Classes",
"$(SRCROOT)/../../../libsimulator/lib",
"$(SRCROOT)/../../../libsimulator/lib/protobuf-lite",
);
INFOPLIST_FILE = ios/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
LIBRARY_SEARCH_PATHS = "";
PRODUCT_NAME = Simulator;
PROVISIONING_PROFILE = "";
SDKROOT = iphoneos;
TARGETED_DEVICE_FAMILY = "1,2";
USER_HEADER_SEARCH_PATHS = "$(inherited) $(SRCROOT)/../../../../../cocos/platform/ios $(SRCROOT)/../../../../../external/sources $(SRCROOT)/../../../../../external/ios/include $(SRCROOT)/../../../../../external/ios/include/spidermonkey";
VALID_ARCHS = "armv7 arm64";
};
name = Debug;
};
F293B6C615EB7BEA00256477 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = YES;
ARCHS = (
armv7,
arm64,
);
CODE_SIGN_IDENTITY = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COMPRESS_PNG_FILES = NO;
DEVELOPMENT_TEAM = "";
ENABLE_BITCODE = NO;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = ios/Prefix.pch;
GCC_PREPROCESSOR_DEFINITIONS = (
CC_TARGET_OS_IPHONE,
"$(inherited)",
);
HEADER_SEARCH_PATHS = (
"$(SRCROOT)/../Classes",
"$(SRCROOT)/../../../libsimulator/lib",
"$(SRCROOT)/../../../libsimulator/lib/protobuf-lite",
);
INFOPLIST_FILE = ios/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
LIBRARY_SEARCH_PATHS = "";
PRODUCT_NAME = Simulator;
PROVISIONING_PROFILE = "";
SDKROOT = iphoneos;
TARGETED_DEVICE_FAMILY = "1,2";
USER_HEADER_SEARCH_PATHS = "$(inherited) $(SRCROOT)/../../../../../cocos/platform/ios $(SRCROOT)/../../../../../external/sources $(SRCROOT)/../../../../../external/ios/include $(SRCROOT)/../../../../../external/ios/include/spidermonkey";
VALID_ARCHS = "armv7 arm64";
};
name = Release;
};
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
5023816817EBBCE400990C9B /* Build configuration list for PBXNativeTarget "Simulator Mac" */ = {
isa = XCConfigurationList;
buildConfigurations = (
5023816917EBBCE400990C9B /* Debug */,
5023816A17EBBCE400990C9B /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
F293B3C215EB7BE500256477 /* Build configuration list for PBXProject "simulator" */ = {
isa = XCConfigurationList;
buildConfigurations = (
F293B6C215EB7BEA00256477 /* Debug */,
F293B6C315EB7BEA00256477 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
F293B6C415EB7BEA00256477 /* Build configuration list for PBXNativeTarget "Simulator iOS" */ = {
isa = XCConfigurationList;
buildConfigurations = (
F293B6C515EB7BEA00256477 /* Debug */,
F293B6C615EB7BEA00256477 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
};
rootObject = F293B3BF15EB7BE500256477 /* Project object */;
}

View File

@@ -0,0 +1,902 @@
/****************************************************************************
Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd.
http://www.cocos.com
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated engine source code (the "Software"), a limited,
worldwide, royalty-free, non-assignable, revocable and non-exclusive license
to use Cocos Creator solely to develop games on your target platforms. You shall
not use Cocos Creator software for developing other software or tools that's
used for developing games. You are not granted to publish, distribute,
sublicense, and/or sell copies of Cocos Creator.
The software or tools in this License Agreement are licensed, not sold.
Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
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.
****************************************************************************/
#pragma comment(lib, "comctl32.lib")
#pragma comment(linker, "\"/manifestdependency:type='Win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='X86' publicKeyToken='6595b64144ccf1df' language='*'\"")
#include "stdafx.h"
#include <io.h>
#include <stdlib.h>
#include <malloc.h>
#include <stdio.h>
#include <fcntl.h>
#include <Commdlg.h>
#include <Shlobj.h>
#include <winnls.h>
#include <shobjidl.h>
#include <objbase.h>
#include <objidl.h>
#include <shlguid.h>
#include <shellapi.h>
#include <Winuser.h>
#include "SimulatorWin.h"
#include "glfw3.h"
#include "glfw3native.h"
#include "AppEvent.h"
#include "AppLang.h"
#include "runtime/ConfigParser.h"
#include "runtime/Runtime.h"
#include "platform/CCApplication.h"
#include "platform/win32/PlayerWin.h"
#include "platform/win32/PlayerMenuServiceWin.h"
#include "platform/desktop/CCGLView-desktop.h"
#include "resource.h"
USING_NS_CC;
static WNDPROC g_oldWindowProc = NULL;
INT_PTR CALLBACK AboutDialogCallback(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
{
LOGFONT lf;
HFONT hFont;
UNREFERENCED_PARAMETER(lParam);
switch (message)
{
case WM_INITDIALOG:
ZeroMemory(&lf, sizeof(LOGFONT));
lf.lfHeight = 24;
lf.lfWeight = 200;
_tcscpy(lf.lfFaceName, _T("Arial"));
hFont = CreateFontIndirect(&lf);
if ((HFONT)0 != hFont)
{
SendMessage(GetDlgItem(hDlg, IDC_ABOUT_TITLE), WM_SETFONT, (WPARAM)hFont, (LPARAM)TRUE);
}
return (INT_PTR)TRUE;
case WM_COMMAND:
if (LOWORD(wParam) == IDOK || LOWORD(wParam) == IDCANCEL)
{
EndDialog(hDlg, LOWORD(wParam));
return (INT_PTR)TRUE;
}
break;
}
return (INT_PTR)FALSE;
}
HWND getWin32Window()
{
auto glfwWindow = ((cocos2d::GLView*)cocos2d::Application::getInstance()->getView())->getGLFWWindow();
return glfwGetWin32Window(glfwWindow);
}
void onHelpAbout()
{
DialogBox(GetModuleHandle(NULL),
MAKEINTRESOURCE(IDD_DIALOG_ABOUT),
getWin32Window(),
AboutDialogCallback);
}
void shutDownApp()
{
::SendMessage(getWin32Window(), WM_CLOSE, NULL, NULL);
}
std::string getCurAppPath(void)
{
TCHAR szAppDir[MAX_PATH] = {0};
if (!GetModuleFileName(NULL, szAppDir, MAX_PATH))
return "";
int nEnd = 0;
for (int i = 0; szAppDir[i]; i++)
{
if (szAppDir[i] == '\\')
nEnd = i;
}
szAppDir[nEnd] = 0;
int iLen = 2 * wcslen(szAppDir);
char* chRtn = new char[iLen + 1];
wcstombs(chRtn, szAppDir, iLen + 1);
std::string strPath = chRtn;
delete[] chRtn;
chRtn = NULL;
char fuldir[MAX_PATH] = {0};
_fullpath(fuldir, strPath.c_str(), MAX_PATH);
return fuldir;
}
static bool stringEndWith(const std::string str, const std::string needle)
{
if (str.length() >= needle.length())
{
return (0 == str.compare(str.length() - needle.length(), needle.length(), needle));
}
return false;
}
SimulatorWin *SimulatorWin::_instance = nullptr;
SimulatorWin *SimulatorWin::getInstance()
{
if (!_instance)
{
_instance = new SimulatorWin();
}
return _instance;
}
SimulatorWin::SimulatorWin()
: _app(nullptr)
, _hwnd(NULL)
, _hwndConsole(NULL)
, _writeDebugLogFile(nullptr)
{
}
SimulatorWin::~SimulatorWin()
{
if (_writeDebugLogFile)
{
fclose(_writeDebugLogFile);
}
}
void SimulatorWin::quit()
{
_app->end();
}
void SimulatorWin::relaunch()
{
_project.setWindowOffset(Vec2(getPositionX(), getPositionY()));
openProjectWithProjectConfig(_project);
}
void SimulatorWin::openNewPlayer()
{
openNewPlayerWithProjectConfig(_project);
}
void SimulatorWin::openNewPlayerWithProjectConfig(const ProjectConfig &config)
{
static long taskid = 100;
stringstream buf;
buf << taskid++;
string commandLine;
commandLine.append(getApplicationExePath());
commandLine.append(" ");
commandLine.append(config.makeCommandLine());
CCLOG("SimulatorWin::openNewPlayerWithProjectConfig(): %s", commandLine.c_str());
// http://msdn.microsoft.com/en-us/library/windows/desktop/ms682499(v=vs.85).aspx
SECURITY_ATTRIBUTES sa = {0};
sa.nLength = sizeof(sa);
PROCESS_INFORMATION pi = {0};
STARTUPINFO si = {0};
si.cb = sizeof(STARTUPINFO);
#define MAX_COMMAND 1024 // lenth of commandLine is always beyond MAX_PATH
WCHAR command[MAX_COMMAND];
memset(command, 0, sizeof(command));
MultiByteToWideChar(CP_UTF8, 0, commandLine.c_str(), -1, command, MAX_COMMAND);
BOOL success = CreateProcess(NULL,
command, // command line
NULL, // process security attributes
NULL, // primary thread security attributes
FALSE, // handles are inherited
0, // creation flags
NULL, // use parent's environment
NULL, // use parent's current directory
&si, // STARTUPINFO pointer
&pi); // receives PROCESS_INFORMATION
if (!success)
{
CCLOG("PlayerTaskWin::run() - create process failed, for execute %s", commandLine.c_str());
}
}
void SimulatorWin::openProjectWithProjectConfig(const ProjectConfig &config)
{
quit();
openNewPlayerWithProjectConfig(config);
}
int SimulatorWin::getPositionX()
{
RECT rect;
GetWindowRect(_hwnd, &rect);
return rect.left;
}
int SimulatorWin::getPositionY()
{
RECT rect;
GetWindowRect(_hwnd, &rect);
return rect.top;
}
int SimulatorWin::run()
{
INITCOMMONCONTROLSEX InitCtrls;
InitCtrls.dwSize = sizeof(InitCtrls);
InitCtrls.dwICC = ICC_WIN95_CLASSES;
InitCommonControlsEx(&InitCtrls);
parseCocosProjectConfig(_project);
// load project config from command line args
vector<string> args;
for (int i = 0; i < __argc; ++i)
{
wstring ws(__wargv[i]);
string s;
s.assign(ws.begin(), ws.end());
args.push_back(s);
}
_project.parseCommandLine(args);
if (_project.getProjectDir().empty())
{
if (args.size() == 2)
{
// for Code IDE before RC2
_project.setProjectDir(args.at(1));
_project.setDebuggerType(kCCRuntimeDebuggerCodeIDE);
}
}
// create the application instance
RuntimeEngine::getInstance()->setProjectConfig(_project);
// create console window
if (_project.isShowConsole())
{
AllocConsole();
_hwndConsole = GetConsoleWindow();
if (_hwndConsole != NULL)
{
ShowWindow(_hwndConsole, SW_SHOW);
BringWindowToTop(_hwndConsole);
freopen("CONOUT$", "wt", stdout);
freopen("CONOUT$", "wt", stderr);
HMENU hmenu = GetSystemMenu(_hwndConsole, FALSE);
if (hmenu != NULL)
{
DeleteMenu(hmenu, SC_CLOSE, MF_BYCOMMAND);
}
}
}
// log file
if (_project.isWriteDebugLogToFile())
{
const string debugLogFilePath = _project.getDebugLogFilePath();
_writeDebugLogFile = fopen(debugLogFilePath.c_str(), "w");
if (!_writeDebugLogFile)
{
CCLOG("Cannot create debug log file %s", debugLogFilePath.c_str());
}
}
// set environments
SetCurrentDirectoryA(_project.getProjectDir().c_str());
FileUtils::getInstance()->setDefaultResourceRootPath(_project.getProjectDir());
FileUtils::getInstance()->setWritablePath(_project.getWritableRealPath().c_str());
// check screen DPI
HDC screen = GetDC(0);
int dpi = GetDeviceCaps(screen, LOGPIXELSX);
ReleaseDC(0, screen);
// set scale with DPI
// 96 DPI = 100 % scaling
// 120 DPI = 125 % scaling
// 144 DPI = 150 % scaling
// 192 DPI = 200 % scaling
// http://msdn.microsoft.com/en-us/library/windows/desktop/dn469266%28v=vs.85%29.aspx#dpi_and_the_desktop_scaling_factor
//
// enable DPI-Aware with DeclareDPIAware.manifest
// http://msdn.microsoft.com/en-us/library/windows/desktop/dn469266%28v=vs.85%29.aspx#declaring_dpi_awareness
float screenScale = 1.0f;
if (dpi >= 120 && dpi < 144)
{
screenScale = 1.25f;
}
else if (dpi >= 144 && dpi < 192)
{
screenScale = 1.5f;
}
else if (dpi >= 192)
{
screenScale = 2.0f;
}
CCLOG("SCREEN DPI = %d, SCREEN SCALE = %0.2f", dpi, screenScale);
// check scale
Size frameSize = _project.getFrameSize();
float frameScale = _project.getFrameScale();
if (_project.isRetinaDisplay())
{
frameSize.width *= screenScale;
frameSize.height *= screenScale;
}
else
{
frameScale *= screenScale;
}
// check screen workarea
RECT workareaSize;
if (SystemParametersInfo(SPI_GETWORKAREA, NULL, &workareaSize, NULL))
{
float workareaWidth = fabsf(workareaSize.right - workareaSize.left);
float workareaHeight = fabsf(workareaSize.bottom - workareaSize.top);
float frameBorderCX = GetSystemMetrics(SM_CXSIZEFRAME);
float frameBorderCY = GetSystemMetrics(SM_CYSIZEFRAME);
workareaWidth -= frameBorderCX * 2;
workareaHeight -= (frameBorderCY * 2 + GetSystemMetrics(SM_CYCAPTION) + GetSystemMetrics(SM_CYMENU));
CCLOG("WORKAREA WIDTH %0.2f, HEIGHT %0.2f", workareaWidth, workareaHeight);
while (true && frameScale > 0.25f)
{
if (frameSize.width * frameScale > workareaWidth || frameSize.height * frameScale > workareaHeight)
{
frameScale = frameScale - 0.25f;
}
else
{
break;
}
}
if (frameScale < 0.25f) frameScale = 0.25f;
}
_project.setFrameScale(frameScale);
CCLOG("FRAME SCALE = %0.2f", frameScale);
// create opengl view
const Rect frameRect = Rect(0, 0, frameSize.width, frameSize.height);
ConfigParser::getInstance()->setInitViewSize(frameSize);
const bool isResize = _project.isResizeWindow();
std::stringstream title;
title << "Cocos Simulator (" << _project.getFrameScale() * 100 << "%)";
// create opengl view, and init app
_app = new AppDelegate(title.str(), _project.getFrameScale() * frameSize.width, _project.getFrameScale() * frameSize.height);
// path for looking Lang file, Studio Default images
FileUtils::getInstance()->addSearchPath(getApplicationPath().c_str());
_hwnd = getWin32Window();
player::PlayerWin::createWithHwnd(_hwnd);
DragAcceptFiles(_hwnd, TRUE);
// SendMessage(_hwnd, WM_SETICON, ICON_BIG, (LPARAM)icon);
// SendMessage(_hwnd, WM_SETICON, ICON_SMALL, (LPARAM)icon);
// FreeResource(icon);
// path for looking Lang file, Studio Default images
FileUtils::getInstance()->addSearchPath(getApplicationPath().c_str());
// set window position
if (_project.getProjectDir().length())
{
setZoom(_project.getFrameScale());
}
Vec2 pos = _project.getWindowOffset();
if (pos.x != 0 && pos.y != 0)
{
RECT rect;
GetWindowRect(_hwnd, &rect);
if (pos.x < 0)
pos.x = 0;
if (pos.y < 0)
pos.y = 0;
MoveWindow(_hwnd, pos.x, pos.y, rect.right - rect.left, rect.bottom - rect.top, FALSE);
}
// init player services
setupUI();
DrawMenuBar(_hwnd);
// prepare
FileUtils::getInstance()->setPopupNotify(false);
_project.dump();
g_oldWindowProc = (WNDPROC)SetWindowLong(_hwnd, GWL_WNDPROC, (LONG)SimulatorWin::windowProc);
// update window title
updateWindowTitle();
_app->start();
CC_SAFE_DELETE(_app);
return true;
}
// services
void SimulatorWin::setupUI()
{
auto menuBar = player::PlayerProtocol::getInstance()->getMenuService();
// FILE
menuBar->addItem("FILE_MENU", tr("File"));
menuBar->addItem("EXIT_MENU", tr("Exit"), "FILE_MENU");
// VIEW
menuBar->addItem("VIEW_MENU", tr("View"));
SimulatorConfig *config = SimulatorConfig::getInstance();
int current = config->checkScreenSize(_project.getFrameSize());
for (int i = 0; i < config->getScreenSizeCount(); i++)
{
SimulatorScreenSize size = config->getScreenSize(i);
std::stringstream menuId;
menuId << "VIEWSIZE_ITEM_MENU_" << i;
auto menuItem = menuBar->addItem(menuId.str(), size.title.c_str(), "VIEW_MENU");
if (i == current)
{
menuItem->setChecked(true);
}
}
// show FPs
bool displayStats = true; // asume creator default show FPS
string fpsItemName = displayStats ? tr("Hide FPS") : tr("Show FPS");
menuBar->addItem("FPS_MENU", fpsItemName);
// About
menuBar->addItem("HELP_MENU", tr("Help"));
menuBar->addItem("ABOUT_MENUITEM", tr("About"), "HELP_MENU");
menuBar->addItem("DIRECTION_MENU_SEP", "-", "VIEW_MENU");
menuBar->addItem("DIRECTION_PORTRAIT_MENU", tr("Portrait"), "VIEW_MENU")
->setChecked(_project.isPortraitFrame());
menuBar->addItem("DIRECTION_LANDSCAPE_MENU", tr("Landscape"), "VIEW_MENU")
->setChecked(_project.isLandscapeFrame());
menuBar->addItem("VIEW_SCALE_MENU_SEP", "-", "VIEW_MENU");
std::vector<player::PlayerMenuItem*> scaleMenuVector;
auto scale100Menu = menuBar->addItem("VIEW_SCALE_MENU_100", tr("Zoom Out").append(" (100%)"), "VIEW_MENU");
auto scale75Menu = menuBar->addItem("VIEW_SCALE_MENU_75", tr("Zoom Out").append(" (75%)"), "VIEW_MENU");
auto scale50Menu = menuBar->addItem("VIEW_SCALE_MENU_50", tr("Zoom Out").append(" (50%)"), "VIEW_MENU");
auto scale25Menu = menuBar->addItem("VIEW_SCALE_MENU_25", tr("Zoom Out").append(" (25%)"), "VIEW_MENU");
int frameScale = int(_project.getFrameScale() * 100);
if (frameScale == 100)
{
scale100Menu->setChecked(true);
}
else if (frameScale == 75)
{
scale75Menu->setChecked(true);
}
else if (frameScale == 50)
{
scale50Menu->setChecked(true);
}
else if (frameScale == 25)
{
scale25Menu->setChecked(true);
}
else
{
scale100Menu->setChecked(true);
}
scaleMenuVector.push_back(scale100Menu);
scaleMenuVector.push_back(scale75Menu);
scaleMenuVector.push_back(scale50Menu);
scaleMenuVector.push_back(scale25Menu);
menuBar->addItem("REFRESH_MENU_SEP", "-", "VIEW_MENU");
menuBar->addItem("REFRESH_MENU", tr("Refresh"), "VIEW_MENU");
HWND &hwnd = _hwnd;
ProjectConfig &project = _project;
EventDispatcher::CustomEventListener listener = [this, &hwnd, &project, scaleMenuVector](const CustomEvent& event) {
auto menuEvent = dynamic_cast<const AppEvent&>(event);
rapidjson::Document dArgParse;
dArgParse.Parse<0>(menuEvent.getDataString().c_str());
if (dArgParse.HasMember("name"))
{
string strcmd = dArgParse["name"].GetString();
if (strcmd == "menuClicked")
{
player::PlayerMenuItem *menuItem = static_cast<player::PlayerMenuItem*>(menuEvent.args[0].ptrVal);
if (menuItem)
{
if (menuItem->isChecked())
{
return;
}
string data = dArgParse["data"].GetString();
if ((data == "CLOSE_MENU") || (data == "EXIT_MENU"))
{
_instance->quit();
}
else if (data == "REFRESH_MENU")
{
_instance->relaunch();
}
else if (data.find("VIEW_SCALE_MENU_") == 0) // begin with VIEW_SCALE_MENU_
{
string tmp = data.erase(0, strlen("VIEW_SCALE_MENU_"));
float scale = atof(tmp.c_str()) / 100.0f;
project.setFrameScale(scale);
_instance->openProjectWithProjectConfig(project);
}
else if (data.find("VIEWSIZE_ITEM_MENU_") == 0) // begin with VIEWSIZE_ITEM_MENU_
{
string tmp = data.erase(0, strlen("VIEWSIZE_ITEM_MENU_"));
int index = atoi(tmp.c_str());
SimulatorScreenSize size = SimulatorConfig::getInstance()->getScreenSize(index);
if (project.isLandscapeFrame())
{
std::swap(size.width, size.height);
}
project.setFrameSize(cocos2d::Size(size.width, size.height));
project.setWindowOffset(cocos2d::Vec2(_instance->getPositionX(), _instance->getPositionY()));
_instance->openProjectWithProjectConfig(project);
}
else if (data == "DIRECTION_PORTRAIT_MENU")
{
project.changeFrameOrientationToPortait();
_instance->openProjectWithProjectConfig(project);
}
else if (data == "DIRECTION_LANDSCAPE_MENU")
{
project.changeFrameOrientationToLandscape();
_instance->openProjectWithProjectConfig(project);
}
else if (data == "ABOUT_MENUITEM")
{
onHelpAbout();
}
else if (data == "FPS_MENU")
{
bool displayStats = !_app->isDisplayStats();
_app->setDisplayStats(displayStats);
menuItem->setTitle(displayStats ? tr("Hide FPS") : tr("Show FPS"));
}
}
}
}
};
EventDispatcher::addCustomEventListener(kAppEventName, listener);
}
void SimulatorWin::setZoom(float frameScale)
{
_project.setFrameScale(frameScale);
}
void SimulatorWin::updateWindowTitle()
{
std::stringstream title;
title << "Cocos " << tr("Simulator") << " (" << _project.getFrameScale() * 100 << "%)";
std::u16string u16title;
cocos2d::StringUtils::UTF8ToUTF16(title.str(), u16title);
SetWindowText(_hwnd, (LPCTSTR)u16title.c_str());
}
// debug log
void SimulatorWin::writeDebugLog(const char *log)
{
if (!_writeDebugLogFile) return;
fputs(log, _writeDebugLogFile);
fputc('\n', _writeDebugLogFile);
fflush(_writeDebugLogFile);
}
void SimulatorWin::parseCocosProjectConfig(ProjectConfig &config)
{
// get project directory
ProjectConfig tmpConfig;
// load project config from command line args
vector<string> args;
for (int i = 0; i < __argc; ++i)
{
wstring ws(__wargv[i]);
string s;
s.assign(ws.begin(), ws.end());
args.push_back(s);
}
if (args.size() >= 2)
{
if (args.size() && args.at(1).at(0) == '/')
{
// IDEA:
// for Code IDE before RC2
tmpConfig.setProjectDir(args.at(1));
}
tmpConfig.parseCommandLine(args);
}
// set project directory as search root path
string solutionDir = tmpConfig.getProjectDir();
if (!solutionDir.empty())
{
for (int i = 0; i < solutionDir.size(); ++i)
{
if (solutionDir[i] == '\\')
{
solutionDir[i] = '/';
}
}
int nPos = -1;
if (solutionDir[solutionDir.length() - 1] == '/')
nPos = solutionDir.rfind('/', solutionDir.length() - 2);
else
nPos = solutionDir.rfind('/');
if (nPos > 0)
solutionDir = solutionDir.substr(0, nPos + 1);
FileUtils::getInstance()->setDefaultResourceRootPath(solutionDir);
FileUtils::getInstance()->addSearchPath(solutionDir);
FileUtils::getInstance()->addSearchPath(tmpConfig.getProjectDir().c_str());
}
else
{
FileUtils::getInstance()->setDefaultResourceRootPath(tmpConfig.getProjectDir().c_str());
}
// parse config.json
auto parser = ConfigParser::getInstance();
auto configPath = solutionDir.append(CONFIG_FILE);
parser->readConfig(configPath);
// set information
config.setConsolePort(parser->getConsolePort());
config.setFileUploadPort(parser->getUploadPort());
config.setFrameSize(parser->getInitViewSize());
if (parser->isLanscape())
{
config.changeFrameOrientationToLandscape();
}
else
{
config.changeFrameOrientationToPortait();
}
config.setScriptFile(parser->getEntryFile());
}
//
// D:\aaa\bbb\ccc\ddd\abc.txt --> D:/aaa/bbb/ccc/ddd/abc.txt
//
std::string SimulatorWin::convertPathFormatToUnixStyle(const std::string& path)
{
std::string ret = path;
int len = ret.length();
for (int i = 0; i < len; ++i)
{
if (ret[i] == '\\')
{
ret[i] = '/';
}
}
return ret;
}
//
// @return: C:/Users/win8/Documents/
//
std::string SimulatorWin::getUserDocumentPath()
{
TCHAR filePath[MAX_PATH];
SHGetSpecialFolderPath(NULL, filePath, CSIDL_PERSONAL, FALSE);
int length = 2 * wcslen(filePath);
char* tempstring = new char[length + 1];
wcstombs(tempstring, filePath, length + 1);
string userDocumentPath(tempstring);
delete [] tempstring;
userDocumentPath = convertPathFormatToUnixStyle(userDocumentPath);
userDocumentPath.append("/");
return userDocumentPath;
}
//
// convert Unicode/LocalCode TCHAR to Utf8 char
//
char* SimulatorWin::convertTCharToUtf8(const TCHAR* src)
{
#ifdef UNICODE
WCHAR* tmp = (WCHAR*)src;
size_t size = wcslen(src) * 3 + 1;
char* dest = new char[size];
memset(dest, 0, size);
WideCharToMultiByte(CP_UTF8, 0, tmp, -1, dest, size, NULL, NULL);
return dest;
#else
char* tmp = (char*)src;
uint32 size = strlen(tmp) + 1;
WCHAR* dest = new WCHAR[size];
memset(dest, 0, sizeof(WCHAR)*size);
MultiByteToWideChar(CP_ACP, 0, src, -1, dest, (int)size); // convert local code to unicode.
size = wcslen(dest) * 3 + 1;
char* dest2 = new char[size];
memset(dest2, 0, size);
WideCharToMultiByte(CP_UTF8, 0, dest, -1, dest2, size, NULL, NULL); // convert unicode to utf8.
delete[] dest;
return dest2;
#endif
}
//
std::string SimulatorWin::getApplicationExePath()
{
TCHAR szFileName[MAX_PATH];
GetModuleFileName(NULL, szFileName, MAX_PATH);
std::u16string u16ApplicationName;
char *applicationExePath = convertTCharToUtf8(szFileName);
std::string path(applicationExePath);
CC_SAFE_FREE(applicationExePath);
return path;
}
std::string SimulatorWin::getApplicationPath()
{
std::string path = getApplicationExePath();
size_t pos;
while ((pos = path.find_first_of("\\")) != std::string::npos)
{
path.replace(pos, 1, "/");
}
size_t p = path.find_last_of("/");
string workdir;
if (p != path.npos)
{
workdir = path.substr(0, p);
}
return workdir;
}
LRESULT CALLBACK SimulatorWin::windowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
if (!_instance) return 0;
switch (uMsg)
{
case WM_SYSCOMMAND:
case WM_COMMAND:
{
if (HIWORD(wParam) == 0)
{
// menu
WORD menuId = LOWORD(wParam);
auto menuService = dynamic_cast<player::PlayerMenuServiceWin*> (player::PlayerProtocol::getInstance()->getMenuService());
auto menuItem = menuService->getItemByCommandId(menuId);
if (menuItem)
{
AppEvent event(kAppEventName, APP_EVENT_MENU);
std::stringstream buf;
buf << "{\"data\":\"" << menuItem->getMenuId().c_str() << "\"";
buf << ",\"name\":" << "\"menuClicked\"" << "}";
event.setDataString(buf.str());
event.args[0].ptrVal = (void*)menuItem;
cocos2d::EventDispatcher::dispatchCustomEvent(event);
}
if (menuId == ID_HELP_ABOUT)
{
onHelpAbout();
}
}
break;
}
case WM_KEYDOWN:
{
if (wParam == VK_F5)
{
_instance->relaunch();
}
break;
}
case WM_COPYDATA:
{
PCOPYDATASTRUCT pMyCDS = (PCOPYDATASTRUCT)lParam;
if (pMyCDS->dwData == 1)
{
const char *szBuf = (const char*)(pMyCDS->lpData);
SimulatorWin::getInstance()->writeDebugLog(szBuf);
break;
}
}
case WM_DESTROY:
{
DragAcceptFiles(hWnd, FALSE);
break;
}
}
return g_oldWindowProc(hWnd, uMsg, wParam, lParam);
}
void SimulatorWin::onOpenFile(const std::string &filePath)
{
string entry = filePath;
if (entry.empty()) return;
if (stringEndWith(entry, "config.json") || stringEndWith(entry, ".csb") || stringEndWith(entry, ".csd"))
{
replaceAll(entry, "\\", "/");
size_t p = entry.find_last_of("/");
if (p != entry.npos)
{
string workdir = entry.substr(0, p);
_project.setProjectDir(workdir);
}
_project.setScriptFile(entry);
if (stringEndWith(entry, CONFIG_FILE))
{
ConfigParser::getInstance()->readConfig(entry);
_project.setScriptFile(ConfigParser::getInstance()->getEntryFile());
}
openProjectWithProjectConfig(_project);
}
else
{
auto title = tr("Open File") + tr("Error");
auto msg = tr("Only support") + " config.json;*.csb;*.csd";
auto msgBox = player::PlayerProtocol::getInstance()->getMessageBoxService();
msgBox->showMessageBox(title, msg);
}
}

View File

@@ -0,0 +1,83 @@
/****************************************************************************
Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd.
http://www.cocos.com
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated engine source code (the "Software"), a limited,
worldwide, royalty-free, non-assignable, revocable and non-exclusive license
to use Cocos Creator solely to develop games on your target platforms. You shall
not use Cocos Creator software for developing other software or tools that's
used for developing games. You are not granted to publish, distribute,
sublicense, and/or sell copies of Cocos Creator.
The software or tools in this License Agreement are licensed, not sold.
Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
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.
****************************************************************************/
#pragma once
#include "stdafx.h"
#include "Resource.h"
#include "cocos2d.h"
#include "AppDelegate.h"
#include "ProjectConfig/ProjectConfig.h"
#include "ProjectConfig/SimulatorConfig.h"
class SimulatorWin
{
public:
static SimulatorWin *getInstance();
virtual ~SimulatorWin();
int run();
virtual void quit();
virtual void relaunch();
virtual void openNewPlayer();
virtual void openNewPlayerWithProjectConfig(const ProjectConfig &config);
virtual void openProjectWithProjectConfig(const ProjectConfig &config);
virtual int getPositionX();
virtual int getPositionY();
protected:
SimulatorWin();
static SimulatorWin *_instance;
ProjectConfig _project;
HWND _hwnd;
HWND _hwndConsole;
AppDelegate *_app;
FILE *_writeDebugLogFile;
//
void setupUI();
void setZoom(float frameScale);
void updateWindowTitle();
// debug log
void writeDebugLog(const char *log);
void parseCocosProjectConfig(ProjectConfig &config);
//
void onOpenFile(const std::string &filePath);
void onOpenProjectFolder(const std::string &folderPath);
void onDrop(const std::string &path);
// helper
std::string convertPathFormatToUnixStyle(const std::string& path);
std::string getUserDocumentPath();
std::string getApplicationExePath();
std::string getApplicationPath();
static char* convertTCharToUtf8(const TCHAR* src);
static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
};

View File

@@ -0,0 +1,14 @@
{
"copy_resources": [
{
"from": "../../../src",
"to": "src"
},
{
"from": "../Classes/ide-support/lang",
"to": ""
}
],
"must_copy_resources": [
]
}

View File

@@ -0,0 +1,201 @@
// Microsoft Visual C++ generated resource script.
//
#include "resource.h"
#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#include "winres.h"
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
// Chinese (Simplified, PRC) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_CHS)
LANGUAGE LANG_CHINESE, SUBLANG_CHINESE_SIMPLIFIED
#pragma code_page(936)
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//
2 TEXTINCLUDE
BEGIN
"#include ""winres.h""\r\n"
"\0"
END
3 TEXTINCLUDE
BEGIN
"\r\n"
"\0"
END
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Menu
//
IDR_MENU_COCOS MENU
BEGIN
POPUP "<22><><EFBFBD><EFBFBD>(&H)"
BEGIN
MENUITEM "<22><><EFBFBD><EFBFBD>(&A)", ID_HELP_ABOUT
END
END
/////////////////////////////////////////////////////////////////////////////
//
// Dialog
//
IDD_DIALOG_ABOUT DIALOGEX 0, 0, 243, 134
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "About Simulator"
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
CTEXT "Version 3.10 (20151222)",IDC_ABOUT_VERSION,35,70,173,17
CTEXT "Cocos Simulator",IDC_ABOUT_TITLE,35,49,173,17
CTEXT "Copyright (C) 2015. All rights reserved.",IDC_STATIC,35,94,173,17
ICON "GLFW_ICON",IDC_STATIC,111,15,20,20
END
/////////////////////////////////////////////////////////////////////////////
//
// DESIGNINFO
//
#ifdef APSTUDIO_INVOKED
GUIDELINES DESIGNINFO
BEGIN
IDD_DIALOG_ABOUT, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 236
TOPMARGIN, 7
BOTTOMMARGIN, 127
END
END
#endif // APSTUDIO_INVOKED
#endif // Chinese (Simplified, PRC) resources
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
// English resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
LANGUAGE LANG_ENGLISH, SUBLANG_NEUTRAL
#pragma code_page(1252)
/////////////////////////////////////////////////////////////////////////////
//
// Menu
//
IDR_MENU_COCOS MENU
BEGIN
POPUP "&Help"
BEGIN
MENUITEM "&About ...", ID_HELP_ABOUT
END
END
#endif // English resources
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
// English (United States) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
#pragma code_page(1252)
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//
1 TEXTINCLUDE
BEGIN
"resource.h\0"
END
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Icon
//
// Icon with lowest ID value placed first to ensure application icon
// remains consistent on all systems.
GLFW_ICON ICON "res\\game.ico"
/////////////////////////////////////////////////////////////////////////////
//
// Version
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 1,0,0,1
PRODUCTVERSION 1,0,0,1
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
#else
FILEFLAGS 0x0L
#endif
FILEOS 0x4L
FILETYPE 0x2L
FILESUBTYPE 0x0L
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904b0"
BEGIN
VALUE "FileDescription", "game Module"
VALUE "FileVersion", "1, 0, 0, 1"
VALUE "InternalName", "game"
VALUE "LegalCopyright", "Copyright "
VALUE "OriginalFilename", "game.exe"
VALUE "ProductName", "game Module"
VALUE "ProductVersion", "1, 0, 0, 1"
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x409, 1200
END
END
#endif // English (United States) resources
/////////////////////////////////////////////////////////////////////////////
#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//
/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED

View File

@@ -0,0 +1,38 @@
/****************************************************************************
Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd.
http://www.cocos.com
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated engine source code (the "Software"), a limited,
worldwide, royalty-free, non-assignable, revocable and non-exclusive license
to use Cocos Creator solely to develop games on your target platforms. You shall
not use Cocos Creator software for developing other software or tools that's
used for developing games. You are not granted to publish, distribute,
sublicense, and/or sell copies of Cocos Creator.
The software or tools in this License Agreement are licensed, not sold.
Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
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 "main.h"
#include "SimulatorWin.h"
#include <shellapi.h>
int APIENTRY _tWinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPTSTR lpCmdLine,
int nCmdShow)
{
UNREFERENCED_PARAMETER(hPrevInstance);
UNREFERENCED_PARAMETER(lpCmdLine);
return SimulatorWin::getInstance()->run();
}

View File

@@ -0,0 +1,35 @@
/****************************************************************************
Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd.
http://www.cocos.com
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated engine source code (the "Software"), a limited,
worldwide, royalty-free, non-assignable, revocable and non-exclusive license
to use Cocos Creator solely to develop games on your target platforms. You shall
not use Cocos Creator software for developing other software or tools that's
used for developing games. You are not granted to publish, distribute,
sublicense, and/or sell copies of Cocos Creator.
The software or tools in this License Agreement are licensed, not sold.
Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
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 __MAIN_H__
#define __MAIN_H__
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
// Windows Header Files:
#include <windows.h>
#include <tchar.h>
#endif // __WINMAIN_H__

Binary file not shown.

After

Width:  |  Height:  |  Size: 46 KiB

View File

@@ -0,0 +1,39 @@
//{{NO_DEPENDENCIES}}
// Microsoft Visual C++ generated include file.
// Used by game.rc
//
#define IDS_PROJNAME 100
#define IDR_MENU_COCOS 200
#define IDD_DIALOG1 202
#define IDD_DIALOG_ABOUT 203
#define IDC_ABOUT_TITLE 1000
#define IDC_EDIT2 1001
#define IDC_ABOUT_VERSION 1001
#define ID_VIEW_SIZE 30001
#define ID_FILE_NEW_WINDOW 32771
#define ID_VIEW_PORTRAIT 32775
#define ID_VIEW_LANDSCAPE 32776
#define ID_VIEW_CUSTOM 32777
#define ID_HELP_ABOUT 32778
#define ID_FILE_EXIT 32779
#define ID_Menu 32780
#define ID_Menu32781 32781
#define ID_TEST_RESET 32782
#define ID_CONTROL 32783
#define ID_CONTROL_RELOAD 32784
#define ID_VIEW_ZOOMOUT100 32785
#define ID_VIEW_ZOOMOUT75 32786
#define ID_VIEW_ZOOMOUT50 32787
#define ID_VIEW_ZOOMOUT25 32788
#define ID_CONTROL_TOP 32793
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 201
#define _APS_NEXT_COMMAND_VALUE 32794
#define _APS_NEXT_CONTROL_VALUE 1002
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif

View File

@@ -0,0 +1,56 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2013
VisualStudioVersion = 12.0.21005.1
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "simulator", "simulator.vcxproj", "{4E6A7A0E-DDD8-4BAA-8B22-C964069364ED}"
ProjectSection(ProjectDependencies) = postProject
{98A51BA8-FC3A-415B-AC8F-8C7BD464E93E} = {98A51BA8-FC3A-415B-AC8F-8C7BD464E93E}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libcocos2d", "..\..\..\..\..\build\libcocos2d.vcxproj", "{98A51BA8-FC3A-415B-AC8F-8C7BD464E93E}"
ProjectSection(ProjectDependencies) = postProject
{6B494955-1E66-40DA-830D-0D31B8D301EF} = {6B494955-1E66-40DA-830D-0D31B8D301EF}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libsimulator", "..\..\..\libsimulator\proj.win32\libsimulator.vcxproj", "{001B324A-BB91-4E83-875C-C92F75C40857}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Release|Win32 = Release|Win32
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{4E6A7A0E-DDD8-4BAA-8B22-C964069364ED}.Debug|Win32.ActiveCfg = Debug|Win32
{4E6A7A0E-DDD8-4BAA-8B22-C964069364ED}.Debug|Win32.Build.0 = Debug|Win32
{4E6A7A0E-DDD8-4BAA-8B22-C964069364ED}.Release|Win32.ActiveCfg = Release|Win32
{4E6A7A0E-DDD8-4BAA-8B22-C964069364ED}.Release|Win32.Build.0 = Release|Win32
{98A51BA8-FC3A-415B-AC8F-8C7BD464E93E}.Debug|Win32.ActiveCfg = Debug|Win32
{98A51BA8-FC3A-415B-AC8F-8C7BD464E93E}.Debug|Win32.Build.0 = Debug|Win32
{98A51BA8-FC3A-415B-AC8F-8C7BD464E93E}.Release|Win32.ActiveCfg = Release|Win32
{98A51BA8-FC3A-415B-AC8F-8C7BD464E93E}.Release|Win32.Build.0 = Release|Win32
{B7C2A162-DEC9-4418-972E-240AB3CBFCAE}.Debug|Win32.ActiveCfg = Debug|Win32
{B7C2A162-DEC9-4418-972E-240AB3CBFCAE}.Debug|Win32.Build.0 = Debug|Win32
{B7C2A162-DEC9-4418-972E-240AB3CBFCAE}.Release|Win32.ActiveCfg = Release|Win32
{B7C2A162-DEC9-4418-972E-240AB3CBFCAE}.Release|Win32.Build.0 = Release|Win32
{001B324A-BB91-4E83-875C-C92F75C40857}.Debug|Win32.ActiveCfg = Debug|Win32
{001B324A-BB91-4E83-875C-C92F75C40857}.Debug|Win32.Build.0 = Debug|Win32
{001B324A-BB91-4E83-875C-C92F75C40857}.Release|Win32.ActiveCfg = Release|Win32
{001B324A-BB91-4E83-875C-C92F75C40857}.Release|Win32.Build.0 = Release|Win32
{39379840-825A-45A0-B363-C09FFEF864BD}.Debug|Win32.ActiveCfg = Debug|Win32
{39379840-825A-45A0-B363-C09FFEF864BD}.Debug|Win32.Build.0 = Debug|Win32
{39379840-825A-45A0-B363-C09FFEF864BD}.Release|Win32.ActiveCfg = Release|Win32
{39379840-825A-45A0-B363-C09FFEF864BD}.Release|Win32.Build.0 = Release|Win32
{6B494955-1E66-40DA-830D-0D31B8D301EF}.Debug|Win32.ActiveCfg = Debug|Win32
{6B494955-1E66-40DA-830D-0D31B8D301EF}.Debug|Win32.Build.0 = Debug|Win32
{6B494955-1E66-40DA-830D-0D31B8D301EF}.Release|Win32.ActiveCfg = Release|Win32
{6B494955-1E66-40DA-830D-0D31B8D301EF}.Release|Win32.Build.0 = Release|Win32
{EB7E5610-C178-49C9-8B4C-1C283E616ED9}.Debug|Win32.ActiveCfg = Debug|Win32
{EB7E5610-C178-49C9-8B4C-1C283E616ED9}.Debug|Win32.Build.0 = Debug|Win32
{EB7E5610-C178-49C9-8B4C-1C283E616ED9}.Release|Win32.ActiveCfg = Release|Win32
{EB7E5610-C178-49C9-8B4C-1C283E616ED9}.Release|Win32.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

View File

@@ -0,0 +1,249 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{4E6A7A0E-DDD8-4BAA-8B22-C964069364ED}</ProjectGuid>
<ProjectName>simulator</ProjectName>
<WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<CharacterSet>Unicode</CharacterSet>
<PlatformToolset Condition="'$(VisualStudioVersion)' == '11.0'">v110</PlatformToolset>
<PlatformToolset Condition="'$(VisualStudioVersion)' == '12.0'">v120</PlatformToolset>
<PlatformToolset Condition="'$(VisualStudioVersion)' == '14.0'">v140</PlatformToolset>
<PlatformToolset Condition="'$(VisualStudioVersion)' == '14.0' and exists('$(MSBuildProgramFiles32)\Microsoft SDKs\Windows\v7.1A')">v140_xp</PlatformToolset>
<PlatformToolset Condition="'$(VisualStudioVersion)' == '15.0'">v141</PlatformToolset>
<PlatformToolset Condition="'$(VisualStudioVersion)' == '15.0' and exists('$(MSBuildProgramFiles32)\Microsoft SDKs\Windows\v7.1A')">v140_xp</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<CharacterSet>Unicode</CharacterSet>
<PlatformToolset Condition="'$(VisualStudioVersion)' == '11.0'">v110</PlatformToolset>
<PlatformToolset Condition="'$(VisualStudioVersion)' == '12.0'">v120</PlatformToolset>
<PlatformToolset Condition="'$(VisualStudioVersion)' == '14.0'">v140</PlatformToolset>
<PlatformToolset Condition="'$(VisualStudioVersion)' == '14.0' and exists('$(MSBuildProgramFiles32)\Microsoft SDKs\Windows\v7.1A')">v140_xp</PlatformToolset>
<PlatformToolset Condition="'$(VisualStudioVersion)' == '15.0'">v141</PlatformToolset>
<PlatformToolset Condition="'$(VisualStudioVersion)' == '15.0' and exists('$(MSBuildProgramFiles32)\Microsoft SDKs\Windows\v7.1A')">v140_xp</PlatformToolset>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="..\..\..\..\..\build\cocos2dx.props" />
<Import Project="..\..\..\..\..\build\cocos2d_headers.props" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="..\..\..\..\..\build\cocos2dx.props" />
<Import Project="..\..\..\..\..\build\cocos2d_headers.props" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<OutDir>$(SolutionDir)$(Configuration).win32\</OutDir>
<IntDir>$(Configuration).win32\</IntDir>
<LinkIncremental>true</LinkIncremental>
<IncludePath>$(IncludePath)</IncludePath>
<SourcePath>$(SourcePath);</SourcePath>
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<OutDir>$(SolutionDir)$(Configuration).win32\</OutDir>
<IntDir>$(Configuration).win32\</IntDir>
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LibraryPath>$(MSBuildProgramFiles32)\Microsoft SDKs\Windows\v7.1A\lib;$(LibraryPath)</LibraryPath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LibraryPath>$(MSBuildProgramFiles32)\Microsoft SDKs\Windows\v7.1A\lib;$(LibraryPath)</LibraryPath>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<AdditionalIncludeDirectories>$(ProjectDir)..\Classes;$(ProjectDir)..\Classes\runtime;$(ProjectDir)..\Classes\ide-support;$(EngineRoot)cocos\base;$(EngineRoot)external\win32-specific\zlib\include;$(EngineRoot)cocos\scripting\js-bindings\auto;$(EngineRoot)cocos\scripting\js-bindings\manual;$(EngineRoot)cocos\audio\include;$(EngineRoot)external;$(EngineRoot)external\win32\include;$(EngineRoot)external\win32\include\chipmunk;$(EngineRoot)external\win32\include\curl;$(EngineRoot)external\win32\include\glfw3;$(EngineRoot)external\win32\include\v8;$(EngineRoot)tools\simulator\libsimulator\lib;$(EngineRoot)tools\simulator\libsimulator\lib\protobuf-lite;$(EngineRoot)extensions;$(EngineRoot);$(EngineRoot)cocos\editor-support;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<MinimalRebuild>false</MinimalRebuild>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_WINDOWS;STRICT;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS_DEBUG;COCOS2D_DEBUG=1;GLFW_EXPOSE_NATIVE_WIN32;GLFW_EXPOSE_NATIVE_WGL;_USRLUASTATIC;_USRLIBSIMSTATIC;_WINSOCKAPI_;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<DisableSpecificWarnings>4267;4251;4244;%(DisableSpecificWarnings)</DisableSpecificWarnings>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<ProgramDataBaseFileName>$(IntDir)vc$(PlatformToolsetVersion).pdb</ProgramDataBaseFileName>
<ForcedIncludeFiles>algorithm</ForcedIncludeFiles>
<CompileAs>CompileAsCpp</CompileAs>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<TargetMachine>MachineX86</TargetMachine>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalLibraryDirectories>$(OutDir);$(EngineRoot)external\win32\libs;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalDependencies>libcurl.lib;websockets.lib;v8.dll.lib;v8_libbase.dll.lib;v8_libplatform.dll.lib;libuv.lib;%(AdditionalDependencies)</AdditionalDependencies>
<ProgramDatabaseFile>$(OutDir)$(TargetName).pdb</ProgramDatabaseFile>
<OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile>
<IgnoreSpecificDefaultLibraries>libcmt.lib;%(IgnoreSpecificDefaultLibraries)</IgnoreSpecificDefaultLibraries>
</Link>
<ResourceCompile>
<Culture>0x0409</Culture>
<AdditionalIncludeDirectories>$(MSBuildProgramFiles32)\Microsoft SDKs\Windows\v7.1A\include;$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ResourceCompile>
<Midl>
<MkTypLibCompatible>false</MkTypLibCompatible>
<TargetEnvironment>Win32</TargetEnvironment>
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<HeaderFileName>simulator.h</HeaderFileName>
<InterfaceIdentifierFileName>simulator_i.c</InterfaceIdentifierFileName>
<ProxyFileName>simulator_p.c</ProxyFileName>
<GenerateStublessProxies>true</GenerateStublessProxies>
<TypeLibraryName>$(IntDir)/simulator.tlb</TypeLibraryName>
<DllDataFileName>
</DllDataFileName>
</Midl>
<PreBuildEvent>
<Command>if not exist "$(OutDir)" mkdir "$(OutDir)"
xcopy /Y /Q "$(ProjectDir)..\Classes\ide-support\lang" "$(OutDir)"
</Command>
<Message>
</Message>
</PreBuildEvent>
<PreLinkEvent>
<Command>
</Command>
</PreLinkEvent>
<PostBuildEvent>
<Command>if not exist "$(ProjectDir)..\..\..\runtime" mkdir "$(ProjectDir)..\..\..\runtime"
if not exist "$(ProjectDir)..\..\..\runtime\win32" mkdir "$(ProjectDir)..\..\..\runtime\win32"
xcopy /Y /Q "$(OutDir)*.dll" "$(ProjectDir)..\..\..\runtime\win32"
xcopy /Y /Q "$(OutDir)*.exe" "$(ProjectDir)..\..\..\runtime\win32"
xcopy /Y /Q "$(OutDir)lang" "$(ProjectDir)..\..\..\runtime\win32"
if exist "$(ProjectDir)..\..\..\..\..\simulator\win32\config.json" copy "$(ProjectDir)..\..\..\..\..\simulator\win32\config.json" "$(OutDir)config.json"
</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<AdditionalIncludeDirectories>$(ProjectDir)..\Classes;$(ProjectDir)..\Classes\runtime;$(ProjectDir)..\Classes\ide-support;$(EngineRoot)cocos\base;$(EngineRoot)tools\simulator\libsimulator\lib\protobuf-lite;$(EngineRoot)external\win32-specific\zlib\include;$(EngineRoot)cocos\scripting\lua-bindings\auto;$(EngineRoot)cocos\scripting\lua-bindings\manual;$(EngineRoot)cocos\scripting\js-bindings\auto;$(EngineRoot)cocos\scripting\js-bindings\manual;$(EngineRoot)cocos\audio\include;$(EngineRoot)external;$(EngineRoot)extensions;$(EngineRoot)external\win32\include;$(EngineRoot)external\win32\include\chipmunk;$(EngineRoot)external\win32\include\curl;$(EngineRoot)external\win32\include\glfw3;$(EngineRoot)external\win32\include\v8;$(EngineRoot)tools\simulator\libsimulator\lib;$(EngineRoot);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<ExceptionHandling>Sync</ExceptionHandling>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<PreprocessorDefinitions>COCOS2D_DEBUG=1;WIN32;_WINDOWS;STRICT;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGSNDEBUG;GLFW_EXPOSE_NATIVE_WIN32;GLFW_EXPOSE_NATIVE_WGL;_USRLUASTATIC;_USRLIBSIMSTATIC;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<DisableSpecificWarnings>4267;4251;4244;%(DisableSpecificWarnings)</DisableSpecificWarnings>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<ProgramDataBaseFileName>$(IntDir)vc$(PlatformToolsetVersion).pdb</ProgramDataBaseFileName>
<ForcedIncludeFiles>algorithm</ForcedIncludeFiles>
<CompileAs>CompileAsCpp</CompileAs>
<BasicRuntimeChecks>Default</BasicRuntimeChecks>
<MinimalRebuild>true</MinimalRebuild>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<TargetMachine>MachineX86</TargetMachine>
<AdditionalLibraryDirectories>$(OutDir);$(EngineRoot)external\spidermonkey\prebuilt\win32;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalDependencies>libcurl.lib;websockets.lib;v8.dll.lib;v8_libbase.dll.lib;v8_libplatform.dll.lib;libuv.lib;%(AdditionalDependencies)</AdditionalDependencies>
<GenerateDebugInformation>false</GenerateDebugInformation>
<OutputFile>$(OutDir)$(ProjectName).exe</OutputFile>
<IgnoreSpecificDefaultLibraries>libcmt.lib;%(IgnoreSpecificDefaultLibraries)</IgnoreSpecificDefaultLibraries>
</Link>
<ResourceCompile>
<Culture>0x0409</Culture>
<AdditionalIncludeDirectories>$(MSBuildProgramFiles32)\Microsoft SDKs\Windows\v7.1A\include;$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ResourceCompile>
<Midl>
<MkTypLibCompatible>false</MkTypLibCompatible>
<TargetEnvironment>Win32</TargetEnvironment>
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<HeaderFileName>simulator.h</HeaderFileName>
<InterfaceIdentifierFileName>simulator_i.c</InterfaceIdentifierFileName>
<ProxyFileName>simulator_p.c</ProxyFileName>
<GenerateStublessProxies>true</GenerateStublessProxies>
<TypeLibraryName>$(IntDir)/simulator.tlb</TypeLibraryName>
<DllDataFileName>
</DllDataFileName>
</Midl>
<PreBuildEvent>
<Command>if not exist "$(OutDir)" mkdir "$(OutDir)"
xcopy /Y /Q "$(ProjectDir)..\Classes\ide-support\lang" "$(OutDir)"
</Command>
<Message>
</Message>
</PreBuildEvent>
<PreLinkEvent>
<Command>
</Command>
</PreLinkEvent>
<PostBuildEvent>
<Command>if not exist "$(ProjectDir)..\..\..\runtime" mkdir "$(ProjectDir)..\..\..\runtime"
if not exist "$(ProjectDir)..\..\..\runtime\win32" mkdir "$(ProjectDir)..\..\..\runtime\win32"
xcopy /Y /Q "$(OutDir)*.dll" "$(ProjectDir)..\..\..\runtime\win32"
xcopy /Y /Q "$(OutDir)*.exe" "$(ProjectDir)..\..\..\runtime\win32"
xcopy /Y /Q "$(OutDir)lang" "$(ProjectDir)..\..\..\runtime\win32"
</Command>
</PostBuildEvent>
<Manifest>
<AdditionalManifestFiles>
</AdditionalManifestFiles>
</Manifest>
</ItemDefinitionGroup>
<ItemGroup>
<ClInclude Include="..\Classes\AppDelegate.h" />
<ClInclude Include="..\Classes\ide-support\CodeIDESupport.h" />
<ClInclude Include="..\Classes\ide-support\RuntimeJsImpl.h" />
<ClInclude Include="main.h" />
<ClInclude Include="resource.h" />
<ClInclude Include="SimulatorWin.h" />
<ClInclude Include="stdafx.h" />
<ClInclude Include="targetver.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\..\..\..\..\cocos\scripting\js-bindings\manual\jsb_module_register.cpp" />
<ClCompile Include="..\Classes\AppDelegate.cpp" />
<ClCompile Include="..\Classes\ide-support\RuntimeJsImpl.cpp" />
<ClCompile Include="main.cpp" />
<ClCompile Include="SimulatorWin.cpp" />
<ClCompile Include="stdafx.cpp" />
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="game.rc" />
</ItemGroup>
<ItemGroup>
<Image Include="res\game.ico" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\..\..\build\libcocos2d.vcxproj">
<Project>{98a51ba8-fc3a-415b-ac8f-8c7bd464e93e}</Project>
</ProjectReference>
<ProjectReference Include="..\..\..\libsimulator\proj.win32\libsimulator.vcxproj">
<Project>{001b324a-bb91-4e83-875c-c92f75c40857}</Project>
</ProjectReference>
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View File

@@ -0,0 +1,65 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Classes">
<UniqueIdentifier>{fc5cb953-2953-4968-83b3-39e3ff951754}</UniqueIdentifier>
</Filter>
<Filter Include="win32">
<UniqueIdentifier>{037a9a02-b906-4cc5-ad98-304acd4e25ee}</UniqueIdentifier>
</Filter>
<Filter Include="resource">
<UniqueIdentifier>{2d1d0979-58cd-4ab6-b91c-13650158f1fa}</UniqueIdentifier>
</Filter>
<Filter Include="Classes\ide-support">
<UniqueIdentifier>{9f68f9a7-7069-4c93-94ae-942a0aa910c1}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\Classes\AppDelegate.h">
<Filter>Classes</Filter>
</ClInclude>
<ClInclude Include="main.h">
<Filter>win32</Filter>
</ClInclude>
<ClInclude Include="resource.h" />
<ClInclude Include="SimulatorWin.h" />
<ClInclude Include="stdafx.h">
<Filter>win32</Filter>
</ClInclude>
<ClInclude Include="targetver.h">
<Filter>win32</Filter>
</ClInclude>
<ClInclude Include="..\Classes\ide-support\CodeIDESupport.h">
<Filter>Classes\ide-support</Filter>
</ClInclude>
<ClInclude Include="..\Classes\ide-support\RuntimeJsImpl.h">
<Filter>Classes\ide-support</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\Classes\AppDelegate.cpp">
<Filter>Classes</Filter>
</ClCompile>
<ClCompile Include="main.cpp">
<Filter>win32</Filter>
</ClCompile>
<ClCompile Include="SimulatorWin.cpp" />
<ClCompile Include="stdafx.cpp">
<Filter>win32</Filter>
</ClCompile>
<ClCompile Include="..\Classes\ide-support\RuntimeJsImpl.cpp">
<Filter>Classes\ide-support</Filter>
</ClCompile>
<ClCompile Include="..\..\..\..\..\cocos\scripting\js-bindings\manual\jsb_module_register.cpp">
<Filter>Classes</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="game.rc">
<Filter>resource</Filter>
</ResourceCompile>
</ItemGroup>
<ItemGroup>
<Image Include="res\game.ico" />
</ItemGroup>
</Project>

View File

@@ -0,0 +1,33 @@
/****************************************************************************
Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd.
http://www.cocos.com
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated engine source code (the "Software"), a limited,
worldwide, royalty-free, non-assignable, revocable and non-exclusive license
to use Cocos Creator solely to develop games on your target platforms. You shall
not use Cocos Creator software for developing other software or tools that's
used for developing games. You are not granted to publish, distribute,
sublicense, and/or sell copies of Cocos Creator.
The software or tools in this License Agreement are licensed, not sold.
Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
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.
****************************************************************************/
// stdafx.cpp : source file that includes just the standard includes
// player.pch will be the pre-compiled header
// stdafx.obj will contain the pre-compiled type information
#include "stdafx.h"
// REFINE: reference any additional headers you need in STDAFX.H
// and not in this file

View File

@@ -0,0 +1,46 @@
/****************************************************************************
Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd.
http://www.cocos.com
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated engine source code (the "Software"), a limited,
worldwide, royalty-free, non-assignable, revocable and non-exclusive license
to use Cocos Creator solely to develop games on your target platforms. You shall
not use Cocos Creator software for developing other software or tools that's
used for developing games. You are not granted to publish, distribute,
sublicense, and/or sell copies of Cocos Creator.
The software or tools in this License Agreement are licensed, not sold.
Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
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.
****************************************************************************/
// stdafx.h : include file for standard system include files,
// or project specific include files that are used frequently, but
// are changed infrequently
//
#pragma once
#include "targetver.h"
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
// Windows Header Files:
#include <windows.h>
// C RunTime Header Files
#include <stdlib.h>
#include <malloc.h>
#include <memory.h>
#include <tchar.h>
// REFINE: reference additional headers your program requires here

View File

@@ -0,0 +1,33 @@
/****************************************************************************
Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd.
http://www.cocos.com
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated engine source code (the "Software"), a limited,
worldwide, royalty-free, non-assignable, revocable and non-exclusive license
to use Cocos Creator solely to develop games on your target platforms. You shall
not use Cocos Creator software for developing other software or tools that's
used for developing games. You are not granted to publish, distribute,
sublicense, and/or sell copies of Cocos Creator.
The software or tools in this License Agreement are licensed, not sold.
Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
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.
****************************************************************************/
#pragma once
// Including SDKDDKVer.h defines the highest available Windows platform.
// If you wish to build your application for a previous Windows platform, include WinSDKVer.h and
// set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h.
#include <SDKDDKVer.h>

View File

@@ -0,0 +1,59 @@
/****************************************************************************
Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd.
http://www.cocos.com
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated engine source code (the "Software"), a limited,
worldwide, royalty-free, non-assignable, revocable and non-exclusive license
to use Cocos Creator solely to develop games on your target platforms. You shall
not use Cocos Creator software for developing other software or tools that's
used for developing games. You are not granted to publish, distribute,
sublicense, and/or sell copies of Cocos Creator.
The software or tools in this License Agreement are licensed, not sold.
Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
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.
****************************************************************************/
//
// AppEvent.cpp
// Simulator
//
//
#include "AppEvent.h"
AppEvent::AppEvent(const std::string& eventName, int type)
: CustomEvent()
, _eventName(eventName)
{
name = eventName;
setEventType(type);
}
void AppEvent::setEventType(int type)
{
_eventType = type;
}
int AppEvent::getEventType()
{
return _eventType;
}
void AppEvent::setDataString(std::string data)
{
_dataString = data;
}
std::string AppEvent::getDataString()
{
return _dataString;
}

View File

@@ -0,0 +1,74 @@
/****************************************************************************
Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd.
http://www.cocos.com
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated engine source code (the "Software"), a limited,
worldwide, royalty-free, non-assignable, revocable and non-exclusive license
to use Cocos Creator solely to develop games on your target platforms. You shall
not use Cocos Creator software for developing other software or tools that's
used for developing games. You are not granted to publish, distribute,
sublicense, and/or sell copies of Cocos Creator.
The software or tools in this License Agreement are licensed, not sold.
Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
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.
****************************************************************************/
//
// AppEvent.h
// Simulator
//
//
#ifndef __Simulator__AppEvent__
#define __Simulator__AppEvent__
#include <string>
#include "cocos2d.h"
// encode / decode json
#include "json/document.h"
#include "json/stringbuffer.h"
#include "json/writer.h"
#include "SimulatorExport.h"
#include "cocos/scripting/js-bindings/event/EventDispatcher.h"
#include "cocos/scripting/js-bindings/event/CustomEventTypes.h"
enum
{
APP_EVENT_MENU = 1,
APP_EVENT_DROP = 2
};
#define kAppEventName "APP.EVENT"
class CC_LIBSIM_DLL AppEvent : public cocos2d::CustomEvent
{
public:
/** Constructor */
AppEvent(const std::string& eventName, int type);
/** Gets event name */
inline const std::string& getEventName() const { return _eventName; };
void setEventType(int type);
int getEventType();
void setDataString(std::string data);
std::string getDataString();
protected:
std::string _eventName;
std::string _dataString;
int _eventType;
};
#endif /* defined(__Simulator__AppEvent__) */

View File

@@ -0,0 +1,98 @@
/****************************************************************************
Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd.
http://www.cocos.com
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated engine source code (the "Software"), a limited,
worldwide, royalty-free, non-assignable, revocable and non-exclusive license
to use Cocos Creator solely to develop games on your target platforms. You shall
not use Cocos Creator software for developing other software or tools that's
used for developing games. You are not granted to publish, distribute,
sublicense, and/or sell copies of Cocos Creator.
The software or tools in this License Agreement are licensed, not sold.
Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
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.
****************************************************************************/
//
// AppLang.cpp
// Simulator
//
#include "AppLang.h"
AppLang::AppLang()
: _hasInit(false)
{
_localizationFileName = "lang";
}
void AppLang::readLocalizationFile()
{
if (!_hasInit)
{
_hasInit = true;
auto fileUtils = cocos2d::FileUtils::getInstance();
if (!fileUtils->isFileExist(_localizationFileName))
{
cocos2d::log("[WARNING]:not find %s", _localizationFileName.c_str());
return;
}
auto fullFilePath = fileUtils->fullPathForFilename(_localizationFileName);
std::string fileContent = cocos2d::FileUtils::getInstance()->getStringFromFile(fullFilePath);
if(fileContent.empty())
return;
if (_docRootjson.Parse<0>(fileContent.c_str()).HasParseError())
{
cocos2d::log("[WARNING]:read json file %s failed because of %d", _localizationFileName.c_str(), _docRootjson.GetParseError());
return;
}
}
}
AppLang* AppLang::getInstance()
{
static AppLang *lang = nullptr;
if (!lang)
{
lang = new AppLang;
lang->readLocalizationFile();
}
return lang;
}
std::string AppLang::getString(const std::string &lang, const std::string &key)
{
std::string tmpKey = key;
const char *ckey = tmpKey.c_str();
std::string tmpLang = lang;
const char *langKey = tmpLang.c_str();
if (!_docRootjson.IsObject())
{
return key;
}
if (_docRootjson.HasMember(langKey))
{
const rapidjson::Value& v = _docRootjson[langKey];
if (v.HasMember(ckey))
{
return v[ckey].GetString();
}
}
return key;
}

View File

@@ -0,0 +1,59 @@
/****************************************************************************
Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd.
http://www.cocos.com
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated engine source code (the "Software"), a limited,
worldwide, royalty-free, non-assignable, revocable and non-exclusive license
to use Cocos Creator solely to develop games on your target platforms. You shall
not use Cocos Creator software for developing other software or tools that's
used for developing games. You are not granted to publish, distribute,
sublicense, and/or sell copies of Cocos Creator.
The software or tools in this License Agreement are licensed, not sold.
Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
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.
****************************************************************************/
//
// AppLang.h
// Simulator
//
#ifndef __Simulator__AppLang__
#define __Simulator__AppLang__
#include "cocos2d.h"
#include <map>
#include "json/document.h"
#include "DeviceEx.h"
#include "SimulatorExport.h"
class CC_LIBSIM_DLL AppLang
{
public:
static AppLang* getInstance();
std::string getString(const std::string &lang, const std::string& key);
protected:
AppLang();
void readLocalizationFile();
bool _hasInit;
std::string _localizationFileName;
rapidjson::Document _docRootjson;
};
#define tr(key) AppLang::getInstance()->getString(player::DeviceEx::getInstance()->getCurrentUILangName(), key)
#endif /* defined(__Simulator__AppLang__) */

View File

@@ -0,0 +1,52 @@
/****************************************************************************
Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd.
http://www.cocos.com
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated engine source code (the "Software"), a limited,
worldwide, royalty-free, non-assignable, revocable and non-exclusive license
to use Cocos Creator solely to develop games on your target platforms. You shall
not use Cocos Creator software for developing other software or tools that's
used for developing games. You are not granted to publish, distribute,
sublicense, and/or sell copies of Cocos Creator.
The software or tools in this License Agreement are licensed, not sold.
Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
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.
****************************************************************************/
#pragma once
#include <string>
#include "PlayerMacros.h"
#include "SimulatorExport.h"
PLAYER_NS_BEGIN
class CC_LIBSIM_DLL DeviceEx
{
public:
static DeviceEx *getInstance();
std::string getCurrentUILangName();
std::string getUserGUID();
private:
DeviceEx();
void init();
void makeUILangName();
std::string makeUserGUID();
std::string _uiLangName;
std::string _userGUID;
};
PLAYER_NS_END

View File

@@ -0,0 +1,62 @@
/****************************************************************************
Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd.
http://www.cocos.com
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated engine source code (the "Software"), a limited,
worldwide, royalty-free, non-assignable, revocable and non-exclusive license
to use Cocos Creator solely to develop games on your target platforms. You shall
not use Cocos Creator software for developing other software or tools that's
used for developing games. You are not granted to publish, distribute,
sublicense, and/or sell copies of Cocos Creator.
The software or tools in this License Agreement are licensed, not sold.
Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
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 __PLAYER_EDITBOX_SERVICE_PROTOCOL_H_
#define __PLAYER_EDITBOX_SERVICE_PROTOCOL_H_
#include <string>
#include "cocos2d.h"
#include "PlayerMacros.h"
#include "PlayerServiceProtocol.h"
PLAYER_NS_BEGIN
class PlayerEditBoxServiceProtocol : public PlayerServiceProtocol
{
public:
static const int FORMAT_NONE = 0;
static const int FORMAT_NUMBER = 1;
virtual void showSingleLineEditBox(const cocos2d::Rect &rect) = 0;
virtual void showMultiLineEditBox(const cocos2d::Rect &rect) = 0;
virtual void hide() = 0;
virtual void setText(const std::string &text) = 0;
virtual void setFont(const std::string &name, int size) = 0;
virtual void setFontColor(const cocos2d::Color3B &color) = 0;
virtual void setFormator(int formator) = 0;
void registerHandler(int handler) { _handler = handler; }
int getHandler() { return _handler; }
protected:
int _handler;
};
PLAYER_NS_END
#endif // __PLAYER_EDITBOX_SERVICE_PROTOCOL_H_

View File

@@ -0,0 +1,58 @@
/****************************************************************************
Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd.
http://www.cocos.com
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated engine source code (the "Software"), a limited,
worldwide, royalty-free, non-assignable, revocable and non-exclusive license
to use Cocos Creator solely to develop games on your target platforms. You shall
not use Cocos Creator software for developing other software or tools that's
used for developing games. You are not granted to publish, distribute,
sublicense, and/or sell copies of Cocos Creator.
The software or tools in this License Agreement are licensed, not sold.
Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
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 __PLAYER_FILE_DIALOG_SERVICE_PROTOCOL_H_
#define __PLAYER_FILE_DIALOG_SERVICE_PROTOCOL_H_
#include <string>
#include <vector>
#include "PlayerMacros.h"
#include "PlayerServiceProtocol.h"
PLAYER_NS_BEGIN
class PlayerFileDialogServiceProtocol : public PlayerServiceProtocol
{
public:
/**
* extensions = "Lua Script File|*.lua;JSON File|*.json";
*/
virtual std::string openFile(const std::string &title,
const std::string &directory,
const std::string &extensions) const = 0;
virtual std::vector<std::string> openMultiple(const std::string &title,
const std::string &directory,
const std::string &extensions) const = 0;
virtual std::string saveFile(const std::string &title,
const std::string &path) const = 0;
virtual std::string openDirectory(const std::string &title,
const std::string &directory) const = 0;
};
PLAYER_NS_END
#endif // __PLAYER_FILE_DIALOG_SERVICE_PROTOCOL_H_

View File

@@ -0,0 +1,34 @@
/****************************************************************************
Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd.
http://www.cocos.com
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated engine source code (the "Software"), a limited,
worldwide, royalty-free, non-assignable, revocable and non-exclusive license
to use Cocos Creator solely to develop games on your target platforms. You shall
not use Cocos Creator software for developing other software or tools that's
used for developing games. You are not granted to publish, distribute,
sublicense, and/or sell copies of Cocos Creator.
The software or tools in this License Agreement are licensed, not sold.
Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
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 __PLAYER_MACROS_H_
#define __PLAYER_MACROS_H_
#define PLAYER_NS_BEGIN namespace player {
#define PLAYER_NS_END }
#define USING_PLAYER_NS using namespace player;
#endif // __PLAYER_MACROS_H_

View File

@@ -0,0 +1,78 @@
/****************************************************************************
Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd.
http://www.cocos.com
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated engine source code (the "Software"), a limited,
worldwide, royalty-free, non-assignable, revocable and non-exclusive license
to use Cocos Creator solely to develop games on your target platforms. You shall
not use Cocos Creator software for developing other software or tools that's
used for developing games. You are not granted to publish, distribute,
sublicense, and/or sell copies of Cocos Creator.
The software or tools in this License Agreement are licensed, not sold.
Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
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 "PlayerMenuServiceProtocol.h"
PLAYER_NS_BEGIN
PlayerMenuItem::PlayerMenuItem()
: _order(0)
, _isGroup(false)
, _isEnabled(true)
, _isChecked(false)
{
}
PlayerMenuItem::~PlayerMenuItem()
{
}
std::string PlayerMenuItem::getMenuId() const
{
return _menuId;
}
std::string PlayerMenuItem::getTitle() const
{
return _title;
}
int PlayerMenuItem::getOrder() const
{
return _order;
}
bool PlayerMenuItem::isGroup() const
{
return _isGroup;
}
bool PlayerMenuItem::isEnabled() const
{
return _isEnabled;
}
bool PlayerMenuItem::isChecked() const
{
return _isChecked;
}
std::string PlayerMenuItem::getShortcut() const
{
return _shortcut;
}
PLAYER_NS_END

View File

@@ -0,0 +1,92 @@
/****************************************************************************
Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd.
http://www.cocos.com
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated engine source code (the "Software"), a limited,
worldwide, royalty-free, non-assignable, revocable and non-exclusive license
to use Cocos Creator solely to develop games on your target platforms. You shall
not use Cocos Creator software for developing other software or tools that's
used for developing games. You are not granted to publish, distribute,
sublicense, and/or sell copies of Cocos Creator.
The software or tools in this License Agreement are licensed, not sold.
Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
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 __PLAYER_MENU_SERVICE_PROTOCOL_H
#define __PLAYER_MENU_SERVICE_PROTOCOL_H
#include <string>
#include "cocos2d.h"
#include "PlayerMacros.h"
#include "PlayerServiceProtocol.h"
#include "SimulatorExport.h"
PLAYER_NS_BEGIN
#define kPlayerSuperModifyKey "super"
#define kPlayerShiftModifyKey "shift"
#define kPlayerCtrlModifyKey "ctrl"
#define kPlayerAltModifyKey "alt"
class CC_LIBSIM_DLL PlayerMenuItem : public cocos2d::Ref
{
public:
virtual ~PlayerMenuItem();
std::string getMenuId() const;
std::string getTitle() const;
int getOrder() const;
bool isGroup() const;
bool isEnabled() const;
bool isChecked() const;
std::string getShortcut() const;
virtual void setTitle(const std::string &title) = 0;
virtual void setEnabled(bool enabled) = 0;
virtual void setChecked(bool checked) = 0;
virtual void setShortcut(const std::string &shortcut) = 0;
protected:
PlayerMenuItem();
std::string _menuId;
std::string _title;
int _order;
bool _isGroup;
bool _isEnabled;
bool _isChecked; // ignored when isGroup = true
std::string _shortcut; // ignored when isGroup = true
};
class PlayerMenuServiceProtocol : public PlayerServiceProtocol
{
public:
static const int MAX_ORDER = 9999;
virtual PlayerMenuItem *addItem(const std::string &menuId,
const std::string &title,
const std::string &parentId,
int order = MAX_ORDER) = 0;
virtual PlayerMenuItem *addItem(const std::string &menuId,
const std::string &title) = 0;
virtual PlayerMenuItem *getItem(const std::string &menuId) = 0;
virtual bool removeItem(const std::string &menuId) = 0;
virtual void setMenuBarEnabled(bool enabled) = 0;
};
PLAYER_NS_END
#endif // __PLAYER_MENU_SERVICE_PROTOCOL_H

View File

@@ -0,0 +1,60 @@
/****************************************************************************
Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd.
http://www.cocos.com
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated engine source code (the "Software"), a limited,
worldwide, royalty-free, non-assignable, revocable and non-exclusive license
to use Cocos Creator solely to develop games on your target platforms. You shall
not use Cocos Creator software for developing other software or tools that's
used for developing games. You are not granted to publish, distribute,
sublicense, and/or sell copies of Cocos Creator.
The software or tools in this License Agreement are licensed, not sold.
Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
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 __PLAYER_MESSAGEBOX_SERVICE_PROTOCOL_H
#define __PLAYER_MESSAGEBOX_SERVICE_PROTOCOL_H
#include <string>
#include "PlayerMacros.h"
#include "PlayerServiceProtocol.h"
PLAYER_NS_BEGIN
class PlayerMessageBoxServiceProtocol : public PlayerServiceProtocol
{
public:
static const int BUTTONS_OK = 0;
static const int BUTTONS_OK_CANCEL = 1;
static const int BUTTONS_YES_NO = 2;
static const int BUTTONS_YES_NO_CANCEL = 3;
static const int BUTTON_OK = 0;
static const int BUTTON_CANCEL = 1;
static const int BUTTON_YES = 2;
static const int BUTTON_NO = 3;
// Show a message box, return index of user clicked button
//
// @return int first button index is 0
virtual int showMessageBox(const std::string &title,
const std::string &message,
int buttonsType = BUTTONS_OK) = 0;
};
PLAYER_NS_END
#endif // __PLAYER_MESSAGEBOX_SERVICE_PROTOCOL_H

View File

@@ -0,0 +1,65 @@
/****************************************************************************
Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd.
http://www.cocos.com
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated engine source code (the "Software"), a limited,
worldwide, royalty-free, non-assignable, revocable and non-exclusive license
to use Cocos Creator solely to develop games on your target platforms. You shall
not use Cocos Creator software for developing other software or tools that's
used for developing games. You are not granted to publish, distribute,
sublicense, and/or sell copies of Cocos Creator.
The software or tools in this License Agreement are licensed, not sold.
Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
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 "PlayerProtocol.h"
#include "base/ccMacros.h"
PLAYER_NS_BEGIN
PlayerProtocol *PlayerProtocol::_instance = nullptr;
PlayerProtocol::PlayerProtocol()
{
CCASSERT(_instance == nullptr, "CAN NOT CREATE MORE PLAYER INSTANCE");
_instance = this;
}
PlayerProtocol::~PlayerProtocol()
{
_instance = nullptr;
}
PlayerProtocol *PlayerProtocol::getInstance()
{
return _instance;
}
void PlayerProtocol::purgeInstance()
{
if (_instance) delete _instance;
}
void PlayerProtocol::setPlayerSettings(const PlayerSettings &settings)
{
_settings = settings;
}
PlayerSettings PlayerProtocol::getPlayerSettings() const
{
return _settings;
}
PLAYER_NS_END

View File

@@ -0,0 +1,72 @@
/****************************************************************************
Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd.
http://www.cocos.com
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated engine source code (the "Software"), a limited,
worldwide, royalty-free, non-assignable, revocable and non-exclusive license
to use Cocos Creator solely to develop games on your target platforms. You shall
not use Cocos Creator software for developing other software or tools that's
used for developing games. You are not granted to publish, distribute,
sublicense, and/or sell copies of Cocos Creator.
The software or tools in this License Agreement are licensed, not sold.
Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
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 __PLAYER_PROTOCOL_H_
#define __PLAYER_PROTOCOL_H_
#include "PlayerMacros.h"
#include "PlayerSettings.h"
#include "PlayerFileDialogServiceProtocol.h"
#include "PlayerMessageBoxServiceProtocol.h"
#include "PlayerMenuServiceProtocol.h"
#include "PlayerEditBoxServiceProtocol.h"
#include "PlayerTaskServiceProtocol.h"
#include "ProjectConfig/ProjectConfig.h"
#include "SimulatorExport.h"
PLAYER_NS_BEGIN
class CC_LIBSIM_DLL PlayerProtocol
{
public:
virtual ~PlayerProtocol();
static PlayerProtocol *getInstance();
static void purgeInstance();
void setPlayerSettings(const PlayerSettings &settings);
PlayerSettings getPlayerSettings() const;
virtual PlayerFileDialogServiceProtocol *getFileDialogService() = 0; // implemented in platform related source files
virtual PlayerMessageBoxServiceProtocol *getMessageBoxService() = 0;
virtual PlayerMenuServiceProtocol *getMenuService() = 0;
// virtual PlayerEditBoxServiceProtocol *getEditBoxService() = 0;
virtual PlayerTaskServiceProtocol *getTaskService() = 0;
protected:
PlayerProtocol(); // avoid create instance from outside
PlayerSettings _settings;
private:
static PlayerProtocol *_instance;
};
PLAYER_NS_END
#endif // __PLAYER_PROTOCOL_H_

View File

@@ -0,0 +1,31 @@
/****************************************************************************
Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd.
http://www.cocos.com
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated engine source code (the "Software"), a limited,
worldwide, royalty-free, non-assignable, revocable and non-exclusive license
to use Cocos Creator solely to develop games on your target platforms. You shall
not use Cocos Creator software for developing other software or tools that's
used for developing games. You are not granted to publish, distribute,
sublicense, and/or sell copies of Cocos Creator.
The software or tools in this License Agreement are licensed, not sold.
Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
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 "PlayerServiceProtocol.h"
PLAYER_NS_BEGIN
PLAYER_NS_END

View File

@@ -0,0 +1,42 @@
/****************************************************************************
Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd.
http://www.cocos.com
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated engine source code (the "Software"), a limited,
worldwide, royalty-free, non-assignable, revocable and non-exclusive license
to use Cocos Creator solely to develop games on your target platforms. You shall
not use Cocos Creator software for developing other software or tools that's
used for developing games. You are not granted to publish, distribute,
sublicense, and/or sell copies of Cocos Creator.
The software or tools in this License Agreement are licensed, not sold.
Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
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 __PLAYER_SERVICE_PROTOCOL_H_
#define __PLAYER_SERVICE_PROTOCOL_H_
#include "PlayerMacros.h"
PLAYER_NS_BEGIN
class PlayerServiceProtocol
{
public:
virtual ~PlayerServiceProtocol() {};
};
PLAYER_NS_END
#endif // __PLAYER_SERVICE_PROTOCOL_H_

View File

@@ -0,0 +1,27 @@
/****************************************************************************
Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd.
http://www.cocos.com
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated engine source code (the "Software"), a limited,
worldwide, royalty-free, non-assignable, revocable and non-exclusive license
to use Cocos Creator solely to develop games on your target platforms. You shall
not use Cocos Creator software for developing other software or tools that's
used for developing games. You are not granted to publish, distribute,
sublicense, and/or sell copies of Cocos Creator.
The software or tools in this License Agreement are licensed, not sold.
Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
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 "PlayerSettings.h"

View File

@@ -0,0 +1,50 @@
/****************************************************************************
Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd.
http://www.cocos.com
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated engine source code (the "Software"), a limited,
worldwide, royalty-free, non-assignable, revocable and non-exclusive license
to use Cocos Creator solely to develop games on your target platforms. You shall
not use Cocos Creator software for developing other software or tools that's
used for developing games. You are not granted to publish, distribute,
sublicense, and/or sell copies of Cocos Creator.
The software or tools in this License Agreement are licensed, not sold.
Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
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 __PLAYER_SETTINGS_H_
#define __PLAYER_SETTINGS_H_
#include "PlayerMacros.h"
PLAYER_NS_BEGIN
class PlayerSettings
{
public:
PlayerSettings()
: openLastProject(false)
, offsetX(0)
, offsetY(0)
{}
bool openLastProject;
int offsetX;
int offsetY;
};
PLAYER_NS_END
#endif // __PLAYER_SETTINGS_H_

View File

@@ -0,0 +1,93 @@
/****************************************************************************
Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd.
http://www.cocos.com
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated engine source code (the "Software"), a limited,
worldwide, royalty-free, non-assignable, revocable and non-exclusive license
to use Cocos Creator solely to develop games on your target platforms. You shall
not use Cocos Creator software for developing other software or tools that's
used for developing games. You are not granted to publish, distribute,
sublicense, and/or sell copies of Cocos Creator.
The software or tools in this License Agreement are licensed, not sold.
Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
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 "PlayerTaskServiceProtocol.h"
PLAYER_NS_BEGIN
std::string PlayerTask::getName() const
{
return _name;
}
std::string PlayerTask::getExecutePath() const
{
return _executePath;
}
std::string PlayerTask::getCommandLineArguments() const
{
return _commandLineArguments;
}
std::string PlayerTask::getOutput() const
{
return _output;
}
int PlayerTask::getState() const
{
return _state;
}
bool PlayerTask::isIdle() const
{
return _state == STATE_IDLE;
}
bool PlayerTask::isRunning() const
{
return _state == STATE_RUNNING;
}
bool PlayerTask::isCompleted() const
{
return _state == STATE_COMPLETED;
}
float PlayerTask::getLifetime() const
{
return _lifetime;
}
int PlayerTask::getResultCode() const
{
return _resultCode;
}
PlayerTask::PlayerTask(const std::string &name,
const std::string &executePath,
const std::string &commandLineArguments)
: _name(name)
, _executePath(executePath)
, _commandLineArguments(commandLineArguments)
, _state(STATE_IDLE)
, _lifetime(0)
, _resultCode(0)
{
}
PLAYER_NS_END

View File

@@ -0,0 +1,88 @@
/****************************************************************************
Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd.
http://www.cocos.com
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated engine source code (the "Software"), a limited,
worldwide, royalty-free, non-assignable, revocable and non-exclusive license
to use Cocos Creator solely to develop games on your target platforms. You shall
not use Cocos Creator software for developing other software or tools that's
used for developing games. You are not granted to publish, distribute,
sublicense, and/or sell copies of Cocos Creator.
The software or tools in this License Agreement are licensed, not sold.
Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
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 __PLAYER_TASK_SERVICE_PROTOCOL_H
#define __PLAYER_TASK_SERVICE_PROTOCOL_H
#include <string>
#include "cocos2d.h"
#include "PlayerMacros.h"
#include "PlayerServiceProtocol.h"
PLAYER_NS_BEGIN
class PlayerTask : public cocos2d::Ref
{
public:
static const int STATE_IDLE = 0;
static const int STATE_RUNNING = 1;
static const int STATE_COMPLETED = 2;
virtual ~PlayerTask() {};
std::string getName() const;
std::string getExecutePath() const;
std::string getCommandLineArguments() const;
std::string getOutput() const;
int getState() const;
bool isIdle() const;
bool isRunning() const;
bool isCompleted() const;
float getLifetime() const;
int getResultCode() const;
virtual bool run() = 0;
virtual void stop() = 0;
virtual void runInTerminal() = 0;
protected:
PlayerTask(const std::string &name,
const std::string &executePath,
const std::string &commandLineArguments);
std::string _name;
std::string _executePath;
std::string _commandLineArguments;
std::string _output;
float _lifetime;
int _state;
int _resultCode;
};
class PlayerTaskServiceProtocol : public PlayerServiceProtocol
{
public:
virtual PlayerTask *createTask(const std::string &name,
const std::string &executePath,
const std::string &commandLineArguments) = 0;
virtual PlayerTask *getTask(const std::string &name) = 0;
virtual void removeTask(const std::string &name) = 0;
};
PLAYER_NS_END
#endif // __PLAYER_TASK_SERVICE_PROTOCOL_H

View File

@@ -0,0 +1,27 @@
/****************************************************************************
Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd.
http://www.cocos.com
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated engine source code (the "Software"), a limited,
worldwide, royalty-free, non-assignable, revocable and non-exclusive license
to use Cocos Creator solely to develop games on your target platforms. You shall
not use Cocos Creator software for developing other software or tools that's
used for developing games. You are not granted to publish, distribute,
sublicense, and/or sell copies of Cocos Creator.
The software or tools in this License Agreement are licensed, not sold.
Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
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 "PlayerUtils.h"

View File

@@ -0,0 +1,61 @@
/****************************************************************************
Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd.
http://www.cocos.com
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated engine source code (the "Software"), a limited,
worldwide, royalty-free, non-assignable, revocable and non-exclusive license
to use Cocos Creator solely to develop games on your target platforms. You shall
not use Cocos Creator software for developing other software or tools that's
used for developing games. You are not granted to publish, distribute,
sublicense, and/or sell copies of Cocos Creator.
The software or tools in this License Agreement are licensed, not sold.
Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
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 __PLAYER_UTILS_H_
#define __PLAYER_UTILS_H_
#include "PlayerMacros.h"
#include <string>
#include <vector>
using namespace std;
PLAYER_NS_BEGIN
template<class T>
vector<T> splitString(T str, T pattern)
{
vector<T> result;
str += pattern;
size_t size = str.size();
for (size_t i = 0; i < size; i++)
{
size_t pos = str.find(pattern, i);
if (pos < size)
{
T s = str.substr(i, pos - i);
result.push_back(s);
i = pos + pattern.size() - 1;
}
}
return result;
};
PLAYER_NS_END
#endif // __PLAYER_UTILS_H_

View File

@@ -0,0 +1,816 @@
/****************************************************************************
Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd.
http://www.cocos.com
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated engine source code (the "Software"), a limited,
worldwide, royalty-free, non-assignable, revocable and non-exclusive license
to use Cocos Creator solely to develop games on your target platforms. You shall
not use Cocos Creator software for developing other software or tools that's
used for developing games. You are not granted to publish, distribute,
sublicense, and/or sell copies of Cocos Creator.
The software or tools in this License Agreement are licensed, not sold.
Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
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 <sstream>
#include "ProjectConfig/ProjectConfig.h"
#include "ProjectConfig/SimulatorConfig.h"
#ifdef _MSC_VER
#define strcasecmp _stricmp
#endif
#if defined(_WINDOWS)
#define DIRECTORY_SEPARATOR "\\"
#define DIRECTORY_SEPARATOR_CHAR '\\'
#else
#define DIRECTORY_SEPARATOR "/"
#define DIRECTORY_SEPARATOR_CHAR '/'
#endif
static std::vector<std::string> &split(const std::string &s, char delim, std::vector<std::string> &elems) {
std::stringstream ss(s);
std::string item;
while (std::getline(ss, item, delim)) {
elems.push_back(item);
}
return elems;
}
static std::vector<std::string> split(const std::string &s, char delim) {
std::vector<std::string> elems;
split(s, delim, elems);
return elems;
}
ProjectConfig::ProjectConfig()
: _scriptFile("")
, _writablePath("")
, _packagePath("")
, _frameSize(960, 640)
, _frameScale(1.0f)
, _showConsole(false)
, _loadPrecompiledFramework(false)
, _writeDebugLogToFile(false)
, _windowOffset(0, 0)
, _debuggerType(kCCRuntimeDebuggerNone)
, _isAppMenu(true)
, _isResizeWindow(false)
, _isRetinaDisplay(false)
, _debugLogFile("debug.log")
, _consolePort(kProjectConfigConsolePort)
, _fileUploadPort(kProjectConfigUploadPort)
, _bindAddress("")
{
normalize();
}
string ProjectConfig::getProjectDir() const
{
return _projectDir;
}
void ProjectConfig::setProjectDir(const string &projectDir)
{
_projectDir = projectDir;
normalize();
}
string ProjectConfig::getScriptFile() const
{
return _scriptFile;
}
string ProjectConfig::getScriptFileRealPath() const
{
return replaceProjectDirToFullPath(_scriptFile);
}
void ProjectConfig::setScriptFile(const string &scriptFile)
{
_scriptFile = scriptFile;
normalize();
}
string ProjectConfig::getWritablePath() const
{
return _writablePath;
}
string ProjectConfig::getWritableRealPath() const
{
return replaceProjectDirToFullPath(_writablePath);
}
void ProjectConfig::setWritablePath(const string &writablePath)
{
_writablePath = writablePath;
normalize();
}
string ProjectConfig::getPackagePath() const
{
return _packagePath;
}
string ProjectConfig::getNormalizedPackagePath() const
{
// replace $(PROJDIR)
auto path = _packagePath;
auto pos = string::npos;
while ((pos = path.find("$(PROJDIR)")) != string::npos)
{
path = path.substr(0, pos) + _projectDir + path.substr(pos + 10);
}
auto len = path.length();
if (len && path[len - 1] != ';')
{
path.append(";");
}
path.append(";");
SimulatorConfig::makeNormalizePath(&path, "/");
return path;
}
void ProjectConfig::setPackagePath(const string &packagePath)
{
_packagePath = packagePath;
}
void ProjectConfig::addPackagePath(const string &packagePath)
{
if (packagePath.length())
{
if (_packagePath.length())
{
_packagePath.append(";");
}
_packagePath.append(packagePath);
normalize();
}
}
vector<string> ProjectConfig::getPackagePathArray() const
{
vector<string> arr;
size_t pos = string::npos;
size_t prev = 0;
while ((pos = _packagePath.find_first_of(";", pos + 1)) != string::npos)
{
auto path = _packagePath.substr(prev, pos - prev);
if (path.length() > 0) arr.push_back(path);
prev = pos + 1;
}
auto path = _packagePath.substr(prev);
if (path.length() > 0) arr.push_back(path);
return arr;
}
cocos2d::Size ProjectConfig::getFrameSize() const
{
return _frameSize;
}
void ProjectConfig::setFrameSize(const cocos2d::Size &frameSize)
{
if (frameSize.width > 0 && frameSize.height > 0)
{
_frameSize = frameSize;
}
}
bool ProjectConfig::isLandscapeFrame() const
{
return _frameSize.width > _frameSize.height;
}
bool ProjectConfig::isPortraitFrame() const
{
return _frameSize.width < _frameSize.height;
}
void ProjectConfig::changeFrameOrientation()
{
float w = _frameSize.width;
_frameSize.width = _frameSize.height;
_frameSize.height = w;
}
void ProjectConfig::changeFrameOrientationToPortait()
{
if (isLandscapeFrame()) changeFrameOrientation();
}
void ProjectConfig::changeFrameOrientationToLandscape()
{
if (!isLandscapeFrame()) changeFrameOrientation();
}
float ProjectConfig::getFrameScale() const
{
return _frameScale;
}
void ProjectConfig::setFrameScale(float frameScale)
{
if (frameScale > 0)
{
_frameScale = frameScale;
}
}
bool ProjectConfig::isShowConsole() const
{
return _showConsole;
}
void ProjectConfig::setShowConsole(bool showConsole)
{
_showConsole = showConsole;
}
bool ProjectConfig::isLoadPrecompiledFramework() const
{
return _loadPrecompiledFramework;
}
void ProjectConfig::setLoadPrecompiledFramework(bool load)
{
_loadPrecompiledFramework = load;
}
bool ProjectConfig::isWriteDebugLogToFile() const
{
return _writeDebugLogToFile;
}
void ProjectConfig::setWriteDebugLogToFile(bool writeDebugLogToFile)
{
_writeDebugLogToFile = writeDebugLogToFile;
}
void ProjectConfig::setDebugLogFilePath(const std::string &logFile)
{
_debugLogFile = logFile;
}
string ProjectConfig::getDebugLogFilePath() const
{
if (isAbsolutePath(_debugLogFile)) return _debugLogFile;
auto path(getProjectDir());
path.append(_debugLogFile);
return path;
}
cocos2d::Vec2 ProjectConfig::getWindowOffset() const
{
return _windowOffset;
}
void ProjectConfig::setWindowOffset(const cocos2d::Vec2 &windowOffset)
{
_windowOffset = windowOffset;
}
int ProjectConfig::getDebuggerType() const
{
return _debuggerType;
}
void ProjectConfig::setDebuggerType(int debuggerType)
{
_debuggerType = debuggerType;
}
void ProjectConfig::parseCommandLine(const vector<string> &args)
{
auto it = args.begin();
while (it != args.end())
{
string arg = *it;
if (arg.compare("-workdir") == 0)
{
++it;
if (it == args.end()) break;
setProjectDir(*it);
if (_writablePath.length() == 0) setWritablePath(*it);
}
else if (arg.compare("-writable-path") == 0)
{
++it;
if (it == args.end()) break;
setWritablePath(*it);
}
else if (arg.compare("-entry") == 0)
{
++it;
if (it == args.end()) break;
setScriptFile(*it);
}
else if (arg.compare("-landscape") == 0)
{
setFrameSize(cocos2d::Size(DEFAULT_HEIGHT, DEFAULT_WIDTH));
}
else if (arg.compare("-portrait") == 0)
{
setFrameSize(cocos2d::Size(DEFAULT_WIDTH, DEFAULT_HEIGHT));
}
else if (arg.compare("-resolution") == 0)
{
++it;
if (it == args.end()) break;
const string& sizeStr(*it);
size_t pos = sizeStr.find('x');
int width = 0;
int height = 0;
if (pos != sizeStr.npos && pos > 0)
{
string widthStr, heightStr;
widthStr.assign(sizeStr, 0, pos);
heightStr.assign(sizeStr, pos + 1, sizeStr.length() - pos);
width = atoi(widthStr.c_str());
height = atoi(heightStr.c_str());
setFrameSize(cocos2d::Size(width, height));
}
}
else if (arg.compare("-scale") == 0)
{
++it;
if (it == args.end()) break;
float scale = atof((*it).c_str());
setFrameScale(scale);
}
else if (arg.compare("-write-debug-log") == 0)
{
++it;
if (it == args.end()) break;
setDebugLogFilePath((*it));
setWriteDebugLogToFile(true);
}
else if (arg.compare("-console") == 0)
{
++it;
if (it == args.end()) break;
if ((*it).compare("enable") == 0)
{
setShowConsole(true);
}
else
{
setShowConsole(false);
}
}
else if (arg.compare("-position") == 0)
{
++it;
if (it == args.end()) break;
const string& posStr(*it);
size_t pos = posStr.find(',');
int x = 0;
int y = 0;
if (pos != posStr.npos && pos > 0)
{
string xStr, yStr;
xStr.assign(posStr, 0, pos);
yStr.assign(posStr, pos + 1, posStr.length() - pos);
x = atoi(xStr.c_str());
y = atoi(yStr.c_str());
setWindowOffset(cocos2d::Vec2(x, y));
}
}
else if (arg.compare("-debugger") == 0)
{
++it;
if (it == args.end()) break;
if ((*it).compare("codeide") == 0)
{
setDebuggerType(kCCRuntimeDebuggerCodeIDE);
}
else if ((*it).compare("studio") == 0)
{
setDebuggerType(kCCRuntimeDebuggerStudio);
}
}
else if (arg.compare("-app-menu") == 0)
{
_isAppMenu = true;
}
else if (arg.compare("-resize-window") == 0)
{
_isResizeWindow = true;
}
else if (arg.compare("-retina-display") == 0)
{
_isRetinaDisplay = true;
}
else if (arg.compare("-port") == 0)
{
CCLOG("REFINE:");
}
else if (arg.compare("-listen") == 0)
{
++it;
setBindAddress((*it));
}
else if (arg.compare("-search-path") == 0)
{
++it;
vector<string> pathes = split((*it), ';');
setSearchPath(pathes);
}
++it;
}
}
string ProjectConfig::makeCommandLine(unsigned int mask /* = kProjectConfigAll */) const
{
stringstream buff;
vector<string> commands = makeCommandLineVector(mask);
for (auto &cmd : commands)
{
buff << " " << cmd;
}
string result = buff.str();
while (result.at(0) == ' ')
{
result = result.assign(result, 1, result.length());
}
return result;
}
vector<string> ProjectConfig::makeCommandLineVector(unsigned int mask /* = kProjectConfigAll */) const
{
vector<string> ret;
stringstream buff;
if (mask & kProjectConfigProjectDir)
{
auto path = getProjectDir();
if (path.length())
{
ret.push_back("-workdir");
ret.push_back(dealWithSpaceWithPath(path));
}
}
if (mask & kProjectConfigScriptFile)
{
auto path = getScriptFileRealPath();
if (path.length())
{
ret.push_back("-entry");
ret.push_back(dealWithSpaceWithPath(path));
}
}
if (mask & kProjectConfigWritablePath)
{
auto path = getWritableRealPath();
if (path.length())
{
ret.push_back("-writable-path");
ret.push_back(dealWithSpaceWithPath(path));
}
}
if (mask & kProjectConfigFrameSize)
{
buff.str("");
buff << (int)getFrameSize().width;
buff << "x";
buff << (int)getFrameSize().height;
ret.push_back("-resolution");
ret.push_back(buff.str());
}
if (mask & kProjectConfigFrameScale)
{
if (getFrameScale() < 1.0f)
{
buff.str("");
buff.precision(2);
buff << getFrameScale();
ret.push_back("-scale");
ret.push_back(buff.str());
}
}
if (mask & kProjectConfigWriteDebugLogToFile)
{
if (isWriteDebugLogToFile())
{
ret.push_back("-write-debug-log");
ret.push_back(getDebugLogFilePath());
}
}
if (mask & kProjectConfigShowConsole)
{
if (isShowConsole())
{
ret.push_back("-console");
ret.push_back("enable");
}
else
{
ret.push_back("-console");
ret.push_back("disable");
}
}
if (mask & kProjectConfigWindowOffset)
{
if (_windowOffset.x != 0 && _windowOffset.y != 0)
{
buff.str("");
buff << (int)_windowOffset.x;
buff << ",";
buff << (int)_windowOffset.y;
buff << "";
ret.push_back("-position");
ret.push_back(buff.str());
}
}
if (mask & kProjectConfigDebugger)
{
switch (getDebuggerType())
{
case kCCRuntimeDebuggerCodeIDE:
ret.push_back("-debugger");
ret.push_back("codeide");
break;
case kCCRuntimeDebuggerStudio:
ret.push_back("-debugger");
ret.push_back("studio");
break;
}
}
if (mask & kProjectConfigListen)
{
if (!_bindAddress.empty())
{
ret.push_back("-listen");
ret.push_back(_bindAddress);
}
}
if (mask & kProjectConfigSearchPath)
{
if (_searchPath.size() > 0)
{
stringstream pathbuff;
for (auto &path : _searchPath)
{
pathbuff << dealWithSpaceWithPath(path) << ";";
}
string pathArgs = pathbuff.str();
pathArgs[pathArgs.length()-1] = '\0';
ret.push_back("-search-path");
ret.push_back(pathArgs);
}
}
return ret;
}
void ProjectConfig::setConsolePort(int port)
{
_consolePort = port;
}
int ProjectConfig::getConsolePort()
{
return _consolePort;
}
void ProjectConfig::setFileUploadPort(int port)
{
_fileUploadPort = port;
}
int ProjectConfig::getFileUploadPort()
{
return _fileUploadPort;
}
void ProjectConfig::setBindAddress(const std::string &address)
{
_bindAddress = address;
}
const std::string &ProjectConfig::getBindAddress() const
{
return _bindAddress;
}
void ProjectConfig::setSearchPath(const vector<string> &args)
{
_searchPath = args;
}
const vector<string> &ProjectConfig::getSearchPath() const
{
return _searchPath;
}
bool ProjectConfig::isAppMenu() const
{
return _isAppMenu;
}
bool ProjectConfig::isResizeWindow() const
{
return _isResizeWindow;
}
bool ProjectConfig::isRetinaDisplay() const
{
return _isRetinaDisplay;
}
bool ProjectConfig::validate() const
{
auto utils = cocos2d::FileUtils::getInstance();
if (!utils->isDirectoryExist(_projectDir)) return false;
if (!utils->isDirectoryExist(getWritableRealPath())) return false;
if (!utils->isFileExist(getScriptFileRealPath())) return false;
return true;
}
void ProjectConfig::dump()
{
CCLOG("Project Config:");
CCLOG(" project dir: %s", _projectDir.c_str());
CCLOG(" writable path: %s", _writablePath.length() ? _writablePath.c_str() : "-");
CCLOG(" script file: %s", _scriptFile.c_str());
CCLOG(" frame size: %0.0f x %0.0f", _frameSize.width, _frameSize.height);
CCLOG(" frame scale: %0.2f", _frameScale);
CCLOG(" show console: %s", _showConsole ? "YES" : "NO");
CCLOG(" write debug log: %s (%s)", _writeDebugLogToFile ? getDebugLogFilePath().c_str() : "NO",
_writeDebugLogToFile ? getDebugLogFilePath().c_str() : "");
CCLOG(" listen: %s", _bindAddress.c_str());
if (_debuggerType == kCCRuntimeDebuggerLDT)
{
CCLOG(" debugger: Eclipse LDT");
}
else if (_debuggerType == kCCRuntimeDebuggerCodeIDE)
{
CCLOG(" debugger: Cocos Code IDE");
}
else if (_debuggerType == kCCRuntimeDebuggerStudio)
{
CCLOG(" debugger: Cocos Studio");
}
else
{
CCLOG(" debugger: none");
}
CCLOG(" add searching path:");
for (auto &path : _searchPath)
{
CCLOG(" %s", path.c_str());
}
CCLOG("\n\n");
}
void ProjectConfig::normalize()
{
SimulatorConfig::makeNormalizePath(&_projectDir);
SimulatorConfig::makeNormalizePath(&_scriptFile);
SimulatorConfig::makeNormalizePath(&_writablePath);
SimulatorConfig::makeNormalizePath(&_packagePath);
// projectDir
size_t len = _projectDir.length();
if (len > 0 && _projectDir[len - 1] != DIRECTORY_SEPARATOR_CHAR)
{
_projectDir.append(DIRECTORY_SEPARATOR);
len++;
}
// writablePath
if (len > 0 && _writablePath.length() == 0)
{
_writablePath = _projectDir;
}
len = _writablePath.length();
if (len > 0 && _writablePath[len - 1] != DIRECTORY_SEPARATOR_CHAR)
{
_writablePath.append(DIRECTORY_SEPARATOR);
}
_writablePath = replaceProjectDirToMacro(_writablePath);
// scriptFile
_scriptFile = replaceProjectDirToMacro(_scriptFile);
// package.path
vector<string> arr = getPackagePathArray();
_packagePath = string("");
for (auto it = arr.begin(); it != arr.end(); ++it)
{
string path = replaceProjectDirToMacro(*it);
_packagePath.append(path);
_packagePath.append(";");
}
if (_packagePath.length() > 0 && _packagePath[_packagePath.length() - 1] == ';')
{
_packagePath = _packagePath.substr(0, _packagePath.length() - 1);
}
}
string ProjectConfig::replaceProjectDirToMacro(const string &path) const
{
if (!isAbsolutePath(path))
{
if (path.compare(0, 10, "$(PROJDIR)") == 0) return path;
string result("$(PROJDIR)");
result.append(DIRECTORY_SEPARATOR);
result.append(path);
return result;
}
string result = path;
size_t len = _projectDir.length();
if (len > 0 && result.compare(0, len, _projectDir) == 0)
{
result = "$(PROJDIR)";
result.append(DIRECTORY_SEPARATOR);
result.append(path.substr(len));
}
return result;
}
string ProjectConfig::replaceProjectDirToFullPath(const string &path) const
{
if (isAbsolutePath(path)) return path;
if (path.length() == 0) return _projectDir;
string result = path;
if (path.compare(0, 10, "$(PROJDIR)") == 0)
{
result = _projectDir;
string suffix = path.substr(10);
if (suffix[0] == DIRECTORY_SEPARATOR_CHAR)
{
suffix = suffix.substr(1);
}
result.append(suffix);
}
return result;
}
bool ProjectConfig::isAbsolutePath(const string &path) const
{
if (DIRECTORY_SEPARATOR_CHAR == '/')
{
return path.length() > 0 && path[0] == '/';
}
return path.length() > 2 && path[1] == ':';
}
string ProjectConfig::dealWithSpaceWithPath(const string &path) const
{
#if defined(_WINDOWS)
string ret("\"");
ret += path;
if (path[path.length() - 1] == '\\')
{
ret += "\\";
}
ret += "\"";
return ret;
#else
return path;
#endif
}

View File

@@ -0,0 +1,174 @@
/****************************************************************************
Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd.
http://www.cocos.com
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated engine source code (the "Software"), a limited,
worldwide, royalty-free, non-assignable, revocable and non-exclusive license
to use Cocos Creator solely to develop games on your target platforms. You shall
not use Cocos Creator software for developing other software or tools that's
used for developing games. You are not granted to publish, distribute,
sublicense, and/or sell copies of Cocos Creator.
The software or tools in this License Agreement are licensed, not sold.
Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
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 __PROJECT_CONFIG_H_
#define __PROJECT_CONFIG_H_
#include <string>
#include <vector>
using namespace std;
#include "cocos2d.h"
#include "SimulatorExport.h"
#define kCCRuntimeDebuggerNone 0
#define kCCRuntimeDebuggerLDT 1
#define kCCRuntimeDebuggerCodeIDE 2
#define kCCRuntimeDebuggerStudio 3
#define kProjectConfigProjectDir 1 // -workdir "PATH"
#define kProjectConfigScriptFile 2 // -script "FILENAME"
#define kProjectConfigPackagePath 4 // -package.path "PATH;PATH"
#define kProjectConfigWritablePath 8 // -writable "PATH"
#define kProjectConfigFrameSize 16 // -size 960x640
#define kProjectConfigFrameScale 32 // -scale 1.0
#define kProjectConfigShowConsole 64 // -console, -disable-console
#define kProjectConfigLoadPrecompiledFramework 128 // -load-framework, -disable-load-framework
#define kProjectConfigWriteDebugLogToFile 256 // -write-debug-log, -disable-write-debug-log
#define kProjectConfigWindowOffset 512 // -offset {0,0}
#define kProjectConfigDebugger 1024 // -debugger-ldt, -debugger-codeide, -disable-debugger
#define kProjectConfigListen 2048 //
#define kProjectConfigSearchPath 4096 //
#define kProjectConfigOpenRecent (kProjectConfigProjectDir | kProjectConfigScriptFile | kProjectConfigPackagePath | kProjectConfigWritablePath | kProjectConfigFrameSize | kProjectConfigFrameScale | kProjectConfigShowConsole | kProjectConfigLoadPrecompiledFramework | kProjectConfigWriteDebugLogToFile)
#define kProjectConfigAll (kProjectConfigProjectDir | kProjectConfigScriptFile | kProjectConfigPackagePath | kProjectConfigWritablePath | kProjectConfigFrameSize | kProjectConfigFrameScale | kProjectConfigShowConsole | kProjectConfigLoadPrecompiledFramework | kProjectConfigWriteDebugLogToFile | kProjectConfigWindowOffset | kProjectConfigDebugger | kProjectConfigListen | kProjectConfigSearchPath)
#define kProjectConfigConsolePort 6010
#define kProjectConfigUploadPort 6020
#define kProjectConfigDebugPort 5086
class CC_LIBSIM_DLL ProjectConfig
{
public:
ProjectConfig();
static const int DEFAULT_WIDTH = 640;
static const int DEFAULT_HEIGHT = 960;
string getProjectDir() const;
void setProjectDir(const string &projectDir);
string getScriptFile() const;
string getScriptFileRealPath() const;
void setScriptFile(const string &scriptFile);
string getWritablePath() const;
string getWritableRealPath() const;
void setWritablePath(const string &writablePath);
string getPackagePath() const;
string getNormalizedPackagePath() const;
void setPackagePath(const string &packagePath);
void addPackagePath(const string &packagePath);
vector<string> getPackagePathArray() const;
cocos2d::Size getFrameSize() const;
void setFrameSize(const cocos2d::Size &frameSize);
bool isLandscapeFrame() const;
bool isPortraitFrame() const;
void changeFrameOrientation();
void changeFrameOrientationToPortait();
void changeFrameOrientationToLandscape();
float getFrameScale() const;
void setFrameScale(float frameScale);
bool isShowConsole() const;
void setShowConsole(bool showConsole);
bool isLoadPrecompiledFramework() const;
void setLoadPrecompiledFramework(bool load);
bool isWriteDebugLogToFile() const;
void setWriteDebugLogToFile(bool writeDebugLogToFile);
void setDebugLogFilePath(const std::string &logFile);
string getDebugLogFilePath() const;
cocos2d::Vec2 getWindowOffset() const;
void setWindowOffset(const cocos2d::Vec2 &windowOffset);
int getDebuggerType() const;
void setDebuggerType(int debuggerType);
void parseCommandLine(const vector<string> &args);
string makeCommandLine(unsigned int mask = kProjectConfigAll) const;
vector<string> makeCommandLineVector(unsigned int mask = kProjectConfigAll) const;
void setConsolePort(int port);
int getConsolePort();
void setFileUploadPort(int port);
int getFileUploadPort();
// @address: 127.0.0.1
void setBindAddress(const std::string &address);
const std::string &getBindAddress() const;
void setSearchPath(const vector<string> &args);
const vector<string> &getSearchPath() const;
bool isAppMenu() const;
bool isResizeWindow() const;
bool isRetinaDisplay() const;
bool validate() const;
void dump();
private:
string _projectDir;
string _scriptFile;
string _packagePath;
string _writablePath;
cocos2d::Size _frameSize;
float _frameScale;
bool _showConsole;
bool _loadPrecompiledFramework;
bool _writeDebugLogToFile;
bool _restartProcess;
cocos2d::Vec2 _windowOffset;
int _debuggerType;
bool _isAppMenu;
bool _isResizeWindow;
bool _isRetinaDisplay;
string _debugLogFile;
int _consolePort;
int _fileUploadPort;
string _bindAddress;
vector<string> _searchPath;
void normalize();
string replaceProjectDirToMacro(const string &path) const;
string replaceProjectDirToFullPath(const string &path) const;
bool isAbsolutePath(const string &path) const;
/**
* windows : Y:\Documents\CocosProjects\Cocos Project\ -> "Y:\Documents\CocosProjects\Cocos Project\\"
* other : return @path
*/
string dealWithSpaceWithPath(const string &path) const;
};
#endif // __PROJECT_CONFIG_H_

View File

@@ -0,0 +1,109 @@
/****************************************************************************
Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd.
http://www.cocos.com
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated engine source code (the "Software"), a limited,
worldwide, royalty-free, non-assignable, revocable and non-exclusive license
to use Cocos Creator solely to develop games on your target platforms. You shall
not use Cocos Creator software for developing other software or tools that's
used for developing games. You are not granted to publish, distribute,
sublicense, and/or sell copies of Cocos Creator.
The software or tools in this License Agreement are licensed, not sold.
Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
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 "SimulatorConfig.h"
#include <sstream>
SimulatorConfig *SimulatorConfig::_instance = NULL;
SimulatorConfig *SimulatorConfig::getInstance()
{
if (!_instance)
{
_instance = new SimulatorConfig();
}
return _instance;
}
SimulatorConfig::SimulatorConfig()
{
_screenSizeArray.push_back(SimulatorScreenSize("Apple iPhone 5 (640x1136)", 640, 1136));
_screenSizeArray.push_back(SimulatorScreenSize("Apple iPhone 6 (750x1334)", 750, 1334));
_screenSizeArray.push_back(SimulatorScreenSize("Apple iPhone 6Plus (1242x2208)", 1242, 2208));
_screenSizeArray.push_back(SimulatorScreenSize("Apple iPhone 7 (750x1334)", 750, 1334));
_screenSizeArray.push_back(SimulatorScreenSize("Apple iPhone 7Plus (1242x2208)", 1242, 2208));
_screenSizeArray.push_back(SimulatorScreenSize("Apple iPhone X (750x2436)", 750, 2436));
_screenSizeArray.push_back(SimulatorScreenSize("Apple iPad (2048x1536)", 2048, 1536));
_screenSizeArray.push_back(SimulatorScreenSize("Apple iPad Air 2 (1536x2048)", 1536, 2048));
_screenSizeArray.push_back(SimulatorScreenSize("Apple iPad Pro 10.5-inch (1668x2224)", 1668, 2224));
_screenSizeArray.push_back(SimulatorScreenSize("Apple iPad Pro 12.9-inch (2048x2732)", 2048, 2732));
_screenSizeArray.push_back(SimulatorScreenSize("Huawei P9 (1080x1920)", 1080, 1920));
_screenSizeArray.push_back(SimulatorScreenSize("Huawei Mate9 Pro (1440x2560)", 1440, 2560));
_screenSizeArray.push_back(SimulatorScreenSize("Google Nexus 5 (1080x2880)", 1080, 2880));
_screenSizeArray.push_back(SimulatorScreenSize("Google Nexus 5X (1079x1919)", 1079, 1919));
_screenSizeArray.push_back(SimulatorScreenSize("Google Nexus 6 (1442x2562)", 1442, 2562));
_screenSizeArray.push_back(SimulatorScreenSize("Google Nexus 7 (1920x1200)", 1920, 1200));
}
int SimulatorConfig::getScreenSizeCount() const
{
return (int)_screenSizeArray.size();
}
SimulatorScreenSize SimulatorConfig::getScreenSize(int index) const
{
return _screenSizeArray.at(index);
}
int SimulatorConfig::checkScreenSize(const cocos2d::Size &size) const
{
int width = size.width;
int height = size.height;
if (width > height)
{
int w = width;
width = height;
height = w;
}
int count = (int)_screenSizeArray.size();
for (int i = 0; i < count; ++i)
{
const SimulatorScreenSize &size = _screenSizeArray[i];
if (size.width == width && size.height == height)
{
return i;
}
}
return -1;
}
// helper
void SimulatorConfig::makeNormalizePath(string *path, const char *directorySeparator/* = NULL*/)
{
if (!directorySeparator) directorySeparator = DIRECTORY_SEPARATOR;
size_t pos = std::string::npos;
while ((pos = path->find_first_of("/\\", pos + 1)) != std::string::npos)
{
path->replace(pos, 1, directorySeparator);
}
}

View File

@@ -0,0 +1,83 @@
/****************************************************************************
Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd.
http://www.cocos.com
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated engine source code (the "Software"), a limited,
worldwide, royalty-free, non-assignable, revocable and non-exclusive license
to use Cocos Creator solely to develop games on your target platforms. You shall
not use Cocos Creator software for developing other software or tools that's
used for developing games. You are not granted to publish, distribute,
sublicense, and/or sell copies of Cocos Creator.
The software or tools in this License Agreement are licensed, not sold.
Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
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 __SIMULATOR_CONFIG_H_
#define __SIMULATOR_CONFIG_H_
#include <string>
#include <vector>
using namespace std;
#include "cocos2d.h"
#include "SimulatorExport.h"
#if defined(_WINDOWS)
#define DIRECTORY_SEPARATOR "\\"
#define DIRECTORY_SEPARATOR_CHAR '\\'
#else
#define DIRECTORY_SEPARATOR "/"
#define DIRECTORY_SEPARATOR_CHAR '/'
#endif
typedef struct _SimulatorScreenSize {
string title;
int width;
int height;
_SimulatorScreenSize(const string &title_, int width_, int height_)
{
title = title_;
width = width_;
height = height_;
}
} SimulatorScreenSize;
typedef vector<SimulatorScreenSize> ScreenSizeArray;
typedef ScreenSizeArray::iterator ScreenSizeArrayIterator;
class CC_LIBSIM_DLL SimulatorConfig
{
public:
static SimulatorConfig *getInstance();
// predefined screen size
int getScreenSizeCount() const;
SimulatorScreenSize getScreenSize(int index) const;
int checkScreenSize(const cocos2d::Size &size) const;
// helper
static void makeNormalizePath(string *path, const char *directorySeparator = NULL);
private:
SimulatorConfig();
static SimulatorConfig *_instance;
ScreenSizeArray _screenSizeArray;
};
#endif // __SIMULATOR_CONFIG_H_

View File

@@ -0,0 +1,55 @@
/****************************************************************************
Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd.
http://www.cocos.com
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated engine source code (the "Software"), a limited,
worldwide, royalty-free, non-assignable, revocable and non-exclusive license
to use Cocos Creator solely to develop games on your target platforms. You shall
not use Cocos Creator software for developing other software or tools that's
used for developing games. You are not granted to publish, distribute,
sublicense, and/or sell copies of Cocos Creator.
The software or tools in this License Agreement are licensed, not sold.
Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
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.
****************************************************************************/
#pragma once
#if (defined(WIN32) && defined(_WINDOWS)) || defined(WINRT) || defined(WP8)
#ifdef __MINGW32__
#include <string.h>
#endif
#if defined(_USRLIBSIMSTATIC)
#define CC_LIBSIM_DLL
#else
#if defined(_USRLIBSIMDLL)
#define CC_LIBSIM_DLL __declspec(dllexport)
#else /* use a DLL library */
#define CC_LIBSIM_DLL __declspec(dllimport)
#endif
#endif
/* Define NULL pointer value */
#ifndef NULL
#ifdef __cplusplus
#define NULL 0
#else
#define NULL ((void *)0)
#endif
#endif
#elif defined(_SHARED_)
#define CC_LIBSIM_DLL __attribute__((visibility("default")))
#else
#define CC_LIBSIM_DLL
#endif

View File

@@ -0,0 +1,39 @@
/****************************************************************************
Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd.
http://www.cocos.com
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated engine source code (the "Software"), a limited,
worldwide, royalty-free, non-assignable, revocable and non-exclusive license
to use Cocos Creator solely to develop games on your target platforms. You shall
not use Cocos Creator software for developing other software or tools that's
used for developing games. You are not granted to publish, distribute,
sublicense, and/or sell copies of Cocos Creator.
The software or tools in this License Agreement are licensed, not sold.
Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
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 __COCOS2D_X_EXTRA_H_
#define __COCOS2D_X_EXTRA_H_
#include "cocos2d.h"
#include <string>
using namespace std;
#define NS_CC_EXTRA_BEGIN namespace cocos2d { namespace extra {
#define NS_CC_EXTRA_END }}
#define USING_NS_CC_EXTRA using namespace cocos2d::extra
#endif /* __COCOS2D_X_EXTRA_H_ */

View File

@@ -0,0 +1,579 @@
/****************************************************************************
Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd.
http://www.cocos.com
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated engine source code (the "Software"), a limited,
worldwide, royalty-free, non-assignable, revocable and non-exclusive license
to use Cocos Creator solely to develop games on your target platforms. You shall
not use Cocos Creator software for developing other software or tools that's
used for developing games. You are not granted to publish, distribute,
sublicense, and/or sell copies of Cocos Creator.
The software or tools in this License Agreement are licensed, not sold.
Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
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 "network/CCHTTPRequest.h"
#include <stdio.h>
#include <iostream>
#include <thread>
#if CC_LUA_ENGINE_ENABLED > 0
extern "C" {
#include "lua.h"
}
#include "CCLuaEngine.h"
#endif
#include <sstream>
NS_CC_EXTRA_BEGIN
unsigned int HTTPRequest::s_id = 0;
HTTPRequest *HTTPRequest::createWithUrl(HTTPRequestDelegate *delegate,
const char *url,
int method)
{
HTTPRequest *request = new HTTPRequest();
request->initWithDelegate(delegate, url, method);
request->autorelease();
return request;
}
#if CC_LUA_ENGINE_ENABLED > 0
HTTPRequest *HTTPRequest::createWithUrlLua(LUA_FUNCTION listener,
const char *url,
int method)
{
HTTPRequest *request = new HTTPRequest();
request->initWithListener(listener, url, method);
request->autorelease();
return request;
}
#endif
bool HTTPRequest::initWithDelegate(HTTPRequestDelegate *delegate, const char *url, int method)
{
_delegate = delegate;
return initWithUrl(url, method);
}
#if CC_LUA_ENGINE_ENABLED > 0
bool HTTPRequest::initWithListener(LUA_FUNCTION listener, const char *url, int method)
{
_listener = listener;
return initWithUrl(url, method);
}
#endif
bool HTTPRequest::initWithUrl(const char *url, int method)
{
CCASSERT(url, "HTTPRequest::initWithUrl() - invalid url");
_curl = curl_easy_init();
curl_easy_setopt(_curl, CURLOPT_URL, url);
curl_easy_setopt(_curl, CURLOPT_USERAGENT, "libcurl");
curl_easy_setopt(_curl, CURLOPT_CONNECTTIMEOUT, DEFAULT_TIMEOUT);
curl_easy_setopt(_curl, CURLOPT_TIMEOUT, DEFAULT_TIMEOUT);
curl_easy_setopt(_curl, CURLOPT_NOSIGNAL, 1L);
if (method == kCCHTTPRequestMethodPOST)
{
curl_easy_setopt(_curl, CURLOPT_POST, 1L);
curl_easy_setopt(_curl, CURLOPT_COPYPOSTFIELDS, "");
}
++s_id;
// CCLOG("HTTPRequest[0x%04x] - create request with url: %s", s_id, url);
return true;
}
HTTPRequest::~HTTPRequest(void)
{
cleanup();
if (_listener)
{
#if (CC_LUA_ENGINE_ENABLED > 0)
LuaEngine::getInstance()->removeScriptHandler(_listener);
#endif
}
// CCLOG("HTTPRequest[0x%04x] - request removed", s_id);
}
void HTTPRequest::setRequestUrl(const char *url)
{
CCASSERT(url, "HTTPRequest::setRequestUrl() - invalid url");
_url = url;
curl_easy_setopt(_curl, CURLOPT_URL, _url.c_str());
}
const string HTTPRequest::getRequestUrl(void)
{
return _url;
}
void HTTPRequest::addRequestHeader(const char *header)
{
CCASSERT(_state == kCCHTTPRequestStateIdle, "HTTPRequest::addRequestHeader() - request not idle");
CCASSERT(header, "HTTPRequest::addRequestHeader() - invalid header");
_headers.push_back(string(header));
}
void HTTPRequest::addPOSTValue(const char *key, const char *value)
{
CCASSERT(_state == kCCHTTPRequestStateIdle, "HTTPRequest::addPOSTValue() - request not idle");
CCASSERT(key, "HTTPRequest::addPOSTValue() - invalid key");
_postFields[string(key)] = string(value ? value : "");
}
void HTTPRequest::setPOSTData(const char *data)
{
CCASSERT(_state == kCCHTTPRequestStateIdle, "HTTPRequest::setPOSTData() - request not idle");
CCASSERT(data, "HTTPRequest::setPOSTData() - invalid post data");
_postFields.clear();
curl_easy_setopt(_curl, CURLOPT_POST, 1L);
curl_easy_setopt(_curl, CURLOPT_COPYPOSTFIELDS, data);
}
void HTTPRequest::addFormFile(const char *name, const char *filePath, const char *contentType)
{
curl_formadd(&_formPost, &_lastPost,
CURLFORM_COPYNAME, name,
CURLFORM_FILE, filePath,
CURLFORM_CONTENTTYPE, contentType,
CURLFORM_END);
//CCLOG("addFormFile %s %s %s", name, filePath, contentType);
}
void HTTPRequest::addFormContents(const char *name, const char *value)
{
curl_formadd(&_formPost, &_lastPost,
CURLFORM_COPYNAME, name,
CURLFORM_COPYCONTENTS, value,
CURLFORM_END);
//CCLOG("addFormContents %s %s", name, value);
}
void HTTPRequest::setCookieString(const char *cookie)
{
CCASSERT(_state == kCCHTTPRequestStateIdle, "HTTPRequest::setAcceptEncoding() - request not idle");
curl_easy_setopt(_curl, CURLOPT_COOKIE, cookie ? cookie : "");
}
const string HTTPRequest::getCookieString(void)
{
CCASSERT(_state == kCCHTTPRequestStateCompleted, "HTTPRequest::getResponseData() - request not completed");
return _responseCookies;
}
void HTTPRequest::setAcceptEncoding(int acceptEncoding)
{
CCASSERT(_state == kCCHTTPRequestStateIdle, "HTTPRequest::setAcceptEncoding() - request not idle");
switch (acceptEncoding)
{
case kCCHTTPRequestAcceptEncodingGzip:
curl_easy_setopt(_curl, CURLOPT_ACCEPT_ENCODING, "gzip");
break;
case kCCHTTPRequestAcceptEncodingDeflate:
curl_easy_setopt(_curl, CURLOPT_ACCEPT_ENCODING, "deflate");
break;
default:
curl_easy_setopt(_curl, CURLOPT_ACCEPT_ENCODING, "identity");
}
}
void HTTPRequest::setTimeout(int timeout)
{
CCASSERT(_state == kCCHTTPRequestStateIdle, "HTTPRequest::setTimeout() - request not idle");
curl_easy_setopt(_curl, CURLOPT_CONNECTTIMEOUT, timeout);
curl_easy_setopt(_curl, CURLOPT_TIMEOUT, timeout);
}
bool HTTPRequest::start(void)
{
CCASSERT(_state == kCCHTTPRequestStateIdle, "HTTPRequest::start() - request not idle");
_state = kCCHTTPRequestStateInProgress;
_curlState = kCCHTTPRequestCURLStateBusy;
retain();
curl_easy_setopt(_curl, CURLOPT_HTTP_CONTENT_DECODING, 1);
curl_easy_setopt(_curl, CURLOPT_WRITEFUNCTION, writeDataCURL);
curl_easy_setopt(_curl, CURLOPT_WRITEDATA, this);
curl_easy_setopt(_curl, CURLOPT_HEADERFUNCTION, writeHeaderCURL);
curl_easy_setopt(_curl, CURLOPT_WRITEHEADER, this);
curl_easy_setopt(_curl, CURLOPT_NOPROGRESS, false);
curl_easy_setopt(_curl, CURLOPT_PROGRESSFUNCTION, progressCURL);
curl_easy_setopt(_curl, CURLOPT_PROGRESSDATA, this);
curl_easy_setopt(_curl, CURLOPT_COOKIEFILE, "");
#ifdef _WINDOWS_
#if (CC_TARGET_PLATFORM == CC_PLATFORM_WP8) || (CC_TARGET_PLATFORM == CC_PLATFORM_WINRT)
std::thread worker(requestCURL, this);
worker.detach();
#else
CreateThread(NULL, // default security attributes
0, // use default stack size
requestCURL, // thread function name
this, // argument to thread function
0, // use default creation flags
NULL);
#endif // CC_TARGET_PLATFORM == CC_PLATFORM_WP8
#else
pthread_create(&_thread, NULL, requestCURL, this);
pthread_detach(_thread);
#endif
// Director::getInstance()->getScheduler()->scheduleUpdate(this, 0, false);
// CCLOG("HTTPRequest[0x%04x] - request start", s_id);
return true;
}
void HTTPRequest::cancel(void)
{
_delegate = NULL;
if (_state == kCCHTTPRequestStateIdle || _state == kCCHTTPRequestStateInProgress)
{
_state = kCCHTTPRequestStateCancelled;
}
}
int HTTPRequest::getState(void)
{
return _state;
}
int HTTPRequest::getResponseStatusCode(void)
{
CCASSERT(_state == kCCHTTPRequestStateCompleted, "Request not completed");
return _responseCode;
}
const HTTPRequestHeaders &HTTPRequest::getResponseHeaders(void)
{
CCASSERT(_state == kCCHTTPRequestStateCompleted, "HTTPRequest::getResponseHeaders() - request not completed");
return _responseHeaders;
}
const string HTTPRequest::getResponseHeadersString()
{
string buf;
for (HTTPRequestHeadersIterator it = _responseHeaders.begin(); it != _responseHeaders.end(); ++it)
{
buf.append(*it);
}
return buf;
}
const string HTTPRequest::getResponseString(void)
{
CCASSERT(_state == kCCHTTPRequestStateCompleted, "HTTPRequest::getResponseString() - request not completed");
return string(_responseBuffer ? static_cast<char*>(_responseBuffer) : "");
}
void *HTTPRequest::getResponseData(void)
{
CCASSERT(_state == kCCHTTPRequestStateCompleted, "HTTPRequest::getResponseData() - request not completed");
void *buff = malloc(_responseDataLength);
memcpy(buff, _responseBuffer, _responseDataLength);
return buff;
}
#if CC_LUA_ENGINE_ENABLED > 0
LUA_STRING HTTPRequest::getResponseDataLua(void)
{
CCASSERT(_state == kCCHTTPRequestStateCompleted, "HTTPRequest::getResponseDataLua() - request not completed");
LuaStack *stack = LuaEngine::getInstance()->getLuaStack();
stack->clean();
stack->pushString(static_cast<char*>(_responseBuffer), (int)_responseDataLength);
return 1;
}
#endif
int HTTPRequest::getResponseDataLength(void)
{
CCASSERT(_state == kCCHTTPRequestStateCompleted, "Request not completed");
return (int)_responseDataLength;
}
size_t HTTPRequest::saveResponseData(const char *filename)
{
CCASSERT(_state == kCCHTTPRequestStateCompleted, "HTTPRequest::saveResponseData() - request not completed");
FILE *fp = fopen(filename, "wb");
CCASSERT(fp, "HTTPRequest::saveResponseData() - open file failure");
size_t writedBytes = _responseDataLength;
if (writedBytes > 0)
{
fwrite(_responseBuffer, _responseDataLength, 1, fp);
}
fclose(fp);
return writedBytes;
}
int HTTPRequest::getErrorCode(void)
{
return _errorCode;
}
const string HTTPRequest::getErrorMessage(void)
{
return _errorMessage;
}
HTTPRequestDelegate* HTTPRequest::getDelegate(void)
{
return _delegate;
}
void HTTPRequest::checkCURLState(float dt)
{
CC_UNUSED_PARAM(dt);
if (_curlState != kCCHTTPRequestCURLStateBusy)
{
// Director::getInstance()->getScheduler()->unscheduleAllForTarget(this);
release();
}
}
void HTTPRequest::update(float dt)
{
if (_state == kCCHTTPRequestStateInProgress)
{
#if CC_LUA_ENGINE_ENABLED > 0
if (_listener)
{
LuaValueDict dict;
dict["name"] = LuaValue::stringValue("progress");
dict["total"] = LuaValue::intValue((int)_dltotal);
dict["dltotal"] = LuaValue::intValue((int)_dlnow);
dict["request"] = LuaValue::ccobjectValue(this, "HTTPRequest");
LuaStack *stack = LuaEngine::getInstance()->getLuaStack();
stack->clean();
stack->pushLuaValueDict(dict);
stack->executeFunctionByHandler(_listener, 1);
}
#endif
return;
}
// Director::getInstance()->getScheduler()->unscheduleAllForTarget(this);
if (_curlState != kCCHTTPRequestCURLStateIdle)
{
// Director::getInstance()->getScheduler()->schedule(schedule_selector(HTTPRequest::checkCURLState), this, 0, false);
}
if (_state == kCCHTTPRequestStateCompleted)
{
// CCLOG("HTTPRequest[0x%04x] - request completed", s_id);
if (_delegate) _delegate->requestFinished(this);
}
else
{
// CCLOG("HTTPRequest[0x%04x] - request failed", s_id);
if (_delegate) _delegate->requestFailed(this);
}
#if CC_LUA_ENGINE_ENABLED > 0
if (_listener)
{
LuaValueDict dict;
switch (_state)
{
case kCCHTTPRequestStateCompleted:
dict["name"] = LuaValue::stringValue("completed");
break;
case kCCHTTPRequestStateCancelled:
dict["name"] = LuaValue::stringValue("cancelled");
break;
case kCCHTTPRequestStateFailed:
dict["name"] = LuaValue::stringValue("failed");
break;
default:
dict["name"] = LuaValue::stringValue("unknown");
}
dict["request"] = LuaValue::ccobjectValue(this, "HTTPRequest");
LuaStack *stack = LuaEngine::getInstance()->getLuaStack();
stack->clean();
stack->pushLuaValueDict(dict);
stack->executeFunctionByHandler(_listener, 1);
}
#endif
}
// instance callback
void HTTPRequest::onRequest(void)
{
if (_postFields.size() > 0)
{
curl_easy_setopt(_curl, CURLOPT_POST, 1L);
stringbuf buf;
for (Fields::iterator it = _postFields.begin(); it != _postFields.end(); ++it)
{
char *part = curl_easy_escape(_curl, it->first.c_str(), 0);
buf.sputn(part, strlen(part));
buf.sputc('=');
curl_free(part);
part = curl_easy_escape(_curl, it->second.c_str(), 0);
buf.sputn(part, strlen(part));
curl_free(part);
buf.sputc('&');
}
curl_easy_setopt(_curl, CURLOPT_COPYPOSTFIELDS, buf.str().c_str());
}
struct curl_slist *chunk = NULL;
for (HTTPRequestHeadersIterator it = _headers.begin(); it != _headers.end(); ++it)
{
chunk = curl_slist_append(chunk, (*it).c_str());
}
if (_formPost)
{
curl_easy_setopt(_curl, CURLOPT_HTTPPOST, _formPost);
}
curl_slist *cookies = NULL;
curl_easy_setopt(_curl, CURLOPT_HTTPHEADER, chunk);
CURLcode code = curl_easy_perform(_curl);
curl_easy_getinfo(_curl, CURLINFO_RESPONSE_CODE, &_responseCode);
curl_easy_getinfo(_curl, CURLINFO_COOKIELIST, &cookies);
if (cookies)
{
struct curl_slist *nc = cookies;
stringbuf buf;
while (nc)
{
buf.sputn(nc->data, strlen(nc->data));
buf.sputc('\n');
nc = nc->next;
}
_responseCookies = buf.str();
curl_slist_free_all(cookies);
cookies = NULL;
}
curl_easy_cleanup(_curl);
_curl = NULL;
if (_formPost)
{
curl_formfree(_formPost);
_formPost = NULL;
}
curl_slist_free_all(chunk);
_errorCode = code;
_errorMessage = (code == CURLE_OK) ? "" : curl_easy_strerror(code);
_state = (code == CURLE_OK) ? kCCHTTPRequestStateCompleted : kCCHTTPRequestStateFailed;
_curlState = kCCHTTPRequestCURLStateClosed;
}
size_t HTTPRequest::onWriteData(void *buffer, size_t bytes)
{
if (_responseDataLength + bytes + 1 > _responseBufferLength)
{
_responseBufferLength += BUFFER_CHUNK_SIZE;
_responseBuffer = realloc(_responseBuffer, _responseBufferLength);
}
memcpy(static_cast<char*>(_responseBuffer) + _responseDataLength, buffer, bytes);
_responseDataLength += bytes;
static_cast<char*>(_responseBuffer)[_responseDataLength] = 0;
return bytes;
}
size_t HTTPRequest::onWriteHeader(void *buffer, size_t bytes)
{
char *headerBuffer = new char[bytes + 1];
headerBuffer[bytes] = 0;
memcpy(headerBuffer, buffer, bytes);
_responseHeaders.push_back(string(headerBuffer));
delete []headerBuffer;
return bytes;
}
int HTTPRequest::onProgress(double dltotal, double dlnow, double ultotal, double ulnow)
{
_dltotal = dltotal;
_dlnow = dlnow;
_ultotal = ultotal;
_ulnow = ulnow;
return _state == kCCHTTPRequestStateCancelled ? 1: 0;
}
void HTTPRequest::cleanup(void)
{
_state = kCCHTTPRequestStateCleared;
_responseBufferLength = 0;
_responseDataLength = 0;
if (_responseBuffer)
{
free(_responseBuffer);
_responseBuffer = NULL;
}
if (_curl)
{
curl_easy_cleanup(_curl);
_curl = NULL;
}
}
// curl callback
#ifdef _WINDOWS_
DWORD WINAPI HTTPRequest::requestCURL(LPVOID userdata)
{
static_cast<HTTPRequest*>(userdata)->onRequest();
return 0;
}
#else // _WINDOWS_
void *HTTPRequest::requestCURL(void *userdata)
{
static_cast<HTTPRequest*>(userdata)->onRequest();
return NULL;
}
#endif // _WINDOWS_
size_t HTTPRequest::writeDataCURL(void *buffer, size_t size, size_t nmemb, void *userdata)
{
return static_cast<HTTPRequest*>(userdata)->onWriteData(buffer, size *nmemb);
}
size_t HTTPRequest::writeHeaderCURL(void *buffer, size_t size, size_t nmemb, void *userdata)
{
return static_cast<HTTPRequest*>(userdata)->onWriteHeader(buffer, size *nmemb);
}
int HTTPRequest::progressCURL(void *userdata, double dltotal, double dlnow, double ultotal, double ulnow)
{
return static_cast<HTTPRequest*>(userdata)->onProgress(dltotal, dlnow, ultotal, ulnow);
}
NS_CC_EXTRA_END

View File

@@ -0,0 +1,250 @@
/****************************************************************************
Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd.
http://www.cocos.com
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated engine source code (the "Software"), a limited,
worldwide, royalty-free, non-assignable, revocable and non-exclusive license
to use Cocos Creator solely to develop games on your target platforms. You shall
not use Cocos Creator software for developing other software or tools that's
used for developing games. You are not granted to publish, distribute,
sublicense, and/or sell copies of Cocos Creator.
The software or tools in this License Agreement are licensed, not sold.
Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
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 __CC_HTTP_REQUEST_H_
#define __CC_HTTP_REQUEST_H_
#include "cocos2dx_extra.h"
#include "cocos2d.h"
#include "network/CCHTTPRequestDelegate.h"
#if CC_LUA_ENGINE_ENABLED > 0
#include "CCLuaEngine.h"
#endif
#ifdef _WINDOWS_
#include <Windows.h>
#else
#include <pthread.h>
#endif
#include <stdio.h>
#include <vector>
#include <map>
#include <string>
#include "curl/curl.h"
using namespace std;
NS_CC_EXTRA_BEGIN
#define kCCHTTPRequestMethodGET 0
#define kCCHTTPRequestMethodPOST 1
#define kCCHTTPRequestAcceptEncodingIdentity 0
#define kCCHTTPRequestAcceptEncodingGzip 1
#define kCCHTTPRequestAcceptEncodingDeflate 2
#define kCCHTTPRequestStateIdle 0
#define kCCHTTPRequestStateCleared 1
#define kCCHTTPRequestStateInProgress 2
#define kCCHTTPRequestStateCompleted 3
#define kCCHTTPRequestStateCancelled 4
#define kCCHTTPRequestStateFailed 5
#define kCCHTTPRequestCURLStateIdle 0
#define kCCHTTPRequestCURLStateBusy 1
#define kCCHTTPRequestCURLStateClosed 2
typedef vector<string> HTTPRequestHeaders;
typedef HTTPRequestHeaders::iterator HTTPRequestHeadersIterator;
class HTTPRequest : public Ref
{
public:
static HTTPRequest *createWithUrl(HTTPRequestDelegate *delegate,
const char *url,
int method = kCCHTTPRequestMethodGET);
#if CC_LUA_ENGINE_ENABLED > 0
static HTTPRequest* createWithUrlLua(LUA_FUNCTION listener,
const char *url,
int method = kCCHTTPRequestMethodGET);
#endif
~HTTPRequest(void);
/** @brief Set request url. */
void setRequestUrl(const char *url);
/** @brief Get request url. */
const string getRequestUrl(void);
/** @brief Add a custom header to the request. */
void addRequestHeader(const char *header);
/** @brief Add a POST variable to the request, POST only. */
void addPOSTValue(const char *key, const char *value);
/** @brief Set POST data to the request body, POST only. */
void setPOSTData(const char *data);
void addFormFile(const char *name, const char *filePath, const char *fileType="application/octet-stream");
void addFormContents(const char *name, const char *value);
/** @brief Set/Get cookie string. */
void setCookieString(const char *cookie);
const string getCookieString(void);
/** @brief Set accept encoding. */
void setAcceptEncoding(int acceptEncoding);
/** @brief Number of seconds to wait before timing out - default is 10. */
void setTimeout(int timeout);
/** @brief Execute an asynchronous request. */
bool start(void);
/** @brief Cancel an asynchronous request, clearing all delegates first. */
void cancel(void);
/** @brief Get the request state. */
int getState(void);
/** @brief Return HTTP status code. */
int getResponseStatusCode(void);
/** @brief Return HTTP response headers. */
const HTTPRequestHeaders &getResponseHeaders(void);
const string getResponseHeadersString(void);
/** @brief Returns the contents of the result. */
const string getResponseString(void);
/** @brief Alloc memory block, return response data. use free() release memory block */
void *getResponseData(void);
#if CC_LUA_ENGINE_ENABLED > 0
LUA_STRING getResponseDataLua(void);
#endif
/** @brief Get response data length (bytes). */
int getResponseDataLength(void);
/** @brief Save response data to file. */
size_t saveResponseData(const char *filename);
/** @brief Get error code. */
int getErrorCode(void);
/** @brief Get error message. */
const string getErrorMessage(void);
/** @brief Return HTTPRequestDelegate delegate. */
HTTPRequestDelegate* getDelegate(void);
/** @brief timer function. */
void checkCURLState(float dt);
virtual void update(float dt);
private:
HTTPRequest(void)
: _delegate(NULL)
, _listener(0)
, _state(kCCHTTPRequestStateIdle)
, _errorCode(0)
, _responseCode(0)
, _responseBuffer(NULL)
, _responseBufferLength(0)
, _responseDataLength(0)
, _curlState(kCCHTTPRequestCURLStateIdle)
, _formPost(NULL)
, _lastPost(NULL)
, _dltotal(0)
, _dlnow(0)
, _ultotal(0)
, _ulnow(0)
{
}
bool initWithDelegate(HTTPRequestDelegate* delegate, const char *url, int method);
#if CC_LUA_ENGINE_ENABLED > 0
bool initWithListener(LUA_FUNCTION listener, const char *url, int method);
#endif
bool initWithUrl(const char *url, int method);
enum {
DEFAULT_TIMEOUT = 10, // 10 seconds
BUFFER_CHUNK_SIZE = 32768, // 32 KB
};
static unsigned int s_id;
string _url;
HTTPRequestDelegate* _delegate;
int _listener;
int _curlState;
CURL *_curl;
curl_httppost *_formPost;
curl_httppost *_lastPost;
int _state;
int _errorCode;
string _errorMessage;
// request
typedef map<string, string> Fields;
Fields _postFields;
HTTPRequestHeaders _headers;
// response
int _responseCode;
HTTPRequestHeaders _responseHeaders;
void *_responseBuffer;
size_t _responseBufferLength;
size_t _responseDataLength;
string _responseCookies;
double _dltotal;
double _dlnow;
double _ultotal;
double _ulnow;
// private methods
void cleanup(void);
void cleanupRawResponseBuff(void);
// instance callback
void onRequest(void);
size_t onWriteData(void *buffer, size_t bytes);
size_t onWriteHeader(void *buffer, size_t bytes);
int onProgress(double dltotal, double dlnow, double ultotal, double ulnow);
// curl callback
#ifdef _WINDOWS_
static DWORD WINAPI requestCURL(LPVOID userdata);
#else
pthread_t _thread;
static void *requestCURL(void *userdata);
#endif
static size_t writeDataCURL(void *buffer, size_t size, size_t nmemb, void *userdata);
static size_t writeHeaderCURL(void *buffer, size_t size, size_t nmemb, void *userdata);
static int progressCURL(void *userdata, double dltotal, double dlnow, double ultotal, double ulnow);
};
NS_CC_EXTRA_END
#endif /* __CC_HTTP_REQUEST_H_ */

View File

@@ -0,0 +1,45 @@
/****************************************************************************
Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd.
http://www.cocos.com
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated engine source code (the "Software"), a limited,
worldwide, royalty-free, non-assignable, revocable and non-exclusive license
to use Cocos Creator solely to develop games on your target platforms. You shall
not use Cocos Creator software for developing other software or tools that's
used for developing games. You are not granted to publish, distribute,
sublicense, and/or sell copies of Cocos Creator.
The software or tools in this License Agreement are licensed, not sold.
Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
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 __CC_EXTENSION_CCHTTP_REQUEST_DELEGATE_H_
#define __CC_EXTENSION_CCHTTP_REQUEST_DELEGATE_H_
#include "cocos2dx_extra.h"
NS_CC_EXTRA_BEGIN
class HTTPRequest;
class HTTPRequestDelegate
{
public:
virtual void requestFinished(HTTPRequest* request) {}
virtual void requestFailed(HTTPRequest* request) {}
};
NS_CC_EXTRA_END
#endif // __CC_EXTENSION_CCHTTP_REQUEST_DELEGATE_H_

View File

@@ -0,0 +1,95 @@
/****************************************************************************
Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd.
http://www.cocos.com
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated engine source code (the "Software"), a limited,
worldwide, royalty-free, non-assignable, revocable and non-exclusive license
to use Cocos Creator solely to develop games on your target platforms. You shall
not use Cocos Creator software for developing other software or tools that's
used for developing games. You are not granted to publish, distribute,
sublicense, and/or sell copies of Cocos Creator.
The software or tools in this License Agreement are licensed, not sold.
Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
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 "DeviceEx.h"
#import "openudid/OpenUDIDMac.h"
using namespace std;
PLAYER_NS_BEGIN
DeviceEx *DeviceEx::getInstance()
{
static DeviceEx *instance = NULL;
if (!instance)
{
instance = new DeviceEx();
instance->init();
}
return instance;
}
std::string DeviceEx::getCurrentUILangName()
{
return _uiLangName;
}
std::string DeviceEx::getUserGUID()
{
return _userGUID;
}
////////// private //////////
DeviceEx::DeviceEx()
: _uiLangName("en")
{
}
void DeviceEx::init()
{
makeUILangName();
makeUserGUID();
}
void DeviceEx::makeUILangName()
{
NSUserDefaults *defs = [NSUserDefaults standardUserDefaults];
NSArray *languages = [defs objectForKey:@"AppleLanguages"];
if ([languages count] > 0)
{
NSString *lang = [languages objectAtIndex:0];
_uiLangName = lang.UTF8String;
}
}
std::string DeviceEx::makeUserGUID()
{
if (_userGUID.length() <= 0)
{
_userGUID = string([[OpenUDIDMac value] cStringUsingEncoding:NSUTF8StringEncoding]);
if (_userGUID.length() <= 0)
{
_userGUID = "guid-fixed-1234567890";
}
}
return _userGUID;
}
PLAYER_NS_END

View File

@@ -0,0 +1,87 @@
/****************************************************************************
Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd.
http://www.cocos.com
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated engine source code (the "Software"), a limited,
worldwide, royalty-free, non-assignable, revocable and non-exclusive license
to use Cocos Creator solely to develop games on your target platforms. You shall
not use Cocos Creator software for developing other software or tools that's
used for developing games. You are not granted to publish, distribute,
sublicense, and/or sell copies of Cocos Creator.
The software or tools in this License Agreement are licensed, not sold.
Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
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.
****************************************************************************/
//
// EditBoxServiceMac.h
// player
//
#ifndef __player__EditBoxServiceMac__
#define __player__EditBoxServiceMac__
#include "PlayerEditBoxServiceProtocol.h"
@interface EditBoxServiceImplMac : NSObject <NSTextFieldDelegate>
{
NSTextField* textField_;
void* editBox_;
BOOL editState_;
NSMutableDictionary* placeholderAttributes_;
}
@property(nonatomic, retain) NSTextField* textField;
@property(nonatomic, retain) NSMutableDictionary* placeholderAttributes;
@property(nonatomic, readonly, getter = isEditState) BOOL editState;
@property(nonatomic, assign) void* editBox;
-(id) initWithFrame: (NSRect) frameRect editBox: (void*) editBox;
-(void) doAnimationWhenKeyboardMoveWithDuration:(float)duration distance:(float)distance;
-(void) setPosition:(NSPoint) pos;
-(void) setContentSize:(NSSize) size;
-(void) visit;
-(void) openKeyboard;
-(void) closeKeyboard;
@end
PLAYER_NS_BEGIN
class PlayerEditBoxServiceMac : public PlayerEditBoxServiceProtocol
{
public:
PlayerEditBoxServiceMac();
virtual ~PlayerEditBoxServiceMac();
// overwrite
virtual void showSingleLineEditBox(const cocos2d::Rect &rect) ;
virtual void showMultiLineEditBox(const cocos2d::Rect &rect) ;
virtual void hide() ;
virtual void setText(const std::string &text);
virtual void setFont(const std::string &name, int size);
virtual void setFontColor(const cocos2d::Color3B &color);
virtual void setFormator(int formator);
private:
void show();
private:
EditBoxServiceImplMac* _sysEdit;
};
PLAYER_NS_END
#endif

View File

@@ -0,0 +1,256 @@
/****************************************************************************
Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd.
http://www.cocos.com
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated engine source code (the "Software"), a limited,
worldwide, royalty-free, non-assignable, revocable and non-exclusive license
to use Cocos Creator solely to develop games on your target platforms. You shall
not use Cocos Creator software for developing other software or tools that's
used for developing games. You are not granted to publish, distribute,
sublicense, and/or sell copies of Cocos Creator.
The software or tools in this License Agreement are licensed, not sold.
Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
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 "PlayerEditBoxServiceMac.h"
#include "cocos2d.h"
#if (CC_LUA_ENGINE_ENABLED > 0)
#include "CCLuaEngine.h"
#endif
#include "glfw3native.h"
// internal
@implementation EditBoxServiceImplMac
@synthesize textField = textField_;
@synthesize placeholderAttributes = placeholderAttributes_;
@synthesize editState = editState_;
@synthesize editBox = editBox_;
- (id) getNSWindow
{
// auto glview = cocos2d::Director::getInstance()->getOpenGLView();
// return glview->getCocoaWindow();
CCLOG("- (id) getNSWindow");
}
- (void)dealloc
{
[[NSNotificationCenter defaultCenter] removeObserver:self];
[textField_ removeFromSuperview];
[textField_ release];
[placeholderAttributes_ release];
[super dealloc];
}
-(id) initWithFrame: (NSRect) frameRect editBox: (void*) editBox
{
self = [super init];
if (self)
{
editState_ = NO;
self.textField = [[[NSTextField alloc] initWithFrame:frameRect] autorelease];
NSColor *newColor = [NSColor colorWithCalibratedRed:255 / 255.0f green:0 blue:0 alpha:1.0f];
self.textField.textColor = newColor;
NSFont *font = [NSFont systemFontOfSize:10]; //REFINE: need to delete hard code here.
textField_.font = font;
[self setupTextField:textField_];
self.editBox = editBox;
self.placeholderAttributes = [NSMutableDictionary dictionaryWithObjectsAndKeys:
font, NSFontAttributeName,
[NSColor grayColor], NSForegroundColorAttributeName,
nil];
[[[self getNSWindow] contentView] addSubview:textField_];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(onTextDidChanged:)
name:NSControlTextDidEndEditingNotification
object:nil];
}
return self;
}
- (void)onTextDidChanged:(NSNotification *) notification
{
// hide first
[self.textField setHidden:YES];
#if (CC_LUA_ENGINE_ENABLED > 0)
player::PlayerEditBoxServiceMac *macEditBox = static_cast<player::PlayerEditBoxServiceMac *>(self.editBox);
auto luaStack = cocos2d::LuaEngine::getInstance()->getLuaStack();
luaStack->pushString([self.textField.stringValue UTF8String]);
luaStack->executeFunctionByHandler(macEditBox->getHandler(), 1);
#endif
}
- (void)setupTextField:(NSTextField *)textField
{
[textField setTextColor:[NSColor whiteColor]];
[textField setBackgroundColor:[NSColor clearColor]];
[textField setBordered:NO];
[textField setHidden:NO];
[textField setWantsLayer:YES];
[textField setDelegate:self];
}
-(void) doAnimationWhenKeyboardMoveWithDuration:(float)duration distance:(float)distance
{
[[[self getNSWindow] contentView] doAnimationWhenKeyboardMoveWithDuration:duration distance:distance];
}
-(void) setPosition:(NSPoint) pos
{
NSRect frame = [textField_ frame];
frame.origin = pos;
[textField_ setFrame:frame];
}
-(void) setContentSize:(NSSize) size
{
[self.textField setFrameSize:size];
}
-(void) visit
{
}
-(void) openKeyboard
{
if ([textField_ superview]) {
[textField_ becomeFirstResponder];
}
}
-(void) closeKeyboard
{
if ([textField_ superview]) {
[textField_ resignFirstResponder];
}
}
- (BOOL)textFieldShouldReturn:(NSTextField *)sender
{
if (sender == textField_) {
[sender resignFirstResponder];
}
return NO;
}
-(void)animationSelector
{
}
- (BOOL) control:(NSControl *)control textView:(NSTextView *)textView doCommandBySelector:(SEL)commandSelector
{
return NO;
}
@end
PLAYER_NS_BEGIN;
////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////
PlayerEditBoxServiceMac::PlayerEditBoxServiceMac()
{
_handler = 0;
NSRect rect = NSMakeRect(0, 0, 100, 20);
_sysEdit = [[EditBoxServiceImplMac alloc] initWithFrame:rect editBox:this];
}
PlayerEditBoxServiceMac::~PlayerEditBoxServiceMac()
{
[_sysEdit release];
}
void PlayerEditBoxServiceMac::showSingleLineEditBox(const cocos2d::Rect &rect)
{
[[_sysEdit.textField cell] setLineBreakMode:NSLineBreakByTruncatingTail];
[[_sysEdit.textField cell] setTruncatesLastVisibleLine:YES];
[_sysEdit setPosition:NSMakePoint(rect.origin.x, rect.origin.y)];
[_sysEdit setContentSize:NSMakeSize(rect.size.width, rect.size.height)];
show();
}
void PlayerEditBoxServiceMac::showMultiLineEditBox(const cocos2d::Rect &rect)
{
[[_sysEdit.textField cell] setLineBreakMode:NSLineBreakByCharWrapping];
[[_sysEdit.textField cell] setTruncatesLastVisibleLine:NO];
[_sysEdit setPosition:NSMakePoint(rect.origin.x, rect.origin.y)];
[_sysEdit setContentSize:NSMakeSize(rect.size.width, rect.size.height)];
show();
}
void PlayerEditBoxServiceMac::setText(const std::string &text)
{
_sysEdit.textField.stringValue = [NSString stringWithUTF8String:text.c_str()];
}
void PlayerEditBoxServiceMac::setFont(const std::string &name, int size)
{
NSString *fntName = [NSString stringWithUTF8String:name.c_str()];
NSFont *textFont = [NSFont fontWithName:fntName size:size];
if (textFont != nil)
{
[_sysEdit.textField setFont:textFont];
}
}
void PlayerEditBoxServiceMac::setFontColor(const cocos2d::Color3B &color)
{
NSColor *textColor = [NSColor colorWithCalibratedRed:color.r / 255.0f green:color.g / 255.0f blue:color.b / 255.0f alpha:1.0f];
_sysEdit.textField.textColor = textColor;
}
// hide editbox
void PlayerEditBoxServiceMac::hide()
{
[_sysEdit.textField setHidden:YES];
[_sysEdit closeKeyboard];
}
void PlayerEditBoxServiceMac::show()
{
[_sysEdit.textField setHidden:NO];
[_sysEdit openKeyboard];
}
void PlayerEditBoxServiceMac::setFormator(int formator)
{
CCLOG("Not support yet.");
}
PLAYER_NS_END;

Some files were not shown because too many files have changed in this diff Show More