Changeset 97
- Timestamp:
- Mar 9, 2008, 7:22:52 PM (14 years ago)
- Location:
- abuse/trunk
- Files:
-
- 6 added
- 3 deleted
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
abuse/trunk/osx/SDLMain.m
r2 r97 7 7 8 8 #import "SDL.h" 9 #import <Cocoa/Cocoa.h> 10 11 @interface SDLMain : NSObject 12 @end 13 9 #import "SDLMain.h" 14 10 #import <sys/param.h> /* for MAXPATHLEN */ 15 11 #import <unistd.h> 16 12 17 13 /* Use this flag to determine whether we use SDLMain.nib or not */ 18 #define SDL_USE_NIB_FILE 114 #define SDL_USE_NIB_FILE 0 19 15 20 16 … … 27 23 @interface NSString (ReplaceSubString) 28 24 - (NSString *)stringByReplacingRange:(NSRange)aRange with:(NSString *)aString; 25 @end 26 #else 27 /* An internal Apple class used to setup Apple menus */ 28 @interface NSAppleMenuController:NSObject {} 29 - (void)controlMenu:(NSMenu *)aMenu; 29 30 @end 30 31 #endif … … 47 48 /* The main class of the application, the application's delegate */ 48 49 @implementation SDLMain 49 - (void)quit:(id)sender 50 { 51 /* Post a SDL_QUIT event */ 52 SDL_Event event; 53 event.type = SDL_QUIT; 54 SDL_PushEvent(&event); 55 } 50 56 51 /* Set the working directory to the .app's parent directory */ 57 52 - (void) setupWorkingDirectory:(BOOL)shouldChdir … … 101 96 } 102 97 [ aMenu sizeToFit ]; 98 } 99 100 #else 101 102 void setupAppleMenu(void) 103 { 104 /* warning: this code is very odd */ 105 NSAppleMenuController *appleMenuController; 106 NSMenu *appleMenu; 107 NSMenuItem *appleMenuItem; 108 109 appleMenuController = [[NSAppleMenuController alloc] init]; 110 appleMenu = [[NSMenu alloc] initWithTitle:@""]; 111 appleMenuItem = [[NSMenuItem alloc] initWithTitle:@"" action:nil keyEquivalent:@""]; 112 113 [appleMenuItem setSubmenu:appleMenu]; 114 115 /* yes, we do need to add it and then remove it -- 116 if you don't add it, it doesn't get displayed 117 if you don't remove it, you have an extra, titleless item in the menubar 118 when you remove it, it appears to stick around 119 very, very odd */ 120 [[NSApp mainMenu] addItem:appleMenuItem]; 121 [appleMenuController controlMenu:appleMenu]; 122 [[NSApp mainMenu] removeItem:appleMenuItem]; 123 [appleMenu release]; 124 [appleMenuItem release]; 125 } 126 127 /* Create a window menu */ 128 void setupWindowMenu(void) 129 { 130 NSMenu *windowMenu; 131 NSMenuItem *windowMenuItem; 132 NSMenuItem *menuItem; 133 134 135 windowMenu = [[NSMenu alloc] initWithTitle:@"Window"]; 136 137 /* "Minimize" item */ 138 menuItem = [[NSMenuItem alloc] initWithTitle:@"Minimize" action:@selector(performMiniaturize:) keyEquivalent:@"m"]; 139 [windowMenu addItem:menuItem]; 140 [menuItem release]; 141 142 /* Put menu into the menubar */ 143 windowMenuItem = [[NSMenuItem alloc] initWithTitle:@"Window" action:nil keyEquivalent:@""]; 144 [windowMenuItem setSubmenu:windowMenu]; 145 [[NSApp mainMenu] addItem:windowMenuItem]; 146 147 /* Tell the application object that this is now the window menu */ 148 [NSApp setWindowsMenu:windowMenu]; 149 150 /* Finally give up our references to the objects */ 151 [windowMenu release]; 152 [windowMenuItem release]; 153 } 154 155 /* Replacement for NSApplicationMain */ 156 void CustomApplicationMain (argc, argv) 157 { 158 NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; 159 SDLMain *sdlMain; 160 161 /* Ensure the application object is initialised */ 162 [SDLApplication sharedApplication]; 163 164 /* Set up the menubar */ 165 [NSApp setMainMenu:[[NSMenu alloc] init]]; 166 setupAppleMenu(); 167 setupWindowMenu(); 168 169 /* Create SDLMain and make it the app delegate */ 170 sdlMain = [[SDLMain alloc] init]; 171 [NSApp setDelegate:sdlMain]; 172 173 /* Start the main event loop */ 174 [NSApp run]; 175 176 [sdlMain release]; 177 [pool release]; 103 178 } 104 179 … … 197 272 [SDLApplication poseAsClass:[NSApplication class]]; 198 273 NSApplicationMain (argc, argv); 274 #else 275 CustomApplicationMain (argc, argv); 199 276 #endif 200 277 return 0; -
abuse/trunk/src/imlib/specs.cpp
r90 r97 932 932 void write_uint8(FILE *fp, uint8_t x) { fputc((unsigned char)x,fp); } 933 933 934 uint32_t read_other_ int32(FILE *fp)934 uint32_t read_other_uint32(FILE *fp) 935 935 { 936 936 uint32_t x; -
abuse/trunk/src/imlib/system.h
r90 r97 11 11 #define __SYS__ 12 12 13 14 #ifdef WORDS_BIGENDIAN 15 #define BIG_ENDIANS 16 #else 17 #define LITTLE_ENDIANS 18 #endif 19 13 #include <SDL.h> 20 14 21 15 #include <unistd.h> … … 27 21 ((( ((uint32_t)(x)) )&0x0000ff00)<<8)|(( ((uint32_t)(x)) )<<24)) 28 22 29 #if defined BIG_ENDIANS23 #if SDL_BYTEORDER == SDL_BIG_ENDIAN 30 24 #define LONG int32_t 31 25 #define uint16_to_intel(x) uint16_swap(x) -
abuse/trunk/src/imlib/xwdread.cpp
r56 r97 21 21 #include "video.hpp" 22 22 #include "dos.h" 23 #ifndef __APPLE__ 23 24 #include "main.hpp" 25 #endif 24 26 #include "macs.hpp" 25 27 #include "image24.hpp" … … 296 298 int i,j; 297 299 uint8_t *sl; 298 #if BYTE_ORDER!=BIG_ENDIAN 299 printf("little guys\n"); 300 #endif 300 301 301 printf("getting image, bits_per_item = %d %d %d\n",bits_per_item,bits_used,bit_order==MSBFirst); 302 302 for (i=0; i<im->height(); i++) -
abuse/trunk/src/net/tcpip.hpp
r57 r97 9 9 #include <sys/types.h> 10 10 #include "isllist.hpp" 11 12 #ifdef __APPLE__13 typedef int socklen_t;14 #endif15 11 16 12 #if (defined(__APPLE__) && !defined(__MACH__)) -
abuse/trunk/src/sdlport/setup.cpp
r68 r97 27 27 #ifdef HAVE_OPENGL 28 28 #ifdef __APPLE__ 29 #include <Carbon/Carbon.h> 29 30 #include <OpenGL/gl.h> 30 31 #include <OpenGL/glu.h> … … 90 91 { 91 92 fputs( "; Abuse-SDL Configuration file\n\n", fd ); 93 fputs( "; Startup fullscreen\nfullscreen=0\n\n", fd ); 94 #ifdef __APPLE__ 95 fputs( "; Use DoubleBuffering\ndoublebuf=1\n\n", fd ); 96 fputs( "; Use OpenGL\ngl=1\n\n", fd ); 97 #else 98 fputs( "; Use DoubleBuffering\ndoublebuf=0\n\n", fd ); 99 fputs( "; Use OpenGL\ngl=0\n\n", fd ); 92 100 fputs( "; Location of the datafiles\ndatadir=/var/games/abuse\n\n", fd ); 93 fputs( "; Startup fullscreen\nfullscreen=0\n\n", fd ); 94 fputs( "; Use DoubleBuffering\ndoublebuf=0\n\n", fd ); 95 fputs( "; Use mono audio only\nmono=0\n\n", fd ); 101 #endif 102 fputs( "; Use mono audio only\nmono=0\n\n", fd ); 96 103 fputs( "; Grab the mouse to the window\ngrabmouse=0\n\n", fd ); 97 104 fputs( "; Set the scale factor\nscale=2\n\n", fd ); 98 fputs( "; Use OpenGL\ngl=0\n\n", fd ); 99 fputs( "; Use anti-aliasing (with gl=1 only)\nantialias=1\n\n", fd ); 105 fputs( "; Use anti-aliasing (with gl=1 only)\nantialias=1\n\n", fd ); 100 106 // fputs( "; Set the width of the window\nx=320\n\n", fd ); 101 107 // fputs( "; Set the height of the window\ny=200\n\n", fd ); … … 339 345 // Initialise default settings 340 346 flags.fullscreen = 0; // Start in a window 341 flags.doublebuf = 0; // No double buffering342 347 flags.mono = 0; // Enable stereo sound 343 348 flags.nosound = 0; // Enable sound … … 346 351 flags.xres = xres = 320; // Default window width 347 352 flags.yres = yres = 200; // Default window height 353 #ifdef __APPLE__ 354 flags.gl = 1; // Use opengl 355 flags.doublebuf = 1; // Do double buffering 356 #else 348 357 flags.gl = 0; // Don't use opengl 358 flags.doublebuf = 0; // No double buffering 359 #endif 349 360 #ifdef HAVE_OPENGL 350 361 flags.antialias = GL_NEAREST; // Don't anti-alias … … 403 414 // Set the datadir to a default value 404 415 // (The current directory) 416 #ifdef __APPLE__ 417 UInt8 buffer[255]; 418 CFURLRef bundleurl = CFBundleCopyBundleURL(CFBundleGetMainBundle()); 419 CFURLRef url = CFURLCreateCopyAppendingPathComponent(kCFAllocatorDefault, bundleurl, CFSTR("Contents/Resources/data"), true); 420 421 if (!CFURLGetFileSystemRepresentation(url, true, buffer, 255)) 422 { 423 exit(1); 424 } 425 else 426 set_filename_prefix( (const char*)buffer ); 427 #else 405 428 set_filename_prefix( EXPDATADIR ); 406 429 #endif 430 407 431 // Load the users configuration 408 432 readRCFile();
Note: See TracChangeset
for help on using the changeset viewer.