cocos2dx 3.x(加载cocostudio进度条)
//
// MyLoagingScene.hpp
// My
//
// Created by work on 16/10/13.
//
// #ifndef MyLoagingScene_hpp
#define MyLoagingScene_hpp #include <stdio.h>
#include "cocos2d.h"
#include <editor-support/cocostudio/CocoStudio.h>
#include "ui/cocosGUI.h" //加载视图框架 class MyLoagingScene : public cocos2d::Layer
{ private: cocos2d::Node* m_loginNode; //初始化当前场景的节点 cocos2d::ui::LoadingBar * m_loadingBar; //声明进度条私有成员变量 cocos2d::ui::TextAtlas* m_percent; //声明艺术字私有成员变量 public:
static cocos2d::Scene* createScene(); virtual bool init(); void update(float dt); //帧循环调用方法 // implement the "static create()" method manually
CREATE_FUNC(MyLoagingScene);
}; #endif /* MyLoagingScene_hpp */
//
// MyLoagingScene.cpp
// My
//
// Created by work on 16/10/13.
//
// #include "MyLoagingScene.hpp"
#include "SimpleAudioEngine.h"
#include "MyGameScene.hpp"
USING_NS_CC; Scene* MyLoagingScene::createScene()
{
// 'scene' is an autorelease object
auto scene = Scene::create(); // 'layer' is an autorelease object
auto layer = MyLoagingScene::create(); // add layer as a child to scene
scene->addChild(layer); // return the scene
return scene;
} bool MyLoagingScene::init()
{
//////////////////////////////
// 1. super init first
if ( !Layer::init() )
{
return false;
} m_loginNode=CSLoader::createNode("MyLoagingScene.csb");
this->addChild(m_loginNode); m_loadingBar=static_cast<cocos2d::ui::LoadingBar*>(m_loginNode->getChildByName("LoadingBar_1")); //获取cab里进度条
m_percent = static_cast<cocos2d::ui::TextAtlas*>(m_loginNode->getChildByName("LB_loading")); // 获取cab 里的进度显示艺术字 // this-> schedule(schedule_selector(MyLoagingScene::update), 0.05); // 自定义定时器,可自主设置时间拼了吧
scheduleUpdate(); // 系统的定时器
return true;
} void MyLoagingScene::update(float dt){ int num = m_loadingBar ->getPercent();//获取进度条的当前进度
m_loadingBar->setPercent(++num); //使进度增加 // auto ns=__String::createWithFormat("%d",num); //强转,将 int 类型转化为字符串String类型 // m_percent->setString(cocos2d::StringUtils::format("%d",(int)m_loadingBar->getPercent())); // 改变进度条上的艺术字 m_percent->setString(cocos2d::StringUtils::format("%d%c",(int)m_loadingBar->getPercent(),''+)); if(num >= ){
//判断当前进度自动跳转
Scene* gameScene = MyGameScene::createScene();
Director::getInstance()->replaceScene(gameScene); } }
cocos2dx 3.x(加载cocostudio进度条)的更多相关文章
- android 网络异步加载数据进度条
ProgressDialog progressDialog = null; public static final int MESSAGETYPE = 0; private void execute( ...
- js - 预加载+监听图片资源加载制作进度条
这两天遇到一个新需求:一个一镜到底的h5动画.因为功能的特殊性,就要求我们提前监听页面的静态图片是否全部加载完毕.即处理预加载. 总结下来,下次这种需求需要提前注意以下几点: 一.图片而不是背景图 本 ...
- WPF BackGroundWord 异步加载更新进度条示例
<Window x:Class="AsynchronousLoading.MainWindow" xmlns="http://schemas.microsoft.c ...
- js 多张图片加载 环形进度条
css 部分使用 svg 绘制环形 svg{width:100px; height: 100px; margin:15% auto 25%; box-sizing:border-box; displa ...
- WebView长按保存图片;WebView不跳转到系统的浏览器;WebView加载显示进度条;WebView返回事件处理;
直接看代码即可,代码里面注释写的很清楚,这个类拉下来就能用: 写法和命名比较粗暴,但也简单易懂: public class MainActivity extends AppCompatActivity ...
- cocos2d-x addImageAsync()异步加载资源成功之后的场景跳转问题
http://blog.csdn.net/w20175357/article/details/23546985 1.先说说addImageAsync()异步加载图片的问题 做游戏的时候现在资源的比较大 ...
- cocos2d-x 使用UIWebView加载网页(顺便可以看到如何用OC调C++)
猴子原创,欢迎转载.转载请注明: 转载自Cocos2D开发网–Cocos2Dev.com,谢谢! 原文地址: http://www.cocos2dev.com/?p=248 前段时间项目中要微博授权登 ...
- cocos2dx lua 热加载实现
[Q]原创 2015-08-30 在公司使用cocos2dx+lua 开发游戏有一段时间了,刚好lua的热更新交给我负责.以前热更新的lua脚本大部分都是在下载之后加载.最近策划又有新需求,需要在游戏 ...
- 读取txt文件加DevExpress之进度条progressBarControl
进度条使用 主要掌握下边几个命令, //水平进度条 progressBarControlH.Properties.Minimum = 0;//1:设置最大数量,比如读取txt文件内容,先要查出行数,然 ...
随机推荐
- AMD GPU spec (public)
http://www.x.org/docs/AMD/old/ Index of /docs/AMD/old Name Last modified Size Description Parent Dir ...
- css 强制换行
强制不换行 div{white-space:nowrap;} 自动换行div{ word-wrap: break-word; word-break: normal; } 强制英文单词断行div{wor ...
- 【翻译】Kinect v2程序设计(C++) Color篇
Kinect SDK v2预览版,获取数据的基本流程的说明.以及取得Color图像的示例程序的介绍. 上一节,是关于当前型号Kinect for Windows(后面称作Kinect v1)和次世代型 ...
- oracle 内联同时删除多表
在 MySql 中,内联同时删除多表可以使用这样的语法: DELETE t1,t2 FROM table1 AS t1 INNER JOIN table2 t2 ... INNER JOIN tabl ...
- PHP文件操作 之统计目录大小
<?php //定义一个函数 统计目录大小函数 function dirSize($dirName) { //判断目录是否存在 if (!file_exists($dirName)) { die ...
- 【转载】Linux系统与性能监控
原文地址:http://kerrigan.sinaapp.com/post-7.html Linux System and Performance Monitoring http://www.hous ...
- the OS maintains a number of queues
COMPUTER ORGANIZATION AND ARCHITECTURE DESIGNING FOR PERFORMANCE NINTH EDITION To do its job, the OS ...
- 在Delphi中如何动态创建dbf数据库(一)?
table2.Close; table2.Active:=false; table2.Exclusive:=true; table2.TableName:='h:\gzkd\sds'; table2. ...
- http://d3js.org/
http://d3js.org/ http://www.ourd3js.com/wordpress/?p=51 http://www.ourd3js.com/wordpress/?p=104file: ...
- 函数式编程Map()&Reduce()
.forEach():每个元素都调用指定函数,可传三个参数:数组元素丶元素索引丶数组本身丶 , , , , , , , ]; a.forEach(function(v,i,a){a[i]=v+;}); ...