动态噪点(要求水平方向无缝的噪点图:w=1024,h=640)
DynamicNoiseLayer.h
//
// DynamicNoiseLayer.h
// HungryBear
//
// Created by Bruce Yang on 12-8-2.
// Copyright (c) 2012年 EricGameStudio. All rights reserved.
//
#import "cocos2d.h"
@interface DynamicNoiseLayer : CCLayer {
CCTexture2D* m_texGradientBg;
CCTexture2D* m_texNoise;
CCSprite* m_spNoise;
}
+(CCScene*) scene;
-(id) init;
@endDynamicNoiseLayer.mm
//
// DynamicNoiseLayer.mm
// HungryBear
//
// Created by Bruce Yang on 12-8-2.
// Copyright (c) 2012年 EricGameStudio. All rights reserved.
//
#import "DynamicNoiseLayer.h"
#ifndef PORTRAIT_CENTER
#define PORTRAIT_CENTER ccp(160, 240)
#endif
#ifndef LANDSCAPE_CENTER
#define LANDSCAPE_CENTER ccp(240, 160)
#endif
#define SPEED_FACTOR 8
@implementation DynamicNoiseLayer
+(CCScene*) scene {
CCScene* t_scene = [CCScene node];
DynamicNoiseLayer* t_layer = [DynamicNoiseLayer node];
[t_scene addChild:t_layer];
return t_scene;
}
-(id) init {
if((self = [super init])) {
CCTextureCache* tmp_texCache = [CCTextureCache sharedTextureCache];
// 1.背景图片~
m_texGradientBg = [tmp_texCache addImage:@"gbg.png"];
CCSprite* tmp_spBg = [[CCSprite alloc] initWithTexture:m_texGradientBg];
[tmp_spBg setPosition: LANDSCAPE_CENTER];
[self addChild:tmp_spBg];
[tmp_spBg release];
// 2.噪点图片~
m_texNoise = [tmp_texCache addImage:@"noiseTexture.png"];
ccTexParams tmp_texParams = (ccTexParams){GL_LINEAR, GL_LINEAR, GL_REPEAT, GL_REPEAT};
[m_texNoise setTexParameters:&tmp_texParams];
m_spNoise = [[CCSprite alloc] initWithTexture:m_texNoise];
[m_spNoise setPosition: LANDSCAPE_CENTER];
ccBlendFunc tmp_blendFunc = (ccBlendFunc){GL_DST_COLOR, GL_ONE_MINUS_SRC_ALPHA};
[m_spNoise setBlendFunc:tmp_blendFunc];
[self addChild:m_spNoise];
[m_spNoise release];
// 3.定时器~
[self schedule:@selector(tick:)];
}
return self;
}
-(void) tick:(ccTime)dt {
static float offset = 0;
offset += dt * SPEED_FACTOR;
CGSize tmp_texRect = m_spNoise.textureRect.size;
[m_spNoise setTextureRect:CGRectMake(offset, 0, tmp_texRect.width, tmp_texRect.height)];
}
-(void) dealloc {
CCTextureCache* texCache = [CCTextureCache sharedTextureCache];
[texCache removeTexture:m_texGradientBg];
[texCache removeTexture:m_texNoise];
[super dealloc];
}
@end遥想当年初接触qt,只要能要就心满意足了。随着不断学习,发现了越来越多的问题。在linux环境下,qt自动补全代码的快捷键是ctrl+space,而输入法的切换启动快捷键也是如此,这就冲突了!导致qt,准确说QtCreator自动补全代码、提示功能有时用不了,输入法的权限貌似是高于应用软件的快捷键权限,也可能是我安装顺序问题。 不管了,总之要解决。我输入法是fcitx,本想修改它的启动快捷键,弄了半天无效,而且还把他给搞坏了,启动按ctrl+space,关闭按ctrl+space无效了,只能按ctrl+alt,我本来是想把ctrl+space快捷键换成ctrl+alt,谁知道 怎么也换不了,启动输入法只能是ctrl+space,还给老子换残废了!
无奈,只能改QtCreator,方法:
1,打开QtCreator
2,点
<->工具
-->选项
-->环境
-->键盘
-->找到TextEditor大标题
-->CompleteThis -> 修改为 Alt+/
顺便插一句,在android开发时,如果eclipse的检测到当前系统的环境是中文,eclipse会自动将代码补全快捷键ctrl+space修改为alt+/,这个着实比较好。
另外,在windows下qt开发也一样,只不过修改输入法切换快捷键很容易,就不多说了。
接着要卸载fcitx,再安装个新的。fedora下常用的卸载软件命令:
1,rpm -q -a 查询安装的软件包,将会列举出所有安装的包。-q是查询意思,-a是all的意思。
如果rpm -q fcitx 查询fcitx是否安装,及fcitx的完整包的名字
2,rpm -e fcitx 卸载fcitx,一般这是针对用rpm安装软件的卸载方法。如果这个命令卸载不了,就用下面的
3,yum remove fcitx
然后参照这里http://blog.csdn.net/yanzi1225627/article/details/7770750重新安装fcitx,ok了终于。
1楼helinlin0074天前 16:09师兄,访问量已经超过10000,顶一下,哈哈!Re: yanzi12256274天前 17:31回复helinlin007哈哈 是啊1. Add gcc parmater "-fprofile-arcs and -ftest-coverage flags" and compile the program.
2. Run the programer, will generate gcno data.
3. Use the command gcc *.c can see the coverage total data.
Use the lcov -d -c -o test.info
4. Generate HTML
genhtml test.info -o html_test (folder)