Begone, AppKit

git-svn-id: http://svn.berlios.de/svnroot/repos/oolite-linux/trunk@402 127b21dd-08f5-0310-b4b7-95ae10353056
This commit is contained in:
Dylan Smith 2006-04-01 18:57:39 +00:00
parent fe1ae1ffd4
commit 3594399b40
13 changed files with 57 additions and 30 deletions

View File

@ -6,23 +6,23 @@ vpath %.c src/SDL:src/Core:src/BSDCompat
GNUSTEP_INSTALLATION_DIR = $(GNUSTEP_USER_ROOT)
ifeq ($(GNUSTEP_HOST_OS),mingw32)
ADDITIONAL_INCLUDE_DIRS =
ADDITIONAL_GUI_LIBS = -lglu32 -lopengl32 -lmingw32 -lSDLmain -lSDL -lSDL_mixer -lSDL_image
ADDITIONAL_OBJC_LIBS = -lglu32 -lopengl32 -lmingw32 -lSDLmain -lSDL -lSDL_mixer -lSDL_image -lgnustep-base
ADDITIONAL_CFLAGS = -DLINUX -DWIN32 -DNEED_STRLCPY `sdl-config --cflags`
# note the vpath stuff above isn't working for me, so adding src/SDL and src/Core explicitly
ADDITIONAL_OBJCFLAGS = -DLOADSAVEGUI -DLINUX -DWIN32 -DHAVE_SOUND -Isrc/SDL -Isrc/Core -Wno-import `sdl-config --cflags`
oolite_LIB_DIRS += -L$(GNUSTEP_LOCAL_ROOT)/lib
else
ADDITIONAL_INCLUDE_DIRS = -Isrc/SDL -Isrc/Core -Isrc/BSDCompat
ADDITIONAL_GUI_LIBS = -lGLU -lGL -lSDL -lpthread -lSDL_mixer -lSDL_image
ADDITIONAL_OBJC_LIBS = -lGLU -lGL -lSDL -lpthread -lSDL_mixer -lSDL_image -lgnustep-base
ADDITIONAL_CFLAGS = -DLINUX -DNEED_STRLCPY `sdl-config --cflags`
ADDITIONAL_OBJCFLAGS = -DLOADSAVEGUI -DLINUX -DHAVE_SOUND -Wno-import `sdl-config --cflags`
oolite_LIB_DIRS += -L/usr/X11R6/lib/
endif
APP_NAME = oolite
OBJC_PROGRAM_NAME = oolite
oolite_C_FILES = vector.c legacy_random.c strlcpy.c
oolite_OBJC_FILES = Comparison.m AI.m DustEntity.m Entity.m GameController.m GuiDisplayGen.m HeadUpDisplay.m main.m MyOpenGLView.m OpenGLSprite.m ParticleEntity.m PlanetEntity.m PlayerEntity_Additions.m PlayerEntity_contracts.m PlayerEntity_Controls.m PlayerEntity_Sound.m PlayerEntity.m ResourceManager.m RingEntity.m ShipEntity_AI.m ShipEntity.m SkyEntity.m StationEntity.m TextureStore.m Universe.m OOSound.m OOMusic.m SDLImage.m LoadSave.m OOFileManager.m JoystickHandler.m PlayerEntity_StickMapper.m OOBasicSoundReferencePoint.m OOBasicSoundSource.m OOCharacter.m OOTrumble.m WormholeEntity.m ScannerExtension.m OOXMLExtensions.m MutableDictionaryExtension.m Geometry.m Octree.m CollisionRegion.m
oolite_OBJC_FILES = Comparison.m AI.m DustEntity.m Entity.m GameController.m GuiDisplayGen.m HeadUpDisplay.m main.m MyOpenGLView.m OpenGLSprite.m ParticleEntity.m PlanetEntity.m PlayerEntity_Additions.m PlayerEntity_contracts.m PlayerEntity_Controls.m PlayerEntity_Sound.m PlayerEntity.m ResourceManager.m RingEntity.m ShipEntity_AI.m ShipEntity.m SkyEntity.m StationEntity.m TextureStore.m Universe.m OOSound.m OOMusic.m SDLImage.m LoadSave.m OOFileManager.m JoystickHandler.m PlayerEntity_StickMapper.m OOBasicSoundReferencePoint.m OOBasicSoundSource.m OOCharacter.m OOTrumble.m WormholeEntity.m ScannerExtension.m OOXMLExtensions.m MutableDictionaryExtension.m Geometry.m Octree.m CollisionRegion.m OOColor.m
include $(GNUSTEP_MAKEFILES)/application.make
include $(GNUSTEP_MAKEFILES)/objc.make
include GNUmakefile.postamble

View File

@ -5,15 +5,28 @@
#
ifeq ($(debug),yes)
EXTENSION=debug
SHAREDOBJ=shared_debug_obj
else
EXTENSION=app
SHAREDOBJ=shared_obj
endif
ifeq ($(GNUSTEP_HOST_OS),mingw32)
BINARY=$(SHAREDOBJ)/$(OBJC_PROGRAM_NAME).exe
else
BINARY=$(SHAREDOBJ)/$(OBJC_PROGRAM_NAME)
endif
CONTENTS = Contents
CONTENTDIR=$(APP_NAME).$(EXTENSION)/$(CONTENTS)
GNUSTEP_OW=$(APP_NAME).$(EXTENSION)/Resources/Info-gnustep.plist
PROGDIR=$(OBJC_PROGRAM_NAME).$(EXTENSION)
CONTENTDIR=$(OBJC_PROGRAM_NAME).$(EXTENSION)/$(CONTENTS)
GNUSTEP_OW=$(OBJC_PROGRAM_NAME).$(EXTENSION)/Resources/Info-gnustep.plist
after-all::
rm -rf $(CONTENTDIR)
$(MKDIRS) $(PROGDIR)
$(MKDIRS) $(PROGDIR)/Resources
$(MKDIRS) $(CONTENTDIR)
$(CP) -r Resources $(CONTENTDIR)/Resources
$(CP) src/Cocoa/Info-Oolite.plist $(GNUSTEP_OW)
$(CP) $(BINARY) $(PROGDIR)

View File

@ -695,7 +695,7 @@ static Universe *data_store_universe;
else
{
NSLog(@"ERROR no basefile for entity %@");
NSBeep();
// NSBeep(); // appkit dependency
}
}
glShadeModel(GL_SMOOTH);

View File

@ -503,7 +503,7 @@
if(![[self commanderDataDictionary] writeOOXMLToFile:savePath atomically:YES])
{
NSBeep();
//NSBeep(); // appkit dependency
NSLog(@"***** ERROR: Save to %@ failed!", savePath);
NSException *myException = [NSException
exceptionWithName:@"OoliteException"

View File

@ -62,7 +62,9 @@ extern int debug;
- (id) init;
#ifndef GNUSTEP
- (id) initWithImage:(NSImage *)textureImage cropRectangle:(NSRect)cropRect size:(NSSize) spriteSize;
#endif
- (id) initWithText:(NSString *)str;
- (id) initWithText:(NSString *)str ofColor:(NSColor *) textColor;
- (void) dealloc;
@ -73,10 +75,12 @@ extern int debug;
- (void)blitCentredToX:(float)x Y:(float)y Z:(float)z Alpha:(float)a;
- (void) setText:(NSString *)str;
#ifndef GNUSTEP
- (void)makeTextureFromImage:(NSImage *)texImage cropRectangle:(NSRect)cropRect size:(NSSize)spriteSize;
- (void)replaceTextureFromImage:(NSImage *)texImage cropRectangle:(NSRect)cropRect;
- (void)substituteTextureFromImage:(NSImage *)texImage;
#endif
#ifdef GNUSTEP
- (id) initWithSurface:(SDLImage *)textureImage cropRectangle:(NSRect)cropRect size:(NSSize) spriteSize;

View File

@ -59,7 +59,7 @@ Your fair use and other rights are in no way affected by the above.
- (id) initWithText:(NSString *)str
{
return [self initWithText:str ofColor:[NSColor yellowColor]];
return [self initWithText:str ofColor:[OOColor yellowColor]];
}
- (id) initWithText:(NSString *)str ofColor:(NSColor *) textColor
@ -183,7 +183,7 @@ Your fair use and other rights are in no way affected by the above.
#endif
}
#ifndef GNUSTEP
- (void)makeTextureFromImage:(NSImage *)texImage cropRectangle:(NSRect)cropRect size:(NSSize)spriteSize
{
NSBitmapImageRep* bitmapImageRep;
@ -346,6 +346,8 @@ Your fair use and other rights are in no way affected by the above.
[bitmapImageRep release];
}
#endif
#ifdef GNUSTEP
/* SDL interprets each pixel as a 32-bit number, so our masks must depend
on the endianness (byte order) of the machine */

View File

@ -97,13 +97,13 @@ static NSString * mission_key;
if (conditions == nil)
{
NSLog(@"SCRIPT ERROR no 'conditions' in %@ - returning YES.", [couplet description]);
NSBeep();
// NSBeep(); // AppKit dependency
return success;
}
if (![conditions isKindOfClass:[NSArray class]])
{
NSLog(@"SCRIPT ERROR \"conditions = %@\" is not an array - returning YES.", [conditions description]);
NSBeep();
// NSBeep(); // AppKit dependency
return success;
}
for (i = 0; (i < [conditions count])&&(success); i++)
@ -113,7 +113,7 @@ static NSString * mission_key;
if (![actions isKindOfClass:[NSArray class]])
{
NSLog(@"SCRIPT ERROR \"actions = %@\" is not an array.", [actions description]);
NSBeep();
// NSBeep(); AppKit dependency
}
else
{
@ -132,7 +132,7 @@ static NSString * mission_key;
if (![else_actions isKindOfClass:[NSArray class]])
{
NSLog(@"SCRIPT ERROR \"else_actions = %@\" is not an array.", [else_actions description]);
NSBeep();
// NSBeep(); AppKit
}
else
{
@ -1807,7 +1807,7 @@ static int shipsFound;
if (![conditions isKindOfClass:[NSArray class]])
{
NSLog(@"SCENE ERROR \"conditions = %@\" is not an array - returning NO.", [conditions description]);
NSBeep();
// NSBeep(); AppKit
return NO;
}
}

View File

@ -3998,7 +3998,7 @@ double scoopSoundPlayTime = 0.0;
filename = [[(MyOpenGLView *)[universe gameView] gameController] playerFileToLoad];
if (!filename)
{
NSBeep();
// NSBeep(); // AppKit
NSLog(@"ERROR no filename returned by [[(MyOpenGLView *)[universe gameView] gameController] playerFileToLoad]");
NSException* myException = [NSException
exceptionWithName:@"GameNotSavedException"
@ -4009,7 +4009,7 @@ double scoopSoundPlayTime = 0.0;
}
if (![[self commanderDataDictionary] writeOOXMLToFile:filename atomically:YES])
{
NSBeep();
// NSBeep(); //AppKit
NSLog(@"***** ERROR: Save to %@ failed!", filename);
NSException* myException = [NSException
exceptionWithName:@"OoliteException"
@ -4036,6 +4036,8 @@ double scoopSoundPlayTime = 0.0;
- (void) savePlayer
{
// Load/Save is done by an Oolite native function for gnustep.
#ifndef GNUSTEP
NSSavePanel *sp;
int runResult;
@ -4063,7 +4065,7 @@ double scoopSoundPlayTime = 0.0;
if (![[self commanderDataDictionary] writeOOXMLToFile:[sp filename] atomically:YES])
{
NSBeep();
// NSBeep(); // AppKit
NSLog(@"***** ERROR: Save to %@ failed!", [sp filename]);
NSException* myException = [NSException
exceptionWithName:@"OoliteException"
@ -4087,10 +4089,12 @@ double scoopSoundPlayTime = 0.0;
[[[Entity dataStore] preloadedDataFiles] writeToFile: cache_path atomically: YES];
}
[self setGuiToStatusScreen];
#endif
}
- (void) loadPlayer
{
#ifndef GNUSTEP
int result;
NSArray *fileTypes = [NSArray arrayWithObject:@"oolite-save"];
NSOpenPanel *oPanel = [NSOpenPanel openPanel];
@ -4099,6 +4103,7 @@ double scoopSoundPlayTime = 0.0;
result = [oPanel runModalForDirectory:nil file:nil types:fileTypes];
if (result == NSOKButton)
[self loadPlayerFromFile:[oPanel filename]];
#endif
}
- (void) loadPlayerFromFile:(NSString *)fileToOpen
@ -4156,7 +4161,7 @@ double scoopSoundPlayTime = 0.0;
else
{
NSLog(@"***** FILE LOADING ERROR!! *****");
NSBeep();
// NSBeep(); AppKit
[[universe gameController] setPlayerFileToLoad:nil];
[universe game_over];
[universe clearPreviousMessage];
@ -4580,6 +4585,7 @@ double scoopSoundPlayTime = 0.0;
- (void) starChartDump
{
#ifndef GNUSTEP
NSString *filepath = [[[NSBundle mainBundle] bundlePath] stringByDeletingLastPathComponent];
NSString *pathToPic = [filepath stringByAppendingPathComponent:[NSString stringWithFormat:@"StarChart-Galaxy-%03d.tiff",galaxy_number]];
BOOL dumpPic = (![[NSFileManager defaultManager] fileExistsAtPath:pathToPic]);
@ -4760,6 +4766,7 @@ double scoopSoundPlayTime = 0.0;
[NSBezierPath setDefaultLineWidth:1.0];
}
/* ends */
#endif
}

View File

@ -165,7 +165,7 @@
- (void) displayFunctionList: (GuiDisplayGen *)gui
{
int i;
[gui setColor: [NSColor greenColor] forRow: HEADINGROW];
[gui setColor: [OOColor greenColor] forRow: HEADINGROW];
[gui setArray: [NSArray arrayWithObjects:
@"Function", @"Assigned to", @"Type", nil]
forRow: HEADINGROW];

View File

@ -81,7 +81,9 @@ BOOL always_include_addons;
+ (OOSound *) ooSoundNamed:(NSString *)filename inFolder:(NSString *)foldername;
+ (OOMusic *) ooMusicNamed:(NSString *)filename inFolder:(NSString *)foldername;
#ifndef GNUSTEP
+ (NSImage *) imageNamed:(NSString *)filename inFolder:(NSString *)foldername;
#endif
+ (NSString *) stringFromFilesNamed:(NSString *)filename inFolder:(NSString *)foldername;
#ifdef GNUSTEP
+ (SDLImage *) surfaceNamed:(NSString *)filename inFolder:(NSString *)foldername;

View File

@ -227,7 +227,7 @@ NSMutableDictionary* surface_cache;
else
{
NSString* version = (NSString *)[[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleVersion"];
NSBeep();
// NSBeep(); // AppKit
if (!failed_parsing)
{
NSString* old_errors = errors;
@ -569,6 +569,7 @@ NSMutableDictionary* surface_cache;
return result;
}
#ifndef GNUSTEP
+ (NSImage *) imageNamed:(NSString *)filename inFolder:(NSString *)foldername
{
NSImage *result = nil;
@ -608,6 +609,7 @@ NSMutableDictionary* surface_cache;
//NSLog(@"---> ResourceManager found %d file(s) with name '%@' (in folder '%@')", r, filename, foldername);
return result;
}
#endif
+ (NSString *) stringFromFilesNamed:(NSString *)filename inFolder:(NSString *)foldername
{

View File

@ -4253,7 +4253,7 @@ GLfloat starboard_matrix[] = { 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f,
if (!e1)
{
NSLog(@"ERROR ***** No entity set in Universe getSafeVectorFromEntity:toDistance:fromPoint:");
NSBeep();
// NSBeep(); // AppKit
return make_vector( 0.0f, 0.0f, 0.0f);
}
Vector f1;
@ -7016,7 +7016,7 @@ NSComparisonResult comparePrice( id dict1, id dict2, void * context)
if (!ship)
{
NSLog(@"ERROR ***** No ship set in Universe getSunSkimStartPositionForShip:");
NSBeep();
// NSBeep(); // AppKit
return make_vector( 0.0f, 0.0f, 0.0f);
}
PlanetEntity* the_sun = [self sun];
@ -7024,7 +7024,7 @@ NSComparisonResult comparePrice( id dict1, id dict2, void * context)
if (!the_sun)
{
NSLog(@"ERROR ***** No sun set in Universe getSunSkimStartPositionForShip:");
NSBeep();
// NSBeep(); // AppKit
return make_vector( 0.0f, 0.0f, 0.0f);
}
Vector v0 = the_sun->position;
@ -7047,14 +7047,14 @@ NSComparisonResult comparePrice( id dict1, id dict2, void * context)
if (!ship)
{
NSLog(@"ERROR ***** No ship set in Universe getSunSkimEndPositionForShip:");
NSBeep();
// NSBeep(); // AppKit
return make_vector( 0.0f, 0.0f, 0.0f);
}
// get vector from sun position to ship
if (!the_sun)
{
NSLog(@"ERROR ***** No sun set in Universe getSunSkimEndPositionForShip:");
NSBeep();
// NSBeep(); // AppKit
return make_vector( 0.0f, 0.0f, 0.0f);
}
Vector v0 = the_sun->position;

View File

@ -22,9 +22,6 @@ int main(int argc, char *argv[])
#ifdef GNUSTEP && !OOLITE_SDL_MAC
int i;
// This is still necessary for NSFont calls.
[NSApplication sharedApplication];
// Need this because we're not using the default run loop's autorelease
// pool.
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];