Merge branch 'v3' into v3-winrt-librecast

This commit is contained in:
Dale Stammen 2015-06-15 19:27:40 -07:00
commit 8d8e7d6cb9
114 changed files with 5953 additions and 35 deletions

3
.gitignore vendored
View File

@ -136,4 +136,5 @@ tests/cpp-tests/Resources/audio
/tests/lua-game-controller-test/src/cocos/
/tests/lua-tests/src/cocos/
/tests/js-tests/res/
/tools/framework-compile/
/tools/framework-compile/bin/proj_modifier/plutil-win32/
!/tools/framework-compile/bin/

View File

@ -410,20 +410,14 @@ void Camera::clearBackground(float depth)
{
glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE);
glStencilMask(0);
RenderState::StateBlock::_defaultState->setStencilWrite(0);
oldDepthTest = glIsEnabled(GL_DEPTH_TEST);
glGetIntegerv(GL_DEPTH_FUNC, &oldDepthFunc);
glGetBooleanv(GL_DEPTH_WRITEMASK, &oldDepthMask);
glDepthMask(GL_TRUE);
RenderState::StateBlock::_defaultState->setDepthWrite(true);
glEnable(GL_DEPTH_TEST);
RenderState::StateBlock::_defaultState->setDepthTest(true);
glDepthFunc(GL_ALWAYS);
RenderState::StateBlock::_defaultState->setDepthFunction(RenderState::DEPTH_ALWAYS);
}
//draw
@ -470,18 +464,23 @@ void Camera::clearBackground(float depth)
if(GL_FALSE == oldDepthTest)
{
glDisable(GL_DEPTH_TEST);
RenderState::StateBlock::_defaultState->setDepthTest(false);
}
glDepthFunc(oldDepthFunc);
if(GL_FALSE == oldDepthMask)
{
glDepthMask(GL_FALSE);
RenderState::StateBlock::_defaultState->setDepthWrite(false);
}
/* IMPORTANT: We only need to update the states that are not restored.
Since we don't know what was the previous value of the mask, we update the RenderState
after setting it.
The other values don't need to be updated since they were restored to their original values
*/
glStencilMask(0xFFFFF);
RenderState::StateBlock::_defaultState->setStencilWrite(0xFFFFF);
/* BUG: RenderState does not support glColorMask yet. */
glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
}
}

View File

@ -429,13 +429,7 @@ void ClippingNode::onBeforeVisit()
// if not in inverted mode: set the current layer value to 0 in the stencil buffer
// if in inverted mode: set the current layer value to 1 in the stencil buffer
glStencilFunc(GL_NEVER, mask_layer, mask_layer);
RenderState::StateBlock::_defaultState->setStencilFunction(RenderState::STENCIL_NEVER, mask_layer, mask_layer);
glStencilOp(!_inverted ? GL_ZERO : GL_REPLACE, GL_KEEP, GL_KEEP);
RenderState::StateBlock::_defaultState->setStencilOperation(
!_inverted ? RenderState::STENCIL_OP_ZERO : RenderState::STENCIL_OP_REPLACE,
RenderState::STENCIL_OP_KEEP,
RenderState::STENCIL_OP_KEEP);
// draw a fullscreen solid rectangle to clear the stencil buffer
//ccDrawSolidRect(Vec2::ZERO, ccpFromSize([[Director sharedDirector] winSize]), Color4F(1, 1, 1, 1));

View File

@ -942,6 +942,7 @@ void Director::reset()
stopAnimation();
CC_SAFE_RELEASE_NULL(_notificationNode);
CC_SAFE_RELEASE_NULL(_FPSLabel);
CC_SAFE_RELEASE_NULL(_drawnBatchesLabel);
CC_SAFE_RELEASE_NULL(_drawnVerticesLabel);

View File

@ -253,6 +253,26 @@ It should work same as apples CFSwapInt32LittleToHost(..)
} while (false)
#endif
/**
* GL assertion that can be used for any OpenGL function call.
*
* This macro will assert if an error is detected when executing
* the specified GL code. This macro will do nothing in release
* mode and is therefore safe to use for realtime/per-frame GL
* function calls.
*/
#if defined(NDEBUG) || (defined(__APPLE__) && !defined(DEBUG))
#define CC_GL_ASSERT( gl_code ) gl_code
#else
#define CC_GL_ASSERT( gl_code ) do \
{ \
gl_code; \
__gl_error_code = glGetError(); \
CC_ASSERT(__gl_error_code == GL_NO_ERROR, "Error"); \
} while(0)
#endif
/** @def CC_INCREMENT_GL_DRAWS_BY_ONE
Increments the GL Draws counts by one.
The number of calls per frame are displayed on the screen when the Director's stats are enabled.

View File

@ -132,7 +132,6 @@ void Physics3DDebugDrawer::drawImplementation( const Mat4 &transform, uint32_t f
_program->use();
_program->setUniformsForBuiltins(transform);
glEnable(GL_DEPTH_TEST);
RenderState::StateBlock::_defaultState->setDepthTest(true);
GL::blendFunc(_blendFunc.src, _blendFunc.dst);

View File

@ -252,6 +252,10 @@ void MeshCommand::postBatchDraw()
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
glBindBuffer(GL_ARRAY_BUFFER, 0);
}
// restore the default state since we don't know
// if the next command will need the default state or not
RenderState::StateBlock::restore(0);
}
}

View File

@ -201,6 +201,13 @@ public:
*/
static StateBlock* create();
/** The recommended way to create StateBlocks is by calling `create`.
* Don't use `new` or `delete` on them.
*
*/
StateBlock();
~StateBlock();
/**
* Binds the state in this StateBlock to the renderer.
*
@ -380,14 +387,26 @@ public:
*/
static void invalidate(long stateBits);
/**
* Restores the global Render State to the default state
*
* The difference between `invalidate()` and `restore()`, is that `restore()` will
* restore the global Render State based on its current state. Only the
* states that were changed will be restored.
*
* Rule of thumb:
- call `restore()` if you want to restore to the default state after using `StateBlock`.
- call `invalidate()` if you want to restore to the default state after calling manual GL calls.
*/
static void restore(long stateOverrideBits);
static StateBlock* _defaultState;
protected:
StateBlock();
~StateBlock();
void bindNoRestore();
static void restore(long stateOverrideBits);
static void enableDepthWrite();
void cloneInto(StateBlock* renderState) const;

View File

@ -482,6 +482,9 @@ void Renderer::processRenderCommand(RenderCommand* command)
if(cmd->isSkipBatching())
{
// XXX: execute() will call bind() and unbind()
// but unbind() shouldn't be call if the next command is a MESH_COMMAND with Material.
// Once most of cocos2d-x moves to Pass/StateBlock, only bind() should be used.
cmd->execute();
}
else

View File

@ -348,16 +348,7 @@ void Layout::onBeforeVisitStencil()
RenderState::StateBlock::_defaultState->setDepthWrite(false);
glStencilFunc(GL_NEVER, mask_layer, mask_layer);
RenderState::StateBlock::_defaultState->setStencilFunction(
RenderState::STENCIL_NEVER,
mask_layer,
mask_layer);
glStencilOp(GL_ZERO, GL_KEEP, GL_KEEP);
RenderState::StateBlock::_defaultState->setStencilOperation(
RenderState::STENCIL_OP_ZERO,
RenderState::STENCIL_OP_KEEP,
RenderState::STENCIL_OP_KEEP);
this->drawFullScreenQuadClearStencil();

View File

@ -1,10 +1,10 @@
{
"version":"v3-deps-62",
"zip_file_size":"138162176",
"version":"v3-deps-65",
"zip_file_size":"131249725",
"repo_name":"cocos2d-x-3rd-party-libs-bin",
"repo_parent":"https://github.com/cocos2d/",
"move_dirs":{
"fbx-conv":"tools",
"framework-compile":"tools"
"plutil-win32":"tools/framework-compile/bin/proj_modifier"
}
}

View File

@ -2264,6 +2264,8 @@
"external/chipmunk/prebuilt/winrt_8.1/win32/chipmunk.lib",
"external/chipmunk/prebuilt/wp_8.1/arm/chipmunk.lib",
"external/chipmunk/prebuilt/wp_8.1/win32/chipmunk.lib",
"external/clipper/clipper.cpp",
"external/clipper/clipper.hpp",
"external/config.json",
"external/curl/include/android/curl/curl.h",
"external/curl/include/android/curl/curlbuild.h",
@ -5203,7 +5205,6 @@
"tools/framework-compile/bin-templates/cpp-template-default/Classes/HelloWorldScene.h",
"tools/framework-compile/bin-templates/cpp-template-default/cocos-project-template.json",
"tools/framework-compile/bin-templates/cpp-template-default/proj.android/jni/Android.mk",
"tools/framework-compile/bin-templates/cpp-template-default/proj.android/project.properties",
"tools/framework-compile/bin-templates/cpp-template-default/proj.win32/HelloCpp.sln",
"tools/framework-compile/bin-templates/cpp-template-default/proj.win32/main.cpp",
"tools/framework-compile/bin-templates/cpp-template-default/res-landscape/HelloCpp.ccs",
@ -5229,7 +5230,6 @@
"tools/framework-compile/bin-templates/js-template-runtime/cocos-project-template.json",
"tools/framework-compile/bin-templates/js-template-runtime/frameworks/runtime-src/proj.android/build-cfg.json",
"tools/framework-compile/bin-templates/js-template-runtime/frameworks/runtime-src/proj.android/jni/Android.mk",
"tools/framework-compile/bin-templates/js-template-runtime/frameworks/runtime-src/proj.android/project.properties",
"tools/framework-compile/bin-templates/js-template-runtime/frameworks/runtime-src/proj.win32/HelloJavascript.sln",
"tools/framework-compile/bin-templates/js-template-runtime/frameworks/runtime-src/proj.win32/build-cfg.json",
"tools/framework-compile/bin-templates/js-template-runtime/frameworks/runtime-src/proj.win32/main.cpp",
@ -5262,7 +5262,6 @@
"tools/framework-compile/bin-templates/js-template-runtime/src/resource.js",
"tools/framework-compile/bin-templates/lua-template-runtime/cocos-project-template.json",
"tools/framework-compile/bin-templates/lua-template-runtime/frameworks/runtime-src/proj.android/jni/Android.mk",
"tools/framework-compile/bin-templates/lua-template-runtime/frameworks/runtime-src/proj.android/project.properties",
"tools/framework-compile/bin-templates/lua-template-runtime/frameworks/runtime-src/proj.win32/HelloLua.sln",
"tools/framework-compile/bin-templates/lua-template-runtime/frameworks/runtime-src/proj.win32/main.cpp",
"tools/framework-compile/bin-templates/lua-template-runtime/res-landscape/HelloLua.ccs",

View File

@ -49,6 +49,7 @@ MaterialSystemTest::MaterialSystemTest()
ADD_TEST_CASE(Material_Sprite3DTest);
ADD_TEST_CASE(Material_parsePerformance);
ADD_TEST_CASE(Material_invalidate);
ADD_TEST_CASE(Material_renderState);
}
std::string MaterialSystemBaseTest::title() const
@ -382,6 +383,7 @@ std::string Material_parsePerformance::subtitle() const
{
return "Testing parsing performance";
}
//
//
//
@ -451,6 +453,62 @@ void Material_invalidate::draw(cocos2d::Renderer *renderer, const cocos2d::Mat4
renderer->addCommand(&_customCommand);
}
//
//
//
void Material_renderState::onEnter()
{
MaterialSystemBaseTest::onEnter();
// ORC
auto sprite = Sprite3D::create("Sprite3DTest/orc.c3b");
sprite->setScale(5);
sprite->setRotation3D(Vec3(0,180,0));
addChild(sprite);
sprite->setNormalizedPosition(Vec2(0.3,0.3));
auto rotate = RotateBy::create(5, Vec3(0,360,0));
auto repeat = RepeatForever::create(rotate);
sprite->runAction(repeat);
// SPINE
auto skeletonNode = spine::SkeletonAnimation::createWithFile("spine/goblins-ffd.json", "spine/goblins-ffd.atlas", 1.5f);
skeletonNode->setAnimation(0, "walk", true);
skeletonNode->setSkin("goblin");
skeletonNode->setScale(0.25);
skeletonNode->setNormalizedPosition(Vec2(0.6,0.3));
this->addChild(skeletonNode);
_stateBlock.setDepthTest(false);
_stateBlock.setDepthWrite(false);
_stateBlock.setCullFace(true);
_stateBlock.setCullFaceSide(RenderState::CULL_FACE_SIDE_FRONT);
_stateBlock.setFrontFace(RenderState::FRONT_FACE_CW);
_stateBlock.setBlend(false);
}
std::string Material_renderState::subtitle() const
{
return "You should see a Spine animation on the right";
}
void Material_renderState::draw(cocos2d::Renderer *renderer, const cocos2d::Mat4 &transform, uint32_t flags)
{
_customCommand.init(_globalZOrder, transform, flags);
_customCommand.func = [this]() {
this->_stateBlock.bind();
// should do something...
// and after that, restore
this->_stateBlock.restore(0);
};
renderer->addCommand(&_customCommand);
}
// MARK: Helper functions
static void printProperties(Properties* properties, int indent)

View File

@ -124,4 +124,18 @@ public:
cocos2d::CustomCommand _customCommand;
};
class Material_renderState : public MaterialSystemBaseTest
{
public:
CREATE_FUNC(Material_renderState);
virtual void onEnter() override;
virtual std::string subtitle() const override;
virtual void draw(cocos2d::Renderer *renderer, const cocos2d::Mat4 &transform, uint32_t flags) override;
cocos2d::RenderState::StateBlock _stateBlock;
cocos2d::CustomCommand _customCommand;
};

View File

@ -0,0 +1,67 @@
#include "AppDelegate.h"
#include "HelloWorldScene.h"
USING_NS_CC;
AppDelegate::AppDelegate() {
}
AppDelegate::~AppDelegate()
{
}
//if you want a different context,just modify the value of glContextAttrs
//it will takes effect on all platforms
void AppDelegate::initGLContextAttrs()
{
//set OpenGL context attributions,now can only set six attributions:
//red,green,blue,alpha,depth,stencil
GLContextAttrs glContextAttrs = {8, 8, 8, 8, 24, 8};
GLView::setGLContextAttrs(glContextAttrs);
}
bool AppDelegate::applicationDidFinishLaunching() {
// initialize director
auto director = Director::getInstance();
auto glview = director->getOpenGLView();
if(!glview) {
glview = GLViewImpl::createWithRect("HelloCpp", Rect(0, 0, 960, 640));
director->setOpenGLView(glview);
}
director->getOpenGLView()->setDesignResolutionSize(960, 640, ResolutionPolicy::SHOW_ALL);
// turn on display FPS
director->setDisplayStats(true);
// set FPS. the default value is 1.0/60 if you don't call this
director->setAnimationInterval(1.0 / 60);
FileUtils::getInstance()->addSearchPath("res");
// create a scene. it's an autorelease object
auto scene = HelloWorld::createScene();
// run
director->runWithScene(scene);
return true;
}
// This function will be called when the app is inactive. When comes a phone call,it's be invoked too
void AppDelegate::applicationDidEnterBackground() {
Director::getInstance()->stopAnimation();
// if you use SimpleAudioEngine, it must be pause
// SimpleAudioEngine::getInstance()->pauseBackgroundMusic();
}
// this function will be called when the app is active again
void AppDelegate::applicationWillEnterForeground() {
Director::getInstance()->startAnimation();
// if you use SimpleAudioEngine, it must resume here
// SimpleAudioEngine::getInstance()->resumeBackgroundMusic();
}

View File

@ -0,0 +1,39 @@
#include "HelloWorldScene.h"
#include "cocostudio/CocoStudio.h"
#include "ui/CocosGUI.h"
USING_NS_CC;
using namespace cocostudio::timeline;
Scene* HelloWorld::createScene()
{
// 'scene' is an autorelease object
auto scene = Scene::create();
// 'layer' is an autorelease object
auto layer = HelloWorld::create();
// add layer as a child to scene
scene->addChild(layer);
// return the scene
return scene;
}
// on "init" you need to initialize your instance
bool HelloWorld::init()
{
//////////////////////////////
// 1. super init first
if ( !Layer::init() )
{
return false;
}
auto rootNode = CSLoader::createNode("MainScene.csb");
addChild(rootNode);
return true;
}

View File

@ -0,0 +1,19 @@
#ifndef __HELLOWORLD_SCENE_H__
#define __HELLOWORLD_SCENE_H__
#include "cocos2d.h"
class HelloWorld : public cocos2d::Layer
{
public:
// there's no 'id' in cpp, so we recommend returning the class instance pointer
static cocos2d::Scene* createScene();
// Here's a difference. Method 'init' in cocos2d-x returns bool, instead of returning 'id' in cocos2d-iphone
virtual bool init();
// implement the "static create()" method manually
CREATE_FUNC(HelloWorld);
};
#endif // __HELLOWORLD_SCENE_H__

View File

@ -0,0 +1,110 @@
{
"do_default":{
"exclude_from_template": [
"res-landscape",
"res-portrait"
],
"append_from_template": {
"from": "res-landscape",
"to": ""
},
"project_rename":{
"src_project_name":"HelloCpp",
"files":[
"proj.win32/PROJECT_NAME.vcxproj",
"proj.win32/PROJECT_NAME.vcxproj.filters",
"proj.win32/PROJECT_NAME.vcxproj.user",
"proj.win32/PROJECT_NAME.sln",
"proj.ios_mac/PROJECT_NAME.xcodeproj",
"PROJECT_NAME.ccs",
"PROJECT_NAME.cfg",
"PROJECT_NAME.udf"
]
},
"project_replace_project_name":{
"src_project_name":"HelloCpp",
"files":[
"Classes/AppDelegate.cpp",
"proj.win32/PROJECT_NAME.vcxproj",
"proj.win32/PROJECT_NAME.vcxproj.filters",
"proj.win32/PROJECT_NAME.vcxproj.user",
"proj.win32/PROJECT_NAME.sln",
"PROJECT_NAME.ccs",
"proj.win32/main.cpp",
"proj.android/.project",
"proj.android/.cproject",
"proj.android/AndroidManifest.xml",
"proj.android/build.xml",
"proj.android/res/values/strings.xml",
"proj.ios_mac/ios/main.m",
"proj.ios_mac/ios/Prefix.pch",
"proj.ios_mac/PROJECT_NAME.xcodeproj/project.pbxproj"
]
},
"project_replace_package_name":{
"src_package_name":"org.cocos2dx.hellocpp",
"files":[
"proj.android/AndroidManifest.xml"
]
},
"project_replace_mac_bundleid": {
"src_bundle_id": "org.cocos2dx.hellocpp",
"files": [
"proj.ios_mac/mac/Info.plist"
]
},
"project_replace_ios_bundleid": {
"src_bundle_id": "org.cocos2dx.hellocpp",
"files": [
"proj.ios_mac/ios/Info.plist"
]
}
},
"change_orientation": {
"append_from_template": {
"from": "res-portrait",
"to": ""
},
"modify_files": [
{
"file_path": "Classes/AppDelegate.cpp",
"pattern": "GLViewImpl::createWithRect\\((.*),\\s*Rect\\(\\s*(\\d+),\\s*(\\d+),\\s*(\\d+),\\s*(\\d+)\\)\\)",
"replace_string": "GLViewImpl::createWithRect(\\1, Rect(\\2, \\3, \\5, \\4))"
},
{
"file_path": "Classes/AppDelegate.cpp",
"pattern": "setDesignResolutionSize\\(\\s*(\\d+),\\s*(\\d+),(.*)\\)",
"replace_string": "setDesignResolutionSize(\\2, \\1,\\3)"
},
{
"file_path": "proj.ios_mac/ios/Info.plist",
"pattern": "UIInterfaceOrientationLandscapeRight",
"replace_string": "UIInterfaceOrientationPortrait"
},
{
"file_path": "proj.ios_mac/ios/Info.plist",
"pattern": "UIInterfaceOrientationLandscapeLeft",
"replace_string": "UIInterfaceOrientationPortraitUpsideDown"
},
{
"file_path": "proj.android/AndroidManifest.xml",
"pattern": "android:screenOrientation=\\\".*\\\"",
"replace_string": "android:screenOrientation=\"portrait\""
}
],
"project_rename":{
"src_project_name":"HelloCpp",
"files":[
"PROJECT_NAME.ccs",
"PROJECT_NAME.cfg",
"PROJECT_NAME.udf"
]
},
"project_replace_project_name":{
"src_project_name":"HelloCpp",
"files":[
"PROJECT_NAME.ccs"
]
}
}
}

View File

@ -0,0 +1,19 @@
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := cocos2dcpp_shared
LOCAL_MODULE_FILENAME := libcocos2dcpp
LOCAL_SRC_FILES := hellocpp/main.cpp \
../../Classes/AppDelegate.cpp \
../../Classes/HelloWorldScene.cpp
LOCAL_C_INCLUDES := $(LOCAL_PATH)/../../Classes
LOCAL_STATIC_LIBRARIES := cocos2dx_static
include $(BUILD_SHARED_LIBRARY)
$(call import-module,./prebuilt-mk)

View File

@ -0,0 +1,20 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2013
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "HelloCpp", "HelloCpp.vcxproj", "{76A39BB2-9B84-4C65-98A5-654D86B86F2A}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Release|Win32 = Release|Win32
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{76A39BB2-9B84-4C65-98A5-654D86B86F2A}.Debug|Win32.ActiveCfg = Debug|Win32
{76A39BB2-9B84-4C65-98A5-654D86B86F2A}.Debug|Win32.Build.0 = Debug|Win32
{76A39BB2-9B84-4C65-98A5-654D86B86F2A}.Release|Win32.ActiveCfg = Release|Win32
{76A39BB2-9B84-4C65-98A5-654D86B86F2A}.Release|Win32.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

View File

@ -0,0 +1,22 @@
#include "main.h"
#include "AppDelegate.h"
#include "cocos2d.h"
USING_NS_CC;
#pragma comment(lib,"libcocos2d.lib")
#pragma comment(lib,"libbox2d.lib")
#pragma comment(lib,"libSpine.lib")
int APIENTRY _tWinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPTSTR lpCmdLine,
int nCmdShow)
{
UNREFERENCED_PARAMETER(hPrevInstance);
UNREFERENCED_PARAMETER(lpCmdLine);
// create the application instance
AppDelegate app;
return Application::getInstance()->run();
}

View File

@ -0,0 +1,11 @@
<Solution>
<PropertyGroup Name="HelloCpp" Version="2.1.0.0" Type="CocosStudio" />
<SolutionFolder>
<Group ctype="ResourceGroup">
<RootFolder Name=".">
<Project Name="MainScene.csd" />
<Image Name="HelloWorld.png" />
</RootFolder>
</Group>
</SolutionFolder>
</Solution>

View File

@ -0,0 +1 @@
<Properties PublishDirectory="Resources/res" SolutionSize="960 * 640" DefaultSerializer="Serializer_FlatBuffers" CustomSerializer="Serializer_FlatBuffers" />

View File

@ -0,0 +1,6 @@
<UserData>
<OpenedDocuments>
<FilePathData Path="MainScene.csd" />
</OpenedDocuments>
<ActiveDocument Path="MainScene.csd" />
</UserData>

Binary file not shown.

After

Width:  |  Height:  |  Size: 208 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 208 KiB

View File

@ -0,0 +1,29 @@
<GameProjectFile>
<PropertyGroup Type="Scene" Name="MainScene" ID="a2ee0952-26b5-49ae-8bf9-4f1d6279b798" Version="2.1.0.0" />
<Content ctype="GameProjectContent">
<Content>
<Animation Duration="0" Speed="1.0000" />
<ObjectData Name="Scene" FrameEvent="" RightMargin="-960.0000" TopMargin="-640.0000" ctype="SingleNodeObjectData">
<Position X="0.0000" Y="0.0000" />
<Scale ScaleX="1.0000" ScaleY="1.0000" />
<AnchorPoint />
<CColor A="255" R="255" G="255" B="255" />
<Size X="960.0000" Y="640.0000" />
<PrePosition X="0.0000" Y="0.0000" />
<PreSize X="0.0000" Y="0.0000" />
<Children>
<NodeObjectData Name="Default" ActionTag="953446860" FrameEvent="" Tag="5" ObjectIndex="2" ctype="SpriteObjectData">
<Position X="480.0000" Y="320.0000" />
<Scale ScaleX="1.0000" ScaleY="1.0000" />
<AnchorPoint ScaleX="0.5000" ScaleY="0.5000" />
<CColor A="255" R="255" G="255" B="255" />
<Size X="960.0000" Y="640.0000" />
<PrePosition X="0.5000" Y="0.5000" />
<PreSize X="0.0000" Y="0.0000" />
<FileData Type="Normal" Path="HelloWorld.png" />
</NodeObjectData>
</Children>
</ObjectData>
</Content>
</Content>
</GameProjectFile>

View File

@ -0,0 +1,11 @@
<Solution>
<PropertyGroup Name="HelloCpp" Version="2.1.0.0" Type="CocosStudio" />
<SolutionFolder>
<Group ctype="ResourceGroup">
<RootFolder Name=".">
<Project Name="MainScene.csd" />
<Image Name="HelloWorld.png" />
</RootFolder>
</Group>
</SolutionFolder>
</Solution>

View File

@ -0,0 +1 @@
<Properties publishHasCocos2dxCode="False" PublishDirectory="Resources/res" SolutionSize="640 * 960" DefaultSerializer="Serializer_FlatBuffers" CustomSerializer="Serializer_FlatBuffers" />

View File

@ -0,0 +1,6 @@
<UserData>
<OpenedDocuments>
<FilePathData Path="MainScene.csd" />
</OpenedDocuments>
<ActiveDocument Path="MainScene.csd" />
</UserData>

Binary file not shown.

After

Width:  |  Height:  |  Size: 80 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 80 KiB

View File

@ -0,0 +1,29 @@
<GameProjectFile>
<PropertyGroup Type="Scene" Name="MainScene" ID="a2ee0952-26b5-49ae-8bf9-4f1d6279b798" Version="2.1.0.0" />
<Content ctype="GameProjectContent">
<Content>
<Animation Duration="0" Speed="1.0000" />
<ObjectData Name="Scene" FrameEvent="" ctype="SingleNodeObjectData">
<Position X="0.0000" Y="0.0000" />
<Scale ScaleX="1.0000" ScaleY="1.0000" />
<AnchorPoint />
<CColor A="255" R="255" G="255" B="255" />
<Size X="640.0000" Y="960.0000" />
<PrePosition X="0.0000" Y="0.0000" />
<PreSize X="0.0000" Y="0.0000" />
<Children>
<NodeObjectData Name="Default" ActionTag="-620272433" FrameEvent="" Tag="5" ObjectIndex="3" ctype="SpriteObjectData">
<Position X="320.0000" Y="480.0000" />
<Scale ScaleX="1.0000" ScaleY="1.0000" />
<AnchorPoint ScaleX="0.5000" ScaleY="0.5000" />
<CColor A="255" R="255" G="255" B="255" />
<Size X="640.0000" Y="960.0000" />
<PrePosition X="0.5000" Y="0.5000" />
<PreSize X="0.0000" Y="0.0000" />
<FileData Type="Normal" Path="HelloWorld.png" />
</NodeObjectData>
</Children>
</ObjectData>
</Content>
</Content>
</GameProjectFile>

Binary file not shown.

After

Width:  |  Height:  |  Size: 75 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 190 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 369 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 45 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 80 KiB

View File

@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>HelloJavascript</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
</buildSpec>
<natures>
<nature>org.ccdt.cocosproject</nature>
<nature>org.ccdt.jsdt.core.jsNature</nature>
</natures>
<cocosprojecttemplate>
<version>1.2</version>
</cocosprojecttemplate>
</projectDescription>

View File

@ -0,0 +1,166 @@
{
"do_default":{
"exclude_from_template":[
"frameworks/runtime-src",
"res-landscape",
"res-portrait"
],
"append_from_template": {
"from": "res-landscape",
"to": ""
},
"project_rename": {
"src_project_name": "HelloJavascript",
"files": [
"PROJECT_NAME.ccs",
"PROJECT_NAME.cfg",
"PROJECT_NAME.udf"
]
},
"project_replace_project_name":{
"src_project_name":"HelloJavascript",
"files":[
"config.json",
".project",
"PROJECT_NAME.ccs"
]
},
"append_dir":[
{
"from": "cocos/scripting/js-bindings/script",
"to": "script",
"include": [
"*.js"
]
}
]
},
"do_add_native_support":{
"append_from_template":{
"from":"frameworks/runtime-src",
"to":"frameworks/runtime-src",
"exclude":[
"proj.android/bin",
"proj.android/assets",
"proj.ios_mac/HelloJavascript.xcodeproj/project.xcworkspace",
"proj.ios_mac/HelloJavascript.xcodeproj/xcuserdata",
"proj.win32/Debug.win32",
"proj.win32/Release.win32",
"proj.win32/HelloJavascript.sdf"
]
},
"append_dir":[
{
"from":"tools/bindings-generator",
"to":"tools/bindings-generator",
"exclude":[
".git"
]
},
{
"from":"tools",
"to":"tools",
"include":[
"tojs"
]
}
],
"project_rename":{
"src_project_name":"HelloJavascript",
"files":[
"frameworks/runtime-src/proj.win32/PROJECT_NAME.vcxproj",
"frameworks/runtime-src/proj.win32/PROJECT_NAME.vcxproj.filters",
"frameworks/runtime-src/proj.win32/PROJECT_NAME.vcxproj.user",
"frameworks/runtime-src/proj.win32/PROJECT_NAME.sln",
"frameworks/runtime-src/proj.ios_mac/PROJECT_NAME.xcodeproj"
]
},
"project_replace_project_name":{
"src_project_name":"HelloJavascript",
"files":[
"config.json",
".project",
"frameworks/runtime-src/proj.win32/PROJECT_NAME.vcxproj",
"frameworks/runtime-src/proj.win32/PROJECT_NAME.vcxproj.filters",
"frameworks/runtime-src/proj.win32/PROJECT_NAME.vcxproj.user",
"frameworks/runtime-src/proj.win32/PROJECT_NAME.sln",
"frameworks/runtime-src/proj.win32/main.cpp",
"frameworks/runtime-src/proj.android/.project",
"frameworks/runtime-src/proj.android/AndroidManifest.xml",
"frameworks/runtime-src/proj.android/build.xml",
"frameworks/runtime-src/proj.android/res/values/strings.xml",
"frameworks/runtime-src/proj.ios_mac/ios/main.m",
"frameworks/runtime-src/proj.ios_mac/ios/Prefix.pch",
"frameworks/runtime-src/proj.ios_mac/mac/SimulatorApp.mm",
"frameworks/runtime-src/proj.ios_mac/PROJECT_NAME.xcodeproj/project.pbxproj",
"frameworks/runtime-src/Classes/AppDelegate.cpp"
]
},
"project_replace_package_name":{
"src_package_name":"org.cocos2dx.hellojavascript",
"files":[
"frameworks/runtime-src/proj.android/AndroidManifest.xml"
]
},
"project_replace_mac_bundleid":{
"src_bundle_id":"org.cocos2dx.hellojavascript",
"files":[
"frameworks/runtime-src/proj.ios_mac/mac/Info.plist"
]
},
"project_replace_ios_bundleid":{
"src_bundle_id":"org.cocos2dx.hellojavascript",
"files":[
"frameworks/runtime-src/proj.ios_mac/ios/Info.plist"
]
}
},
"change_orientation": {
"append_from_template": {
"from": "res-portrait",
"to": ""
},
"modify_files": [
{
"file_path": "config.json",
"pattern": "\\\"isLandscape\\\"\\s*:.*,",
"replace_string": "\"isLandscape\": false,"
},
{
"file_path": "main.js",
"pattern": "setDesignResolutionSize\\(\\s*(\\d+),\\s*(\\d+),(.*)\\)",
"replace_string": "setDesignResolutionSize(\\2, \\1,\\3)"
},
{
"file_path": "frameworks/runtime-src/proj.ios_mac/ios/Info.plist",
"pattern": "UIInterfaceOrientationLandscapeRight",
"replace_string": "UIInterfaceOrientationPortrait"
},
{
"file_path": "frameworks/runtime-src/proj.ios_mac/ios/Info.plist",
"pattern": "UIInterfaceOrientationLandscapeLeft",
"replace_string": "UIInterfaceOrientationPortraitUpsideDown"
},
{
"file_path": "frameworks/runtime-src/proj.android/AndroidManifest.xml",
"pattern": "android:screenOrientation=\\\".*\\\"",
"replace_string": "android:screenOrientation=\"portrait\""
}
],
"project_rename":{
"src_project_name":"HelloJavascript",
"files":[
"PROJECT_NAME.ccs",
"PROJECT_NAME.cfg",
"PROJECT_NAME.udf"
]
},
"project_replace_project_name":{
"src_project_name":"HelloJavascript",
"files":[
"PROJECT_NAME.ccs"
]
}
}
}

View File

@ -0,0 +1,35 @@
{
"ndk_module_path" :[
"../../cocos2d-x",
"../../cocos2d-x/cocos",
"../../cocos2d-x/external"
],
"copy_resources": [
{
"from": "../../../src",
"to": "src"
},
{
"from": "../../../res",
"to": "res"
},
{
"from": "../../../main.js",
"to": ""
}
],
"must_copy_resources": [
{
"from": "../../../config.json",
"to": ""
},
{
"from": "../../../project.json",
"to": ""
},
{
"from": "../../../script",
"to": "script"
}
]
}

View File

@ -0,0 +1,25 @@
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := cocos2djs_shared
LOCAL_MODULE_FILENAME := libcocos2djs
LOCAL_SRC_FILES := \
../../Classes/AppDelegate.cpp \
../../Classes/ide-support/SimpleConfigParser.cpp \
../../Classes/ide-support/RuntimeJsImpl.cpp \
hellojavascript/main.cpp
LOCAL_C_INCLUDES := $(LOCAL_PATH)/../../Classes
LOCAL_STATIC_LIBRARIES := cocos2d_js_static
LOCAL_STATIC_LIBRARIES += cocos2d_simulator_static
include $(BUILD_SHARED_LIBRARY)
$(call import-module,scripting/js-bindings/proj.android/prebuilt-mk)
$(call import-module,tools/simulator/libsimulator/proj.android/prebuilt-mk)

View File

@ -0,0 +1,20 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2013
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "HelloJavascript", "HelloJavascript.vcxproj", "{3B0B58B1-2734-488E-A542-ECEC11EB2455}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Release|Win32 = Release|Win32
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{3B0B58B1-2734-488E-A542-ECEC11EB2455}.Debug|Win32.ActiveCfg = Debug|Win32
{3B0B58B1-2734-488E-A542-ECEC11EB2455}.Debug|Win32.Build.0 = Debug|Win32
{3B0B58B1-2734-488E-A542-ECEC11EB2455}.Release|Win32.ActiveCfg = Release|Win32
{3B0B58B1-2734-488E-A542-ECEC11EB2455}.Release|Win32.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

View File

@ -0,0 +1,34 @@
{
"copy_resources": [
{
"from": "../../../src",
"to": "src"
},
{
"from": "../../../res",
"to": "res"
},
{
"from": "../../../main.js",
"to": ""
},
{
"from": "../../../project.json",
"to": ""
},
{
"from": "../../../config.json",
"to": ""
},
{
"from": "../Classes/ide-support/lang",
"to": ""
}
],
"must_copy_resources": [
{
"from": "../../../script",
"to": "script"
}
]
}

View File

@ -0,0 +1,20 @@
#include "main.h"
#include "SimulatorWin.h"
#include <shellapi.h>
#pragma comment(lib,"libcocos2d.lib")
#pragma comment(lib,"libjscocos2d.lib")
#pragma comment(lib,"libbox2d.lib")
#pragma comment(lib,"libSpine.lib")
#pragma comment(lib,"libsimulator.lib")
int APIENTRY _tWinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPTSTR lpCmdLine,
int nCmdShow)
{
UNREFERENCED_PARAMETER(hPrevInstance);
UNREFERENCED_PARAMETER(lpCmdLine);
auto simulator = SimulatorWin::getInstance();
return simulator->run();
}

View File

@ -0,0 +1,8 @@
// 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"
// TODO: reference any additional headers you need in STDAFX.H
// and not in this file

View File

@ -0,0 +1,21 @@
// 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>
// TODO: reference additional headers your program requires here

View File

@ -0,0 +1,8 @@
#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,27 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Cocos2d-html5 Hello World test</title>
<link rel="icon" type="image/GIF" href="res/favicon.ico"/>
<meta name="apple-mobile-web-app-capable" content="yes"/>
<meta name="full-screen" content="yes"/>
<meta name="screen-orientation" content="portrait"/>
<meta name="x5-fullscreen" content="true"/>
<meta name="360-fullscreen" content="true"/>
<style>
body, canvas, div {
-moz-user-select: none;
-webkit-user-select: none;
-ms-user-select: none;
-khtml-user-select: none;
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
}
</style>
</head>
<body style="padding:0; margin: 0; background: #000;">
<canvas id="gameCanvas" width="800" height="450"></canvas>
<script src="frameworks/cocos2d-html5/CCBoot.js"></script>
<script src="main.js"></script>
</body>
</html>

View File

@ -0,0 +1,59 @@
/**
* A brief explanation for "project.json":
* Here is the content of project.json file, this is the global configuration for your game, you can modify it to customize some behavior.
* The detail of each field is under it.
{
"project_type": "javascript",
// "project_type" indicate the program language of your project, you can ignore this field
"debugMode" : 1,
// "debugMode" possible values :
// 0 - No message will be printed.
// 1 - cc.error, cc.assert, cc.warn, cc.log will print in console.
// 2 - cc.error, cc.assert, cc.warn will print in console.
// 3 - cc.error, cc.assert will print in console.
// 4 - cc.error, cc.assert, cc.warn, cc.log will print on canvas, available only on web.
// 5 - cc.error, cc.assert, cc.warn will print on canvas, available only on web.
// 6 - cc.error, cc.assert will print on canvas, available only on web.
"showFPS" : true,
// Left bottom corner fps information will show when "showFPS" equals true, otherwise it will be hide.
"frameRate" : 60,
// "frameRate" set the wanted frame rate for your game, but the real fps depends on your game implementation and the running environment.
"id" : "gameCanvas",
// "gameCanvas" sets the id of your canvas element on the web page, it's useful only on web.
"renderMode" : 0,
// "renderMode" sets the renderer type, only useful on web :
// 0 - Automatically chosen by engine
// 1 - Forced to use canvas renderer
// 2 - Forced to use WebGL renderer, but this will be ignored on mobile browsers
"engineDir" : "frameworks/cocos2d-html5/",
// In debug mode, if you use the whole engine to develop your game, you should specify its relative path with "engineDir",
// but if you are using a single engine file, you can ignore it.
"modules" : ["cocos2d"],
// "modules" defines which modules you will need in your game, it's useful only on web,
// using this can greatly reduce your game's resource size, and the cocos console tool can package your game with only the modules you set.
// For details about modules definitions, you can refer to "../../frameworks/cocos2d-html5/modulesConfig.json".
"jsList" : [
]
// "jsList" sets the list of js files in your game.
}
*
*/
cc.game.onStart = function(){
cc.view.adjustViewPort(true);
cc.view.setDesignResolutionSize(960, 640, cc.ResolutionPolicy.SHOW_ALL);
cc.view.resizeWithBrowserSize(true);
//load resources
cc.LoaderScene.preload(g_resources, function () {
cc.director.runScene(new HelloWorldScene());
}, this);
};
cc.game.run();

View File

@ -0,0 +1,17 @@
{
"project_type": "javascript",
"debugMode" : 1,
"showFPS" : true,
"frameRate" : 60,
"id" : "gameCanvas",
"renderMode" : 0,
"engineDir":"frameworks/cocos2d-html5",
"modules" : ["cocos2d", "cocostudio"],
"jsList" : [
"src/resource.js",
"src/app.js"
]
}

View File

@ -0,0 +1,11 @@
<Solution>
<PropertyGroup Name="HelloJavascript" Version="2.1.0.0" Type="CocosStudio" />
<SolutionFolder>
<Group ctype="ResourceGroup">
<RootFolder Name=".">
<Project Name="MainScene.csd" />
<Image Name="HelloWorld.png" />
</RootFolder>
</Group>
</SolutionFolder>
</Solution>

View File

@ -0,0 +1 @@
<Properties PublishDirectory="res" SolutionSize="960 * 640" DefaultSerializer="Serializer_FlatBuffers" CustomSerializer="Serializer_FlatBuffers" />

View File

@ -0,0 +1,6 @@
<UserData>
<OpenedDocuments>
<FilePathData Path="MainScene.csd" />
</OpenedDocuments>
<ActiveDocument Path="MainScene.csd" />
</UserData>

Binary file not shown.

After

Width:  |  Height:  |  Size: 208 KiB

View File

@ -0,0 +1,29 @@
<GameProjectFile>
<PropertyGroup Type="Scene" Name="MainScene" ID="a2ee0952-26b5-49ae-8bf9-4f1d6279b798" Version="2.1.0.0" />
<Content ctype="GameProjectContent">
<Content>
<Animation Duration="0" Speed="1.0000" />
<ObjectData Name="Scene" FrameEvent="" RightMargin="-960.0000" TopMargin="-640.0000" ctype="SingleNodeObjectData">
<Position X="0.0000" Y="0.0000" />
<Scale ScaleX="1.0000" ScaleY="1.0000" />
<AnchorPoint />
<CColor A="255" R="255" G="255" B="255" />
<Size X="960.0000" Y="640.0000" />
<PrePosition X="0.0000" Y="0.0000" />
<PreSize X="0.0000" Y="0.0000" />
<Children>
<NodeObjectData Name="Default" ActionTag="953446860" FrameEvent="" Tag="5" ObjectIndex="2" ctype="SpriteObjectData">
<Position X="480.0000" Y="320.0000" />
<Scale ScaleX="1.0000" ScaleY="1.0000" />
<AnchorPoint ScaleX="0.5000" ScaleY="0.5000" />
<CColor A="255" R="255" G="255" B="255" />
<Size X="960.0000" Y="640.0000" />
<PrePosition X="0.5000" Y="0.5000" />
<PreSize X="0.0000" Y="0.0000" />
<FileData Type="Normal" Path="HelloWorld.png" />
</NodeObjectData>
</Children>
</ObjectData>
</Content>
</Content>
</GameProjectFile>

Binary file not shown.

After

Width:  |  Height:  |  Size: 208 KiB

View File

@ -0,0 +1,85 @@
{
"ID": "a2ee0952-26b5-49ae-8bf9-4f1d6279b798",
"Version": "2.1.0.0",
"Type": "Scene",
"Name": "MainScene",
"Content": {
"Content": {
"Animation": {
"Duration": 0,
"Speed": 1.0,
"Timelines": [],
"ctype": "TimelineActionData"
},
"AnimationList": [],
"ObjectData": {
"PrePosition": {
"X": 0.0,
"Y": 0.0
},
"PreSize": {
"X": 0.0,
"Y": 0.0
},
"RightMargin": -960.0,
"TopMargin": -640.0,
"Children": [
{
"FileData": {
"Type": "Normal",
"Path": "HelloWorld.png"
},
"Tag": 5,
"PrePosition": {
"X": 0.5,
"Y": 0.5
},
"PreSize": {
"X": 0.0,
"Y": 0.0
},
"ActionTag": 953446860,
"Position": {
"X": 480.0,
"Y": 320.0
},
"Scale": {
"ScaleX": 1.0,
"ScaleY": 1.0
},
"AnchorPoint": {
"ScaleX": 0.5,
"ScaleY": 0.5
},
"CColor": {},
"Size": {
"X": 960.0,
"Y": 640.0
},
"FrameEvent": "",
"Name": "Default",
"ctype": "SpriteObjectData"
}
],
"Position": {
"X": 0.0,
"Y": 0.0
},
"Scale": {
"ScaleX": 1.0,
"ScaleY": 1.0
},
"AnchorPoint": {},
"CColor": {},
"Size": {
"X": 960.0,
"Y": 640.0
},
"FrameEvent": "",
"Name": "Scene",
"ctype": "SingleNodeObjectData"
},
"ctype": "GameProjectData"
}
}
}

View File

@ -0,0 +1,11 @@
<Solution>
<PropertyGroup Name="HelloJavascript" Version="2.1.0.0" Type="CocosStudio" />
<SolutionFolder>
<Group ctype="ResourceGroup">
<RootFolder Name=".">
<Project Name="MainScene.csd" />
<Image Name="HelloWorld.png" />
</RootFolder>
</Group>
</SolutionFolder>
</Solution>

View File

@ -0,0 +1 @@
<Properties publishHasCocos2dxCode="False" PublishDirectory="res" SolutionSize="640 * 960" DefaultSerializer="Serializer_FlatBuffers" CustomSerializer="Serializer_FlatBuffers" />

View File

@ -0,0 +1,6 @@
<UserData>
<OpenedDocuments>
<FilePathData Path="MainScene.csd" />
</OpenedDocuments>
<ActiveDocument Path="MainScene.csd" />
</UserData>

Binary file not shown.

After

Width:  |  Height:  |  Size: 80 KiB

View File

@ -0,0 +1,29 @@
<GameProjectFile>
<PropertyGroup Type="Scene" Name="MainScene" ID="a2ee0952-26b5-49ae-8bf9-4f1d6279b798" Version="2.1.0.0" />
<Content ctype="GameProjectContent">
<Content>
<Animation Duration="0" Speed="1.0000" />
<ObjectData Name="Scene" FrameEvent="" ctype="SingleNodeObjectData">
<Position X="0.0000" Y="0.0000" />
<Scale ScaleX="1.0000" ScaleY="1.0000" />
<AnchorPoint />
<CColor A="255" R="255" G="255" B="255" />
<Size X="640.0000" Y="960.0000" />
<PrePosition X="0.0000" Y="0.0000" />
<PreSize X="0.0000" Y="0.0000" />
<Children>
<NodeObjectData Name="Default" ActionTag="-620272433" FrameEvent="" Tag="5" ObjectIndex="3" ctype="SpriteObjectData">
<Position X="320.0000" Y="480.0000" />
<Scale ScaleX="1.0000" ScaleY="1.0000" />
<AnchorPoint ScaleX="0.5000" ScaleY="0.5000" />
<CColor A="255" R="255" G="255" B="255" />
<Size X="640.0000" Y="960.0000" />
<PrePosition X="0.5000" Y="0.5000" />
<PreSize X="0.0000" Y="0.0000" />
<FileData Type="Normal" Path="HelloWorld.png" />
</NodeObjectData>
</Children>
</ObjectData>
</Content>
</Content>
</GameProjectFile>

Binary file not shown.

After

Width:  |  Height:  |  Size: 80 KiB

View File

@ -0,0 +1,83 @@
{
"ID": "a2ee0952-26b5-49ae-8bf9-4f1d6279b798",
"Version": "2.1.0.0",
"Type": "Scene",
"Name": "MainScene",
"Content": {
"Content": {
"Animation": {
"Duration": 0,
"Speed": 1.0,
"Timelines": [],
"ctype": "TimelineActionData"
},
"AnimationList": [],
"ObjectData": {
"PrePosition": {
"X": 0.0,
"Y": 0.0
},
"PreSize": {
"X": 0.0,
"Y": 0.0
},
"Children": [
{
"FileData": {
"Type": "Normal",
"Path": "HelloWorld.png"
},
"Tag": 5,
"PrePosition": {
"X": 0.5,
"Y": 0.5
},
"PreSize": {
"X": 0.0,
"Y": 0.0
},
"ActionTag": -620272433,
"Position": {
"X": 320.0,
"Y": 480.0
},
"Scale": {
"ScaleX": 1.0,
"ScaleY": 1.0
},
"AnchorPoint": {
"ScaleX": 0.5,
"ScaleY": 0.5
},
"CColor": {},
"Size": {
"X": 640.0,
"Y": 960.0
},
"FrameEvent": "",
"Name": "Default",
"ctype": "SpriteObjectData"
}
],
"Position": {
"X": 0.0,
"Y": 0.0
},
"Scale": {
"ScaleX": 1.0,
"ScaleY": 1.0
},
"AnchorPoint": {},
"CColor": {},
"Size": {
"X": 640.0,
"Y": 960.0
},
"FrameEvent": "",
"Name": "Scene",
"ctype": "SingleNodeObjectData"
},
"ctype": "GameProjectData"
}
}
}

View File

@ -0,0 +1,29 @@
var HelloWorldLayer = cc.Layer.extend({
sprite:null,
ctor:function () {
//////////////////////////////
// 1. super init first
this._super();
/////////////////////////////
// 2. add a menu item with "X" image, which is clicked to quit the program
// you may modify it.
// ask the window size
var size = cc.winSize;
var mainscene = ccs.load(res.MainScene_json);
this.addChild(mainscene.node);
return true;
}
});
var HelloWorldScene = cc.Scene.extend({
onEnter:function () {
this._super();
var layer = new HelloWorldLayer();
this.addChild(layer);
}
});

View File

@ -0,0 +1,9 @@
var res = {
HelloWorld_png : "res/HelloWorld.png",
MainScene_json : "res/MainScene.json"
};
var g_resources = [];
for (var i in res) {
g_resources.push(res[i]);
}

View File

@ -0,0 +1,152 @@
{
"do_default": {
"exclude_from_template": [
"frameworks/runtime-src",
"res-landscape",
"res-portrait"
],
"append_from_template": {
"from": "res-landscape",
"to": ""
},
"project_rename": {
"src_project_name": "HelloLua",
"files": [
"PROJECT_NAME.ccs",
"PROJECT_NAME.cfg",
"PROJECT_NAME.udf"
]
},
"project_replace_project_name": {
"src_project_name": "HelloLua",
"files": [
"config.json",
".project",
"PROJECT_NAME.ccs"
]
},
"append_dir": [
{
"from": "cocos/scripting/lua-bindings/script",
"to": "src/cocos",
"exclude": []
}
]
},
"do_add_native_support": {
"append_from_template": {
"from": "frameworks/runtime-src",
"to": "frameworks/runtime-src",
"exclude": [
"proj.android/bin",
"proj.android/assets",
"proj.ios_mac/HelloLua.xcodeproj/project.xcworkspace",
"proj.ios_mac/HelloLua.xcodeproj/xcuserdata",
"proj.win32/Debug.win32",
"proj.win32/Release.win32",
"proj.win32/HelloLua.sdf"
]
},
"project_rename": {
"src_project_name": "HelloLua",
"files": [
"frameworks/runtime-src/proj.win32/PROJECT_NAME.vcxproj",
"frameworks/runtime-src/proj.win32/PROJECT_NAME.vcxproj.filters",
"frameworks/runtime-src/proj.win32/PROJECT_NAME.vcxproj.user",
"frameworks/runtime-src/proj.win32/PROJECT_NAME.sln",
"frameworks/runtime-src/proj.ios_mac/PROJECT_NAME.xcodeproj"
]
},
"project_replace_project_name": {
"src_project_name": "HelloLua",
"files": [
"config.json",
".project",
"frameworks/runtime-src/proj.win32/PROJECT_NAME.vcxproj",
"frameworks/runtime-src/proj.win32/PROJECT_NAME.vcxproj.filters",
"frameworks/runtime-src/proj.win32/PROJECT_NAME.vcxproj.user",
"frameworks/runtime-src/proj.win32/PROJECT_NAME.sln",
"frameworks/runtime-src/proj.win32/main.cpp",
"frameworks/runtime-src/proj.android/.project",
"frameworks/runtime-src/proj.android/AndroidManifest.xml",
"frameworks/runtime-src/proj.android/build.xml",
"frameworks/runtime-src/proj.android/res/values/strings.xml",
"frameworks/runtime-src/proj.ios_mac/ios/main.m",
"frameworks/runtime-src/proj.ios_mac/ios/Prefix.pch",
"frameworks/runtime-src/proj.ios_mac/mac/SimulatorApp.mm",
"frameworks/runtime-src/proj.ios_mac/PROJECT_NAME.xcodeproj/project.pbxproj",
"frameworks/runtime-src/Classes/AppDelegate.cpp"
]
},
"project_replace_package_name": {
"src_package_name": "org.cocos2dx.hellolua",
"files": [
"frameworks/runtime-src/proj.android/AndroidManifest.xml"
]
},
"project_replace_mac_bundleid": {
"src_bundle_id": "org.cocos2dx.hellolua",
"files": [
"frameworks/runtime-src/proj.ios_mac/mac/Info.plist"
]
},
"project_replace_ios_bundleid": {
"src_bundle_id": "org.cocos2dx.hellolua",
"files": [
"frameworks/runtime-src/proj.ios_mac/ios/Info.plist"
]
}
},
"change_orientation": {
"append_from_template": {
"from": "res-portrait",
"to": ""
},
"modify_files": [
{
"file_path": "config.json",
"pattern": "\\\"isLandscape\\\"\\s*:.*,",
"replace_string": "\"isLandscape\": false,"
},
{
"file_path": "src/config.lua",
"pattern": "width\\s*=.*,",
"replace_string": "width = 640,"
},
{
"file_path": "src/config.lua",
"pattern": "height\\s*=.*,",
"replace_string": "height = 960,"
},
{
"file_path": "frameworks/runtime-src/proj.ios_mac/ios/Info.plist",
"pattern": "UIInterfaceOrientationLandscapeRight",
"replace_string": "UIInterfaceOrientationPortrait"
},
{
"file_path": "frameworks/runtime-src/proj.ios_mac/ios/Info.plist",
"pattern": "UIInterfaceOrientationLandscapeLeft",
"replace_string": "UIInterfaceOrientationPortraitUpsideDown"
},
{
"file_path": "frameworks/runtime-src/proj.android/AndroidManifest.xml",
"pattern": "android:screenOrientation=\\\".*\\\"",
"replace_string": "android:screenOrientation=\"portrait\""
}
],
"project_rename":{
"src_project_name":"HelloLua",
"files":[
"PROJECT_NAME.ccs",
"PROJECT_NAME.cfg",
"PROJECT_NAME.udf"
]
},
"project_replace_project_name":{
"src_project_name":"HelloLua",
"files":[
"PROJECT_NAME.ccs"
]
}
}
}

View File

@ -0,0 +1,25 @@
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := cocos2dlua_shared
LOCAL_MODULE_FILENAME := libcocos2dlua
FILE_LIST := hellolua/main.cpp
FILE_LIST += $(wildcard $(LOCAL_PATH)/../../Classes/*.cpp)
FILE_LIST += $(wildcard $(LOCAL_PATH)/../../Classes/ide-support/*.cpp)
FILE_LIST += $(wildcard $(LOCAL_PATH)/../../Classes/ide-support/*.c)
LOCAL_SRC_FILES := $(FILE_LIST:$(LOCAL_PATH)/%=%)
LOCAL_C_INCLUDES := $(LOCAL_PATH)/../../Classes
LOCAL_STATIC_LIBRARIES := cocos2d_lua_static
LOCAL_STATIC_LIBRARIES += cocos2d_simulator_static
include $(BUILD_SHARED_LIBRARY)
$(call import-module,scripting/lua-bindings/proj.android/prebuilt-mk)
$(call import-module,tools/simulator/libsimulator/proj.android/prebuilt-mk)

View File

@ -0,0 +1,20 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2013
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "HelloLua", "HelloLua.vcxproj", "{4E6A7A0E-DDD8-4BAA-8B22-C964069364ED}"
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
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

View File

@ -0,0 +1,21 @@
#include "main.h"
#include "SimulatorWin.h"
#include <shellapi.h>
#pragma comment(lib,"libcocos2d.lib")
#pragma comment(lib,"libluacocos2d.lib")
#pragma comment(lib,"libbox2d.lib")
#pragma comment(lib,"libSpine.lib")
#pragma comment(lib,"libsimulator.lib")
int APIENTRY _tWinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPTSTR lpCmdLine,
int nCmdShow)
{
UNREFERENCED_PARAMETER(hPrevInstance);
UNREFERENCED_PARAMETER(lpCmdLine);
auto simulator = SimulatorWin::getInstance();
return simulator->run();
}

View File

@ -0,0 +1,11 @@
<Solution>
<PropertyGroup Name="HelloLua" Version="2.1.0.0" Type="CocosStudio" />
<SolutionFolder>
<Group ctype="ResourceGroup">
<RootFolder Name=".">
<Project Name="MainScene.csd" />
<Image Name="HelloWorld.png" />
</RootFolder>
</Group>
</SolutionFolder>
</Solution>

View File

@ -0,0 +1 @@
<Properties PublishDirectory="res" SolutionSize="960 * 640" DefaultSerializer="Serializer_FlatBuffers" CustomSerializer="Serializer_FlatBuffers" />

View File

@ -0,0 +1,6 @@
<UserData>
<OpenedDocuments>
<FilePathData Path="MainScene.csd" />
</OpenedDocuments>
<ActiveDocument Path="MainScene.csd" />
</UserData>

Binary file not shown.

After

Width:  |  Height:  |  Size: 208 KiB

View File

@ -0,0 +1,29 @@
<GameProjectFile>
<PropertyGroup Type="Scene" Name="MainScene" ID="a2ee0952-26b5-49ae-8bf9-4f1d6279b798" Version="2.1.0.0" />
<Content ctype="GameProjectContent">
<Content>
<Animation Duration="0" Speed="1.0000" />
<ObjectData Name="Scene" FrameEvent="" RightMargin="-960.0000" TopMargin="-640.0000" ctype="SingleNodeObjectData">
<Position X="0.0000" Y="0.0000" />
<Scale ScaleX="1.0000" ScaleY="1.0000" />
<AnchorPoint />
<CColor A="255" R="255" G="255" B="255" />
<Size X="960.0000" Y="640.0000" />
<PrePosition X="0.0000" Y="0.0000" />
<PreSize X="0.0000" Y="0.0000" />
<Children>
<NodeObjectData Name="Default" ActionTag="953446860" FrameEvent="" Tag="5" ObjectIndex="2" ctype="SpriteObjectData">
<Position X="480.0000" Y="320.0000" />
<Scale ScaleX="1.0000" ScaleY="1.0000" />
<AnchorPoint ScaleX="0.5000" ScaleY="0.5000" />
<CColor A="255" R="255" G="255" B="255" />
<Size X="960.0000" Y="640.0000" />
<PrePosition X="0.5000" Y="0.5000" />
<PreSize X="0.0000" Y="0.0000" />
<FileData Type="Normal" Path="HelloWorld.png" />
</NodeObjectData>
</Children>
</ObjectData>
</Content>
</Content>
</GameProjectFile>

Binary file not shown.

After

Width:  |  Height:  |  Size: 208 KiB

View File

@ -0,0 +1,11 @@
<Solution>
<PropertyGroup Name="HelloLua" Version="2.1.0.0" Type="CocosStudio" />
<SolutionFolder>
<Group ctype="ResourceGroup">
<RootFolder Name=".">
<Project Name="MainScene.csd" />
<Image Name="HelloWorld.png" />
</RootFolder>
</Group>
</SolutionFolder>
</Solution>

View File

@ -0,0 +1 @@
<Properties publishHasCocos2dxCode="False" PublishDirectory="res" SolutionSize="640 * 960" DefaultSerializer="Serializer_FlatBuffers" CustomSerializer="Serializer_FlatBuffers" />

View File

@ -0,0 +1,6 @@
<UserData>
<OpenedDocuments>
<FilePathData Path="MainScene.csd" />
</OpenedDocuments>
<ActiveDocument Path="MainScene.csd" />
</UserData>

Binary file not shown.

After

Width:  |  Height:  |  Size: 80 KiB

View File

@ -0,0 +1,29 @@
<GameProjectFile>
<PropertyGroup Type="Scene" Name="MainScene" ID="a2ee0952-26b5-49ae-8bf9-4f1d6279b798" Version="2.1.0.0" />
<Content ctype="GameProjectContent">
<Content>
<Animation Duration="0" Speed="1.0000" />
<ObjectData Name="Scene" FrameEvent="" ctype="SingleNodeObjectData">
<Position X="0.0000" Y="0.0000" />
<Scale ScaleX="1.0000" ScaleY="1.0000" />
<AnchorPoint />
<CColor A="255" R="255" G="255" B="255" />
<Size X="640.0000" Y="960.0000" />
<PrePosition X="0.0000" Y="0.0000" />
<PreSize X="0.0000" Y="0.0000" />
<Children>
<NodeObjectData Name="Default" ActionTag="-620272433" FrameEvent="" Tag="5" ObjectIndex="3" ctype="SpriteObjectData">
<Position X="320.0000" Y="480.0000" />
<Scale ScaleX="1.0000" ScaleY="1.0000" />
<AnchorPoint ScaleX="0.5000" ScaleY="0.5000" />
<CColor A="255" R="255" G="255" B="255" />
<Size X="640.0000" Y="960.0000" />
<PrePosition X="0.5000" Y="0.5000" />
<PreSize X="0.0000" Y="0.0000" />
<FileData Type="Normal" Path="HelloWorld.png" />
</NodeObjectData>
</Children>
</ObjectData>
</Content>
</Content>
</GameProjectFile>

Binary file not shown.

After

Width:  |  Height:  |  Size: 80 KiB

View File

@ -0,0 +1,8 @@
local MyApp = class("MyApp", cc.load("mvc").AppBase)
function MyApp:onCreate()
math.randomseed(os.time())
end
return MyApp

View File

@ -0,0 +1,10 @@
local MainScene = class("MainScene", cc.load("mvc").ViewBase)
MainScene.RESOURCE_FILENAME = "MainScene.csb"
function MainScene:onCreate()
printf("resource node = %s", tostring(self:getResourceNode()))
end
return MainScene

View File

@ -0,0 +1,26 @@
-- 0 - disable debug info, 1 - less debug info, 2 - verbose debug info
DEBUG = 2
-- use framework, will disable all deprecated API, false - use legacy API
CC_USE_FRAMEWORK = true
-- show FPS on screen
CC_SHOW_FPS = true
-- disable create unexpected global variable
CC_DISABLE_GLOBAL = true
-- for module display
CC_DESIGN_RESOLUTION = {
width = 960,
height = 640,
autoscale = "SHOW_ALL",
callback = function(framesize)
local ratio = framesize.width / framesize.height
if ratio <= 1.34 then
-- iPad 768*1024(1536*2048) is 4:3 screen
return {autoscale = "SHOW_ALL"}
end
end
}

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