个人总结:
1.cocos2d-x 程序输出提示方法:
log 和 CClog 一个是 3.0的 一个是2.0的…
2.确定物体x,y,z轴坐标的核心语句.
Sprite3D::getPosition3D();
Sprite::getPosition3D();
3.物体围绕坐标轴旋转语句:
Sprite3D::setRotation3D();
Sprite::setRotation3D();
4.了解LabelTTF等文本类及使用语句:
1 2 3 4 5 6 |
auto center = LabelTTF::create("hello cocos2d-x",//要显示字符串 "Paint Boy",//字体 32,//字号 Size(s.width/2,200),//显示的宽和高 TextHAlignment::CENTER,//显示的位置,定位 TextVAlignment::TOP); |
5.API绘制图形和填充图形:
我只能给一个链接了:http://www.2cto.com/kf/201402/276825.html
6.了解游戏制作流程:
灵感->策划->原画->模型和贴图->程序编写->测试修改
7.3D精灵创建语句:
auto sprite3d = Sprite3D::create();
PS.我不懂,只是按着引导这样敲了…
8.Vector简单实例:C++语句哦…
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 |
#include <iostream> #include <vector> using std::cin; using std::cout; using std::endl; using std::vector; //定义 顺序输出容器元素函数模板 template <typename T> void printVector(const vector<T> & integers2); int main() { const int SIZE = 6; int array[SIZE] = {1,2,3,4,5,6}; vector <int> integers; cout << "The initial size of integers is:" << integers.size() << endl; cout << "The initial capacity of integers is:" << integers.capacity() << endl; integers.push_back(10); integers.push_back(20); integers.push_back(30); integers.push_back(40); integers.push_back(50); integers.push_back(60); integers.push_back(70); integers.push_back(80); integers.push_back(90); integers.push_back(100); cout << "The initial size of integers is:" << integers.size() << endl; cout << "The initial capacity of integers is:" << integers.capacity() << endl; cout << endl << "Output array using pointer natation:"; for(int *ptr = array ; ptr!=array+SIZE ; ptr++) { cout << *ptr << " "; } cout << endl << "Output vector of vector intergers:"; printVector(integers); cout << endl << "Reversed contents of vector integers:"; vector<int>::const_reverse_iterator reverseIterator; vector<int>::const_reverse_iterator tempIterator = integers.rend(); //逆序显示 for(reverseIterator = integers.rbegin();reverseIterator!=tempIterator;++reverseIterator) { cout << *reverseIterator << " "; } cout << endl; return 0; } template <typename T> void printVector (const vector<T> & integers2) { typename vector<T>::const_iterator constIterator; for(constIterator = integers2.begin();constIterator!=integers2.end();++constIterator) { cout << *constIterator << " "; } } |
其实我觉得掌握push_back就行了…其他的我都懒得记…
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
#include <iostream> #include <vector> #include <algorithm> #include <iterator> #include <stdexcept> using namespace std; int main() { const int SIZE = 6; int array[SIZE] = {1,2,3,4,5,6}; vector<int> integers(array,array+SIZE); ostream_iterator <int> output(cout," "); cout << "Vector integers contains:"; copy(integers.begin(),integers.end(),output); cout << endl << "First element of integers:" << integers.front() << endl << "Last element of integers:" << integers.back(); integers[0]=10; integers.at(2) = 10; integers.insert(integers.begin()+1,22); cout << endl << endl << "Contents of vector integers after changes:"; copy(integers.begin(),integers.end(),output); //access out-of-range element try{ integers.at(100) = 77; } catch(out_of_range & outOfRange) { cout << endl << endl << "Exception:" << outOfRange.what(); } integers.erase(integers.begin()); cout << endl << endl << "Vector integers after erasing first element:"; copy(integers.begin(),integers.end(),output); integers.erase(integers.begin(),integers.end()); cout << endl << "After erasing all elements ,vector integers " << (integers.empty() ? "is":"is not") << " Empty" << endl;; integers.insert(integers.begin(),array,array+SIZE); cout << endl << endl << "Contents of vector integers before clear:"; copy(integers.begin(),integers.end(),output); integers.clear(); cout << "\nAfter clear,vertor integers " << (integers.empty() ? "IS" : "IS NOT") << " Empty" << endl; return 0; } |
如果看不懂,就运行试试吧,应该是可以运行的…然后对比着看…
9.导演类控制场景:
1 2 |
auto * fadeIn = TransitionFade::create( 1.0f , StartScene::createScene() ); Director::getInstance()->replaceScene( fadeIn ); |
10.掌握实时更新函数的开启和关闭
链接:http://www.58player.com/blog-2537-86942.html
From TK Xiong
欢迎访问:cocos2d复习资料——2
【cocos2d】复习资料——1
666