Remove QTCreator project files

This commit is contained in:
Simon Robertshaw 2012-05-13 14:30:00 +01:00
parent 7544f46b98
commit a2e91c247f
7 changed files with 397 additions and 370 deletions

View File

@ -1 +0,0 @@
// ADD PREDEFINED MACROS HERE!

View File

@ -1 +0,0 @@
[General]

View File

@ -1,338 +0,0 @@
C:/Users/Simon/Projects/FacialTurd-PowderToypp/data/font.h
C:/Users/Simon/Projects/FacialTurd-PowderToypp/data/hmap.h
C:/Users/Simon/Projects/FacialTurd-PowderToypp/data/icon.h
C:/Users/Simon/Projects/FacialTurd-PowderToypp/data/icondoc.h
C:/Users/Simon/Projects/FacialTurd-PowderToypp/data/images.h
C:/Users/Simon/Projects/FacialTurd-PowderToypp/data/Shaders.h
C:/Users/Simon/Projects/FacialTurd-PowderToypp/elements/acel.cpp
C:/Users/Simon/Projects/FacialTurd-PowderToypp/elements/acid.cpp
C:/Users/Simon/Projects/FacialTurd-PowderToypp/elements/amtr.cpp
C:/Users/Simon/Projects/FacialTurd-PowderToypp/elements/anar.cpp
C:/Users/Simon/Projects/FacialTurd-PowderToypp/elements/aray.cpp
C:/Users/Simon/Projects/FacialTurd-PowderToypp/elements/bang.cpp
C:/Users/Simon/Projects/FacialTurd-PowderToypp/elements/bcln.cpp
C:/Users/Simon/Projects/FacialTurd-PowderToypp/elements/bcol.cpp
C:/Users/Simon/Projects/FacialTurd-PowderToypp/elements/bizr.cpp
C:/Users/Simon/Projects/FacialTurd-PowderToypp/elements/bmtl.cpp
C:/Users/Simon/Projects/FacialTurd-PowderToypp/elements/bomb.cpp
C:/Users/Simon/Projects/FacialTurd-PowderToypp/elements/boyl.cpp
C:/Users/Simon/Projects/FacialTurd-PowderToypp/elements/brmt.cpp
C:/Users/Simon/Projects/FacialTurd-PowderToypp/elements/btry.cpp
C:/Users/Simon/Projects/FacialTurd-PowderToypp/elements/c5.cpp
C:/Users/Simon/Projects/FacialTurd-PowderToypp/elements/caus.cpp
C:/Users/Simon/Projects/FacialTurd-PowderToypp/elements/cbnw.cpp
C:/Users/Simon/Projects/FacialTurd-PowderToypp/elements/clne.cpp
C:/Users/Simon/Projects/FacialTurd-PowderToypp/elements/clst.cpp
C:/Users/Simon/Projects/FacialTurd-PowderToypp/elements/co2.cpp
C:/Users/Simon/Projects/FacialTurd-PowderToypp/elements/coal.cpp
C:/Users/Simon/Projects/FacialTurd-PowderToypp/elements/conv.cpp
C:/Users/Simon/Projects/FacialTurd-PowderToypp/elements/dest.cpp
C:/Users/Simon/Projects/FacialTurd-PowderToypp/elements/deut.cpp
C:/Users/Simon/Projects/FacialTurd-PowderToypp/elements/dlay.cpp
C:/Users/Simon/Projects/FacialTurd-PowderToypp/elements/dstw.cpp
C:/Users/Simon/Projects/FacialTurd-PowderToypp/elements/elec.cpp
C:/Users/Simon/Projects/FacialTurd-PowderToypp/elements/elementmisc.cpp
C:/Users/Simon/Projects/FacialTurd-PowderToypp/elements/emp.cpp
C:/Users/Simon/Projects/FacialTurd-PowderToypp/elements/figh.cpp
C:/Users/Simon/Projects/FacialTurd-PowderToypp/elements/fire.cpp
C:/Users/Simon/Projects/FacialTurd-PowderToypp/elements/firw.cpp
C:/Users/Simon/Projects/FacialTurd-PowderToypp/elements/fog.cpp
C:/Users/Simon/Projects/FacialTurd-PowderToypp/elements/frzw.cpp
C:/Users/Simon/Projects/FacialTurd-PowderToypp/elements/frzz.cpp
C:/Users/Simon/Projects/FacialTurd-PowderToypp/elements/fsep.cpp
C:/Users/Simon/Projects/FacialTurd-PowderToypp/elements/fuse.cpp
C:/Users/Simon/Projects/FacialTurd-PowderToypp/elements/fwrk.cpp
C:/Users/Simon/Projects/FacialTurd-PowderToypp/elements/gbmb.cpp
C:/Users/Simon/Projects/FacialTurd-PowderToypp/elements/glas.cpp
C:/Users/Simon/Projects/FacialTurd-PowderToypp/elements/glow.cpp
C:/Users/Simon/Projects/FacialTurd-PowderToypp/elements/goo.cpp
C:/Users/Simon/Projects/FacialTurd-PowderToypp/elements/gpmp.cpp
C:/Users/Simon/Projects/FacialTurd-PowderToypp/elements/graphics_default.cpp
C:/Users/Simon/Projects/FacialTurd-PowderToypp/elements/h2.cpp
C:/Users/Simon/Projects/FacialTurd-PowderToypp/elements/hswc.cpp
C:/Users/Simon/Projects/FacialTurd-PowderToypp/elements/ice.cpp
C:/Users/Simon/Projects/FacialTurd-PowderToypp/elements/ignt.cpp
C:/Users/Simon/Projects/FacialTurd-PowderToypp/elements/iron.cpp
C:/Users/Simon/Projects/FacialTurd-PowderToypp/elements/isz.cpp
C:/Users/Simon/Projects/FacialTurd-PowderToypp/elements/lava.cpp
C:/Users/Simon/Projects/FacialTurd-PowderToypp/elements/lcry.cpp
C:/Users/Simon/Projects/FacialTurd-PowderToypp/elements/legacy.cpp
C:/Users/Simon/Projects/FacialTurd-PowderToypp/elements/ligh.cpp
C:/Users/Simon/Projects/FacialTurd-PowderToypp/elements/merc.cpp
C:/Users/Simon/Projects/FacialTurd-PowderToypp/elements/mort.cpp
C:/Users/Simon/Projects/FacialTurd-PowderToypp/elements/nbhl.cpp
C:/Users/Simon/Projects/FacialTurd-PowderToypp/elements/neut.cpp
C:/Users/Simon/Projects/FacialTurd-PowderToypp/elements/newgraphics.cpp
C:/Users/Simon/Projects/FacialTurd-PowderToypp/elements/none.cpp
C:/Users/Simon/Projects/FacialTurd-PowderToypp/elements/nptct.cpp
C:/Users/Simon/Projects/FacialTurd-PowderToypp/elements/nwhl.cpp
C:/Users/Simon/Projects/FacialTurd-PowderToypp/elements/O2.cpp
C:/Users/Simon/Projects/FacialTurd-PowderToypp/elements/pbcn.cpp
C:/Users/Simon/Projects/FacialTurd-PowderToypp/elements/pcln.cpp
C:/Users/Simon/Projects/FacialTurd-PowderToypp/elements/phot.cpp
C:/Users/Simon/Projects/FacialTurd-PowderToypp/elements/pipe.cpp
C:/Users/Simon/Projects/FacialTurd-PowderToypp/elements/plnt.cpp
C:/Users/Simon/Projects/FacialTurd-PowderToypp/elements/plsm.cpp
C:/Users/Simon/Projects/FacialTurd-PowderToypp/elements/plut.cpp
C:/Users/Simon/Projects/FacialTurd-PowderToypp/elements/prti.cpp
C:/Users/Simon/Projects/FacialTurd-PowderToypp/elements/prto.cpp
C:/Users/Simon/Projects/FacialTurd-PowderToypp/elements/pump.cpp
C:/Users/Simon/Projects/FacialTurd-PowderToypp/elements/pvod.cpp
C:/Users/Simon/Projects/FacialTurd-PowderToypp/elements/pyro.cpp
C:/Users/Simon/Projects/FacialTurd-PowderToypp/elements/qrtz.cpp
C:/Users/Simon/Projects/FacialTurd-PowderToypp/elements/rime.cpp
C:/Users/Simon/Projects/FacialTurd-PowderToypp/elements/shld.cpp
C:/Users/Simon/Projects/FacialTurd-PowderToypp/elements/sing.cpp
C:/Users/Simon/Projects/FacialTurd-PowderToypp/elements/sltw.cpp
C:/Users/Simon/Projects/FacialTurd-PowderToypp/elements/smke.cpp
C:/Users/Simon/Projects/FacialTurd-PowderToypp/elements/soap.cpp
C:/Users/Simon/Projects/FacialTurd-PowderToypp/elements/spng.cpp
C:/Users/Simon/Projects/FacialTurd-PowderToypp/elements/sprk.cpp
C:/Users/Simon/Projects/FacialTurd-PowderToypp/elements/stkm.cpp
C:/Users/Simon/Projects/FacialTurd-PowderToypp/elements/stkm2.cpp
C:/Users/Simon/Projects/FacialTurd-PowderToypp/elements/stor.cpp
C:/Users/Simon/Projects/FacialTurd-PowderToypp/elements/swch.cpp
C:/Users/Simon/Projects/FacialTurd-PowderToypp/elements/thdr.cpp
C:/Users/Simon/Projects/FacialTurd-PowderToypp/elements/thrm.cpp
C:/Users/Simon/Projects/FacialTurd-PowderToypp/elements/uran.cpp
C:/Users/Simon/Projects/FacialTurd-PowderToypp/elements/vine.cpp
C:/Users/Simon/Projects/FacialTurd-PowderToypp/elements/warp.cpp
C:/Users/Simon/Projects/FacialTurd-PowderToypp/elements/watr.cpp
C:/Users/Simon/Projects/FacialTurd-PowderToypp/elements/wifi.cpp
C:/Users/Simon/Projects/FacialTurd-PowderToypp/elements/wire.cpp
C:/Users/Simon/Projects/FacialTurd-PowderToypp/elements/wtrv.cpp
C:/Users/Simon/Projects/FacialTurd-PowderToypp/elements/yest.cpp
C:/Users/Simon/Projects/FacialTurd-PowderToypp/includes/interface/Button.h
C:/Users/Simon/Projects/FacialTurd-PowderToypp/includes/interface/Component.h
C:/Users/Simon/Projects/FacialTurd-PowderToypp/includes/interface/Panel.h
C:/Users/Simon/Projects/FacialTurd-PowderToypp/includes/interface/Sandbox.h
C:/Users/Simon/Projects/FacialTurd-PowderToypp/includes/interface/State.h
C:/Users/Simon/Projects/FacialTurd-PowderToypp/includes/interface/Window.h
C:/Users/Simon/Projects/FacialTurd-PowderToypp/includes/Air.h
C:/Users/Simon/Projects/FacialTurd-PowderToypp/includes/Config.h
C:/Users/Simon/Projects/FacialTurd-PowderToypp/includes/Element.h
C:/Users/Simon/Projects/FacialTurd-PowderToypp/includes/ElementFunctions.h
C:/Users/Simon/Projects/FacialTurd-PowderToypp/includes/ElementGraphics.h
C:/Users/Simon/Projects/FacialTurd-PowderToypp/includes/Elements.h
C:/Users/Simon/Projects/FacialTurd-PowderToypp/includes/Graphics.h
C:/Users/Simon/Projects/FacialTurd-PowderToypp/includes/Gravity.h
C:/Users/Simon/Projects/FacialTurd-PowderToypp/includes/Misc.h
C:/Users/Simon/Projects/FacialTurd-PowderToypp/includes/Renderer.h
C:/Users/Simon/Projects/FacialTurd-PowderToypp/includes/Simulation.h
C:/Users/Simon/Projects/FacialTurd-PowderToypp/src/interface/Button.cpp
C:/Users/Simon/Projects/FacialTurd-PowderToypp/src/interface/Component.cpp
C:/Users/Simon/Projects/FacialTurd-PowderToypp/src/interface/Panel.cpp
C:/Users/Simon/Projects/FacialTurd-PowderToypp/src/interface/Sandbox.cpp
C:/Users/Simon/Projects/FacialTurd-PowderToypp/src/interface/State.cpp
C:/Users/Simon/Projects/FacialTurd-PowderToypp/src/Air.cpp
C:/Users/Simon/Projects/FacialTurd-PowderToypp/src/Graphics.cpp
C:/Users/Simon/Projects/FacialTurd-PowderToypp/src/Gravity.cpp
C:/Users/Simon/Projects/FacialTurd-PowderToypp/src/Misc.cpp
C:/Users/Simon/Projects/FacialTurd-PowderToypp/src/PowderToy.cpp
C:/Users/Simon/Projects/FacialTurd-PowderToypp/src/Renderer.cpp
C:/Users/Simon/Projects/FacialTurd-PowderToypp/src/Simulation.cpp
C:/Users/Simon/Projects/FacialTurd-PowderToypp/Changelog.txt
src/interface/ControlFactory.cpp
includes/interface/ControlFactory.h
includes/GameSession.h
src/Console.cpp
includes/Console.h
includes/interface/Engine.h
includes/interface/Platform.h
src/interface/State.cpp
src/interface/Panel.cpp
src/interface/Engine.cpp
src/interface/ControlFactory.cpp
src/interface/Component.cpp
src/interface/Button.cpp
includes/interface/Point.h
includes/Singleton.h
src/interface/Label.cpp
includes/interface/Label.h
includes/Global.h
src/Global.cpp
src/search/SearchModel.h
src/search/SearchModel.cpp
src/search/Save.h
src/search/SearchView.h
src/search/SearchView.cpp
src/search/SearchController.h
src/search/SearchController.cpp
src/game/GameController.h
src/game/GameController.cpp
src/game/GameModel.h
src/game/GameModel.cpp
src/interface/Window.h
src/interface/Window.cpp
src/game/GameView.h
src/game/GameView.cpp
src/Singleton.h
src/Simulation.h
src/Renderer.h
src/Misc.h
src/Gravity.h
src/Graphics.h
src/Global.h
src/Elements.h
src/ElementGraphics.h
src/ElementFunctions.h
src/Element.h
src/Console.h
src/Config.h
src/Air.h
src/Simulation.cpp
src/Renderer.cpp
src/PowderToy.cpp
src/Misc.cpp
src/Gravity.cpp
src/Graphics.cpp
src/Global.cpp
src/Console.cpp
src/Air.cpp
src/elements/yest.cpp
src/elements/wtrv.cpp
src/elements/wire.cpp
src/elements/wifi.cpp
src/elements/watr.cpp
src/elements/warp.cpp
src/elements/vine.cpp
src/elements/uran.cpp
src/elements/thrm.cpp
src/elements/thdr.cpp
src/elements/swch.cpp
src/elements/stor.cpp
src/elements/stkm2.cpp
src/elements/stkm.cpp
src/elements/sprk.cpp
src/elements/spng.cpp
src/elements/soap.cpp
src/elements/smke.cpp
src/elements/sltw.cpp
src/elements/sing.cpp
src/elements/shld.cpp
src/elements/rime.cpp
src/elements/qrtz.cpp
src/elements/pyro.cpp
src/elements/pvod.cpp
src/elements/pump.cpp
src/elements/prto.cpp
src/elements/prti.cpp
src/elements/plut.cpp
src/elements/plsm.cpp
src/elements/plnt.cpp
src/elements/pipe.cpp
src/elements/phot.cpp
src/elements/pcln.cpp
src/elements/pbcn.cpp
src/elements/O2.cpp
src/elements/nwhl.cpp
src/elements/nptct.cpp
src/elements/none.cpp
src/elements/newgraphics.cpp
src/elements/neut.cpp
src/elements/nbhl.cpp
src/elements/mort.cpp
src/elements/merc.cpp
src/elements/ligh.cpp
src/elements/legacy.cpp
src/elements/lcry.cpp
src/elements/lava.cpp
src/elements/isz.cpp
src/elements/iron.cpp
src/elements/ignt.cpp
src/elements/ice.cpp
src/elements/hswc.cpp
src/elements/h2.cpp
src/elements/graphics_default.cpp
src/elements/gpmp.cpp
src/elements/goo.cpp
src/elements/glow.cpp
src/elements/glas.cpp
src/elements/gbmb.cpp
src/elements/fwrk.cpp
src/elements/fuse.cpp
src/elements/fsep.cpp
src/elements/frzz.cpp
src/elements/frzw.cpp
src/elements/fog.cpp
src/elements/firw.cpp
src/elements/fire.cpp
src/elements/figh.cpp
src/elements/emp.cpp
src/elements/elementmisc.cpp
src/elements/elec.cpp
src/elements/dstw.cpp
src/elements/dlay.cpp
src/elements/deut.cpp
src/elements/dest.cpp
src/elements/conv.cpp
src/elements/coal.cpp
src/elements/co2.cpp
src/elements/clst.cpp
src/elements/clne.cpp
src/elements/cbnw.cpp
src/elements/caus.cpp
src/elements/c5.cpp
src/elements/btry.cpp
src/elements/brmt.cpp
src/elements/boyl.cpp
src/elements/bomb.cpp
src/elements/bmtl.cpp
src/elements/bizr.cpp
src/elements/bcol.cpp
src/elements/bcln.cpp
src/elements/bang.cpp
src/elements/aray.cpp
src/elements/anar.cpp
src/elements/amtr.cpp
src/elements/acid.cpp
src/elements/acel.cpp
src/interface/Window.h
src/interface/State.h
src/interface/Point.h
src/interface/Platform.h
src/interface/Panel.h
src/interface/Label.h
src/interface/Engine.h
src/interface/ControlFactory.h
src/interface/Component.h
src/interface/Button.h
src/interface/Window.cpp
src/interface/State.cpp
src/interface/Sandbox.cpp
src/interface/Panel.cpp
src/interface/Label.cpp
src/interface/Engine.cpp
src/interface/ControlFactory.cpp
src/interface/Component.cpp
src/interface/Button.cpp
src/interface/SaveButton.h
src/interface/SaveButton.cpp
src/client/Client.h
src/client/Client.cpp
src/client/HTTP.h
src/client/HTTP.c
src/client/HTTP.cpp
src/client/MD5.cpp
src/client/MD5.h
src/search/Thumbnail.h
src/simulation/Simulation.h
src/simulation/Gravity.h
src/simulation/Elements.h
src/simulation/ElementGraphics.h
src/simulation/ElementFunctions.h
src/simulation/Element.h
src/simulation/Air.h
src/simulation/Simulation.cpp
src/simulation/Gravity.cpp
src/simulation/Air.cpp
src/cajun/writer.h
src/cajun/visitor.h
src/cajun/reader.h
src/cajun/elements.h
src/cajun/writer.inl
src/cajun/reader.inl
src/cajun/elements.inl
src/interface/Textbox.h
src/interface/Textbox.cpp
src/interface/Keys.h

View File

@ -1,3 +0,0 @@
C:/Users/Simon/Projects/FacialTurd-PowderToypp/data
C:/Users/Simon/Projects/FacialTurd-PowderToypp/includes
C:/Users/Simon/Projects/FacialTurd-PowderToypp/includes/interface

16
SDLMain.h Normal file
View File

@ -0,0 +1,16 @@
/* SDLMain.m - main entry point for our Cocoa-ized SDL app
Initial Version: Darrell Walisser <dwaliss1@purdue.edu>
Non-NIB-Code & other changes: Max Horn <max@quendi.de>
Feel free to customize this file to suit your needs
*/
#ifndef _SDLMain_h_
#define _SDLMain_h_
#import <Cocoa/Cocoa.h>
@interface SDLMain : NSObject
@end
#endif /* _SDLMain_h_ */

381
SDLMain.m Normal file
View File

@ -0,0 +1,381 @@
/* SDLMain.m - main entry point for our Cocoa-ized SDL app
Initial Version: Darrell Walisser <dwaliss1@purdue.edu>
Non-NIB-Code & other changes: Max Horn <max@quendi.de>
Feel free to customize this file to suit your needs
*/
#include "SDL.h"
#include "SDLMain.h"
#include <sys/param.h> /* for MAXPATHLEN */
#include <unistd.h>
/* For some reaon, Apple removed setAppleMenu from the headers in 10.4,
but the method still is there and works. To avoid warnings, we declare
it ourselves here. */
@interface NSApplication(SDL_Missing_Methods)
- (void)setAppleMenu:(NSMenu *)menu;
@end
/* Use this flag to determine whether we use SDLMain.nib or not */
#define SDL_USE_NIB_FILE 0
/* Use this flag to determine whether we use CPS (docking) or not */
#define SDL_USE_CPS 1
#ifdef SDL_USE_CPS
/* Portions of CPS.h */
typedef struct CPSProcessSerNum
{
UInt32 lo;
UInt32 hi;
} CPSProcessSerNum;
extern OSErr CPSGetCurrentProcess( CPSProcessSerNum *psn);
extern OSErr CPSEnableForegroundOperation( CPSProcessSerNum *psn, UInt32 _arg2, UInt32 _arg3, UInt32 _arg4, UInt32 _arg5);
extern OSErr CPSSetFrontProcess( CPSProcessSerNum *psn);
#endif /* SDL_USE_CPS */
static int gArgc;
static char **gArgv;
static BOOL gFinderLaunch;
static BOOL gCalledAppMainline = FALSE;
static NSString *getApplicationName(void)
{
const NSDictionary *dict;
NSString *appName = 0;
/* Determine the application name */
dict = (const NSDictionary *)CFBundleGetInfoDictionary(CFBundleGetMainBundle());
if (dict)
appName = [dict objectForKey: @"CFBundleName"];
if (![appName length])
appName = [[NSProcessInfo processInfo] processName];
return appName;
}
#if SDL_USE_NIB_FILE
/* A helper category for NSString */
@interface NSString (ReplaceSubString)
- (NSString *)stringByReplacingRange:(NSRange)aRange with:(NSString *)aString;
@end
#endif
@interface NSApplication (SDLApplication)
@end
@implementation NSApplication (SDLApplication)
/* Invoked from the Quit menu item */
- (void)terminate:(id)sender
{
/* Post a SDL_QUIT event */
SDL_Event event;
event.type = SDL_QUIT;
SDL_PushEvent(&event);
}
@end
/* The main class of the application, the application's delegate */
@implementation SDLMain
/* Set the working directory to the .app's parent directory */
- (void) setupWorkingDirectory:(BOOL)shouldChdir
{
if (shouldChdir)
{
char parentdir[MAXPATHLEN];
CFURLRef url = CFBundleCopyBundleURL(CFBundleGetMainBundle());
CFURLRef url2 = CFURLCreateCopyDeletingLastPathComponent(0, url);
if (CFURLGetFileSystemRepresentation(url2, 1, (UInt8 *)parentdir, MAXPATHLEN)) {
chdir(parentdir); /* chdir to the binary app's parent */
}
CFRelease(url);
CFRelease(url2);
}
}
#if SDL_USE_NIB_FILE
/* Fix menu to contain the real app name instead of "SDL App" */
- (void)fixMenu:(NSMenu *)aMenu withAppName:(NSString *)appName
{
NSRange aRange;
NSEnumerator *enumerator;
NSMenuItem *menuItem;
aRange = [[aMenu title] rangeOfString:@"SDL App"];
if (aRange.length != 0)
[aMenu setTitle: [[aMenu title] stringByReplacingRange:aRange with:appName]];
enumerator = [[aMenu itemArray] objectEnumerator];
while ((menuItem = [enumerator nextObject]))
{
aRange = [[menuItem title] rangeOfString:@"SDL App"];
if (aRange.length != 0)
[menuItem setTitle: [[menuItem title] stringByReplacingRange:aRange with:appName]];
if ([menuItem hasSubmenu])
[self fixMenu:[menuItem submenu] withAppName:appName];
}
}
#else
static void setApplicationMenu(void)
{
/* warning: this code is very odd */
NSMenu *appleMenu;
NSMenuItem *menuItem;
NSString *title;
NSString *appName;
appName = getApplicationName();
appleMenu = [[NSMenu alloc] initWithTitle:@""];
/* Add menu items */
title = [@"About " stringByAppendingString:appName];
[appleMenu addItemWithTitle:title action:@selector(orderFrontStandardAboutPanel:) keyEquivalent:@""];
[appleMenu addItem:[NSMenuItem separatorItem]];
title = [@"Hide " stringByAppendingString:appName];
[appleMenu addItemWithTitle:title action:@selector(hide:) keyEquivalent:@"h"];
menuItem = (NSMenuItem *)[appleMenu addItemWithTitle:@"Hide Others" action:@selector(hideOtherApplications:) keyEquivalent:@"h"];
[menuItem setKeyEquivalentModifierMask:(NSAlternateKeyMask|NSCommandKeyMask)];
[appleMenu addItemWithTitle:@"Show All" action:@selector(unhideAllApplications:) keyEquivalent:@""];
[appleMenu addItem:[NSMenuItem separatorItem]];
title = [@"Quit " stringByAppendingString:appName];
[appleMenu addItemWithTitle:title action:@selector(terminate:) keyEquivalent:@"q"];
/* Put menu into the menubar */
menuItem = [[NSMenuItem alloc] initWithTitle:@"" action:nil keyEquivalent:@""];
[menuItem setSubmenu:appleMenu];
[[NSApp mainMenu] addItem:menuItem];
/* Tell the application object that this is now the application menu */
[NSApp setAppleMenu:appleMenu];
/* Finally give up our references to the objects */
[appleMenu release];
[menuItem release];
}
/* Create a window menu */
static void setupWindowMenu(void)
{
NSMenu *windowMenu;
NSMenuItem *windowMenuItem;
NSMenuItem *menuItem;
windowMenu = [[NSMenu alloc] initWithTitle:@"Window"];
/* "Minimize" item */
menuItem = [[NSMenuItem alloc] initWithTitle:@"Minimize" action:@selector(performMiniaturize:) keyEquivalent:@"m"];
[windowMenu addItem:menuItem];
[menuItem release];
/* Put menu into the menubar */
windowMenuItem = [[NSMenuItem alloc] initWithTitle:@"Window" action:nil keyEquivalent:@""];
[windowMenuItem setSubmenu:windowMenu];
[[NSApp mainMenu] addItem:windowMenuItem];
/* Tell the application object that this is now the window menu */
[NSApp setWindowsMenu:windowMenu];
/* Finally give up our references to the objects */
[windowMenu release];
[windowMenuItem release];
}
/* Replacement for NSApplicationMain */
static void CustomApplicationMain (int argc, char **argv)
{
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
SDLMain *sdlMain;
/* Ensure the application object is initialised */
[NSApplication sharedApplication];
#ifdef SDL_USE_CPS
{
CPSProcessSerNum PSN;
/* Tell the dock about us */
if (!CPSGetCurrentProcess(&PSN))
if (!CPSEnableForegroundOperation(&PSN,0x03,0x3C,0x2C,0x1103))
if (!CPSSetFrontProcess(&PSN))
[NSApplication sharedApplication];
}
#endif /* SDL_USE_CPS */
/* Set up the menubar */
[NSApp setMainMenu:[[NSMenu alloc] init]];
setApplicationMenu();
setupWindowMenu();
/* Create SDLMain and make it the app delegate */
sdlMain = [[SDLMain alloc] init];
[NSApp setDelegate:sdlMain];
/* Start the main event loop */
[NSApp run];
[sdlMain release];
[pool release];
}
#endif
/*
* Catch document open requests...this lets us notice files when the app
* was launched by double-clicking a document, or when a document was
* dragged/dropped on the app's icon. You need to have a
* CFBundleDocumentsType section in your Info.plist to get this message,
* apparently.
*
* Files are added to gArgv, so to the app, they'll look like command line
* arguments. Previously, apps launched from the finder had nothing but
* an argv[0].
*
* This message may be received multiple times to open several docs on launch.
*
* This message is ignored once the app's mainline has been called.
*/
- (BOOL)application:(NSApplication *)theApplication openFile:(NSString *)filename
{
const char *temparg;
size_t arglen;
char *arg;
char **newargv;
if (!gFinderLaunch) /* MacOS is passing command line args. */
return FALSE;
if (gCalledAppMainline) /* app has started, ignore this document. */
return FALSE;
temparg = [filename UTF8String];
arglen = SDL_strlen(temparg) + 1;
arg = (char *) SDL_malloc(arglen);
if (arg == NULL)
return FALSE;
newargv = (char **) realloc(gArgv, sizeof (char *) * (gArgc + 2));
if (newargv == NULL)
{
SDL_free(arg);
return FALSE;
}
gArgv = newargv;
SDL_strlcpy(arg, temparg, arglen);
gArgv[gArgc++] = arg;
gArgv[gArgc] = NULL;
return TRUE;
}
/* Called when the internal event loop has just started running */
- (void) applicationDidFinishLaunching: (NSNotification *) note
{
int status;
/* Set the working directory to the .app's parent directory */
[self setupWorkingDirectory:gFinderLaunch];
#if SDL_USE_NIB_FILE
/* Set the main menu to contain the real app name instead of "SDL App" */
[self fixMenu:[NSApp mainMenu] withAppName:getApplicationName()];
#endif
/* Hand off to main application code */
gCalledAppMainline = TRUE;
status = SDL_main (gArgc, gArgv);
/* We're done, thank you for playing */
exit(status);
}
@end
@implementation NSString (ReplaceSubString)
- (NSString *)stringByReplacingRange:(NSRange)aRange with:(NSString *)aString
{
unsigned int bufferSize;
unsigned int selfLen = [self length];
unsigned int aStringLen = [aString length];
unichar *buffer;
NSRange localRange;
NSString *result;
bufferSize = selfLen + aStringLen - aRange.length;
buffer = (unichar *)NSAllocateMemoryPages(bufferSize*sizeof(unichar));
/* Get first part into buffer */
localRange.location = 0;
localRange.length = aRange.location;
[self getCharacters:buffer range:localRange];
/* Get middle part into buffer */
localRange.location = 0;
localRange.length = aStringLen;
[aString getCharacters:(buffer+aRange.location) range:localRange];
/* Get last part into buffer */
localRange.location = aRange.location + aRange.length;
localRange.length = selfLen - localRange.location;
[self getCharacters:(buffer+aRange.location+aStringLen) range:localRange];
/* Build output string */
result = [NSString stringWithCharacters:buffer length:bufferSize];
NSDeallocateMemoryPages(buffer, bufferSize);
return result;
}
@end
#ifdef main
# undef main
#endif
/* Main entry point to executable - should *not* be SDL_main! */
int main (int argc, char **argv)
{
/* Copy the arguments into a global variable */
/* This is passed if we are launched by double-clicking */
if ( argc >= 2 && strncmp (argv[1], "-psn", 4) == 0 ) {
gArgv = (char **) SDL_malloc(sizeof (char *) * 2);
gArgv[0] = argv[0];
gArgv[1] = NULL;
gArgc = 1;
gFinderLaunch = YES;
} else {
int i;
gArgc = argc;
gArgv = (char **) SDL_malloc(sizeof (char *) * (argc+1));
for (i = 0; i <= argc; i++)
gArgv[i] = argv[i];
gFinderLaunch = NO;
}
#if SDL_USE_NIB_FILE
NSApplicationMain (argc, argv);
#else
CustomApplicationMain (argc, argv);
#endif
return 0;
}

View File

@ -1,27 +0,0 @@
QMAKE_CXXFLAGS_RELEASE += -fkeep-inline-functions
QMAKE_CXXFLAGS_DEBUG += -fkeep-inline-functions
LIBS += -lSDL -lm -lbz2
INCLUDEPATH += data/ \
src/
SOURCES += $$files(src/*.cpp) \
$$files(src/client/*.cpp) \
$$files(src/elements/*.cpp) \
$$files(src/game/*.cpp) \
$$files(src/interface/*.cpp) \
$$files(src/search/*.cpp) \
$$files(src/simulation/*.cpp) \
$$files(src/cajun/*.cpp)
HEADERS += src/*.h \
src/client/*.h \
src/elements/*.h \
src/game/*.h \
src/interface/*.h \
src/search/*.h \
src/simulation/*.h \
src/cajun/*.h