#ifndef __HELLOWORLD_SCENE_H__#define __HELLOWORLD_SCENE_H__#include "cocos2d.h"USING_NS_CC;class HelloWorld : public cocos2d::Layer{public: static cocos2d::Scene* createScene(); virtual bool init(); voID menuCloseCallback(cocos2d::Ref* pSender); virtual voID update(float dt); voID tick(float dt); CREATE_FUNC(HelloWorld);};#endif // __HELLOWORLD_SCENE_H__
#include "HelloWorldScene.h"Scene* HelloWorld::createScene(){ auto scene = Scene::create(); auto layer = HelloWorld::create(); scene->addChild(layer); return scene;}bool HelloWorld::init(){ if ( !Layer::init() ) { return false; } Size visibleSize = Director::getInstance()->getVisibleSize(); Vec2 origin = Director::getInstance()->getVisibleOrigin(); auto sprite = Sprite::create("HelloWorld.png"); sprite->setposition(Vec2(visibleSize.wIDth / 2 + origin.x,visibleSize.height / 2 + origin.y)); this->addChild(sprite,0); this->scheduleUpdate(); this->schedule(schedule_selector(HelloWorld::tick),1); return true;}voID HelloWorld::update(float dt){ log("HelloWorld::update");}voID HelloWorld::tick(float dt){ log("HelloWorld::tick");}总结
以上是内存溢出为你收集整理的Cocos2d-3.x_定时器全部内容,希望文章能够帮你解决Cocos2d-3.x_定时器所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)