Skip to content

Commit 6748f2c

Browse files
author
SeanLin
committed
Merge pull request cocos2d#493 from ShengxiangChen/issue1428_template
fixed cocos2d#1428: Update the resources setting in template
2 parents afd4484 + 64b3255 commit 6748f2c

File tree

7 files changed

+28
-6
lines changed

7 files changed

+28
-6
lines changed

template/build.xml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
<target name="compile">
88
<jscomp compilationLevel="simple" warning="quiet"
9-
debug="false" output="lib/cocos2d-html5-beta-min.js">
9+
debug="false" output="myApp-v0.1.js">
1010
<sources dir="${basedir}/../cocos2d">
1111
<file name="platform/CCClass.js"/>
1212
<file name="platform/CCCommon.js"/>
@@ -52,6 +52,11 @@
5252
<sources dir="${basedir}/../CocosDenshion">
5353
<file name="SimpleAudioEngine.js"/>
5454
</sources>
55+
<sources dir="${basedir}">
56+
<file name="src/resource.js"/>
57+
<file name="src/myApp.js"/>
58+
<file name="main.js"/>
59+
</sources>
5560
</jscomp>
5661
</target>
5762
</project>

template/cocos2d.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
tag:'gameCanvas', //the dom element to run cocos2d on
3636
engineDir:'../cocos2d/',
3737
appFiles:[
38+
'src/resource.js',
3839
'src/myApp.js'//add your own files in order here
3940
]
4041
};

template/main.js

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,7 @@ var cocos2dApp = cc.Application.extend({
3838
cc.Loader.shareLoader().onload = function () {
3939
cc.AppController.shareAppController().didFinishLaunchingWithOptions();
4040
};
41-
cc.Loader.shareLoader().preload([
42-
{type:"image", src:"res/HelloWorld.png"},
43-
{type:"image", src:"res/CloseNormal.png"},
44-
{type:"image", src:"res/CloseSelected.png"}
45-
]);
41+
cc.Loader.shareLoader().preload(g_ressources);
4642
},
4743
applicationDidFinishLaunching:function () {
4844
// initialize director

template/res/cocos64.png

-6.55 KB
Binary file not shown.

template/res/grossini_dance_07.png

-1.51 KB
Binary file not shown.

template/res/logo.png

-33.4 KB
Binary file not shown.

template/src/resource.js

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
var s_HelloWorld = "res/HelloWorld.png";
2+
var s_CloseNormal = "res/CloseNormal.png";
3+
var s_CloseSelected = "res/CloseSelected.png";
4+
5+
var g_ressources = [
6+
//image
7+
{type:"image", src:s_HelloWorld},
8+
{type:"image", src:s_CloseNormal},
9+
{type:"image", src:s_CloseSelected}
10+
11+
//plist
12+
13+
//fnt
14+
15+
//tmx
16+
17+
//bgm
18+
19+
//effect
20+
];

0 commit comments

Comments
 (0)