newlist

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::

随笔分类 -  cocos2d-x

上一页 1 2 3 4 5 6 下一页

摘要:#include "XAnimation.h"CXAnimation::CXAnimation(void){ m_strName = ""; m_nFrameCount = 0; m_fInterval = 0.0f;}CXAnimation::~CXAnimation(){}CXAnimation* CXAnimation::create( const char* psName, int nBegan, int nCount, float delayPerUnit /*= 1.0*/ ){ CXAnimation* pAnimation = new C 阅读全文
posted @ 2013-06-25 22:52 一枚程序 阅读(277) 评论(0) 推荐(0) 编辑

摘要:/****************************************************************************使用一个CCAnimation对象可以CCSprite对象上执行动画。 CCAnimation对象包含CCSpriteFrame对象,与帧之间可能出现的延误。可以使用CCAnimate的方法 播放CCAnimation对象。*****************************************************************************/#ifndef __CXAnimation_H__#define 阅读全文
posted @ 2013-06-25 22:50 一枚程序 阅读(452) 评论(0) 推荐(0) 编辑

摘要:#ifndef __XCOMMON_H__#define __XCOMMON_H__/************************************************************************///XCommon.h 是通用类,提供一些功能//1.字符串截断//2.坐标转换//3.文字乱码处理// /************************************************************************/#if (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32)#include &qu 阅读全文
posted @ 2013-06-25 13:46 一枚程序 阅读(527) 评论(0) 推荐(0) 编辑

摘要:#include "XSprite.h"CXSprite::CXSprite(void){ m_strPic.clear();}CXSprite::~CXSprite(){}/**********************************函数名称:createSprite*函数功能:创建精灵*函数参数:const char* psFile--创建精灵用的图片 int nFrameIndex--(-1--普通图片 0-2--按钮图片帧(按钮统一为3帧))*函数返回值:创建的精灵指针*备注:分两种情况来创建1.第一种:只是简单的通过图片来创建2.第二种:通过纹理来创... 阅读全文
posted @ 2013-06-24 17:13 一枚程序 阅读(360) 评论(0) 推荐(0) 编辑

摘要:#ifndef __XSprite_H__#define __XSprite_H__#include "CocoHead.h"#define BTN_FRAME_AMOUNT 3class ENGINE_API CXSprite : public CCSprite{public: /* 按钮的图片分割成几张 那个分割后每张的索引值 */ enum BTN_FRAME_INDEX { BTN_FRAME_0 = 0, BTN_FRAME_1 = 1, BTN_FRAME_2 = 2, BTN_FRAME_3... 阅读全文
posted @ 2013-06-24 17:12 一枚程序 阅读(262) 评论(0) 推荐(0) 编辑

摘要:#include "SectsInfomation.h"#include "WidgetMgr.h"#include "XButton.h"#include "XSroll.h"#include "Config.h"#include "XCommon.h"#include "XStatic.h"#include "XImage.h"#if(CC_TARGET_PLATFORM == CC_PLATFORM_IOS)#include &q 阅读全文
posted @ 2013-06-24 16:07 一枚程序 阅读(313) 评论(0) 推荐(0) 编辑

摘要:#ifndef SECTSINFOMATION_H#define SECTSINFOMATION_H#include "XWidget.h"#include "XImage.h"#include "XStatic.h"#include class CXButton;class CSectsInfomation : public CXWidget{public: CSectsInfomation(void); ~CSectsInfomation(void);public: enum CSectsInfomationId { _IDD_C 阅读全文
posted @ 2013-06-24 16:06 一枚程序 阅读(250) 评论(0) 推荐(0) 编辑

摘要:/************************************************************************///屏蔽消息面板 //优先级默认为 TP_BOTTOM = 1, // /************************************************************************/#ifndef __XNOTOUCH_H__#define __XNOTOUCH_H__#include "XWindow.h"class ENGINE_API CXNoTouch : public CXWind 阅读全文
posted @ 2013-06-23 18:37 一枚程序 阅读(963) 评论(0) 推荐(0) 编辑

摘要:#ifndef __XSROLL_H__#define __XSROLL_H__#include "CocoHead.h"#include "XWindow.h"class ENGINE_API CXSroll : public CXWindow{public: enum XSrollType { _SrollDirectionVertical = 0, //垂直 _SrollDirectionHorizontal = 1, //水平 _SrollVerticalTable ... 阅读全文
posted @ 2013-06-23 16:48 一枚程序 阅读(397) 评论(0) 推荐(0) 编辑

摘要:1 /************************************* 2 *函数名称:visit 3 *函数功能:获取游戏设计的分辨率与真实设备的比例,并根据值来剪切显示区域 4 *函数参数:void 5 *函数返回值:void 6 *笔记: 7 1.glEnable用于开启opengl相应的功能 8 2.GL_SCISSOR_TEST根据函数glScissor设置,启用图形剪切 9 3.glScissor10 http://blog.csdn.net/augusdi/article/details/728221411 ****************************... 阅读全文
posted @ 2013-06-23 16:34 一枚程序 阅读(582) 评论(0) 推荐(0) 编辑

摘要://编码转换 //#if (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32) // string title = "成绩"; // GBK2UTF8(title,"gb2312","utf-8"); //#endif static int GBK2UTF8(std::string & gbkStr, const char* toCode, const char* fromCode) { iconv_t iconvH; iconvH = iconv_open(fromCo... 阅读全文
posted @ 2013-06-20 12:03 一枚程序 阅读(493) 评论(0) 推荐(0) 编辑

摘要:/****************************************************************************Copyright (c) 2010 cocos2d-x.orghttp://www.cocos2d-x.orgPermission is hereby granted, free of charge, to any person obtaining a copyof this software and associated documentation files (the "Software"), to dealin t 阅读全文
posted @ 2013-06-20 11:21 一枚程序 阅读(1369) 评论(0) 推荐(0) 编辑

摘要://转换坐标 //锚点为(x,x)是的坐标转换成锚点为(0,0)的坐标 //例如:把锚点(0.5,0.5)坐标(0,0)转换成 //锚点(0.5,0.5)坐标(0 - pNode.getContentSize.width * 0.5,0 - pNode.getContentSize.Height * 0.5) static void anchorToLocalPos(CCNode* pNode) { pNode->setPositionX(pNode->getPositionX() + pNode->getContentSize().width * ... 阅读全文
posted @ 2013-06-20 10:07 一枚程序 阅读(533) 评论(0) 推荐(0) 编辑

摘要:MapInfo* CGameConfig::getMapInfoById( int nId ){ for (map::iterator it = m_mapMapInfo.begin(); it != m_mapMapInfo.end(); it++) { if (nId == it->first) { return &(it->second); } } CCLog("error: CGameConfig::getMapInfoById"); return NULL;} 阅读全文
posted @ 2013-06-18 14:20 一枚程序 阅读(1685) 评论(0) 推荐(0) 编辑

摘要:"100,100;500,500;300,300;150,150;30,30"static void split(const string& src, const string& separator, vector& dest) { string str = src; string substring; string::size_type start = 0, index; do { index = str.find_first_of(separator,start); if... 阅读全文
posted @ 2013-06-18 14:16 一枚程序 阅读(1975) 评论(0) 推荐(0) 编辑

摘要:// libxmlTest.cpp : 定义控制台应用程序的入口点。//#include "stdafx.h"#include #include #include #include int _tmain(int argc, _TCHAR* argv[]){ //定义文档和节点指针 xmlDocPtr doc = xmlNewDoc(BAD_CAST "1.0"); xmlNodePtr root_node = xmlNewNode(NULL,BAD_CAST"root"); //设置根节点 xmlDocSetRootElement(d 阅读全文
posted @ 2013-06-17 10:46 一枚程序 阅读(472) 评论(0) 推荐(0) 编辑

摘要:打开然后将图片拖入点击回到项目中,添加现有项,得到CCSpriteFrameCache::sharedSpriteFrameCache()->addSpriteFramesWithFile("spriteframe.plist"); CCSpriteFrame* pFrame = CCSpriteFrameCache::sharedSpriteFrameCache()->spriteFrameByName("12.png"); CCSprite *pSprite = CCSprite::spriteWithSpriteFrame(pFrame 阅读全文
posted @ 2013-06-14 16:38 一枚程序 阅读(1178) 评论(0) 推荐(0) 编辑

摘要:#ifndef HROCKER_H#define HROCKER_H#include "cocos2d.h"using namespace cocos2d;//用于标识摇杆与摇杆的背景typedef enum{ tag_rocker, tag_rockerBG,}tagForHRocker;class HRocker:public CCLayer{public: HRocker(void); ~HRocker(void); //创建摇杆(摇杆的操作题图片资源名,摇杆背景图片资源名,起始坐标) static HRocker* createHRocker... 阅读全文
posted @ 2013-06-11 16:45 一枚程序 阅读(1448) 评论(0) 推荐(0) 编辑

摘要://自定义粒子 CCParticleSystem* myParticle = CCParticleSystemQuad::create("Flower.plist"); addChild(myParticle); 阅读全文
posted @ 2013-06-07 17:17 一枚程序 阅读(265) 评论(0) 推荐(0) 编辑

摘要:CCParticleSystem* particleSystemFree = CCParticleSun::create(); //设置贴图 particleSystemFree->setTexture(CCTextureCache::sharedTextureCache()->addImage("fire.png")); //设置自动释放 particleSystemFree->setAutoRemoveOnFinish(true); //设置类型移动类型kCCPositionTypeFree-----随着layer的移... 阅读全文
posted @ 2013-06-07 17:09 一枚程序 阅读(1853) 评论(0) 推荐(0) 编辑

上一页 1 2 3 4 5 6 下一页