mirror of https://github.com/axmolengine/axmol.git
issue #2460: project template for glfw
This commit is contained in:
parent
bc5ae78423
commit
4c12f4029a
|
@ -13,7 +13,7 @@ int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
// create the application instance
|
// create the application instance
|
||||||
AppDelegate app;
|
AppDelegate app;
|
||||||
EGLView* eglView = EGLView::getInstance();
|
EGLView* eglView = new EGLView();
|
||||||
eglView->setFrameSize(800, 480);
|
eglView->init("TestCPP",900,640);
|
||||||
return Application::getInstance()->run();
|
return Application::getInstance()->run();
|
||||||
}
|
}
|
||||||
|
|
|
@ -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 <NSApplicationDelegate>
|
|
||||||
{
|
|
||||||
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
|
|
|
@ -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
|
|
|
@ -27,11 +27,11 @@
|
||||||
1AFAF8C516D3884900DB1158 /* HelloWorld.png in Resources */ = {isa = PBXBuildFile; fileRef = 1AFAF8C216D3884900DB1158 /* HelloWorld.png */; };
|
1AFAF8C516D3884900DB1158 /* HelloWorld.png in Resources */ = {isa = PBXBuildFile; fileRef = 1AFAF8C216D3884900DB1158 /* HelloWorld.png */; };
|
||||||
1AFAF8CA16D3886000DB1158 /* AppDelegate.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AFAF8C616D3886000DB1158 /* AppDelegate.cpp */; };
|
1AFAF8CA16D3886000DB1158 /* AppDelegate.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AFAF8C616D3886000DB1158 /* AppDelegate.cpp */; };
|
||||||
1AFAF8CB16D3886000DB1158 /* HelloWorldScene.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AFAF8C816D3886000DB1158 /* HelloWorldScene.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 */; };
|
41BC70E515BF81A5006A0A6C /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 41BC70DC15BF81A5006A0A6C /* InfoPlist.strings */; };
|
||||||
41BC70E615BF81A5006A0A6C /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 41BC70DE15BF81A5006A0A6C /* MainMenu.xib */; };
|
41BC70E615BF81A5006A0A6C /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 41BC70DE15BF81A5006A0A6C /* MainMenu.xib */; };
|
||||||
41BC70E715BF81A5006A0A6C /* Icon.icns in Resources */ = {isa = PBXBuildFile; fileRef = 41BC70E015BF81A5006A0A6C /* Icon.icns */; };
|
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 */
|
/* End PBXBuildFile section */
|
||||||
|
|
||||||
/* Begin PBXContainerItemProxy 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 = "<group>"; };
|
1AFAF8C816D3886000DB1158 /* HelloWorldScene.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = HelloWorldScene.cpp; path = ../Classes/HelloWorldScene.cpp; sourceTree = "<group>"; };
|
||||||
1AFAF8C916D3886000DB1158 /* HelloWorldScene.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = HelloWorldScene.h; path = ../Classes/HelloWorldScene.h; sourceTree = "<group>"; };
|
1AFAF8C916D3886000DB1158 /* HelloWorldScene.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = HelloWorldScene.h; path = ../Classes/HelloWorldScene.h; sourceTree = "<group>"; };
|
||||||
1D6058910D05DD3D006BFB54 /* HelloCpp.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = HelloCpp.app; sourceTree = BUILT_PRODUCTS_DIR; };
|
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 = "<group>"; };
|
41BC70DD15BF81A5006A0A6C /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = InfoPlist.strings; sourceTree = "<group>"; };
|
||||||
41BC70DF15BF81A5006A0A6C /* en */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = en; path = MainMenu.xib; sourceTree = "<group>"; };
|
41BC70DF15BF81A5006A0A6C /* en */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = en; path = MainMenu.xib; sourceTree = "<group>"; };
|
||||||
41BC70E015BF81A5006A0A6C /* Icon.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; path = Icon.icns; sourceTree = SOURCE_ROOT; };
|
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; };
|
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; };
|
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 */
|
/* End PBXFileReference section */
|
||||||
|
|
||||||
/* Begin PBXFrameworksBuildPhase section */
|
/* Begin PBXFrameworksBuildPhase section */
|
||||||
|
@ -205,6 +204,7 @@
|
||||||
isa = PBXFrameworksBuildPhase;
|
isa = PBXFrameworksBuildPhase;
|
||||||
buildActionMask = 2147483647;
|
buildActionMask = 2147483647;
|
||||||
files = (
|
files = (
|
||||||
|
ED4D1B3D17D445F10058FC68 /* IOKit.framework in Frameworks */,
|
||||||
1AF4C39717865FD400122817 /* libbox2d Mac.a in Frameworks */,
|
1AF4C39717865FD400122817 /* libbox2d Mac.a in Frameworks */,
|
||||||
1AF4C39817865FD400122817 /* libchipmunk Mac.a in Frameworks */,
|
1AF4C39817865FD400122817 /* libchipmunk Mac.a in Frameworks */,
|
||||||
1AF4C39917865FD400122817 /* libcocos2dx Mac.a in Frameworks */,
|
1AF4C39917865FD400122817 /* libcocos2dx Mac.a in Frameworks */,
|
||||||
|
@ -283,6 +283,7 @@
|
||||||
29B97323FDCFA39411CA2CEA /* Frameworks */ = {
|
29B97323FDCFA39411CA2CEA /* Frameworks */ = {
|
||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
|
ED4D1B3C17D445F10058FC68 /* IOKit.framework */,
|
||||||
15C6498616633E65007D4F18 /* libcurl.a */,
|
15C6498616633E65007D4F18 /* libcurl.a */,
|
||||||
15C64830165F39AB007D4F18 /* libxml2.dylib */,
|
15C64830165F39AB007D4F18 /* libxml2.dylib */,
|
||||||
15C6482E165F399D007D4F18 /* libz.dylib */,
|
15C6482E165F399D007D4F18 /* libz.dylib */,
|
||||||
|
@ -300,11 +301,9 @@
|
||||||
41BC70D815BF818D006A0A6C /* mac */ = {
|
41BC70D815BF818D006A0A6C /* mac */ = {
|
||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
41BC70D915BF81A5006A0A6C /* AppController.h */,
|
|
||||||
41BC70DA15BF81A5006A0A6C /* AppController.mm */,
|
|
||||||
41BC70DB15BF81A5006A0A6C /* en.lproj */,
|
41BC70DB15BF81A5006A0A6C /* en.lproj */,
|
||||||
41BC70E015BF81A5006A0A6C /* Icon.icns */,
|
41BC70E015BF81A5006A0A6C /* Icon.icns */,
|
||||||
41BC70E115BF81A5006A0A6C /* main.m */,
|
41BC70E115BF81A5006A0A6C /* main.cpp */,
|
||||||
41BC70E215BF81A5006A0A6C /* Info.plist */,
|
41BC70E215BF81A5006A0A6C /* Info.plist */,
|
||||||
41BC70E315BF81A5006A0A6C /* Prefix.pch */,
|
41BC70E315BF81A5006A0A6C /* Prefix.pch */,
|
||||||
);
|
);
|
||||||
|
@ -513,8 +512,7 @@
|
||||||
isa = PBXSourcesBuildPhase;
|
isa = PBXSourcesBuildPhase;
|
||||||
buildActionMask = 2147483647;
|
buildActionMask = 2147483647;
|
||||||
files = (
|
files = (
|
||||||
41BC70E415BF81A5006A0A6C /* AppController.mm in Sources */,
|
41BC70E815BF81A5006A0A6C /* main.cpp in Sources */,
|
||||||
41BC70E815BF81A5006A0A6C /* main.m in Sources */,
|
|
||||||
1AFAF8CA16D3886000DB1158 /* AppDelegate.cpp in Sources */,
|
1AFAF8CA16D3886000DB1158 /* AppDelegate.cpp in Sources */,
|
||||||
1AFAF8CB16D3886000DB1158 /* HelloWorldScene.cpp in Sources */,
|
1AFAF8CB16D3886000DB1158 /* HelloWorldScene.cpp in Sources */,
|
||||||
);
|
);
|
||||||
|
|
|
@ -22,9 +22,15 @@
|
||||||
THE SOFTWARE.
|
THE SOFTWARE.
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#import <Cocoa/Cocoa.h>
|
#include "AppDelegate.h"
|
||||||
|
#include "CCEGLView.h"
|
||||||
|
|
||||||
|
USING_NS_CC;
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
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();
|
||||||
}
|
}
|
|
@ -14,8 +14,7 @@ int APIENTRY _tWinMain(HINSTANCE hInstance,
|
||||||
|
|
||||||
// create the application instance
|
// create the application instance
|
||||||
AppDelegate app;
|
AppDelegate app;
|
||||||
EGLView* eglView = EGLView::getInstance();
|
EGLView* eglView = new EGLView();
|
||||||
eglView->setViewName("HelloCpp");
|
eglView->init("TestCPP",900,640);
|
||||||
eglView->setFrameSize(480, 320);
|
|
||||||
return Application::getInstance()->run();
|
return Application::getInstance()->run();
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,9 +24,8 @@ int APIENTRY _tWinMain(HINSTANCE hInstance,
|
||||||
|
|
||||||
// create the application instance
|
// create the application instance
|
||||||
AppDelegate app;
|
AppDelegate app;
|
||||||
EGLView* eglView = EGLView::getInstance();
|
EGLView* eglView = new EGLView();
|
||||||
eglView->setViewName("HelloJavascript");
|
eglView->init("TestCPP",900,640);
|
||||||
eglView->setFrameSize(480, 320);
|
|
||||||
|
|
||||||
int ret = Application::getInstance()->run();
|
int ret = Application::getInstance()->run();
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,7 @@ int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
// create the application instance
|
// create the application instance
|
||||||
AppDelegate app;
|
AppDelegate app;
|
||||||
EGLView* eglView = EGLView::getInstance();
|
EGLView* eglView = new EGLView();
|
||||||
eglView->setFrameSize(800, 480);
|
eglView->init("TestCPP",900,640);
|
||||||
return Application::getInstance()->run();
|
return Application::getInstance()->run();
|
||||||
}
|
}
|
||||||
|
|
|
@ -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 <NSApplicationDelegate>
|
|
||||||
{
|
|
||||||
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
|
|
|
@ -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
|
|
|
@ -40,13 +40,13 @@
|
||||||
15A02F4617A64D1E0035E92B /* menu1.png in Resources */ = {isa = PBXBuildFile; fileRef = 15A02F3317A64D1E0035E92B /* menu1.png */; };
|
15A02F4617A64D1E0035E92B /* menu1.png in Resources */ = {isa = PBXBuildFile; fileRef = 15A02F3317A64D1E0035E92B /* menu1.png */; };
|
||||||
15A02F4717A64D1E0035E92B /* menu2.png in Resources */ = {isa = PBXBuildFile; fileRef = 15A02F3417A64D1E0035E92B /* menu2.png */; };
|
15A02F4717A64D1E0035E92B /* menu2.png in Resources */ = {isa = PBXBuildFile; fileRef = 15A02F3417A64D1E0035E92B /* menu2.png */; };
|
||||||
15A02F4D17A64D390035E92B /* AppDelegate.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 15A02F4B17A64D390035E92B /* AppDelegate.cpp */; };
|
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 */; };
|
15A02F7317A64DFB0035E92B /* Icon.icns in Resources */ = {isa = PBXBuildFile; fileRef = 15A02F6D17A64DFB0035E92B /* Icon.icns */; };
|
||||||
15A02F7417A64DFB0035E92B /* Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 15A02F6E17A64DFB0035E92B /* Info.plist */; };
|
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 */; };
|
15A02F7B17A64E2A0035E92B /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 15A02F7717A64E2A0035E92B /* InfoPlist.strings */; };
|
||||||
15A02F7C17A64E2A0035E92B /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 15A02F7917A64E2A0035E92B /* MainMenu.xib */; };
|
15A02F7C17A64E2A0035E92B /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 15A02F7917A64E2A0035E92B /* MainMenu.xib */; };
|
||||||
1ADB273B17CCA0F500634B5E /* Cocos2d.lua in Resources */ = {isa = PBXBuildFile; fileRef = 1ADB273A17CCA0F500634B5E /* Cocos2d.lua */; };
|
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 */
|
/* End PBXBuildFile section */
|
||||||
|
|
||||||
/* Begin PBXContainerItemProxy section */
|
/* Begin PBXContainerItemProxy section */
|
||||||
|
@ -216,16 +216,14 @@
|
||||||
15A02F3417A64D1E0035E92B /* menu2.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = menu2.png; sourceTree = "<group>"; };
|
15A02F3417A64D1E0035E92B /* menu2.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = menu2.png; sourceTree = "<group>"; };
|
||||||
15A02F4B17A64D390035E92B /* AppDelegate.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AppDelegate.cpp; sourceTree = "<group>"; };
|
15A02F4B17A64D390035E92B /* AppDelegate.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AppDelegate.cpp; sourceTree = "<group>"; };
|
||||||
15A02F4C17A64D390035E92B /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = "<group>"; };
|
15A02F4C17A64D390035E92B /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = "<group>"; };
|
||||||
15A02F6317A64DFB0035E92B /* AppController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppController.h; sourceTree = "<group>"; };
|
|
||||||
15A02F6417A64DFB0035E92B /* AppController.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = AppController.mm; sourceTree = "<group>"; };
|
|
||||||
15A02F6D17A64DFB0035E92B /* Icon.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; path = Icon.icns; sourceTree = "<group>"; };
|
15A02F6D17A64DFB0035E92B /* Icon.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; path = Icon.icns; sourceTree = "<group>"; };
|
||||||
15A02F6E17A64DFB0035E92B /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
15A02F6E17A64DFB0035E92B /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
||||||
15A02F6F17A64DFB0035E92B /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
|
15A02F6F17A64DFB0035E92B /* main.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = main.cpp; sourceTree = "<group>"; };
|
||||||
15A02F7817A64E2A0035E92B /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = InfoPlist.strings; sourceTree = "<group>"; };
|
15A02F7817A64E2A0035E92B /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = InfoPlist.strings; sourceTree = "<group>"; };
|
||||||
15A02F7A17A64E2A0035E92B /* en */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = en; path = MainMenu.xib; sourceTree = "<group>"; };
|
15A02F7A17A64E2A0035E92B /* en */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = en; path = MainMenu.xib; sourceTree = "<group>"; };
|
||||||
15A02F7D17A64EF30035E92B /* Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Prefix.pch; sourceTree = "<group>"; };
|
|
||||||
15A02FAA17A65D810035E92B /* OpenAL.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenAL.framework; path = System/Library/Frameworks/OpenAL.framework; sourceTree = SDKROOT; };
|
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 = "<group>"; };
|
1ADB273A17CCA0F500634B5E /* Cocos2d.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = Cocos2d.lua; sourceTree = "<group>"; };
|
||||||
|
ED4D1B4A17D4460E0058FC68 /* IOKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = IOKit.framework; path = System/Library/Frameworks/IOKit.framework; sourceTree = SDKROOT; };
|
||||||
/* End PBXFileReference section */
|
/* End PBXFileReference section */
|
||||||
|
|
||||||
/* Begin PBXFrameworksBuildPhase section */
|
/* Begin PBXFrameworksBuildPhase section */
|
||||||
|
@ -233,6 +231,7 @@
|
||||||
isa = PBXFrameworksBuildPhase;
|
isa = PBXFrameworksBuildPhase;
|
||||||
buildActionMask = 2147483647;
|
buildActionMask = 2147483647;
|
||||||
files = (
|
files = (
|
||||||
|
ED4D1B4B17D4460E0058FC68 /* IOKit.framework in Frameworks */,
|
||||||
1501826E17A7513400E674E5 /* libchipmunk Mac.a in Frameworks */,
|
1501826E17A7513400E674E5 /* libchipmunk Mac.a in Frameworks */,
|
||||||
1501821D17A6706400E674E5 /* libcocos2dx Mac.a in Frameworks */,
|
1501821D17A6706400E674E5 /* libcocos2dx Mac.a in Frameworks */,
|
||||||
1501821E17A6706400E674E5 /* libcocos2dx-extensions Mac.a in Frameworks */,
|
1501821E17A6706400E674E5 /* libcocos2dx-extensions Mac.a in Frameworks */,
|
||||||
|
@ -293,6 +292,7 @@
|
||||||
15A02E6217A647C90035E92B /* Frameworks */ = {
|
15A02E6217A647C90035E92B /* Frameworks */ = {
|
||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
|
ED4D1B4A17D4460E0058FC68 /* IOKit.framework */,
|
||||||
150181F517A6696400E674E5 /* libcurl.dylib */,
|
150181F517A6696400E674E5 /* libcurl.dylib */,
|
||||||
150181F317A6695400E674E5 /* libz.dylib */,
|
150181F317A6695400E674E5 /* libz.dylib */,
|
||||||
150181EC17A6679B00E674E5 /* ApplicationServices.framework */,
|
150181EC17A6679B00E674E5 /* ApplicationServices.framework */,
|
||||||
|
@ -359,13 +359,10 @@
|
||||||
15A02F6217A64DFB0035E92B /* Mac */ = {
|
15A02F6217A64DFB0035E92B /* Mac */ = {
|
||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
15A02F7D17A64EF30035E92B /* Prefix.pch */,
|
|
||||||
15A02F6317A64DFB0035E92B /* AppController.h */,
|
|
||||||
15A02F6417A64DFB0035E92B /* AppController.mm */,
|
|
||||||
15A02F7617A64E2A0035E92B /* en.lproj */,
|
15A02F7617A64E2A0035E92B /* en.lproj */,
|
||||||
15A02F6D17A64DFB0035E92B /* Icon.icns */,
|
15A02F6D17A64DFB0035E92B /* Icon.icns */,
|
||||||
15A02F6E17A64DFB0035E92B /* Info.plist */,
|
15A02F6E17A64DFB0035E92B /* Info.plist */,
|
||||||
15A02F6F17A64DFB0035E92B /* main.m */,
|
15A02F6F17A64DFB0035E92B /* main.cpp */,
|
||||||
);
|
);
|
||||||
name = Mac;
|
name = Mac;
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
|
@ -576,8 +573,7 @@
|
||||||
buildActionMask = 2147483647;
|
buildActionMask = 2147483647;
|
||||||
files = (
|
files = (
|
||||||
15A02F4D17A64D390035E92B /* AppDelegate.cpp in Sources */,
|
15A02F4D17A64D390035E92B /* AppDelegate.cpp in Sources */,
|
||||||
15A02F7017A64DFB0035E92B /* AppController.mm in Sources */,
|
15A02F7517A64DFB0035E92B /* main.cpp in Sources */,
|
||||||
15A02F7517A64DFB0035E92B /* main.m in Sources */,
|
|
||||||
);
|
);
|
||||||
runOnlyForDeploymentPostprocessing = 0;
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
};
|
};
|
||||||
|
|
|
@ -22,9 +22,15 @@
|
||||||
THE SOFTWARE.
|
THE SOFTWARE.
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#import <Cocoa/Cocoa.h>
|
#include "AppDelegate.h"
|
||||||
|
#include "CCEGLView.h"
|
||||||
|
|
||||||
|
USING_NS_CC;
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
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();
|
||||||
}
|
}
|
|
@ -24,9 +24,8 @@ int APIENTRY _tWinMain(HINSTANCE hInstance,
|
||||||
|
|
||||||
// create the application instance
|
// create the application instance
|
||||||
AppDelegate app;
|
AppDelegate app;
|
||||||
EGLView* eglView = EGLView::getInstance();
|
EGLView* eglView = new EGLView();
|
||||||
eglView->setViewName("HelloLua");
|
eglView->init("TestCPP",900,640);
|
||||||
eglView->setFrameSize(480, 320);
|
|
||||||
|
|
||||||
int ret = Application::getInstance()->run();
|
int ret = Application::getInstance()->run();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue