forked from zilongshanren/programmers-guide
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
71e24b9
commit d31b725
Showing
12 changed files
with
452 additions
and
476 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
# Chapter 10: Lua | ||
# Chapter 10: 3D | ||
|
||
## call custom c++ from Lua | ||
## 3D Sprite | ||
|
||
## bindings to c++ | ||
## 3D Actions | ||
|
||
## subclassing | ||
## 3D Animations | ||
|
||
## Placeholders for: memory management, Debug a Lua Game | ||
## Placeholders for: Lights, Shadows, Cameras | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,11 @@ | ||
# Chapter 11: Services | ||
# Chapter 11: Lua | ||
|
||
## other SDK's | ||
## call custom c++ from Lua | ||
|
||
## Plugin-X | ||
## bindings to c++ | ||
|
||
## Placeholders - IAP, FB | ||
## subclassing | ||
|
||
## Placeholders for: memory management, Debug a Lua Game | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,9 @@ | ||
# Chapter 12: Physics | ||
# Chapter 12: Services | ||
|
||
## What options and why integrated physics engine | ||
## other SDK's | ||
|
||
## Physics concepts | ||
## Plugin-X | ||
|
||
## Physics world, bodies | ||
|
||
## Collision | ||
|
||
## Examples | ||
## Placeholders - IAP, FB | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,13 @@ | ||
# Chapter 13: Advanced Topics | ||
# Chapter 13: Physics | ||
|
||
## Best Practice - Optimization, memory, performance, profiling | ||
## What options and why integrated physics engine | ||
|
||
## Sound | ||
## Physics concepts | ||
|
||
## SQLite | ||
## Physics world, bodies | ||
|
||
## Subclass Cocos2d-x classes | ||
## Collision | ||
|
||
## Data structures (i.e Vector) | ||
|
||
## Custom OpenGL (what to cover here? CustomCommand?) | ||
|
||
## c++11 usage | ||
|
||
## rendering pipeline (notes about this in the wiki) | ||
|
||
## networking - curl, http | ||
## Examples | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# Chapter 14: Advanced Topics | ||
|
||
## Best Practice - Optimization, memory, performance, profiling | ||
|
||
## Sound | ||
|
||
## SQLite | ||
|
||
## Subclass Cocos2d-x classes | ||
|
||
## Data structures (i.e Vector) | ||
|
||
## Custom OpenGL (what to cover here? CustomCommand?) | ||
|
||
## c++11 usage | ||
|
||
## rendering pipeline (notes about this in the wiki) | ||
|
||
## networking - curl, http |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,131 +1 @@ | ||
# Chapter 2: Jumping into Cocos2d-x | ||
|
||
## Installation | ||
|
||
[Appendix A - Android with Terminal Installation and Setup]() | ||
|
||
[Appendix B - Android with Eclipse Installation and Setup]() | ||
|
||
[Appendix C - iOS Installation and Setup]() | ||
|
||
[Appendix D - Mac OSX Installation and Setup]() | ||
|
||
[Appendix E - Linux Installation and Setup]() | ||
|
||
[Appendix F - Win32 Installation and Setup]() | ||
|
||
[Appendix G - WP8 Installation and Setup]() | ||
|
||
[Appendix H - Creating a New Example Project]() | ||
|
||
## Getting Started | ||
This introduction requires a working Cocos2d-x setup to complete. Please ensure that you have gone through the appropriate installation steps for your platform. Please review the Appendix for `Installation Guides`. | ||
|
||
Follow Appendix H for 'Creating A New Example Project'. | ||
|
||
Navigate to your new project and open it. This is dependepent upon the platform that you are running on. Please refer to the appropriate Appendix for your installation. | ||
|
||
Let's Begin! | ||
|
||
## What is in the Project | ||
Everything you need to get started! Platform specific source files, Cocos2d-x and the Resources used in the 'Hello World' sample. | ||
|
||
 | ||
## Creating Your First Scene | ||
'Hello World' has a default Scene, but lets ignore it and create our own. | ||
|
||
`File -> New -> File` or `Command-N` and lets create a C++ class. | ||
|
||
 | ||
|
||
Select `Next` and let's call our new Scene `MainScene.cpp`. | ||
|
||
Select `Create`. | ||
|
||
Select the `MainScene.h` and paste in the following code: | ||
|
||
```cpp | ||
#ifndef __MAINSCENE_H__ | ||
#define __MAINSCENE_H__ | ||
|
||
#include <iostream> | ||
|
||
#include "cocos2d.h" | ||
|
||
class MainScene | ||
{ | ||
public: | ||
MainScene(); | ||
~MainScene(); | ||
|
||
static cocos2d::Scene* createScene(); | ||
|
||
virtual cocos2d::Scene* getScene() { return scene; }; | ||
|
||
private: | ||
cocos2d::Scene* scene; | ||
cocos2d::LayerColor* layer; | ||
}; | ||
|
||
#endif // __MAINSCENE_H__ | ||
``` | ||
Select the `MainScene.cpp` and paste in the following code: | ||
```cpp | ||
// | ||
// MainScene.cpp | ||
// | ||
|
||
#include "MainScene.h" | ||
|
||
MainScene::MainScene() | ||
{ | ||
// get the display size of the device we are using | ||
cocos2d::Size visibleSize = cocos2d::Director::getInstance()->getVisibleSize(); | ||
cocos2d::Vec2 origin = cocos2d::Director::getInstance()->getVisibleOrigin(); | ||
|
||
// scene | ||
scene = cocos2d::Scene::create(); | ||
scene->setContentSize(visibleSize); | ||
|
||
// layer | ||
layer = cocos2d::LayerColor::create(cocos2d::Color4B(120, 50, 50, 120), visibleSize.width, visibleSize.height); | ||
|
||
// finally add the built up Layer to the Scene. | ||
scene->addChild(layer, 0); | ||
} | ||
|
||
MainScene::~MainScene() {} | ||
|
||
cocos2d::Scene* MainScene::createScene() | ||
{ | ||
MainScene m; | ||
return m.getScene(); | ||
} | ||
``` | ||
And finally, in `AppDelegate.cpp`, replace: | ||
|
||
```cpp | ||
auto scene = HelloWorld::createScene(); | ||
``` | ||
with: | ||
```cpp | ||
cocos2d::Scene* scene = MainScene::createScene(); | ||
``` | ||
|
||
That's it! But the Scene is empty. Lets add some content. | ||
|
||
## Adding Content to the SceneLets start to make a simple game! | ||
|
||
First, download <> and toss the contents in the `Resources` directory for your project. Add them to your IDE. | ||
|
||
Second, past in the following code: | ||
|
||
```cpp | ||
|
||
``` | ||
## Using Actions to Animate Scenes | ||
|
||
## Transitioning Between Scenes | ||
## Building Complex Content Using Nodes | ||
|
||
## Creating Nodes That Interact with Each Other | ||
# Chapter 2: Basic Cocos2d-x Concepts |
Oops, something went wrong.