Combine studio change for LuaBinding, jsb and simulator

This commit is contained in:
XiaoFeng 2015-11-25 21:52:44 +08:00
parent 4ce328212b
commit 9811d6efcf
33 changed files with 261 additions and 57 deletions

View File

@ -0,0 +1,30 @@
#pragma once
#if (defined(WIN32) && defined(_WINDOWS)) || defined(WINRT) || defined(WP8)
#ifdef __MINGW32__
#include <string.h>
#endif
#if defined(_USRJSSTATIC)
#define CC_JS_DLL
#else
#if defined(_USRJSDLL)
#define CC_JS_DLL __declspec(dllexport)
#else /* use a DLL library */
#define CC_JS_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_JS_DLL __attribute__((visibility("default")))
#else
#define CC_JS_DLL
#endif

View File

@ -1,7 +1,5 @@
#ifndef __JS_TEMPLATE_RUNTIME_FRAMEWORKS_RUNTIME_SRC_CLASSES_JS_MODULE_REGISTER_H__
#define __JS_TEMPLATE_RUNTIME_FRAMEWORKS_RUNTIME_SRC_CLASSES_JS_MODULE_REGISTER_H__
#include "js_module_register.h"
#include "scripting/js-bindings/manual/ScriptingCore.h"
#include "jsb_cocos2dx_auto.hpp"
#include "jsb_cocos2dx_ui_auto.hpp"
#include "jsb_cocos2dx_studio_auto.hpp"
@ -121,5 +119,7 @@ int js_module_register()
return 1;
}
#endif // __JS_TEMPLATE_RUNTIME_FRAMEWORKS_RUNTIME_SRC_CLASSES_JS_MODULE_REGISTER_H__
JSObject* get_jsb_cocos2d_FileUtils_prototype()
{
return jsb_cocos2d_FileUtils_prototype;
}

View File

@ -0,0 +1,12 @@
#ifndef __JS_TEMPLATE_RUNTIME_FRAMEWORKS_RUNTIME_SRC_CLASSES_JS_MODULE_REGISTER_H__
#define __JS_TEMPLATE_RUNTIME_FRAMEWORKS_RUNTIME_SRC_CLASSES_JS_MODULE_REGISTER_H__
#include "scripting/js-bindings/manual/ScriptingCore.h"
#include "js-BindingsExport.h"
CC_JS_DLL int js_module_register();
CC_JS_DLL JSObject* get_jsb_cocos2d_FileUtils_prototype();
#endif // __JS_TEMPLATE_RUNTIME_FRAMEWORKS_RUNTIME_SRC_CLASSES_JS_MODULE_REGISTER_H__

View File

@ -40,6 +40,7 @@
<ClCompile Include="..\manual\js_bindings_core.cpp" />
<ClCompile Include="..\manual\js_bindings_opengl.cpp" />
<ClCompile Include="..\manual\js_manual_conversions.cpp" />
<ClCompile Include="..\manual\js_module_register.cpp" />
<ClCompile Include="..\manual\localstorage\js_bindings_system_functions.cpp" />
<ClCompile Include="..\manual\localstorage\js_bindings_system_registration.cpp" />
<ClCompile Include="..\manual\navmesh\jsb_cocos2dx_navmesh_conversions.cpp" />
@ -78,6 +79,7 @@
<ClInclude Include="..\manual\cocostudio\jsb_cocos2dx_studio_manual.h" />
<ClInclude Include="..\manual\component\CCComponentJS.h" />
<ClInclude Include="..\manual\extension\jsb_cocos2dx_extension_manual.h" />
<ClInclude Include="..\manual\js-BindingsExport.h" />
<ClInclude Include="..\manual\jsb_event_dispatcher_manual.h" />
<ClInclude Include="..\manual\jsb_helper.h" />
<ClInclude Include="..\manual\jsb_opengl_functions.h" />
@ -87,6 +89,7 @@
<ClInclude Include="..\manual\js_bindings_core.h" />
<ClInclude Include="..\manual\js_bindings_opengl.h" />
<ClInclude Include="..\manual\js_manual_conversions.h" />
<ClInclude Include="..\manual\js_module_register.h" />
<ClInclude Include="..\manual\localstorage\js_bindings_system_functions.h" />
<ClInclude Include="..\manual\localstorage\js_bindings_system_functions_registration.h" />
<ClInclude Include="..\manual\localstorage\js_bindings_system_registration.h" />
@ -160,7 +163,7 @@
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_WINDOWS;_DEBUG;_LIB;COCOS2D_DEBUG=1;XP_WIN;JS_HAVE___INTN;JS_INTPTR_TYPE=int;COCOS2D_JAVASCRIPT=1;CC_ENABLE_CHIPMUNK_INTEGRATION=1;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>WIN32;_WINDOWS;_DEBUG;_LIB;COCOS2D_DEBUG=1;XP_WIN;JS_HAVE___INTN;JS_INTPTR_TYPE=int;COCOS2D_JAVASCRIPT=1;CC_ENABLE_CHIPMUNK_INTEGRATION=1;_CRT_SECURE_NO_WARNINGS;_USRJSSTATIC;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>$(ProjectDir)..;$(EngineRoot);$(EngineRoot)cocos;$(EngineRoot)cocos\base;$(EngineRoot)cocos\3d;$(EngineRoot)cocos\2d;$(EngineRoot)cocos\navmesh;$(EngineRoot)cocos\physics3d;$(EngineRoot)cocos\ui;$(EngineRoot)cocos\storage;$(EngineRoot)cocos\editor-support\spine;$(EngineRoot)cocos\editor-support\cocosbuilder;$(EngineRoot)cocos\editor-support\cocostudio;$(EngineRoot)cocos\audio\include;$(EngineRoot)extensions;$(EngineRoot)external;$(ProjectDir)..\auto;$(ProjectDir)..\manual;$(ProjectDir)..\manual\cocostudio;$(ProjectDir)..\manual\navmesh;$(ProjectDir)..\manual\spine;$(ProjectDir)..\..\..\..\external\spidermonkey\include\win32;$(EngineRoot)external\chipmunk\include\chipmunk;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<DisableSpecificWarnings>4068;4101;4800;4251;4244;4099;4083;4700;%(DisableSpecificWarnings)</DisableSpecificWarnings>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
@ -186,7 +189,7 @@ xcopy /Y /Q "$(ProjectDir)..\..\..\..\external\spidermonkey\prebuilt\win32\*.*"
<Optimization>MinSpace</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>WIN32;_WINDOWS;NDEBUG;_LIB;XP_WIN;JS_HAVE___INTN;JS_INTPTR_TYPE=int;COCOS2D_JAVASCRIPT=1;CC_ENABLE_CHIPMUNK_INTEGRATION=1;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>WIN32;_WINDOWS;NDEBUG;_LIB;XP_WIN;JS_HAVE___INTN;JS_INTPTR_TYPE=int;COCOS2D_JAVASCRIPT=1;CC_ENABLE_CHIPMUNK_INTEGRATION=1;_CRT_SECURE_NO_WARNINGS;_USRJSSTATIC;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>$(ProjectDir)..;$(EngineRoot);$(EngineRoot)cocos;$(EngineRoot)cocos\base;$(EngineRoot)cocos\3d;$(EngineRoot)cocos\2d;$(EngineRoot)cocos\physics3d;$(EngineRoot)cocos\ui;$(EngineRoot)cocos\navmesh;$(EngineRoot)cocos\storage;$(EngineRoot)cocos\editor-support\spine;$(EngineRoot)cocos\editor-support\cocosbuilder;$(EngineRoot)cocos\editor-support\cocostudio;$(EngineRoot)cocos\audio\include;$(EngineRoot)extensions;$(EngineRoot)external;$(ProjectDir)..\auto;$(ProjectDir)..\manual;$(ProjectDir)..\manual\cocostudio;$(ProjectDir)..\manual\navmesh;$(ProjectDir)..\manual\spine;$(ProjectDir)..\..\..\..\external\spidermonkey\include\win32;$(EngineRoot)external\chipmunk\include\chipmunk;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<DisableSpecificWarnings>4068;4101;4800;4251;4244;4099;4083;4700;%(DisableSpecificWarnings)</DisableSpecificWarnings>
<MultiProcessorCompilation>true</MultiProcessorCompilation>

View File

@ -113,9 +113,6 @@
<ClCompile Include="..\manual\cocostudio\jsb_cocos2dx_studio_manual.cpp">
<Filter>manual\cocostudio</Filter>
</ClCompile>
<ClCompile Include="..\manual\component\CCComponentJS.cpp">
<Filter>manual\component</Filter>
</ClCompile>
<ClCompile Include="..\manual\extension\jsb_cocos2dx_extension_manual.cpp">
<Filter>manual\extension</Filter>
</ClCompile>
@ -167,6 +164,12 @@
<ClCompile Include="..\manual\navmesh\jsb_cocos2dx_navmesh_conversions.cpp">
<Filter>manual\navmesh</Filter>
</ClCompile>
<ClCompile Include="..\manual\component\CCComponentJS.cpp">
<Filter>manual</Filter>
</ClCompile>
<ClCompile Include="..\manual\js_module_register.cpp">
<Filter>manual</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\auto\jsb_cocos2dx_auto.hpp">
@ -253,9 +256,6 @@
<ClInclude Include="..\manual\cocostudio\jsb_cocos2dx_studio_manual.h">
<Filter>manual\cocostudio</Filter>
</ClInclude>
<ClInclude Include="..\manual\component\CCComponentJS.h">
<Filter>manual\component</Filter>
</ClInclude>
<ClInclude Include="..\manual\extension\jsb_cocos2dx_extension_manual.h">
<Filter>manual\extension</Filter>
</ClInclude>
@ -310,5 +310,14 @@
<ClInclude Include="..\manual\navmesh\jsb_cocos2dx_navmesh_conversions.h">
<Filter>manual\navmesh</Filter>
</ClInclude>
<ClInclude Include="..\manual\component\CCComponentJS.h">
<Filter>auto</Filter>
</ClInclude>
<ClInclude Include="..\manual\js_module_register.h">
<Filter>manual</Filter>
</ClInclude>
<ClInclude Include="..\manual\js-BindingsExport.h">
<Filter>manual</Filter>
</ClInclude>
</ItemGroup>
</Project>

View File

@ -0,0 +1,33 @@
#ifndef __LUABINDINGEXPROT_H__
#define __LUABINDINGEXPROT_H__
#if (defined(WIN32) && defined(_WINDOWS)) || defined(WINRT) || defined(WP8)
#ifdef __MINGW32__
#include <string.h>
#endif
#if defined(_USRLUASTATIC)
#define CC_LUA_DLL
#else
#if defined(_USRLUADLL)
#define CC_LUA_DLL __declspec(dllexport)
#else /* use a DLL library */
#define CC_LUA_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_LUA_DLL __attribute__((visibility("default")))
#else
#define CC_LUA_DLL
#endif
#endif /* __CCEXTENSIONEXPORT_H__*/

View File

@ -1,5 +1,4 @@
#ifndef __LUA_TEMPLATE_RUNTIME_FRAMEWORKS_RUNTIME_SRC_CLASSES_LUA_MODULE_REGISTER_H__
#define __LUA_TEMPLATE_RUNTIME_FRAMEWORKS_RUNTIME_SRC_CLASSES_LUA_MODULE_REGISTER_H__
#include "lua_module_register.h"
#include "cocosdenshion/lua_cocos2dx_cocosdenshion_manual.h"
#include "network/lua_cocos2dx_network_manual.h"
@ -13,7 +12,8 @@
#include "physics3d/lua_cocos2dx_physics3d_manual.h"
#include "navmesh/lua_cocos2dx_navmesh_manual.h"
static int lua_module_register(lua_State* L)
int lua_module_register(lua_State* L)
{
//Dont' change the module register order unless you know what your are doing
register_cocosdenshion_module(L);
@ -34,5 +34,3 @@ static int lua_module_register(lua_State* L)
return 1;
}
#endif // __LUA_TEMPLATE_RUNTIME_FRAMEWORKS_RUNTIME_SRC_CLASSES_LUA_MODULE_REGISTER_H__

View File

@ -0,0 +1,10 @@
#ifndef __LUA_TEMPLATE_RUNTIME_FRAMEWORKS_RUNTIME_SRC_CLASSES_LUA_MODULE_REGISTER_H__
#define __LUA_TEMPLATE_RUNTIME_FRAMEWORKS_RUNTIME_SRC_CLASSES_LUA_MODULE_REGISTER_H__
#include "lua.h"
#include "Lua-bindingsExport.h"
CC_LUA_DLL int lua_module_register(lua_State* L);
#endif // __LUA_TEMPLATE_RUNTIME_FRAMEWORKS_RUNTIME_SRC_CLASSES_LUA_MODULE_REGISTER_H__

View File

@ -70,6 +70,7 @@
<ClCompile Include="..\manual\cocostudio\lua_cocos2dx_csloader_manual.cpp" />
<ClCompile Include="..\manual\extension\lua_cocos2dx_extension_manual.cpp" />
<ClCompile Include="..\manual\LuaBasicConversions.cpp" />
<ClCompile Include="..\manual\lua_module_register.cpp" />
<ClCompile Include="..\manual\navmesh\lua_cocos2dx_navmesh_conversions.cpp" />
<ClCompile Include="..\manual\navmesh\lua_cocos2dx_navmesh_manual.cpp" />
<ClCompile Include="..\manual\network\lua_cocos2dx_network_manual.cpp" />
@ -145,7 +146,9 @@
<ClInclude Include="..\manual\cocostudio\lua_cocos2dx_coco_studio_manual.hpp" />
<ClInclude Include="..\manual\cocostudio\lua_cocos2dx_csloader_manual.hpp" />
<ClInclude Include="..\manual\extension\lua_cocos2dx_extension_manual.h" />
<ClInclude Include="..\manual\Lua-BindingsExport.h" />
<ClInclude Include="..\manual\LuaBasicConversions.h" />
<ClInclude Include="..\manual\lua_module_register.h" />
<ClInclude Include="..\manual\navmesh\lua_cocos2dx_navmesh_conversions.h" />
<ClInclude Include="..\manual\navmesh\lua_cocos2dx_navmesh_manual.h" />
<ClInclude Include="..\manual\network\lua_cocos2dx_network_manual.h" />
@ -282,7 +285,7 @@
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>$(EngineRoot);$(EngineRoot)cocos\2d;$(EngineRoot)cocos\base;$(EngineRoot)cocos\3d;$(EngineRoot)cocos\physics3d;$(EngineRoot)cocos\audio\include;$(EngineRoot)cocos\ui;$(EngineRoot)cocos\navmesh;$(EngineRoot)external;$(EngineRoot)external\lua;$(EngineRoot)external\lua\tolua;$(EngineRoot)external\lua\luajit\include;$(EngineRoot)external\libwebsockets\win32\include;$(EngineRoot)extensions;$(EngineRoot)cocos\editor-support;$(EngineRoot)cocos\editor-support\cocostudio;$(EngineRoot)cocos\editor-support\cocostudio\ActionTimeline;$(EngineRoot)cocos\editor-support\spine;$(EngineRoot)cocos\editor-support\cocosbuilder;$(EngineRoot)cocos\scripting\lua-bindings\manual;$(EngineRoot)cocos\scripting\lua-bindings\auto;$(EngineRoot)cocos\scripting\lua-bindings\manual\extension;$(EngineRoot)cocos\scripting\lua-bindings\manual\cocostudio;$(EngineRoot)cocos\scripting\lua-bindings\manual\ui;$(EngineRoot)cocos\scripting\lua-bindings\manual\cocos2d;$(EngineRoot)cocos\scripting\lua-bindings\manual\navmesh;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_WINDOWS;_DEBUG;COCOS2D_DEBUG=1;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>WIN32;_WINDOWS;_DEBUG;COCOS2D_DEBUG=1;_CRT_SECURE_NO_WARNINGS;_USRLUASTATIC;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MinimalRebuild>false</MinimalRebuild>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
@ -314,7 +317,7 @@ xcopy /Y /Q "$(ProjectDir)..\..\..\..\external\lua\luajit\prebuilt\win32\*.*" "$
<Optimization>MinSpace</Optimization>
<IntrinsicFunctions>true</IntrinsicFunctions>
<AdditionalIncludeDirectories>$(EngineRoot);$(EngineRoot)cocos\base;$(EngineRoot)cocos;$(EngineRoot)external\lua\tolua;$(EngineRoot)external\lua\luajit\include;$(EngineRoot)external\lua;$(EngineRoot)cocos\scripting\lua-bindings\auto;$(EngineRoot)cocos\scripting\lua-bindings\manual;$(EngineRoot)cocos\2d;$(EngineRoot)cocos\3d;$(EngineRoot)cocos\scripting\lua-bindings\manual\extension;$(EngineRoot)cocos\scripting\lua-bindings\manual\cocostudio;$(EngineRoot)cocos\scripting\lua-bindings\manual\ui;$(EngineRoot)cocos\scripting\lua-bindings\manual\cocos2d;$(EngineRoot)cocos\scripting\lua-bindings\manual\navmesh;$(EngineRoot)extensions;$(EngineRoot)cocos\editor-support;$(EngineRoot)cocos\editor-support\cocostudio;$(EngineRoot)cocos\editor-support\cocostudio\ActionTimeline;$(EngineRoot)cocos\editor-support\spine;$(EngineRoot)cocos\editor-support\cocosbuilder;$(EngineRoot)cocos\audio\include;$(EngineRoot)external\libwebsockets\win32\include;$(EngineRoot)cocos\ui;$(EngineRoot)cocos\physics3d;$(EngineRoot)cocos\navmesh;$(EngineRoot)external;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;LIBLUA_EXPORTS;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;LIBLUA_EXPORTS;_CRT_SECURE_NO_WARNINGS;_USRLUASTATIC;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<FunctionLevelLinking>true</FunctionLevelLinking>
<PrecompiledHeader>

View File

@ -297,6 +297,9 @@
<ClCompile Include="..\manual\navmesh\lua_cocos2dx_navmesh_manual.cpp">
<Filter>manual\navmesh</Filter>
</ClCompile>
<ClCompile Include="..\manual\lua_module_register.cpp">
<Filter>manual</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\auto\lua_cocos2dx_auto.hpp">
@ -521,6 +524,12 @@
<ClInclude Include="..\manual\navmesh\lua_cocos2dx_navmesh_manual.h">
<Filter>manual\navmesh</Filter>
</ClInclude>
<ClInclude Include="..\manual\lua_module_register.h">
<Filter>manual</Filter>
</ClInclude>
<ClInclude Include="..\manual\Lua-BindingsExport.h">
<Filter>manual</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<None Include="..\script\CCBReaderLoad.lua">

View File

@ -15,6 +15,7 @@
#include "runtime/FileServer.h"
// js
#include "scripting/js-bindings/manual/ScriptingCore.h"
#include "js_module_register.h"
@ -146,8 +147,8 @@ void register_FileUtils(JSContext *cx, JS::HandleObject global)
} else {
ns.set(nsval.toObjectOrNull());
}
JS::RootedObject proto(cx, jsb_cocos2d_FileUtils_prototype);
JSObject* fileUtils = get_jsb_cocos2d_FileUtils_prototype();
JS::RootedObject proto(cx, fileUtils);
JS_DefineFunction(cx, proto, "addSearchPath", runtime_FileUtils_addSearchPath, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE);
JS_DefineFunction(cx, proto, "setSearchPaths", runtime_FileUtils_setSearchPaths, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE);
}

View File

@ -20,8 +20,6 @@
#include "runtime/ConfigParser.h"
#include "runtime/FileServer.h"
extern std::string g_projectPath; // Runtime.cpp
USING_NS_CC;
using namespace std;

View File

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
@ -76,7 +76,7 @@
<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;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<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;_USRJSSTATIC;_USRLIBSIMSTATIC;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<DisableSpecificWarnings>4267;4251;4244;%(DisableSpecificWarnings)</DisableSpecificWarnings>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<ProgramDataBaseFileName>$(IntDir)vc$(PlatformToolsetVersion).pdb</ProgramDataBaseFileName>
@ -141,7 +141,7 @@ xcopy /Y /Q "$(OutDir)lang" "$(ProjectDir)..\..\..\runtime\win32"
<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;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>COCOS2D_DEBUG=1;WIN32;_WINDOWS;STRICT;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGSNDEBUG;GLFW_EXPOSE_NATIVE_WIN32;GLFW_EXPOSE_NATIVE_WGL;_USRLUASTATIC;_USRJSSTATIC;_USRLIBSIMSTATIC;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<DisableSpecificWarnings>4267;4251;4244;%(DisableSpecificWarnings)</DisableSpecificWarnings>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<ProgramDataBaseFileName>$(IntDir)vc$(PlatformToolsetVersion).pdb</ProgramDataBaseFileName>

View File

@ -15,6 +15,7 @@
#include "json/filestream.h"
#include "json/stringbuffer.h"
#include "json/writer.h"
#include "SimulatorExport.h"
enum
{
@ -25,7 +26,7 @@ enum
#define kAppEventDropName "APP.EVENT.DROP"
#define kAppEventName "APP.EVENT"
class AppEvent : public cocos2d::EventCustom
class CC_LIBSIM_DLL AppEvent : public cocos2d::EventCustom
{
public:
/** Constructor */

View File

@ -11,8 +11,9 @@
#include "json/document.h"
#include "DeviceEx.h"
#include "SimulatorExport.h"
class AppLang
class CC_LIBSIM_DLL AppLang
{
public:
static AppLang* getInstance();

View File

@ -2,10 +2,11 @@
#include <string>
#include "PlayerMacros.h"
#include "SimulatorExport.h"
PLAYER_NS_BEGIN
class DeviceEx
class CC_LIBSIM_DLL DeviceEx
{
public:
static DeviceEx *getInstance();

View File

@ -7,6 +7,7 @@
#include "cocos2d.h"
#include "PlayerMacros.h"
#include "PlayerServiceProtocol.h"
#include "SimulatorExport.h"
PLAYER_NS_BEGIN
@ -15,7 +16,7 @@ PLAYER_NS_BEGIN
#define kPlayerCtrlModifyKey "ctrl"
#define kPlayerAltModifyKey "alt"
class PlayerMenuItem : public cocos2d::Ref
class CC_LIBSIM_DLL PlayerMenuItem : public cocos2d::Ref
{
public:
virtual ~PlayerMenuItem();

View File

@ -12,10 +12,11 @@
#include "PlayerTaskServiceProtocol.h"
#include "ProjectConfig/ProjectConfig.h"
#include "SimulatorExport.h"
PLAYER_NS_BEGIN
class PlayerProtocol
class CC_LIBSIM_DLL PlayerProtocol
{
public:
virtual ~PlayerProtocol();

View File

@ -8,6 +8,7 @@
using namespace std;
#include "cocos2d.h"
#include "SimulatorExport.h"
#define kCCRuntimeDebuggerNone 0
#define kCCRuntimeDebuggerLDT 1
@ -37,7 +38,7 @@ using namespace std;
#define kProjectConfigUploadPort 6020
#define kProjectConfigDebugPort 5086
class ProjectConfig
class CC_LIBSIM_DLL ProjectConfig
{
public:
ProjectConfig();

View File

@ -8,6 +8,7 @@
using namespace std;
#include "cocos2d.h"
#include "SimulatorExport.h"
#if defined(_WINDOWS)
#define DIRECTORY_SEPARATOR "\\"
@ -33,7 +34,7 @@ typedef struct _SimulatorScreenSize {
typedef vector<SimulatorScreenSize> ScreenSizeArray;
typedef ScreenSizeArray::iterator ScreenSizeArrayIterator;
class SimulatorConfig
class CC_LIBSIM_DLL SimulatorConfig
{
public:
static SimulatorConfig *getInstance();

View File

@ -0,0 +1,30 @@
#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

@ -8,10 +8,11 @@
#include "cocos2d.h"
#include "stdafx.h"
#include "PlayerMenuServiceProtocol.h"
#include "SimulatorExport.h"
PLAYER_NS_BEGIN
class PlayerMenuItemWin : public PlayerMenuItem
class CC_LIBSIM_DLL PlayerMenuItemWin : public PlayerMenuItem
{
public:
static PlayerMenuItemWin *create(const std::string &menuId, const std::string &title);
@ -34,7 +35,7 @@ protected:
friend class PlayerMenuServiceWin;
};
class PlayerMenuServiceWin : public PlayerMenuServiceProtocol
class CC_LIBSIM_DLL PlayerMenuServiceWin : public PlayerMenuServiceProtocol
{
public:
PlayerMenuServiceWin(HWND hwnd);

View File

@ -9,10 +9,11 @@
#include "PlayerFileDialogServiceWin.h"
#include "PlayerEditBoxServiceWin.h"
#include "PlayerTaskServiceWin.h"
#include "SimulatorExport.h"
PLAYER_NS_BEGIN
class PlayerWin : public PlayerProtocol, public cocos2d::Ref
class CC_LIBSIM_DLL PlayerWin : public PlayerProtocol, public cocos2d::Ref
{
public:
static PlayerWin *createWithHwnd(HWND hWnd);

View File

@ -7,13 +7,15 @@
#include "json/document.h"
#include "ProjectConfig/SimulatorConfig.h"
#include "ProjectConfig/ProjectConfig.h"
#include "SimulatorExport.h"
using namespace std;
USING_NS_CC;
#define CONFIG_FILE "config.json"
typedef vector<SimulatorScreenSize> ScreenSizeArray;
class ConfigParser
class CC_LIBSIM_DLL ConfigParser
{
public:
static ConfigParser *getInstance(void);

View File

@ -211,8 +211,10 @@ void ConsoleCommand::onSendCommand(int fd, const std::string &args)
} else if(strcmp(strcmd.c_str(), "shutdownapp") == 0)
{
#if (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32)
extern void shutDownApp();
shutDownApp();
#include <windows.h>
auto glview = dynamic_cast<GLViewImpl*> (Director::getInstance()->getOpenGLView());
HWND hWnd = glview->getWin32Window();
::SendMessage(hWnd, WM_CLOSE, NULL, NULL);
#else
exit(0);
#endif

View File

@ -257,7 +257,7 @@ _responseEndThread(false)
_writePath = FileUtils::getInstance()->getWritablePath();
#if (CC_TARGET_PLATFORM == CC_PLATFORM_MAC)
std::string getCurAppName(void);
#include "Widget_mac.h"
_writePath += getCurAppName();
_writePath += "/";
#endif

View File

@ -32,6 +32,7 @@ THE SOFTWARE.
#include "json/writer.h"
#include "Protos.pb.h"
#include <string>
#include "SimulatorExport.h"
// header files for socket
#ifdef _WIN32
@ -53,7 +54,7 @@ THE SOFTWARE.
#include <unistd.h>
#endif
class FileServer
class CC_LIBSIM_DLL FileServer
{
static FileServer *s_sharedFileServer;
public:

View File

@ -190,10 +190,28 @@ void RuntimeEngine::setProjectPath(const std::string &workPath)
if (workPath.empty())
{
extern std::string getCurAppPath();
std::string appPath = getCurAppPath();
std::string appPath = std::string("");
#if (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32)
appPath.append("/../../");
TCHAR szAppDir[MAX_PATH] = { 0 };
if (GetModuleFileName(NULL, szAppDir, MAX_PATH))
{
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);
appPath = fuldir;
}
#elif (CC_TARGET_PLATFORM == CC_PLATFORM_MAC)
appPath.append("/../../../");
#endif

View File

@ -28,14 +28,17 @@ THE SOFTWARE.
#include <string>
#include <functional>
#include <unordered_map>
#include "SimulatorExport.h"
void recvBuf(int fd, char *pbuf, unsigned long bufsize);
void sendBuf(int fd, const char *pbuf, unsigned long bufsize);
std::string& replaceAll(std::string& str, const std::string& old_value, const std::string& new_value);
CC_LIBSIM_DLL extern std::string g_projectPath;
std::string getIPAddress();
CC_LIBSIM_DLL std::string& replaceAll(std::string& str, const std::string& old_value, const std::string& new_value);
CC_LIBSIM_DLL std::string getIPAddress();
const char* getRuntimeVersion();

View File

@ -9,8 +9,9 @@
#include <string>
#include "json/document.h"
#include "SimulatorExport.h"
class RuntimeProtocol
class CC_LIBSIM_DLL RuntimeProtocol
{
public:
virtual void end();

View File

@ -0,0 +1,12 @@
//
// Widget_mac.h
// Simulator
//
//
#ifndef libsimulator_studio_Widget_mac_h
#define libsimulator_studio_Widget_mac_h
std::string getCurAppName(void);
#endif

View File

@ -0,0 +1,20 @@
//
// Widget_mac.cpp
// Simulator
//
//
#include <string>
#include "Widget_mac.h"
using namespace std;
std::string getCurAppName(void)
{
string appName = [[[NSProcessInfo processInfo] processName] UTF8String];
size_t found = appName.find(" ");
if (found!=std::string::npos)
appName = appName.substr(0,found);
return appName;
}

View File

@ -60,7 +60,7 @@
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<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;%(PreprocessorDefinitions);_SILENCE_STDEXT_HASH_DEPRECATION_WARNINGS</PreprocessorDefinitions>
<PreprocessorDefinitions>WIN32;_WINDOWS;STRICT;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS_DEBUG;COCOS2D_DEBUG=1;GLFW_EXPOSE_NATIVE_WIN32;GLFW_EXPOSE_NATIVE_WGL;%(PreprocessorDefinitions);_SILENCE_STDEXT_HASH_DEPRECATION_WARNINGS;_USRLIBSIMSTATIC</PreprocessorDefinitions>
<SDLCheck>
</SDLCheck>
<AdditionalIncludeDirectories>$(ProjectDir);$(ProjectDir)..\lib\protobuf-lite;$(ProjectDir)..\lib;$(EngineRoot)external\win32-specific\zlib\include;$(EngineRoot)cocos\scripting\lua-bindings\auto;$(EngineRoot)cocos\scripting\lua-bindings\manual;$(EngineRoot)cocos\audio\include;$(EngineRoot)external;$(EngineRoot)external\lua\lua;$(EngineRoot)external\lua\tolua;$(EngineRoot)external\chipmunk\include\chipmunk;$(EngineRoot)external\curl\include\win32;$(EngineRoot)extensions;$(EngineRoot);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
@ -84,7 +84,7 @@
<Optimization>MinSpace</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>COCOS2D_DEBUG=1;WIN32;_WINDOWS;STRICT;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS_DEBUG;GLFW_EXPOSE_NATIVE_WIN32;GLFW_EXPOSE_NATIVE_WGL;_SILENCE_STDEXT_HASH_DEPRECATION_WARNINGS;%(PreprocessorDefinitions);_SILENCE_STDEXT_HASH_DEPRECATION_WARNINGS</PreprocessorDefinitions>
<PreprocessorDefinitions>COCOS2D_DEBUG=1;WIN32;_WINDOWS;STRICT;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS_DEBUG;GLFW_EXPOSE_NATIVE_WIN32;GLFW_EXPOSE_NATIVE_WGL;_SILENCE_STDEXT_HASH_DEPRECATION_WARNINGS;_USRLIBSIMSTATIC;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<SDLCheck>true</SDLCheck>
<AdditionalIncludeDirectories>$(ProjectDir);$(ProjectDir)..\lib\protobuf-lite;$(ProjectDir)..\lib;$(EngineRoot)external\win32-specific\zlib\include;$(EngineRoot)cocos\scripting\lua-bindings\auto;$(EngineRoot)cocos\scripting\lua-bindings\manual;$(EngineRoot)cocos\audio\include;$(EngineRoot)external;$(EngineRoot)external\lua\lua;$(EngineRoot)external\lua\tolua;$(EngineRoot)external\chipmunk\include\chipmunk;$(EngineRoot)external\curl\include\win32;$(EngineRoot)extensions;$(EngineRoot);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<CompileAs>CompileAsCpp</CompileAs>