diff --git a/cocos2dx/proj.win32/cocos2dx.props b/cocos2dx/proj.win32/cocos2dx.props index bc09b9b1e1..ec32230c92 100644 --- a/cocos2dx/proj.win32/cocos2dx.props +++ b/cocos2dx/proj.win32/cocos2dx.props @@ -7,7 +7,7 @@ - opengl32.lib;glew32.lib;libzlib.lib;libpng.lib;libjpeg.lib;libtiff.lib;libwebp.lib;libiconv.lib;freetype250.lib;winmm.lib;%(AdditionalDependencies) + opengl32.lib;glew32.lib;libzlib.lib;libpng.lib;libjpeg.lib;libtiff.lib;libwebp.lib;libiconv.lib;glfw3.lib;freetype250.lib;winmm.lib;%(AdditionalDependencies) $(OutDir);%(AdditionalLibraryDirectories) false diff --git a/samples/Cpp/AssetsManagerTest/proj.win32/main.cpp b/samples/Cpp/AssetsManagerTest/proj.win32/main.cpp index 945ca41a77..f15aa09b20 100644 --- a/samples/Cpp/AssetsManagerTest/proj.win32/main.cpp +++ b/samples/Cpp/AssetsManagerTest/proj.win32/main.cpp @@ -24,9 +24,8 @@ int APIENTRY _tWinMain(HINSTANCE hInstance, // create the application instance AppDelegate app; - auto eglView = EGLView::getInstance(); - eglView->setViewName("AssetsManagerTest"); - eglView->setFrameSize(800, 450); + EGLView* eglView = new EGLView(); + eglView->init("TestCPP",900,640); int ret = Application::getInstance()->run(); diff --git a/samples/Cpp/HelloCpp/proj.linux/main.cpp b/samples/Cpp/HelloCpp/proj.linux/main.cpp index ff814922d7..2c1830bfaf 100644 --- a/samples/Cpp/HelloCpp/proj.linux/main.cpp +++ b/samples/Cpp/HelloCpp/proj.linux/main.cpp @@ -12,9 +12,7 @@ int main(int argc, char **argv) { // create the application instance AppDelegate app; - - auto eglView = EGLView::getInstance(); - eglView->setFrameSize(800, 480); - + EGLView* eglView = new EGLView(); + eglView->init("TestCPP",900,640); return Application::getInstance()->run(); } diff --git a/samples/Cpp/HelloCpp/proj.mac/AppController.h b/samples/Cpp/HelloCpp/proj.mac/AppController.h deleted file mode 100644 index 96c717304b..0000000000 --- a/samples/Cpp/HelloCpp/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/samples/Cpp/HelloCpp/proj.mac/AppController.mm b/samples/Cpp/HelloCpp/proj.mac/AppController.mm deleted file mode 100644 index c58adf7bbd..0000000000 --- a/samples/Cpp/HelloCpp/proj.mac/AppController.mm +++ /dev/null @@ -1,86 +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(0, 0, 2048, 1536); - 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:@"HelloCpp"]; - [window makeKeyAndOrderFront:self]; - [window setAcceptsMouseMovedEvents:NO]; - - [glView setFrameZoomFactor:0.4]; - - 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/samples/Cpp/HelloCpp/proj.mac/main.cpp b/samples/Cpp/HelloCpp/proj.mac/main.cpp new file mode 100644 index 0000000000..a8560f50cd --- /dev/null +++ b/samples/Cpp/HelloCpp/proj.mac/main.cpp @@ -0,0 +1,37 @@ +/**************************************************************************** + 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. + ****************************************************************************/ + +#include "AppDelegate.h" +#include "CCEGLView.h" + +USING_NS_CC; + +int main(int argc, char *argv[]) +{ + AppDelegate app; + EGLView* eglView = new EGLView(); + eglView->init("TestCPP",900,640); + return Application::getInstance()->run(); +} + diff --git a/samples/Cpp/HelloCpp/proj.win32/main.cpp b/samples/Cpp/HelloCpp/proj.win32/main.cpp index d88e9d1805..0bf8bf10ee 100644 --- a/samples/Cpp/HelloCpp/proj.win32/main.cpp +++ b/samples/Cpp/HelloCpp/proj.win32/main.cpp @@ -14,11 +14,7 @@ int APIENTRY _tWinMain(HINSTANCE hInstance, // create the application instance AppDelegate app; - auto eglView = EGLView::getInstance(); - eglView->setViewName("HelloCpp"); - eglView->setFrameSize(2048, 1536); - // The resolution of ipad3 is very large. In general, PC's resolution is smaller than it. - // So we need to invoke 'setFrameZoomFactor'(only valid on desktop(win32, mac, linux)) to make the window smaller. - eglView->setFrameZoomFactor(0.4f); + EGLView* eglView = new EGLView(); + eglView->init("TestCPP",900,640); return Application::getInstance()->run(); } diff --git a/samples/Cpp/SimpleGame/proj.linux/main.cpp b/samples/Cpp/SimpleGame/proj.linux/main.cpp index db61a89dca..651d619dc1 100644 --- a/samples/Cpp/SimpleGame/proj.linux/main.cpp +++ b/samples/Cpp/SimpleGame/proj.linux/main.cpp @@ -12,9 +12,7 @@ int main(int argc, char **argv) { // create the application instance AppDelegate app; - - auto eglView = EGLView::getInstance(); - eglView->setFrameSize(800, 480); - + EGLView* eglView = new EGLView(); + eglView->init("TestCPP",900,640); return Application::getInstance()->run(); } diff --git a/samples/Cpp/SimpleGame/proj.mac/AppController.h b/samples/Cpp/SimpleGame/proj.mac/AppController.h deleted file mode 100644 index 96c717304b..0000000000 --- a/samples/Cpp/SimpleGame/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/samples/Cpp/SimpleGame/proj.mac/AppController.mm b/samples/Cpp/SimpleGame/proj.mac/AppController.mm deleted file mode 100644 index a1dea5af54..0000000000 --- a/samples/Cpp/SimpleGame/proj.mac/AppController.mm +++ /dev/null @@ -1,86 +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(0, 0, 2048, 1536); - 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:@"SampleGame"]; - [window makeKeyAndOrderFront:self]; - [window setAcceptsMouseMovedEvents:NO]; - - [glView setFrameZoomFactor:0.4]; - - 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/samples/Cpp/SimpleGame/proj.mac/main.cpp b/samples/Cpp/SimpleGame/proj.mac/main.cpp new file mode 100644 index 0000000000..a8560f50cd --- /dev/null +++ b/samples/Cpp/SimpleGame/proj.mac/main.cpp @@ -0,0 +1,37 @@ +/**************************************************************************** + 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. + ****************************************************************************/ + +#include "AppDelegate.h" +#include "CCEGLView.h" + +USING_NS_CC; + +int main(int argc, char *argv[]) +{ + AppDelegate app; + EGLView* eglView = new EGLView(); + eglView->init("TestCPP",900,640); + return Application::getInstance()->run(); +} + diff --git a/samples/Cpp/TestCpp/proj.win32/TestCpp.vcxproj b/samples/Cpp/TestCpp/proj.win32/TestCpp.vcxproj index 2afdf4ff67..f85811054a 100644 --- a/samples/Cpp/TestCpp/proj.win32/TestCpp.vcxproj +++ b/samples/Cpp/TestCpp/proj.win32/TestCpp.vcxproj @@ -84,7 +84,7 @@ true Windows MachineX86 - libExtensions.lib;libcocos2d.lib;libCocosDenshion.lib;libBox2d.lib;libchipmunk.lib;libcurl_imp.lib;websockets.lib;glfw3.lib;%(AdditionalDependencies) + libExtensions.lib;libcocos2d.lib;libCocosDenshion.lib;libBox2d.lib;libchipmunk.lib;libcurl_imp.lib;websockets.lib;%(AdditionalDependencies) diff --git a/samples/Javascript/CocosDragonJS/proj.mac/AppController.h b/samples/Javascript/CocosDragonJS/proj.mac/AppController.h deleted file mode 100644 index 96c717304b..0000000000 --- a/samples/Javascript/CocosDragonJS/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/samples/Javascript/CocosDragonJS/proj.mac/AppController.mm b/samples/Javascript/CocosDragonJS/proj.mac/AppController.mm deleted file mode 100644 index c46d03b4e9..0000000000 --- a/samples/Javascript/CocosDragonJS/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(100, 100, 480, 720); - 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:@"JS CocosDragon"]; - [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/samples/Javascript/CocosDragonJS/proj.mac/main.m b/samples/Javascript/CocosDragonJS/proj.mac/main.cpp similarity index 86% rename from samples/Javascript/CocosDragonJS/proj.mac/main.m rename to samples/Javascript/CocosDragonJS/proj.mac/main.cpp index 97d9b73282..d8074883bc 100644 --- a/samples/Javascript/CocosDragonJS/proj.mac/main.m +++ b/samples/Javascript/CocosDragonJS/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/samples/Javascript/CocosDragonJS/proj.win32/main.cpp b/samples/Javascript/CocosDragonJS/proj.win32/main.cpp index 5a6ed2372d..f15aa09b20 100644 --- a/samples/Javascript/CocosDragonJS/proj.win32/main.cpp +++ b/samples/Javascript/CocosDragonJS/proj.win32/main.cpp @@ -24,9 +24,8 @@ int APIENTRY _tWinMain(HINSTANCE hInstance, // create the application instance AppDelegate app; - auto eglView = EGLView::getInstance(); - eglView->setViewName("CocosDragonJS"); - eglView->setFrameSize(320, 480); + EGLView* eglView = new EGLView(); + eglView->init("TestCPP",900,640); int ret = Application::getInstance()->run(); diff --git a/samples/Javascript/CrystalCraze/proj.mac/AppController.h b/samples/Javascript/CrystalCraze/proj.mac/AppController.h deleted file mode 100644 index 96c717304b..0000000000 --- a/samples/Javascript/CrystalCraze/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/samples/Javascript/CrystalCraze/proj.mac/AppController.mm b/samples/Javascript/CrystalCraze/proj.mac/AppController.mm deleted file mode 100644 index 3ebff53e66..0000000000 --- a/samples/Javascript/CrystalCraze/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(100, 100, 480, 720); - 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:@"JS CrystalCraze"]; - [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/samples/Cpp/SimpleGame/proj.mac/main.m b/samples/Javascript/CrystalCraze/proj.mac/main.cpp similarity index 86% rename from samples/Cpp/SimpleGame/proj.mac/main.m rename to samples/Javascript/CrystalCraze/proj.mac/main.cpp index 97d9b73282..d8074883bc 100644 --- a/samples/Cpp/SimpleGame/proj.mac/main.m +++ b/samples/Javascript/CrystalCraze/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/samples/Javascript/CrystalCraze/proj.win32/main.cpp b/samples/Javascript/CrystalCraze/proj.win32/main.cpp index 71c7855504..f15aa09b20 100644 --- a/samples/Javascript/CrystalCraze/proj.win32/main.cpp +++ b/samples/Javascript/CrystalCraze/proj.win32/main.cpp @@ -24,9 +24,8 @@ int APIENTRY _tWinMain(HINSTANCE hInstance, // create the application instance AppDelegate app; - auto eglView = EGLView::getInstance(); - eglView->setViewName("CrystalCraze"); - eglView->setFrameSize(320, 480); + EGLView* eglView = new EGLView(); + eglView->init("TestCPP",900,640); int ret = Application::getInstance()->run(); diff --git a/samples/Javascript/MoonWarriors/proj.mac/AppController.h b/samples/Javascript/MoonWarriors/proj.mac/AppController.h deleted file mode 100644 index 96c717304b..0000000000 --- a/samples/Javascript/MoonWarriors/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/samples/Javascript/MoonWarriors/proj.mac/AppController.mm b/samples/Javascript/MoonWarriors/proj.mac/AppController.mm deleted file mode 100644 index 142ba4f47e..0000000000 --- a/samples/Javascript/MoonWarriors/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(100, 100, 320, 480); - 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:@"JS MoonWarriors"]; - [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/samples/Javascript/MoonWarriors/proj.mac/main.cpp b/samples/Javascript/MoonWarriors/proj.mac/main.cpp new file mode 100644 index 0000000000..a8560f50cd --- /dev/null +++ b/samples/Javascript/MoonWarriors/proj.mac/main.cpp @@ -0,0 +1,37 @@ +/**************************************************************************** + 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. + ****************************************************************************/ + +#include "AppDelegate.h" +#include "CCEGLView.h" + +USING_NS_CC; + +int main(int argc, char *argv[]) +{ + AppDelegate app; + EGLView* eglView = new EGLView(); + eglView->init("TestCPP",900,640); + return Application::getInstance()->run(); +} + diff --git a/samples/Javascript/MoonWarriors/proj.mac/main.m b/samples/Javascript/MoonWarriors/proj.mac/main.m deleted file mode 100644 index 97d9b73282..0000000000 --- a/samples/Javascript/MoonWarriors/proj.mac/main.m +++ /dev/null @@ -1,30 +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 - -int main(int argc, char *argv[]) -{ - return NSApplicationMain(argc, (const char **)argv); -} diff --git a/samples/Javascript/MoonWarriors/proj.win32/main.cpp b/samples/Javascript/MoonWarriors/proj.win32/main.cpp index 8c3a60b997..f15aa09b20 100644 --- a/samples/Javascript/MoonWarriors/proj.win32/main.cpp +++ b/samples/Javascript/MoonWarriors/proj.win32/main.cpp @@ -24,9 +24,8 @@ int APIENTRY _tWinMain(HINSTANCE hInstance, // create the application instance AppDelegate app; - auto eglView = EGLView::getInstance(); - eglView->setViewName("MoonWarriors"); - eglView->setFrameSize(320, 480); + EGLView* eglView = new EGLView(); + eglView->init("TestCPP",900,640); int ret = Application::getInstance()->run(); diff --git a/samples/Javascript/TestJavascript/proj.mac/AppController.h b/samples/Javascript/TestJavascript/proj.mac/AppController.h deleted file mode 100644 index 96c717304b..0000000000 --- a/samples/Javascript/TestJavascript/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/samples/Javascript/TestJavascript/proj.mac/AppController.mm b/samples/Javascript/TestJavascript/proj.mac/AppController.mm deleted file mode 100644 index c7d906af2a..0000000000 --- a/samples/Javascript/TestJavascript/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(100, 100, 800, 450); - 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:@"JS Test"]; - [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/samples/Javascript/TestJavascript/proj.mac/main.cpp b/samples/Javascript/TestJavascript/proj.mac/main.cpp new file mode 100644 index 0000000000..a8560f50cd --- /dev/null +++ b/samples/Javascript/TestJavascript/proj.mac/main.cpp @@ -0,0 +1,37 @@ +/**************************************************************************** + 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. + ****************************************************************************/ + +#include "AppDelegate.h" +#include "CCEGLView.h" + +USING_NS_CC; + +int main(int argc, char *argv[]) +{ + AppDelegate app; + EGLView* eglView = new EGLView(); + eglView->init("TestCPP",900,640); + return Application::getInstance()->run(); +} + diff --git a/samples/Javascript/TestJavascript/proj.mac/main.m b/samples/Javascript/TestJavascript/proj.mac/main.m deleted file mode 100644 index 97d9b73282..0000000000 --- a/samples/Javascript/TestJavascript/proj.mac/main.m +++ /dev/null @@ -1,30 +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 - -int main(int argc, char *argv[]) -{ - return NSApplicationMain(argc, (const char **)argv); -} diff --git a/samples/Javascript/TestJavascript/proj.win32/main.cpp b/samples/Javascript/TestJavascript/proj.win32/main.cpp index 5f8f03ad23..f15aa09b20 100644 --- a/samples/Javascript/TestJavascript/proj.win32/main.cpp +++ b/samples/Javascript/TestJavascript/proj.win32/main.cpp @@ -24,9 +24,8 @@ int APIENTRY _tWinMain(HINSTANCE hInstance, // create the application instance AppDelegate app; - auto eglView = EGLView::getInstance(); - eglView->setViewName("TestJavascript"); - eglView->setFrameSize(800, 450); + EGLView* eglView = new EGLView(); + eglView->init("TestCPP",900,640); int ret = Application::getInstance()->run(); diff --git a/samples/Javascript/WatermelonWithMe/proj.mac/AppController.h b/samples/Javascript/WatermelonWithMe/proj.mac/AppController.h deleted file mode 100644 index 96c717304b..0000000000 --- a/samples/Javascript/WatermelonWithMe/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/samples/Javascript/WatermelonWithMe/proj.mac/AppController.mm b/samples/Javascript/WatermelonWithMe/proj.mac/AppController.mm deleted file mode 100644 index 65790357a7..0000000000 --- a/samples/Javascript/WatermelonWithMe/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(100, 100, 800, 450); - 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:@"JS WatermelonWithMe"]; - [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/samples/Javascript/WatermelonWithMe/proj.mac/main.cpp b/samples/Javascript/WatermelonWithMe/proj.mac/main.cpp new file mode 100644 index 0000000000..a8560f50cd --- /dev/null +++ b/samples/Javascript/WatermelonWithMe/proj.mac/main.cpp @@ -0,0 +1,37 @@ +/**************************************************************************** + 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. + ****************************************************************************/ + +#include "AppDelegate.h" +#include "CCEGLView.h" + +USING_NS_CC; + +int main(int argc, char *argv[]) +{ + AppDelegate app; + EGLView* eglView = new EGLView(); + eglView->init("TestCPP",900,640); + return Application::getInstance()->run(); +} + diff --git a/samples/Javascript/WatermelonWithMe/proj.mac/main.m b/samples/Javascript/WatermelonWithMe/proj.mac/main.m deleted file mode 100644 index 97d9b73282..0000000000 --- a/samples/Javascript/WatermelonWithMe/proj.mac/main.m +++ /dev/null @@ -1,30 +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 - -int main(int argc, char *argv[]) -{ - return NSApplicationMain(argc, (const char **)argv); -} diff --git a/samples/Javascript/WatermelonWithMe/proj.win32/main.cpp b/samples/Javascript/WatermelonWithMe/proj.win32/main.cpp index c07c7c63cf..f15aa09b20 100644 --- a/samples/Javascript/WatermelonWithMe/proj.win32/main.cpp +++ b/samples/Javascript/WatermelonWithMe/proj.win32/main.cpp @@ -24,9 +24,8 @@ int APIENTRY _tWinMain(HINSTANCE hInstance, // create the application instance AppDelegate app; - auto eglView = EGLView::getInstance(); - eglView->setViewName("WatermelonWithMe"); - eglView->setFrameSize(800, 450); + EGLView* eglView = new EGLView(); + eglView->init("TestCPP",900,640); int ret = Application::getInstance()->run(); diff --git a/samples/Lua/HelloLua/proj.linux/main.cpp b/samples/Lua/HelloLua/proj.linux/main.cpp index 32b1bd80b3..2c1830bfaf 100644 --- a/samples/Lua/HelloLua/proj.linux/main.cpp +++ b/samples/Lua/HelloLua/proj.linux/main.cpp @@ -12,7 +12,7 @@ int main(int argc, char **argv) { // create the application instance AppDelegate app; - auto eglView = EGLView::getInstance(); - eglView->setFrameSize(960, 640); + EGLView* eglView = new EGLView(); + eglView->init("TestCPP",900,640); return Application::getInstance()->run(); } diff --git a/samples/Lua/HelloLua/proj.mac/AppController.h b/samples/Lua/HelloLua/proj.mac/AppController.h deleted file mode 100644 index 96c717304b..0000000000 --- a/samples/Lua/HelloLua/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/samples/Lua/HelloLua/proj.mac/AppController.mm b/samples/Lua/HelloLua/proj.mac/AppController.mm deleted file mode 100644 index 86368aa3c2..0000000000 --- a/samples/Lua/HelloLua/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/samples/Cpp/HelloCpp/proj.mac/main.m b/samples/Lua/HelloLua/proj.mac/main.cpp similarity index 86% rename from samples/Cpp/HelloCpp/proj.mac/main.m rename to samples/Lua/HelloLua/proj.mac/main.cpp index 97d9b73282..d8074883bc 100644 --- a/samples/Cpp/HelloCpp/proj.mac/main.m +++ b/samples/Lua/HelloLua/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/samples/Lua/HelloLua/proj.mac/main.m b/samples/Lua/HelloLua/proj.mac/main.m deleted file mode 100644 index 97d9b73282..0000000000 --- a/samples/Lua/HelloLua/proj.mac/main.m +++ /dev/null @@ -1,30 +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 - -int main(int argc, char *argv[]) -{ - return NSApplicationMain(argc, (const char **)argv); -} diff --git a/samples/Lua/HelloLua/proj.win32/main.cpp b/samples/Lua/HelloLua/proj.win32/main.cpp index 957882fa41..46349a8c5a 100644 --- a/samples/Lua/HelloLua/proj.win32/main.cpp +++ b/samples/Lua/HelloLua/proj.win32/main.cpp @@ -24,9 +24,9 @@ int APIENTRY _tWinMain(HINSTANCE hInstance, // create the application instance AppDelegate app; - auto eglView = EGLView::getInstance(); - eglView->setViewName("HelloLua"); - eglView->setFrameSize(480, 320); + EGLView* eglView = new EGLView(); + eglView->init("TestCPP",900,640); + int ret = Application::getInstance()->run(); #ifdef USE_WIN32_CONSOLE diff --git a/samples/Lua/TestLua/proj.linux/main.cpp b/samples/Lua/TestLua/proj.linux/main.cpp index 2a8e3be95f..a2e9b8c38d 100644 --- a/samples/Lua/TestLua/proj.linux/main.cpp +++ b/samples/Lua/TestLua/proj.linux/main.cpp @@ -13,7 +13,7 @@ int main(int argc, char **argv) { // create the application instance AppDelegate app; - auto eglView = EGLView::getInstance(); - eglView->setFrameSize(800, 480); + EGLView* eglView = new EGLView(); + eglView->init("TestCPP",900,640); return Application::getInstance()->run(); } diff --git a/samples/Lua/TestLua/proj.mac/AppController.h b/samples/Lua/TestLua/proj.mac/AppController.h deleted file mode 100644 index 96c717304b..0000000000 --- a/samples/Lua/TestLua/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/samples/Lua/TestLua/proj.mac/AppController.mm b/samples/Lua/TestLua/proj.mac/AppController.mm deleted file mode 100644 index 55c4c3ca11..0000000000 --- a/samples/Lua/TestLua/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, 720, 480); - 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:@"TestLua"]; - [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/samples/Javascript/CrystalCraze/proj.mac/main.m b/samples/Lua/TestLua/proj.mac/main.cpp similarity index 86% rename from samples/Javascript/CrystalCraze/proj.mac/main.m rename to samples/Lua/TestLua/proj.mac/main.cpp index 97d9b73282..d8074883bc 100644 --- a/samples/Javascript/CrystalCraze/proj.mac/main.m +++ b/samples/Lua/TestLua/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/samples/Lua/TestLua/proj.mac/main.m b/samples/Lua/TestLua/proj.mac/main.m deleted file mode 100644 index 97d9b73282..0000000000 --- a/samples/Lua/TestLua/proj.mac/main.m +++ /dev/null @@ -1,30 +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 - -int main(int argc, char *argv[]) -{ - return NSApplicationMain(argc, (const char **)argv); -} diff --git a/samples/Lua/TestLua/proj.win32/main.cpp b/samples/Lua/TestLua/proj.win32/main.cpp index 1b29a1277e..8f302d1f1a 100644 --- a/samples/Lua/TestLua/proj.win32/main.cpp +++ b/samples/Lua/TestLua/proj.win32/main.cpp @@ -24,9 +24,8 @@ int APIENTRY _tWinMain(HINSTANCE hInstance, // create the application instance AppDelegate app; - auto eglView = EGLView::getInstance(); - eglView->setViewName("TestLua"); - eglView->setFrameSize(480, 320); + EGLView* eglView = new EGLView(); + eglView->init("TestCPP",900,640); int ret = Application::getInstance()->run(); diff --git a/samples/samples.xcodeproj/project.pbxproj.REMOVED.git-id b/samples/samples.xcodeproj/project.pbxproj.REMOVED.git-id index cd0c67eacb..51d66c7f01 100644 --- a/samples/samples.xcodeproj/project.pbxproj.REMOVED.git-id +++ b/samples/samples.xcodeproj/project.pbxproj.REMOVED.git-id @@ -1 +1 @@ -a4b4e22fa9c7b5faa973bb5189ea8db27307df37 \ No newline at end of file +4e8c32f47e58d52eeb06cbf388d23efacb69a2da \ No newline at end of file