初始化

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,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,92 @@
#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()
{
/** you can create scene with following comment code instead of using csb file.
// 1. super init first
if ( !Layer::init() )
{
return false;
}
Size visibleSize = Director::getInstance()->getVisibleSize();
Vec2 origin = Director::getInstance()->getVisibleOrigin();
/////////////////////////////
// 2. add a menu item with "X" image, which is clicked to quit the program
// you may modify it.
// add a "close" icon to exit the progress. it's an autorelease object
auto closeItem = MenuItemImage::create(
"CloseNormal.png",
"CloseSelected.png",
CC_CALLBACK_1(HelloWorld::menuCloseCallback, this));
closeItem->setPosition(Vec2(origin.x + visibleSize.width - closeItem->getContentSize().width/2 ,
origin.y + closeItem->getContentSize().height/2));
// create menu, it's an autorelease object
auto menu = Menu::create(closeItem, NULL);
menu->setPosition(Vec2::ZERO);
this->addChild(menu, 1);
/////////////////////////////
// 3. add your codes below...
// add a label shows "Hello World"
// create and initialize a label
auto label = Label::createWithTTF("Hello World", "fonts/Marker Felt.ttf", 24);
// position the label on the center of the screen
label->setPosition(Vec2(origin.x + visibleSize.width/2,
origin.y + visibleSize.height - label->getContentSize().height));
// add the label as a child to this layer
this->addChild(label, 1);
// add "HelloWorld" splash screen"
auto sprite = Sprite::create("HelloWorld.png");
// position the sprite on the center of the screen
sprite->setPosition(Vec2(visibleSize.width/2 + origin.x, visibleSize.height/2 + origin.y));
// add the sprite as a child to this layer
this->addChild(sprite, 0);
**/
//////////////////////////////
// 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,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,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>

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>

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>

View File

@@ -0,0 +1,170 @@
{
"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"
]
},
{
"from": "web",
"to": "frameworks/cocos2d-html5"
}
]
},
"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,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,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>

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,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>

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>

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,50 @@
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);
/* you can create scene with following comment code instead of using csb file.
/////////////////////////////
// 3. add your codes below...
// add a label shows "Hello World"
// create and initialize a label
var helloLabel = new cc.LabelTTF("Hello World", "Arial", 38);
// position the label on the center of the screen
helloLabel.x = size.width / 2;
helloLabel.y = size.height / 2 + 200;
// add the label as a child to this layer
this.addChild(helloLabel, 5);
// add "HelloWorld" splash screen"
this.sprite = new cc.Sprite(res.HelloWorld_png);
this.sprite.attr({
x: size.width / 2,
y: size.height / 2
});
this.addChild(this.sprite, 0);
*/
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,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,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>

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="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>

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>

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,22 @@
local MainScene = class("MainScene", cc.load("mvc").ViewBase)
MainScene.RESOURCE_FILENAME = "MainScene.csb"
function MainScene:onCreate()
printf("resource node = %s", tostring(self:getResourceNode()))
--[[ you can create scene with following comment code instead of using csb file.
-- add background image
display.newSprite("HelloWorld.png")
:move(display.center)
:addTo(self)
-- add HelloWorld label
cc.Label:createWithSystemFont("Hello World", "Arial", 40)
:move(display.cx, display.cy + 200)
:addTo(self)
]]
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
}