摘要: .h#ifndef __COMMON_COMPONENTS__#define __COMMON_COMPONENTS__#include "cocos2d.h"#include "cocos-ext.h"USING_NS_CC;USING_NS_CC_EXT;#define ROOT_BACK_WIDTH 380 //background width#define ROOT_BACK_HEIGHT 450 //background height#define LAYOUT_WIDTH 360 //each page w... 阅读全文
posted @ 2014-01-16 17:25 解放1949 阅读(2730) 评论(0) 推荐(0) 编辑
摘要: 一、准备工作需要下载和安装以下内容,请根据自己的操作系统选择x86和x64(我的是64位win7,我就拿64位说事)1、jdk-7u25-windows-x64.exe(下载完后直接安装,一直下一步)http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html2、adt-bundle-windows-x86_64-20130717.zip(下载完直接解压,解压目录不要带中文和空格,里面包含了带adt插件的eclipse和最新版的android sdk)https://dl.google.c 阅读全文
posted @ 2014-01-01 11:28 解放1949 阅读(221) 评论(0) 推荐(0) 编辑
摘要: C++0x 的语法还是比较简单。下面通过几个例子来介绍下。先是通过 std::for_each 演示一个简单的例子:?std::for_each 和 lambda1234567891011121314#include #include #include int main() {std::vector my_vector({1, 2, 3, 4 ,5});std::for_each(my_vector.begin(), my_vector.end(),[](int value) { std::cout int { return a + b;}这里把返回值设置为 int 型。2. [] 的表示方. 阅读全文
posted @ 2013-12-30 20:17 解放1949 阅读(283) 评论(0) 推荐(0) 编辑
摘要: 面向对象是C++的重要特性. 但是c++在c的基础上新增加的几点优化也是很耀眼的 就const直接可以取代c中的#define 以下几点很重要,学不好后果也也很严重 const1.限定符声明变量只能被读 const int i = 5; int j = 0; …… i = j; //非法,导致编译错误 j = i; //合法 2.必须初始化 const int i = 5; //合法 const int j; //非法,导致编译错误 3.在另一个文件中引用const常量 extern const int i; //合法 ... 阅读全文
posted @ 2013-12-29 21:19 解放1949 阅读(818) 评论(0) 推荐(0) 编辑
摘要: schedule(schedule_selector(HelloWorld::step), 1.0f);void HelloWorld::step(float dt){ CCLog("dt = %f", dt); //this->unschedule(schedule_selector(HelloWorld::step)); //不加这句,每1.0s调用一次 加上这句话,1.0s后调用且只执行一次} schedule(schedule_selector(HelloWorld::step)); //先1.0秒之后执行一次,再每3.0秒执行一次共5次(注:如果最后一个参数 阅读全文
posted @ 2013-12-28 09:54 解放1949 阅读(367) 评论(0) 推荐(0) 编辑
摘要: #include "stdafx.h"#include using namespace std;/*位运算符实现 加 减 乘 除*///加法运算int add(int a, int b){ return b==0 ? a : add(a^b, (a&b)>= 1; } return result;}//乘法int multi(int a, int b){ if (isNegative(a)) { if (isNegative(b)) return multi_help(negative(a), negative(b)); ... 阅读全文
posted @ 2013-12-25 23:17 解放1949 阅读(663) 评论(0) 推荐(0) 编辑
摘要: #include "stdafx.h"#include #include #include using namespace std;#define fn(x) int a##x; //声明一个ax变量 a常量 x变量#define tn(x) #x //可以直接拼一个字符串 int 可以直接输出 int//可以帮你写一个类#define cclass(cname,x,y,z) class C##cname\{\public:\ x m_##x;\ y m_2##y;\ char m_##z;\};//////////////////... 阅读全文
posted @ 2013-12-18 00:16 解放1949 阅读(382) 评论(0) 推荐(0) 编辑
摘要: 2013-12-17int _tmain(int argc, _TCHAR* argv[]){ #ifdef DEBUG cout Properties -> C/C++ -> Preprocessor -> Preprocessor Definitions 中添加 DEBUG , 这样 操作同样会输出 cout<<"DEBUG has been defined"<<endl;∴,在多人开发项目的时候,如果你想让别人运行一段函数,而自己不想运行,则可以这样实现:(你需要使用上述第2步,添加 DEBUG 到自己的项目环境中)void 阅读全文
posted @ 2013-12-17 23:38 解放1949 阅读(302) 评论(0) 推荐(0) 编辑
摘要: 2013-12-15 21:57:33下载地址:http://download.csdn.net/detail/jackyvincefu/6434549(摘自:CSDN资源)CTestLayer.h#ifndef __TEST_LAYER__#define __TEST_LAYER__#include "cocos2d.h"USING_NS_CC;class CTestLayer : public cocos2d::CCLayer{public: CTestLayer(void); ~CTestLayer(void); virtual bool init(); CRE... 阅读全文
posted @ 2013-12-15 22:02 解放1949 阅读(359) 评论(0) 推荐(0) 编辑
摘要: //CCLabelAtlasstatic CCLabelAtlas * create(const char *string, const char *charMapFile, unsigned int itemWidth, unsigned int itemHeight, unsigned int startCharMap);EXAMPLE: CCLabelAtlas::c... 阅读全文
posted @ 2013-12-14 12:01 解放1949 阅读(551) 评论(0) 推荐(0) 编辑