File: programming/cocoa/MacScare-Source.zip/MacScare-Source/GlkSession.m


//
//  GlkSession.m
//  CocoaGlk
//
//  Created by Andrew Hunter on Wed Jun 11 2003.
//  Copyright (c) 2003 Andrew Hunter. All rights reserved.
//
 
#import "GlkSession.h"
#import "GlkWindowView.h"
#import "GlkFileStream.h"
#import "GlkMemoryStream.h"
#import "GlkStatus.h"
#import "glkstart.h"
#define propI    @"Gill Sans"
#define propII   @"Times-Italic"
#define propIII  @"Times-Bold"
 
#define fixFont  @"Courier"
#define propSize 14
#define fixSize  12
"GlkSessionKey""GlkStatus""GlkFlushDemBuffers"#define runningInMainThread ([NSThread currentThread] == mainThread)
 
// == Startup ==
"SaveDirectory"// == Initialisation ==
// Setup
// Images
// Events
// Threads
// Create the user interface elements
// Fonts
// Styles
// Default stylehints
// Setup the UI, display the window
// == User functions ==
 
// -----------------------------------------------------------------------------
//	glkMain:
//		Run the specified game in this session. This synthesizes a command line
//		based on the file path passed in and hands that to the user's
//		glkunix_startup_code() function. Since we only allow one running game
//		right now, this quits the application after that.
//
//	REVISIONS:
//		2004-03-13	witness	Created.
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
//	_threadMain:
//		This hands on the file name of the game file to run to glkMain:.
//
//	REVISIONS:
//		2004-03-13	witness	Added filename parameter.
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
//	queueTheMusic:
//		Actually starts this session and runs it in a separate thread.
//		This hands on the file name of the game file to run to _threadMain:.
//
//	REVISIONS:
//		2004-03-13	witness	Added filename parameter.
// -----------------------------------------------------------------------------
// == Session management ==
 
// Top-level glk functions
"Calling exit from the main thread not implemented yet""*** BUG: FUNCTION NOT IMPLEMENTED\n");
}
 
 
    // Gestalt functions
// Grr
// IMPLEMENT ME :-)
// DITTO
// IMPLEMENT ME
// IMPLEMENT THIS LOT
"*** BUG: FUNCTION NOT IMPLEMENTED\n""*** BUG: FUNCTION NOT IMPLEMENTED\n");
}
 
// == Window management ==
// Return the window in this thread
// Return a reference to the window
// return rootWindow;
// == Stream management ==
// -----------------------------------------------------------------------------
//	openFileWithForcedName:usage:withMode:rock:
//		This method allows opening a GlkStream for *any* file. This is used
//		by glkunix_stream_open_pathname() to allow opening streams to game files
//		at startup.
//
//	REVISIONS:
//		2004-03-13	witness	Created.
// -----------------------------------------------------------------------------
// Memory is owned by whoever creates the stream
    // Currently we ignore mode...
// == Filerefs ==
// Send a request that the dialog be shown
// Wait for the dialog to finish
/*
        return [(GlkSession*)[glkthreadConnection rootProxy] fileRefByPromptingForMode: fmode
                                                                                  rock: rock
                                                                             withUsage: usage];
         */"fileRefByPromptingForMode cannot be run in the main thread""*** BUG: FUNCTION NOT IMPLEMENTED\n");
}
 
// == Dealing with save/open panels ==
// Unknown mode
// Display the panel
"SaveDirectory""SaveDirectory""SaveDirectory""SaveDirectory"// == The iteration functions ==
"*** BUG: FUNCTION NOT IMPLEMENTED\n");
}
 
// == Glk events ==
// Queue an arrange event
// Dummy method called to force an NSRunloop to retun
"Warning: select: called from main thread");
    }
 
    // Setup
// Flush any buffers
// Release any autoreleased objects that are pending
// Get the next event
// Wait for an event to arrive (if none are waiting)
// Do the RunLoop thang (allow other threads to call us)
// Use eventWithEvent to create a local copy of the event
// Run only in the main thread
"*** BUG: FUNCTION NOT IMPLEMENTED\n");
}
 
// == Housekeeping ==
// Threading
// The window
// == Event handling ==
"Attempt to queue nil event"// Signal the thread
"Warning: cancelEventsForWindow called from the wrong thread"// Only execute this in the main thread
// Pop the next event
// No events
// Unlock the lock
"windowHasBeenArranged can only be called from the main thread"// == Window events ==
// Queue an arrange event
// == Images ==
// Create the image
"Image %i not found"// Get the image fromt the cache
// Move the object to the front of the cache
"logo" ofType:@"png"

This code uses the PclZip Zip File reading code, which is subject to the GNU LGPL. It also uses the GeSHi syntax highlighter, subject to the GPL. Ask if you want this for your own web site, it's free.