auto s = Director::getInstance()->getWinSize(); auto sun = ParticleSun::create(); sun->setTexture(Director::getInstance()->getTextureCache()->addImage(fire.png)); sun->setPosition(Vec2(s.width / 2 -100, s.height / 2)); sun->setTotalParticles(130); sun->setLife(5.0f); this->addChild(sun); // timers auto fire = ParticleFire::create(); fire->setTexture(Director::getInstance()->getTextureCache()->addImage(fire.png)); fire->setPosition(Vec2(s.width / 2 + 50, s.height / 2)); fire->setTotalParticles(130); fire->setLife(5.0f); this->addChild(fire); auto fireworks = ParticleFireworks::create(); fireworks->setTexture(Director::getInstance()->getTextureCache()->addImage(fire.png)); fireworks->setPosition(Vec2(s.width / 2 + 50, s.height / 2 - 200)); fireworks->setTotalParticles(130); fireworks->setLife(5.0f); this->addChild(fireworks); auto galaxy = ParticleGalaxy::create(); galaxy->setTexture(Director::getInstance()->getTextureCache()->addImage(fire.png)); galaxy->setPosition(Vec2( 50, s.height / 2 + 200)); galaxy->setTotalParticles(130); galaxy->setLife(5.0f); this->addChild(galaxy); auto flower = ParticleFlower::create(); flower->setTexture(Director::getInstance()->getTextureCache()->addImage(fire.png)); flower->setPosition(Vec2( 250, s.height / 2 + 200)); flower->setTotalParticles(130); flower->setLife(5.0f); this->addChild(flower); //流星 auto meteor = ParticleMeteor::create(); meteor->setTexture(Director::getInstance()->getTextureCache()->addImage(fire.png)); meteor->setPosition(Vec2( 250, 20)); meteor->setTotalParticles(130); meteor->setLife(5.0f); this->addChild(meteor); //旋涡 auto spiral = ParticleSpiral::create(); spiral->setTexture(Director::getInstance()->getTextureCache()->addImage(fire.png)); spiral->setPosition(Vec2( 450, 40)); spiral->setTotalParticles(130); spiral->setLife(5.0f); this->addChild(spiral); //爆炸 auto explosion = ParticleExplosion::create(); explosion->setTexture(Director::getInstance()->getTextureCache()->addImage(fire.png)); explosion->setPosition(Vec2( 50, 440)); explosion->setTotalParticles(130); explosion->setLife(5.0f); this->addChild(explosion); //烟雾 auto smoke = ParticleSmoke::create(); smoke->setTexture(Director::getInstance()->getTextureCache()->addImage(fire.png)); smoke->setPosition(Vec2( 450, 640)); smoke->setTotalParticles(130); smoke->setLife(5.0f); this->addChild(smoke); //雪 auto snow = ParticleSnow::create(); snow->setTexture(Director::getInstance()->getTextureCache()->addImage(fire.png)); snow->setPosition(Vec2( 450, 840)); snow->setTotalParticles(130); snow->setLife(5.0f); this->addChild(snow); //雨 auto rain = ParticleRain::create(); rain->setTexture(Director::getInstance()->getTextureCache()->addImage(fire.png)); rain->setPosition(Vec2( 450, 940)); rain->setTotalParticles(130); rain->setLife(5.0f); this->addChild(rain);
月度存档: 2 月 2016
几种粒子效果
Linux Ctrl+Z 用法
假设你发现前台运行的一个程序需要很长的时间,但是需要干其他的事情,你就可以用 Ctrl-Z ,终止这个程序,然后可以看到系统提示:
[1]+ Stopped /root/bin/rsync.sh
然后我们可以把程序调度到后台执行:(bg 后面的数字为作业号)
#bg 1
[1]+ /root/bin/rsync.sh &
用 jobs 命令查看正在运行的任务:
#jobs
[1]+ Running /root/bin/rsync.sh &
如果想把它调回到前台运行,可以用
#fg 1
/root/bin/rsync.sh
这样,你在控制台上就只能等待这个任务完成了.
& 将指令丢到后台中去执行
[ctrl]+z 将前台任务丢到后台中暂停
jobs 查看后台的工作状态
fg %jobnumber 将后台的任务拿到前台来处理
bg %jobnumber 将任务放到后台中去处理
kill 管理后台的任务
命令运行时使用CTRL+Z,强制当前进程转为后台,并使之停止。
1. 使进程恢复运行(后台)
(1)使用命令bg
Example:
zuii@zuii-desktop:~/unp/tcpcliserv$ ./tcpserv01
*这里使用CTRL+Z,此时serv01是停止状态*
[1]+ Stopped ./tcpserv01
zuii@zuii-desktop:~/unp/tcpcliserv$ bg
[1]+ ./tcpserv01 & *此时serv01运行在后台*
zuii@zuii-desktop:~/unp/tcpcliserv$
(2)如果用CTRL+Z停止了几个程序呢?
Example:
zuii@zuii-desktop:~/unp/tcpcliserv$ jobs
[1]- Running ./tcpserv01 &
[2]+ Stopped ./tcpcli01 127.0.0.1
zuii@zuii-desktop:~/unp/tcpcliserv$ bg %1
bash: bg:任务 1 已转入后台 *后台运行*
2. 使进程恢复至前台运行
Example:
zuii@zuii-desktop:~/unp/tcpcliserv$ ./tcpserv04
[1]+ Stopped ./tcpserv04
zuii@zuii-desktop:~/unp/tcpcliserv$ fg
。/tcpserv04
总结:
(1) CTRL+Z停止进程并放入后台
(2) jobs 显示当前暂停的进程
(3) bg %N 使第N个任务在后台运行(%前有空格)
(4) fg %N 使第N个任务在前台运行
默认bg,fg不带%N时表示对最后一个进程操作!
近期评论