Intent intent = new Intent(TFNoticeTicketReceiver.ACTION_NOTICE);
PendingIntent pendingIntent = PendingIntent.getBroadcast(this, 0, intent,0);
Calendar calendar = Calendar.getInstance();
AlarmManager alarmManager = (AlarmManager)getSystemService(ALARM_SERVICE);
alarmManager.set(AlarmManager.RTC_WAKEUP, calendar.getTimeInMillis(), pendingIntent);
alarmManager.setRepeating(AlarmManager.RTC_WAKEUP, calendar.getTimeInMillis(), 10*1000, pendingIntent);
CCNode是一个核心的类,直接继承至CCObject,CCObject类是cocos2d-x中所有对象的基类,它封装了对象的引用计数和自动释放功能。CCNode是场景、层、菜单、精灵等所有节点的父类。 CCNode是cocos2d-x的渲染链,cocos2d-x同时只能渲染一个scene,因此scene是渲染的根节点,一般树的渲染顺序是scene添加n个CCLayer,一个CCLayer添加n个CCSprite或者CCMenu,CCSprite还可以添加CCParticleSystem,这样就构建了一个渲染树,cocos2d-x历遍这个树来将图像显示在屏幕上。 coco2d-x->visit() 调用Child的zOrder<0的visit()函数,然后调用draw()函数。再调用Child的zOrder>=0的visit()函数。(深度优先的算法 zOrder大的显示在最上层)。 主要函数: Public Member Functions virtual CCCamera * getCamera () 获取节点相机 virtual bool isRunning () virtual void cleanup (void) 停止节点所有运行的 actions 和schedulers. virtual void draw (void) 绘制自己 virtual void visit (void) 访问节点 CCRect boundingBox (void) Returns a "local" axis aligned bounding box of the node. Setters & Getters for Graphic Peroperties virtual void setZOrder (int zOrder) 设置节点顺序,值越大显示越靠前 virtual void _setZOrder (int z) Sets the z order which stands for the drawing order. virtual int getZOrder () 获取节点顺序 virtual void setVertexZ (float vertexZ) Sets the real OpenGL Z vertex. virtual float getVertexZ () Gets OpenGL Z vertex of this node. virtual void setScaleX (float fScaleX) Changes the scale factor on X axis of this node. virtual float getScaleX () Returns the scale factor on X axis of this node. virtual void setScaleY (float fScaleY) Changes the scale factor on Y axis of this node. virtual float getScaleY () Returns the scale factor on Y axis of this node. virtual void setScale (float scale) Changes both X and Y scale factor of the node. virtual float getScale () Gets the scale factor of the node, when X and Y have the same scale factor. virtual void setPosition (const CCPoint &position) 设置节点位置 virtual const CCPoint & getPosition () 获取节点位置 void setPosition (float x, float y) Sets position in a more efficient way. void getPosition (float *x, float *y) Gets position in a more efficient way, returns two number instead of a CCPoint object. void setPositionX (float x) Gets/Sets x or y coordinate individually for position. float getPositionX (void) void setPositionY (float y) float getPositionY (void) virtual void setSkewX (float fSkewX) Changes the X skew angle of the node in degrees. virtual float getSkewX () Returns the X skew angle of the node in degrees. virtual void setSkewY (float fSkewY) Changes the Y skew angle of the node in degrees. virtual float getSkewY () Returns the Y skew angle of the node in degrees. virtual void setAnchorPoint (const CCPoint &anchorPoint) Sets the anchor point in percent. virtual const CCPoint & getAnchorPoint () //获取节点的锚点的位置 virtual const CCPoint & getAnchorPointInPoints () Returns the anchorPoint in absolute pixels. virtual void setContentSize (const CCSize &contentSize) Sets the untransformed size of the node. virtual const CCSize & getContentSize () Returns the untransformed size of the node. virtual void setVisible (bool visible) Sets whether the node is visible. virtual bool isVisible () Determines if the node is visible. virtual void setRotation (float fRotation) Sets the rotation (angle) of the node in degrees. virtual float getRotation () Returns the rotation of the node in degrees. virtual void setRotationX (float fRotaionX) Sets the X rotation (angle) of the node in degrees which performs a horizontal rotational skew. virtual float getRotationX () Gets the X rotation (angle) of the node in degrees which performs a horizontal rotation skew. virtual void setRotationY (float fRotationY) Sets the Y rotation (angle) of the node in degrees which performs a vertical rotational skew. virtual float getRotationY () Gets the Y rotation (angle) of the node in degrees which performs a vertical rotational skew. virtual void setOrderOfArrival (unsigned int uOrderOfArrival) Sets the arrival order when this node has a same ZOrder with other children. virtual unsigned int getOrderOfArrival () Returns the arrival order, indecates which children is added previously. virtual void setGLServerState (ccGLServerState glServerState) Sets the state of OpenGL server side. virtual ccGLServerState getGLServerState () Returns the state of OpenGL server side. virtual void ignoreAnchorPointForPosition (bool ignore) Sets whether the anchor point will be (0,0) when you position this node. virtual bool isIgnoreAnchorPointForPosition () Gets whether the anchor point will be (0,0) when you position this node. Children and Parent virtual void addChild (CCNode *child) Adds a child to the container with z-order as 0. virtual void addChild (CCNode *child, int zOrder) Adds a child to the container with a z-order. virtual void addChild (CCNode *child, int zOrder, int tag) Adds a child to the container with z order and tag. CCNode * getChildByTag (int tag) Gets a child from the container with its tag. virtual CCArray * getChildren () Return an array of children. unsigned int getChildrenCount (void) Get the amount of children. virtual void setParent (CCNode *parent) Sets the parent node. virtual CCNode * getParent () Returns a pointer to the parent node. virtual void removeFromParent () Removes this node itself from its parent node with a cleanup. virtual void removeFromParentAndCleanup (bool cleanup) Removes this node itself from its parent node. virtual void removeChild (CCNode *child) Removes a child from the container with a cleanup. virtual void removeChild (CCNode *child, bool cleanup) Removes a child from the container. virtual void removeChildByTag (int tag) Removes a child from the container by tag value with a cleanup. virtual void removeChildByTag (int tag, bool cleanup) Removes a child from the container by tag value. virtual void removeAllChildren () Removes all children from the container with a cleanup. virtual void removeAllChildrenWithCleanup (bool cleanup) Removes all children from the container, and do a cleanup to all running actions depending on the cleanup parameter. virtual void reorderChild (CCNode *child, int zOrder) Reorders a child according to a new z value. virtual void sortAllChildren () Sorts the children array once before drawing, instead of every time when a child is added or reordered. Grid object for effects virtual CCGridBase * getGrid () Returns a grid object that is used when applying effects. virtual void setGrid (CCGridBase *pGrid) Changes a grid object that is used when applying effects. Tag & User data virtual int getTag () Returns a tag that is used to identify the node easily. virtual void setTag (int nTag) Changes the tag that is used to identify the node easily. virtual void * getUserData () Returns a custom user data pointer. virtual void setUserData (void *pUserData) Sets a custom user data pointer. virtual CCObject * getUserObject () Returns a user assigned CCObject. virtual void setUserObject (CCObject *pUserObject) Returns a user assigned CCObject. Shader Program virtual CCGLProgram * getShaderProgram () Return the shader program currently used for this node. virtual void setShaderProgram (CCGLProgram *pShaderProgram) Sets the shader program for this node. Script Bindings for lua virtual void registerScriptHandler (int handler) Registers a script function that will be called in onEnter() & onExit() seires functions. virtual void unregisterScriptHandler (void) Unregisters a script function that will be called in onEnter() & onExit() series functions. int getScriptHandler () Gets script handler for onEnter/onExit event. void scheduleUpdateWithPriorityLua (int nHandler, int priority) Schedules for lua script.
场景(CCScene)
函数:bool init () 初始化函数
static CCScene* create(void )
创建场景函数
场景切换效果:
CCDirector::sharedDirector()->replaceScene(scene));//默认场景的切换
//场景切换添加效果
CCDirector::sharedDirector()->replaceScene(CCTransitionJumpZoom::transitionWithDuration(1.2f,gameOverScene));
//总结的场景切换效果
CCTransitionJumpZoom::transitionWithDuration(t, s);//跳跃式,本场景先会缩小,然后跳跃进来
CCTransitionFade::transitionWithDuration(t, s);//淡出淡入,原场景淡出,新场景淡入
CCTransitionFade::transitionWithDuration(t, s, ccWHITE);//如果上一个的函数,带3个参数,则第三个参数就是淡出淡入的颜色
CCTransitionFlipX::transitionWithDuration(t, s, kOrientationLeftOver);//x轴左翻
CCTransitionFlipX::transitionWithDuration(t, s, kOrientationRightOver);//x轴右翻
CCTransitionFlipY::transitionWithDuration(t, s, kOrientationUpOver);//y轴上翻
CCTransitionFlipY::transitionWithDuration(t, s, kOrientationDownOver);//y轴下翻
CCTransitionFlipAngular::transitionWithDuration(t, s, kOrientationLeftOver);//有角度转的左翻
CCTransitionFlipAngular::transitionWithDuration(t, s, kOrientationRightOver);//有角度转的右翻
CCTransitionZoomFlipX::transitionWithDuration(t, s, kOrientationLeftOver);//带缩放效果x轴左翻
CCTransitionZoomFlipX::transitionWithDuration(t, s, kOrientationRightOver);//带缩放效果x轴右翻
CCTransitionZoomFlipY::transitionWithDuration(t, s, kOrientationUpOver);//带缩放效果y轴上翻
CCTransitionZoomFlipY::transitionWithDuration(t, s, kOrientationDownOver);//带缩放效果y轴下翻
CCTransitionZoomFlipAngular::transitionWithDuration(t, s, kOrientationLeftOver);//带缩放效果/有角度转的左翻
CCTransitionZoomFlipAngular::transitionWithDuration(t, s, kOrientationRightOver);//带缩放效果有角度转的右翻
CCTransitionShrinkGrow::transitionWithDuration(t, s);//交错换
CCTransitionRotoZoom::transitionWithDuration(t, s);//转角换
CCTransitionMoveInL::transitionWithDuration(t, s);//新场景从左移入覆盖
CCTransitionMoveInR::transitionWithDuration(t, s);//新场景从右移入覆盖
CCTransitionMoveInT::transitionWithDuration(t, s);//新场景从上移入覆盖
CCTransitionMoveInB::transitionWithDuration(t, s);//新场景从下移入覆盖
CCTransitionSlideInL::transitionWithDuration(t, s);//场景从左移入推出原场景
CCTransitionSlideInR::transitionWithDuration(t, s);//场景从右移入推出原场景
CCTransitionSlideInT::transitionWithDuration(t, s);//场景从上移入推出原场景
CCTransitionSlideInB::transitionWithDuration(t, s);//场景从下移入推出原场景
以下三个需要检测opengl版本是否支持CCConfiguration::sharedConfiguration()->getGlesVersion() <= GLES_VER_1_0如果为真则为不支持
CCTransitionCrossFade::transitionWithDuration(t,s);//淡出淡入交叉,同时进行
CCTransitionRadialCCW::transitionWithDuration(t,s);//顺时针切入
CCTransitionRadialCW::transitionWithDuration(t,s);//逆时针切入
以下两个需要先设置摄像机,使用CCDirector::sharedDirector()->setDepthTest(true);
CCTransitionPageTurn::transitionWithDuration(t, s, false);//翻页,前翻
CCTransitionPageTurn::transitionWithDuration(t, s, true);//翻页,后翻
CCTransitionFadeTR::transitionWithDuration(t, s);//向右上波浪
CCTransitionFadeBL::transitionWithDuration(t, s);//向左下波浪
CCTransitionFadeUp::transitionWithDuration(t, s);//向上百叶窗
CCTransitionFadeDown::transitionWithDuration(t, s);//向下百叶窗
CCTransitionTurnOffTiles::transitionWithDuration(t, s);//随机小方块
CCTransitionSplitRows::transitionWithDuration(t, s);//按行切
CCTransitionSplitCols::transitionWithDuration(t, s);//按列切