大佬教程收集整理的这篇文章主要介绍了Cocos2d-x优化中纹理优化,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
|
bool HelloWorld::init()
if
( !Layer::init() )
}
auto closeItem = MenuItemImage::create(
@H_674_278@"CloseSELEcted.png"
:1.1em!important; margin:0px!important; outline:0px!important; overflow:visible!important; padding:0px!important; position:static!important; right:auto!important; top:auto!important; vertical-align:baseline!important; width:auto!important; font-family:Consolas,
closeItem->setPosition(Vec2(origin.x + visibleSize.width - closeItem->getContentSize().width/
2
:1.1em!important; margin:0px!important; outline:0px!important; overflow:visible!important; padding:0px!important; position:static!important; right:auto!important; top:auto!important; vertical-align:baseline!important; width:auto!important; font-family:Consolas,
origin.y + closeItem->getContentSize().height/
));
auto menu = Menu::create(closeItem,null);
_labelLoading = Label::createWithTTF (
"loading..."
:1.1em!important; margin:0px!important; outline:0px!important; overflow:visible!important; padding:0px!important; position:static!important; right:auto!important; top:auto!important; vertical-align:baseline!important; width:auto!important; font-family:Consolas,
"fonts/Marker Felt.ttf"
35
);
_labelLoading->setPosition(Vec2(visibleSize.width /
:1.1em!important; margin:0px!important; outline:0px!important; overflow:visible!important; padding:0px!important; position:static!important; right:auto!important; top:auto!important; vertical-align:baseline!important; width:auto!important; font-family:Consolas,visibleSize.height /
-
20
));
->addChild(_labelLoading);
->addChild(_labelPercent);
_imageOffset =
;
//加载纹理
for
( auto& e : veC) ④
auto row = e.asValueMap();
CC_CALLBACK_1(HelloWorld::loadingCallBACk,monospace!important; font-size:1em!important; min-height:inherit!important; BACkground:none!important">)); ⑤
}
true
;
}
++_numberOfLoadedSprites;
__String* str = __String::createWithFormat(
"%d%%"
:1.1em!important; margin:0px!important; outline:0px!important; overflow:visible!important; padding:0px!important; position:static!important; right:auto!important; top:auto!important; vertical-align:baseline!important; width:auto!important; font-family:Consolas,
i = ++_imageOffset *
60
;
auto sprite = Sprite::createWithTexture(texturE); ⑨
sprite->setAnchorPoint(Vec2(
));
addChild(sprite,-
);
;
}
}
|
"1.0"
encoding=
"utf-8"
?-->
<plist version=
>
<Dict>
<key>filename</key>
</Dict>
<Dict>
<key>filename</key>
02
-redo.png</String>
</Dict>
<Dict>
<key>filename</key>
</Dict>
<Dict>
<key>filename</key>
04
-squiggle.png</String>
</Dict>
… …
</array>
</plist>
第⑨行代码auto sprite = Sprite::createWithTexture(texturE)是通过纹理对象texture创建精灵对象。第⑩行代码if (_numberOfLoadedSprites == _numberOfSprites)是判断是否完成任务,_numberOfLoadedSprites是已经加装的图片数,_numberOfSprites是要加装的全部图片数
@R_489_10107@://www.2cto.com/kf/201411/351657.html
以上是大佬教程为你收集整理的Cocos2d-x优化中纹理优化全部内容,希望文章能够帮你解决Cocos2d-x优化中纹理优化所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。