Skip to content

Commit 90118b7

Browse files
committed
Merge pull request #1496 from joshuastray/wp8-template
Add template for wp8 project
2 parents 23a7698 + d4991c2 commit 90118b7

32 files changed

+3073
-8
lines changed

templates/js-template-default/cocos-project-template.json

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,11 @@
6868
"frameworks/runtime-src/proj.win32/PROJECT_NAME.vcxproj.filters",
6969
"frameworks/runtime-src/proj.win32/PROJECT_NAME.vcxproj.user",
7070
"frameworks/runtime-src/proj.win32/PROJECT_NAME.sln",
71-
"frameworks/runtime-src/proj.ios_mac/PROJECT_NAME.xcodeproj"
71+
"frameworks/runtime-src/proj.ios_mac/PROJECT_NAME.xcodeproj",
72+
"frameworks/runtime-src/proj.wp8-xaml/PROJECT_NAME.sln",
73+
"frameworks/runtime-src/proj.wp8-xaml/App/PROJECT_NAME.csproj",
74+
"frameworks/runtime-src/proj.wp8-xaml/AppComponent/PROJECT_NAMEComponent.vcxproj",
75+
"frameworks/runtime-src/proj.wp8-xaml/AppComponent/PROJECT_NAMEComponent.vcxproj.filters"
7276
]
7377
},
7478
"project_replace_project_name":{
@@ -80,6 +84,9 @@
8084
"frameworks/runtime-src/proj.win32/PROJECT_NAME.vcxproj.user",
8185
"frameworks/runtime-src/proj.win32/PROJECT_NAME.sln",
8286
"frameworks/runtime-src/proj.win32/main.cpp",
87+
"frameworks/runtime-src/proj.wp8-xaml/App/PROJECT_NAME.csproj",
88+
"frameworks/runtime-src/proj.wp8-xaml/App/Properties/WMAppManifest.xml",
89+
"frameworks/runtime-src/proj.wp8-xaml/PROJECT_NAME.sln",
8390
"frameworks/runtime-src/proj.android/.project",
8491
"frameworks/runtime-src/proj.android/AndroidManifest.xml",
8592
"frameworks/runtime-src/proj.android/build.xml",

templates/js-template-default/frameworks/runtime-src/Classes/AppDelegate.cpp

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,15 @@ bool AppDelegate::applicationDidFinishLaunching()
4848
{
4949
// initialize director
5050
auto director = Director::getInstance();
51-
auto glview = director->getOpenGLView();
52-
if(!glview) {
53-
glview = cocos2d::GLViewImpl::createWithRect("HelloJavascript", Rect(0,0,900,640));
54-
director->setOpenGLView(glview);
55-
}
51+
auto glview = director->getOpenGLView();
52+
if(!glview) {
53+
#if(CC_TARGET_PLATFORM == CC_PLATFORM_WP8)
54+
glview = cocos2d::GLViewImpl::create("HelloJavascript");
55+
#else
56+
glview = cocos2d::GLViewImpl::createWithRect("HelloJavascript", Rect(0,0,900,640));
57+
#endif
58+
director->setOpenGLView(glview);
59+
}
5660

5761
// set FPS. the default value is 1.0/60 if you don't call this
5862
director->setAnimationInterval(1.0 / 60);
@@ -103,8 +107,8 @@ bool AppDelegate::applicationDidFinishLaunching()
103107
sc->start();
104108
sc->runScript("script/jsb_boot.js");
105109
ScriptEngineProtocol *engine = ScriptingCore::getInstance();
106-
ScriptEngineManager::getInstance()->setScriptEngine(engine);
107-
ScriptingCore::getInstance()->runScript("main.js");
110+
ScriptEngineManager::getInstance()->setScriptEngine(engine);
111+
ScriptingCore::getInstance()->runScript("main.js");
108112

109113
return true;
110114
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<Application
2+
x:Class="cocos2d.App"
3+
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
4+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
5+
xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
6+
xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone">
7+
8+
<!--Application Resources-->
9+
<Application.Resources>
10+
<local:LocalizedStrings xmlns:local="clr-namespace:cocos2d" x:Key="LocalizedStrings"/>
11+
</Application.Resources>
12+
13+
<Application.ApplicationLifetimeObjects>
14+
<!--Required object that handles lifetime events for the application-->
15+
<shell:PhoneApplicationService
16+
Launching="Application_Launching" Closing="Application_Closing"
17+
Activated="Application_Activated" Deactivated="Application_Deactivated"/>
18+
</Application.ApplicationLifetimeObjects>
19+
20+
</Application>

0 commit comments

Comments
 (0)