Journal

By Steve Challis

Recent Entries

Archive

RSS/Atom

Home

Projects

Installing NetRadiant on Snow Leopard

5 months, 2 weeks ago — 2 Comments — Permalink

  • netradiant
  • gtkradiant
  • macradiant
  • gaming
  • osx
  • how-to

Radiant is tool for creating maps used in popular games including Nexuiz, Quake and OpenArena. Unfortunately, trying to get it to install on OS X 10.6 was a bag of hurt which is why I’m detailing the necessary steps below. I came across three different versions when trying to get it to install on my Mac but was finally successful with NetRadiant after trying GTKRadiant and MacRadiant. So if you need to do the same thing then here’s what you need to do:

Install X11

You can find X11 version 2.3.4 on the OS X 10.6 install disc under Optional Extras. The newer version 2.4 will not run on Snow Leopard so just stick with the one on the disc.

Download NetRadiant

NetRadiant is a stable fork of the GTKRadiant editor and is maintained by Alientrap software. You will find precompiled binaries at http://www.icculus.org/netradiant/files/. You’ll want version 1.5.0 revision 402. Download and install into you /Applications folder.

Patch The Libraries

Snow Leopard requires newer versions of certain libraries used in Radiant and luckily has them all in /usr/lib, so all we have to do symlink the files in the application to the ones in /usr/lib.

cd /Applications/NetRadiant.app/Contents/MacOS/install/
mv libxml2.2.dylib libxml2.2.dylib.bak
mv libiconv.2.dylib libiconv.2.dylib.bak
ln -s /usr/lib/libxml2.2.dylib libxml2.2.dylib
ln -s /usr/lib/libxml2.2.7.3.dylib libxml2.2.dylib

If you start up NetRadiant, you should now see a splash screen and will be asked for a game engine. As an additional step, if you want to create maps for OpenArena, you’ll need a map pack for that which you can get here. Unfortunately OpenArena is not GPL compatible, hence it is not included by default.

All you have to do to install the pack is move it into the application like so:

mv oa.game /Applications/NetRadiant.app/Contents/MacOS/install/
mv games/oa.game /Applications/NetRadiant/Contents/MacOS/install/games/

Restart the application and select OpenArena as your game engine, then get mapping!

Taking OpenGL Fullscreen with Cocoa

7 months ago — 4 Comments — Permalink

  • opengl
  • cocoa
  • objective-c
  • xcode
  • interface-builder
  • how-to

This is a quick how-to on dynamically making a Cocoa OpenGL view fullscreen. It’s pretty simple really - when the user initiates fullscreen, we call a method on our view which creates a new borderless window on top of all other windows and sets the contents to be our view. For this, I’m going to go ahead and assume that you have created a custom OpenGLView and have instantiated it in a regular NSWindow.

We’ll start off by adding a few variables to the view interface. These will allow us to keep track of the non-fullscreen starting window and our newly created fullscreen window, as well as which state we are in. It is important to keep track of the starting window so that we know where to restore the view to when switching away from fullscreen.

@interface MyOpenGLView : NSOpenGLView {
    NSWindow *fullscreenWindow;
    NSWindow *startingWindow;
    BOOL fullscreenOn;
}

@property (assign) IBOutlet NSWindow *startingWindow;

- (IBAction) toggleFullscreen:(id)sender;

Now, in the implementation we synthesize startingWindow so that we have access to it:

@synthesize startingWindow;

Also in the implementation, the toggleFullscreen method should look something like this:

- (IBAction) toggleFullScreen:(id)sender {
    if( fullscreenOn == true ) {
        [fullscreenWindow close];
        [startingWindow setAcceptsMouseMovedEvents:YES];
        [startingWindow setContentView: self];
        [startingWindow makeKeyAndOrderFront: self];
        [startingWindow makeFirstResponder: self];
        fullscreenOn = false;
    }
    else  {
        NSRect frame = [[NSScreen mainScreen] frame];
        // Instantiate new borderless window
        fullscreenWindow = [[NSWindow alloc]
                            initWithContentRect:frame
                            styleMask:NSBorderlessWindowMask
                            backing:NSBackingStoreBuffered
                            defer: NO];
        [startingWindow setAcceptsMouseMovedEvents:NO];
        if(fullscreenWindow != nil) {
            // Set the options for our new fullscreen window
            [fullscreenWindow setTitle: @"Full Screen"];            
            [fullscreenWindow setReleasedWhenClosed: YES];
            [fullscreenWindow setAcceptsMouseMovedEvents:YES];
            [fullscreenWindow setContentView: self];
            [fullscreenWindow makeKeyAndOrderFront:self ];
            // By setting the window level to just beneath the screensaver,
            // only this window will be visible (no menu bar or dock)
            [fullscreenWindow setLevel: NSScreenSaverWindowLevel-1];
            [fullscreenWindow makeFirstResponder:self];
            fullscreenOn = true;
        } else {
            NSLog(@"Error: could not create fullscreen window!");
        }
    }
}

We can now tie everything together in Interface Builder by hooking up the startingWindow outlet to our main window:

Connect the view outlet to out main window

And finally, create a menu option which we hook up to the toggleFullscreen action of our view:

Connect the fullscreen menu option to the toggleFullscreen action of our view

Save, rebuild and enjoy fullscreen goodness!

Preparing Your Mac For Resale

1 year, 6 months ago — 0 Comments — Permalink

  • mac
  • resale
  • how-to

Update: Since posting this article I’ve had a few emails - I’d like to clarify that this does work with Adobe apps such as Photoshop (although you must be careful about the licensing issues!). Thanks to those who who sent me pleasant emails and to RedAntArmy who spread the word over at MacRumours.

I recently sold my first gen Macbook Pro and thought I’d share a few tricks that hopefully gave the buyer a pleasant experience. I figured it would be best to start with a full reinstall of OS X 10.5 Leopard. This solves two problems: All my personal data is removed, and there is no unnecessary bloat left for the new user. You could stop there, however wouldn’t it be nice if all the software was up to date yet the user still got to see the intro movie and setup their own account? To do this we just create our own temporary account, install and update any software, then remove the temporary account and remove the Setup Assistant flag file so that the intro movie is played and the Setup Assistant is presented to the user when the computer is next booted. Simple.

After the fresh installation, boot up the computer and setup a demo account in Setup Assistant. Make sure you remember the short username you used. Once completed, install updates by running Software Update from the Apple () menu. At this point I also upgraded iLife. After this, restart the system in Single User Mode by holding down Command-S (⌘-S). You’ll be presented with a full screen terminal in which you should type the following commands: Start with a disk check and mount it in write mode:

/sbin/fsck -y
/sbin/mount -uw

We can then delete our temporary account with the following, replacing [username] with the short username you used earlier:

rm -R /Users/[username]/
rm /var/db/dslocal/nodes/Default/users/[username].plist

And reset Setup Assistant:

rm /var/db/.AppleSetupDone

You can then shutdown the mac with:

shutdown -h now

… and you’re done. Another thing you can do is ship the mac in it’s original packaging, which not only ensures it gets to the buyer safely but also adds to the user experience because Apple’s packaging is always so pleasant.

« NewerOlder »

Log in

Powered by Mumblr – a basic Django tumblelog application that uses MongoDB with MongoEngine. Fork it on Github. Designed and developed by Harry Marr and Steve Challis.

Unless otherwise noted, everything here is available under the Creative Commons Attribution-Share Alike 3.0 license. Sharing is fucking cool.

Home / Projects / Recent / Archive / RSS /