From 4c12f4029a712f6f933d15a407480417ab6f3add Mon Sep 17 00:00:00 2001 From: "Huabing.Xu" Date: Mon, 2 Sep 2013 13:48:39 +0800 Subject: [PATCH] issue #2460: project template for glfw --- .../multi-platform-cpp/proj.linux/main.cpp | 4 +- .../proj.mac/AppController.h | 42 --------- .../proj.mac/AppController.mm | 93 ------------------- .../HelloCpp.xcodeproj/project.pbxproj | 18 ++-- .../proj.mac/main.cpp} | 10 +- .../multi-platform-cpp/proj.win32/main.cpp | 5 +- .../multi-platform-js/proj.win32/main.cpp | 5 +- .../multi-platform-lua/proj.linux/main.cpp | 4 +- .../proj.mac/AppController.h | 42 --------- .../proj.mac/AppController.mm | 84 ----------------- .../HelloLua.xcodeproj/project.pbxproj | 20 ++-- .../proj.mac/main.cpp} | 12 ++- .../multi-platform-lua/proj.win32/main.cpp | 5 +- 13 files changed, 43 insertions(+), 301 deletions(-) delete mode 100644 template/multi-platform-cpp/proj.mac/AppController.h delete mode 100644 template/multi-platform-cpp/proj.mac/AppController.mm rename template/{multi-platform-lua/proj.mac/main.m => multi-platform-cpp/proj.mac/main.cpp} (86%) delete mode 100644 template/multi-platform-lua/proj.mac/AppController.h delete mode 100644 template/multi-platform-lua/proj.mac/AppController.mm rename template/{multi-platform-cpp/proj.mac/main.m => multi-platform-lua/proj.mac/main.cpp} (86%) diff --git a/template/multi-platform-cpp/proj.linux/main.cpp b/template/multi-platform-cpp/proj.linux/main.cpp index f3ec556870..a2e9b8c38d 100644 --- a/template/multi-platform-cpp/proj.linux/main.cpp +++ b/template/multi-platform-cpp/proj.linux/main.cpp @@ -13,7 +13,7 @@ int main(int argc, char **argv) { // create the application instance AppDelegate app; - EGLView* eglView = EGLView::getInstance(); - eglView->setFrameSize(800, 480); + EGLView* eglView = new EGLView(); + eglView->init("TestCPP",900,640); return Application::getInstance()->run(); } diff --git a/template/multi-platform-cpp/proj.mac/AppController.h b/template/multi-platform-cpp/proj.mac/AppController.h deleted file mode 100644 index 96c717304b..0000000000 --- a/template/multi-platform-cpp/proj.mac/AppController.h +++ /dev/null @@ -1,42 +0,0 @@ -/**************************************************************************** - Copyright (c) 2010 cocos2d-x.org - - http://www.cocos2d-x.org - - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the "Software"), to deal - in the Software without restriction, including without limitation the rights - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - THE SOFTWARE. - ****************************************************************************/ - -#pragma once - -#import "cocos2d.h" -#import "EAGLView.h" - -@interface AppController : NSObject - { - NSWindow *window; - CCEAGLView *glView; - } - - @property (nonatomic, assign) IBOutlet NSWindow* window; - @property (nonatomic, assign) IBOutlet CCEAGLView* glView; - - -(IBAction) toggleFullScreen:(id)sender; - -(IBAction) exitFullScreen:(id)sender; - -@end diff --git a/template/multi-platform-cpp/proj.mac/AppController.mm b/template/multi-platform-cpp/proj.mac/AppController.mm deleted file mode 100644 index 40beca17c8..0000000000 --- a/template/multi-platform-cpp/proj.mac/AppController.mm +++ /dev/null @@ -1,93 +0,0 @@ -/**************************************************************************** - Copyright (c) 2010 cocos2d-x.org - - http://www.cocos2d-x.org - - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the "Software"), to deal - in the Software without restriction, including without limitation the rights - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - THE SOFTWARE. - ****************************************************************************/ - -#import "AppController.h" -#import "AppDelegate.h" - -@implementation AppController - - static AppDelegate s_sharedApplication; - - @synthesize window, glView; - - -(void) applicationDidFinishLaunching:(NSNotification *)aNotification - { - // create the window - // note that using NSResizableWindowMask causes the window to be a little - // smaller and therefore ipad graphics are not loaded - NSRect rect = NSMakeRect(200, 200, 480, 320); - window = [[NSWindow alloc] initWithContentRect:rect - styleMask:( NSClosableWindowMask | NSTitledWindowMask ) - backing:NSBackingStoreBuffered - defer:YES]; - - NSOpenGLPixelFormatAttribute attributes[] = { - NSOpenGLPFADoubleBuffer, - NSOpenGLPFADepthSize, 24, - NSOpenGLPFAStencilSize, 8, - 0 - }; - - NSOpenGLPixelFormat *pixelFormat = [[[NSOpenGLPixelFormat alloc] initWithAttributes:attributes] autorelease]; - - // allocate our GL view - // (isn't there already a shared CCEAGLView?) - glView = [[CCEAGLView alloc] initWithFrame:rect pixelFormat:pixelFormat]; - - // set window parameters - [window becomeFirstResponder]; - [window setContentView:glView]; - [window setTitle:@"HelloCpp"]; - [window makeKeyAndOrderFront:self]; - [window setAcceptsMouseMovedEvents:NO]; - - cocos2d::Application::getInstance()->run(); - } - - -(BOOL) applicationShouldTerminateAfterLastWindowClosed:(NSApplication*)theApplication - { - return YES; - } - - -(void) dealloc - { - cocos2d::Director::getInstance()->end(); - [super dealloc]; - } - -#pragma mark - -#pragma mark IB Actions - - -(IBAction) toggleFullScreen:(id)sender - { - CCEAGLView* pView = [CCEAGLView sharedEGLView]; - [pView setFullScreen:!pView.isFullScreen]; - } - - -(IBAction) exitFullScreen:(id)sender - { - [[CCEAGLView sharedEGLView] setFullScreen:NO]; - } - -@end diff --git a/template/multi-platform-cpp/proj.mac/HelloCpp.xcodeproj/project.pbxproj b/template/multi-platform-cpp/proj.mac/HelloCpp.xcodeproj/project.pbxproj index 0b2bb502bc..da9efca126 100644 --- a/template/multi-platform-cpp/proj.mac/HelloCpp.xcodeproj/project.pbxproj +++ b/template/multi-platform-cpp/proj.mac/HelloCpp.xcodeproj/project.pbxproj @@ -27,11 +27,11 @@ 1AFAF8C516D3884900DB1158 /* HelloWorld.png in Resources */ = {isa = PBXBuildFile; fileRef = 1AFAF8C216D3884900DB1158 /* HelloWorld.png */; }; 1AFAF8CA16D3886000DB1158 /* AppDelegate.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AFAF8C616D3886000DB1158 /* AppDelegate.cpp */; }; 1AFAF8CB16D3886000DB1158 /* HelloWorldScene.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AFAF8C816D3886000DB1158 /* HelloWorldScene.cpp */; }; - 41BC70E415BF81A5006A0A6C /* AppController.mm in Sources */ = {isa = PBXBuildFile; fileRef = 41BC70DA15BF81A5006A0A6C /* AppController.mm */; }; 41BC70E515BF81A5006A0A6C /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 41BC70DC15BF81A5006A0A6C /* InfoPlist.strings */; }; 41BC70E615BF81A5006A0A6C /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 41BC70DE15BF81A5006A0A6C /* MainMenu.xib */; }; 41BC70E715BF81A5006A0A6C /* Icon.icns in Resources */ = {isa = PBXBuildFile; fileRef = 41BC70E015BF81A5006A0A6C /* Icon.icns */; }; - 41BC70E815BF81A5006A0A6C /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 41BC70E115BF81A5006A0A6C /* main.m */; }; + 41BC70E815BF81A5006A0A6C /* main.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 41BC70E115BF81A5006A0A6C /* main.cpp */; }; + ED4D1B3D17D445F10058FC68 /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = ED4D1B3C17D445F10058FC68 /* IOKit.framework */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -190,14 +190,13 @@ 1AFAF8C816D3886000DB1158 /* HelloWorldScene.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = HelloWorldScene.cpp; path = ../Classes/HelloWorldScene.cpp; sourceTree = ""; }; 1AFAF8C916D3886000DB1158 /* HelloWorldScene.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = HelloWorldScene.h; path = ../Classes/HelloWorldScene.h; sourceTree = ""; }; 1D6058910D05DD3D006BFB54 /* HelloCpp.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = HelloCpp.app; sourceTree = BUILT_PRODUCTS_DIR; }; - 41BC70D915BF81A5006A0A6C /* AppController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppController.h; sourceTree = SOURCE_ROOT; }; - 41BC70DA15BF81A5006A0A6C /* AppController.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = AppController.mm; sourceTree = SOURCE_ROOT; }; 41BC70DD15BF81A5006A0A6C /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = InfoPlist.strings; sourceTree = ""; }; 41BC70DF15BF81A5006A0A6C /* en */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = en; path = MainMenu.xib; sourceTree = ""; }; 41BC70E015BF81A5006A0A6C /* Icon.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; path = Icon.icns; sourceTree = SOURCE_ROOT; }; - 41BC70E115BF81A5006A0A6C /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = SOURCE_ROOT; }; + 41BC70E115BF81A5006A0A6C /* main.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = main.cpp; sourceTree = SOURCE_ROOT; }; 41BC70E215BF81A5006A0A6C /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = SOURCE_ROOT; }; 41BC70E315BF81A5006A0A6C /* Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Prefix.pch; sourceTree = SOURCE_ROOT; }; + ED4D1B3C17D445F10058FC68 /* IOKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = IOKit.framework; path = System/Library/Frameworks/IOKit.framework; sourceTree = SDKROOT; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -205,6 +204,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + ED4D1B3D17D445F10058FC68 /* IOKit.framework in Frameworks */, 1AF4C39717865FD400122817 /* libbox2d Mac.a in Frameworks */, 1AF4C39817865FD400122817 /* libchipmunk Mac.a in Frameworks */, 1AF4C39917865FD400122817 /* libcocos2dx Mac.a in Frameworks */, @@ -283,6 +283,7 @@ 29B97323FDCFA39411CA2CEA /* Frameworks */ = { isa = PBXGroup; children = ( + ED4D1B3C17D445F10058FC68 /* IOKit.framework */, 15C6498616633E65007D4F18 /* libcurl.a */, 15C64830165F39AB007D4F18 /* libxml2.dylib */, 15C6482E165F399D007D4F18 /* libz.dylib */, @@ -300,11 +301,9 @@ 41BC70D815BF818D006A0A6C /* mac */ = { isa = PBXGroup; children = ( - 41BC70D915BF81A5006A0A6C /* AppController.h */, - 41BC70DA15BF81A5006A0A6C /* AppController.mm */, 41BC70DB15BF81A5006A0A6C /* en.lproj */, 41BC70E015BF81A5006A0A6C /* Icon.icns */, - 41BC70E115BF81A5006A0A6C /* main.m */, + 41BC70E115BF81A5006A0A6C /* main.cpp */, 41BC70E215BF81A5006A0A6C /* Info.plist */, 41BC70E315BF81A5006A0A6C /* Prefix.pch */, ); @@ -513,8 +512,7 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - 41BC70E415BF81A5006A0A6C /* AppController.mm in Sources */, - 41BC70E815BF81A5006A0A6C /* main.m in Sources */, + 41BC70E815BF81A5006A0A6C /* main.cpp in Sources */, 1AFAF8CA16D3886000DB1158 /* AppDelegate.cpp in Sources */, 1AFAF8CB16D3886000DB1158 /* HelloWorldScene.cpp in Sources */, ); diff --git a/template/multi-platform-lua/proj.mac/main.m b/template/multi-platform-cpp/proj.mac/main.cpp similarity index 86% rename from template/multi-platform-lua/proj.mac/main.m rename to template/multi-platform-cpp/proj.mac/main.cpp index 97d9b73282..d8074883bc 100644 --- a/template/multi-platform-lua/proj.mac/main.m +++ b/template/multi-platform-cpp/proj.mac/main.cpp @@ -22,9 +22,15 @@ THE SOFTWARE. ****************************************************************************/ -#import +#include "AppDelegate.h" +#include "CCEGLView.h" + +USING_NS_CC; int main(int argc, char *argv[]) { - return NSApplicationMain(argc, (const char **)argv); + AppDelegate app; + EGLView* eglView = new EGLView(); + eglView->init("TestCPP",900,640); + return Application::getInstance()->run(); } diff --git a/template/multi-platform-cpp/proj.win32/main.cpp b/template/multi-platform-cpp/proj.win32/main.cpp index 0a0d2f3d57..c7a804c96a 100644 --- a/template/multi-platform-cpp/proj.win32/main.cpp +++ b/template/multi-platform-cpp/proj.win32/main.cpp @@ -14,8 +14,7 @@ int APIENTRY _tWinMain(HINSTANCE hInstance, // create the application instance AppDelegate app; - EGLView* eglView = EGLView::getInstance(); - eglView->setViewName("HelloCpp"); - eglView->setFrameSize(480, 320); + EGLView* eglView = new EGLView(); + eglView->init("TestCPP",900,640); return Application::getInstance()->run(); } diff --git a/template/multi-platform-js/proj.win32/main.cpp b/template/multi-platform-js/proj.win32/main.cpp index f8edf08552..f15aa09b20 100644 --- a/template/multi-platform-js/proj.win32/main.cpp +++ b/template/multi-platform-js/proj.win32/main.cpp @@ -24,9 +24,8 @@ int APIENTRY _tWinMain(HINSTANCE hInstance, // create the application instance AppDelegate app; - EGLView* eglView = EGLView::getInstance(); - eglView->setViewName("HelloJavascript"); - eglView->setFrameSize(480, 320); + EGLView* eglView = new EGLView(); + eglView->init("TestCPP",900,640); int ret = Application::getInstance()->run(); diff --git a/template/multi-platform-lua/proj.linux/main.cpp b/template/multi-platform-lua/proj.linux/main.cpp index f3ec556870..a2e9b8c38d 100644 --- a/template/multi-platform-lua/proj.linux/main.cpp +++ b/template/multi-platform-lua/proj.linux/main.cpp @@ -13,7 +13,7 @@ int main(int argc, char **argv) { // create the application instance AppDelegate app; - EGLView* eglView = EGLView::getInstance(); - eglView->setFrameSize(800, 480); + EGLView* eglView = new EGLView(); + eglView->init("TestCPP",900,640); return Application::getInstance()->run(); } diff --git a/template/multi-platform-lua/proj.mac/AppController.h b/template/multi-platform-lua/proj.mac/AppController.h deleted file mode 100644 index 96c717304b..0000000000 --- a/template/multi-platform-lua/proj.mac/AppController.h +++ /dev/null @@ -1,42 +0,0 @@ -/**************************************************************************** - Copyright (c) 2010 cocos2d-x.org - - http://www.cocos2d-x.org - - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the "Software"), to deal - in the Software without restriction, including without limitation the rights - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - THE SOFTWARE. - ****************************************************************************/ - -#pragma once - -#import "cocos2d.h" -#import "EAGLView.h" - -@interface AppController : NSObject - { - NSWindow *window; - CCEAGLView *glView; - } - - @property (nonatomic, assign) IBOutlet NSWindow* window; - @property (nonatomic, assign) IBOutlet CCEAGLView* glView; - - -(IBAction) toggleFullScreen:(id)sender; - -(IBAction) exitFullScreen:(id)sender; - -@end diff --git a/template/multi-platform-lua/proj.mac/AppController.mm b/template/multi-platform-lua/proj.mac/AppController.mm deleted file mode 100644 index 86368aa3c2..0000000000 --- a/template/multi-platform-lua/proj.mac/AppController.mm +++ /dev/null @@ -1,84 +0,0 @@ -/**************************************************************************** - Copyright (c) 2010 cocos2d-x.org - - http://www.cocos2d-x.org - - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the "Software"), to deal - in the Software without restriction, including without limitation the rights - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - THE SOFTWARE. - ****************************************************************************/ - -#import "AppController.h" -#import "AppDelegate.h" - -static AppDelegate s_sharedApplication; - -@implementation AppController - - @synthesize window, glView; - - -(void) applicationDidFinishLaunching:(NSNotification *)aNotification - { - // create the window - // note that using NSResizableWindowMask causes the window to be a little - // smaller and therefore ipad graphics are not loaded - NSRect rect = NSMakeRect(100, 100, 480, 320); - window = [[NSWindow alloc] initWithContentRect:rect - styleMask:( NSClosableWindowMask | NSTitledWindowMask ) - backing:NSBackingStoreBuffered - defer:YES]; - - // allocate our GL view - // (isn't there already a shared CCEAGLView?) - glView = [[CCEAGLView alloc] initWithFrame:rect]; - - // set window parameters - [window becomeFirstResponder]; - [window setContentView:glView]; - [window setTitle:@"HelloLua"]; - [window makeKeyAndOrderFront:self]; - [window setAcceptsMouseMovedEvents:NO]; - - cocos2d::Application::getInstance()->run(); - } - - -(BOOL) applicationShouldTerminateAfterLastWindowClosed:(NSApplication*)theApplication - { - return YES; - } - - -(void) dealloc - { - cocos2d::Director::getInstance()->end(); - [super dealloc]; - } - -#pragma mark - -#pragma mark IB Actions - - -(IBAction) toggleFullScreen:(id)sender - { - CCEAGLView* pView = [CCEAGLView sharedEGLView]; - [pView setFullScreen:!pView.isFullScreen]; - } - - -(IBAction) exitFullScreen:(id)sender - { - [[CCEAGLView sharedEGLView] setFullScreen:NO]; - } - -@end diff --git a/template/multi-platform-lua/proj.mac/HelloLua.xcodeproj/project.pbxproj b/template/multi-platform-lua/proj.mac/HelloLua.xcodeproj/project.pbxproj index d38a6e4642..fe4f28aead 100644 --- a/template/multi-platform-lua/proj.mac/HelloLua.xcodeproj/project.pbxproj +++ b/template/multi-platform-lua/proj.mac/HelloLua.xcodeproj/project.pbxproj @@ -40,13 +40,13 @@ 15A02F4617A64D1E0035E92B /* menu1.png in Resources */ = {isa = PBXBuildFile; fileRef = 15A02F3317A64D1E0035E92B /* menu1.png */; }; 15A02F4717A64D1E0035E92B /* menu2.png in Resources */ = {isa = PBXBuildFile; fileRef = 15A02F3417A64D1E0035E92B /* menu2.png */; }; 15A02F4D17A64D390035E92B /* AppDelegate.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 15A02F4B17A64D390035E92B /* AppDelegate.cpp */; }; - 15A02F7017A64DFB0035E92B /* AppController.mm in Sources */ = {isa = PBXBuildFile; fileRef = 15A02F6417A64DFB0035E92B /* AppController.mm */; }; 15A02F7317A64DFB0035E92B /* Icon.icns in Resources */ = {isa = PBXBuildFile; fileRef = 15A02F6D17A64DFB0035E92B /* Icon.icns */; }; 15A02F7417A64DFB0035E92B /* Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 15A02F6E17A64DFB0035E92B /* Info.plist */; }; - 15A02F7517A64DFB0035E92B /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 15A02F6F17A64DFB0035E92B /* main.m */; }; + 15A02F7517A64DFB0035E92B /* main.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 15A02F6F17A64DFB0035E92B /* main.cpp */; }; 15A02F7B17A64E2A0035E92B /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 15A02F7717A64E2A0035E92B /* InfoPlist.strings */; }; 15A02F7C17A64E2A0035E92B /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 15A02F7917A64E2A0035E92B /* MainMenu.xib */; }; 1ADB273B17CCA0F500634B5E /* Cocos2d.lua in Resources */ = {isa = PBXBuildFile; fileRef = 1ADB273A17CCA0F500634B5E /* Cocos2d.lua */; }; + ED4D1B4B17D4460E0058FC68 /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = ED4D1B4A17D4460E0058FC68 /* IOKit.framework */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -216,16 +216,14 @@ 15A02F3417A64D1E0035E92B /* menu2.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = menu2.png; sourceTree = ""; }; 15A02F4B17A64D390035E92B /* AppDelegate.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AppDelegate.cpp; sourceTree = ""; }; 15A02F4C17A64D390035E92B /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; - 15A02F6317A64DFB0035E92B /* AppController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppController.h; sourceTree = ""; }; - 15A02F6417A64DFB0035E92B /* AppController.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = AppController.mm; sourceTree = ""; }; 15A02F6D17A64DFB0035E92B /* Icon.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; path = Icon.icns; sourceTree = ""; }; 15A02F6E17A64DFB0035E92B /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - 15A02F6F17A64DFB0035E92B /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; + 15A02F6F17A64DFB0035E92B /* main.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = main.cpp; sourceTree = ""; }; 15A02F7817A64E2A0035E92B /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = InfoPlist.strings; sourceTree = ""; }; 15A02F7A17A64E2A0035E92B /* en */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = en; path = MainMenu.xib; sourceTree = ""; }; - 15A02F7D17A64EF30035E92B /* Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Prefix.pch; sourceTree = ""; }; 15A02FAA17A65D810035E92B /* OpenAL.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenAL.framework; path = System/Library/Frameworks/OpenAL.framework; sourceTree = SDKROOT; }; 1ADB273A17CCA0F500634B5E /* Cocos2d.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = Cocos2d.lua; sourceTree = ""; }; + ED4D1B4A17D4460E0058FC68 /* IOKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = IOKit.framework; path = System/Library/Frameworks/IOKit.framework; sourceTree = SDKROOT; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -233,6 +231,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + ED4D1B4B17D4460E0058FC68 /* IOKit.framework in Frameworks */, 1501826E17A7513400E674E5 /* libchipmunk Mac.a in Frameworks */, 1501821D17A6706400E674E5 /* libcocos2dx Mac.a in Frameworks */, 1501821E17A6706400E674E5 /* libcocos2dx-extensions Mac.a in Frameworks */, @@ -293,6 +292,7 @@ 15A02E6217A647C90035E92B /* Frameworks */ = { isa = PBXGroup; children = ( + ED4D1B4A17D4460E0058FC68 /* IOKit.framework */, 150181F517A6696400E674E5 /* libcurl.dylib */, 150181F317A6695400E674E5 /* libz.dylib */, 150181EC17A6679B00E674E5 /* ApplicationServices.framework */, @@ -359,13 +359,10 @@ 15A02F6217A64DFB0035E92B /* Mac */ = { isa = PBXGroup; children = ( - 15A02F7D17A64EF30035E92B /* Prefix.pch */, - 15A02F6317A64DFB0035E92B /* AppController.h */, - 15A02F6417A64DFB0035E92B /* AppController.mm */, 15A02F7617A64E2A0035E92B /* en.lproj */, 15A02F6D17A64DFB0035E92B /* Icon.icns */, 15A02F6E17A64DFB0035E92B /* Info.plist */, - 15A02F6F17A64DFB0035E92B /* main.m */, + 15A02F6F17A64DFB0035E92B /* main.cpp */, ); name = Mac; sourceTree = ""; @@ -576,8 +573,7 @@ buildActionMask = 2147483647; files = ( 15A02F4D17A64D390035E92B /* AppDelegate.cpp in Sources */, - 15A02F7017A64DFB0035E92B /* AppController.mm in Sources */, - 15A02F7517A64DFB0035E92B /* main.m in Sources */, + 15A02F7517A64DFB0035E92B /* main.cpp in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/template/multi-platform-cpp/proj.mac/main.m b/template/multi-platform-lua/proj.mac/main.cpp similarity index 86% rename from template/multi-platform-cpp/proj.mac/main.m rename to template/multi-platform-lua/proj.mac/main.cpp index 97d9b73282..2d3a9b1eb1 100644 --- a/template/multi-platform-cpp/proj.mac/main.m +++ b/template/multi-platform-lua/proj.mac/main.cpp @@ -22,9 +22,15 @@ THE SOFTWARE. ****************************************************************************/ -#import +#include "AppDelegate.h" +#include "CCEGLView.h" + +USING_NS_CC; int main(int argc, char *argv[]) { - return NSApplicationMain(argc, (const char **)argv); -} + AppDelegate app; + EGLView* eglView = new EGLView(); + eglView->init("TestCPP",900,640); + return Application::getInstance()->run(); +} \ No newline at end of file diff --git a/template/multi-platform-lua/proj.win32/main.cpp b/template/multi-platform-lua/proj.win32/main.cpp index 901b3d4fb8..8f302d1f1a 100644 --- a/template/multi-platform-lua/proj.win32/main.cpp +++ b/template/multi-platform-lua/proj.win32/main.cpp @@ -24,9 +24,8 @@ int APIENTRY _tWinMain(HINSTANCE hInstance, // create the application instance AppDelegate app; - EGLView* eglView = EGLView::getInstance(); - eglView->setViewName("HelloLua"); - eglView->setFrameSize(480, 320); + EGLView* eglView = new EGLView(); + eglView->init("TestCPP",900,640); int ret = Application::getInstance()->run();