├── Game.ulx ├── Icon.png ├── Default.png ├── Icon-50.png ├── Icon-72.png ├── Icon-76.png ├── Icon@2x.png ├── Default@2x.png ├── Icon-40@2x.png ├── Icon-50@2x.png ├── Icon-60@2x.png ├── Icon-72@2x.png ├── Icon-76@2x.png ├── Icon-Small.png ├── README ├── iTunesArtwork ├── Icon-Small-50.png ├── Icon-Small@2x.png ├── Media ├── col-12.png ├── col-34.png ├── checkmark.png ├── col-12@2x.png ├── col-34@2x.png ├── col-full.png ├── lead-wide.png ├── baricon-edit.png ├── checkmark-s.png ├── checkmark@2x.png ├── col-12-sel.png ├── col-34-sel.png ├── col-full-sel.png ├── col-full@2x.png ├── detail-arrow.png ├── lead-narrow.png ├── lead-wide@2x.png ├── tabicon-game.png ├── tabicon-help.png ├── baricon-styles.png ├── brightness-hi.png ├── brightness-lo.png ├── checkmark-s@2x.png ├── col-12-sel@2x.png ├── col-34-sel@2x.png ├── lead-narrow@2x.png ├── tabicon-notes.png ├── background-notes.png ├── baricon-edit-old.png ├── baricon-edit@2x.png ├── baricon-edit@3x.png ├── baricon-styles@2x.png ├── baricon-styles@3x.png ├── brightness-hi@2x.png ├── brightness-lo@2x.png ├── button-detail-hi.png ├── col-full-sel@2x.png ├── detail-arrow@2x.png ├── tabicon-game@2x.png ├── tabicon-game@3x.png ├── tabicon-help@2x.png ├── tabicon-help@3x.png ├── tabicon-notes@2x.png ├── tabicon-notes@3x.png ├── tabicon-settings.png ├── background-notes-s.png ├── baricon-edit-old@2x.png ├── baricon-edit-old@3x.png ├── baricon-styles-old.png ├── button-detail-base.png ├── button-detail-hi@2x.png ├── tabicon-settings@2x.png ├── tabicon-settings@3x.png ├── background-notesopaque.png ├── baricon-styles-old@2x.png ├── baricon-styles-old@3x.png ├── button-detail-base@2x.png └── background-notesopaque-s.png ├── Default-568h@2x.png ├── Default-New@2x.png ├── Default-Landscape.png ├── Default-Portrait.png ├── Icon-Small-50@2x.png ├── Default-New-568h@2x.png ├── Default-New-Portrait.png ├── Default-New-Landscape.png ├── .gitmodules ├── iosglulxe_Prefix.pch ├── TerpSrc ├── HelpViewController.h ├── TerpGlkWindows.h ├── TerpGameOverView.h ├── DisplayWebViewController.h ├── DisplayTextViewController.h ├── GradientView.h ├── TranscriptViewController.h ├── NotesViewController.h ├── TerpGlkViewController.h ├── TerpGameOverView.m ├── SettingsViewController.h ├── TerpGlkWindows.m ├── TerpGlkDelegate.h ├── ShareFilesViewController.h ├── PrefsMenuView.h ├── DisplayWebViewController.m ├── HelpViewController.m ├── GradientView.m ├── DisplayTextViewController.m ├── TranscriptViewController.m ├── SettingsViewController.m ├── TerpGlkViewController.m ├── NotesViewController.m ├── TerpGlkDelegate.m └── PrefsMenuView.m ├── main.m ├── Resources ├── en.lproj │ └── TerpLocalize.strings ├── HelpVC.xib ├── WebDocVC.xib ├── TranscriptVC.xib ├── IosGlkViewController.xib ├── ShareFilesVC.xib └── Base.lproj │ ├── FatalGameOverView.xib │ ├── SettingsVC.xib │ ├── NotesVC.xib │ └── NotesVC~ipad.xib ├── TODO ├── WebSite ├── license.html ├── page.css └── index.html └── iosglulxe-Info.plist /Game.ulx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/erkyrath/iosglulxe/HEAD/Game.ulx -------------------------------------------------------------------------------- /Icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/erkyrath/iosglulxe/HEAD/Icon.png -------------------------------------------------------------------------------- /Default.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/erkyrath/iosglulxe/HEAD/Default.png -------------------------------------------------------------------------------- /Icon-50.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/erkyrath/iosglulxe/HEAD/Icon-50.png -------------------------------------------------------------------------------- /Icon-72.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/erkyrath/iosglulxe/HEAD/Icon-72.png -------------------------------------------------------------------------------- /Icon-76.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/erkyrath/iosglulxe/HEAD/Icon-76.png -------------------------------------------------------------------------------- /Icon@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/erkyrath/iosglulxe/HEAD/Icon@2x.png -------------------------------------------------------------------------------- /Default@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/erkyrath/iosglulxe/HEAD/Default@2x.png -------------------------------------------------------------------------------- /Icon-40@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/erkyrath/iosglulxe/HEAD/Icon-40@2x.png -------------------------------------------------------------------------------- /Icon-50@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/erkyrath/iosglulxe/HEAD/Icon-50@2x.png -------------------------------------------------------------------------------- /Icon-60@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/erkyrath/iosglulxe/HEAD/Icon-60@2x.png -------------------------------------------------------------------------------- /Icon-72@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/erkyrath/iosglulxe/HEAD/Icon-72@2x.png -------------------------------------------------------------------------------- /Icon-76@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/erkyrath/iosglulxe/HEAD/Icon-76@2x.png -------------------------------------------------------------------------------- /Icon-Small.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/erkyrath/iosglulxe/HEAD/Icon-Small.png -------------------------------------------------------------------------------- /README: -------------------------------------------------------------------------------- 1 | This project is a combination of two subprojects: glulxe and iosglk. 2 | -------------------------------------------------------------------------------- /iTunesArtwork: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/erkyrath/iosglulxe/HEAD/iTunesArtwork -------------------------------------------------------------------------------- /Icon-Small-50.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/erkyrath/iosglulxe/HEAD/Icon-Small-50.png -------------------------------------------------------------------------------- /Icon-Small@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/erkyrath/iosglulxe/HEAD/Icon-Small@2x.png -------------------------------------------------------------------------------- /Media/col-12.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/erkyrath/iosglulxe/HEAD/Media/col-12.png -------------------------------------------------------------------------------- /Media/col-34.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/erkyrath/iosglulxe/HEAD/Media/col-34.png -------------------------------------------------------------------------------- /Default-568h@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/erkyrath/iosglulxe/HEAD/Default-568h@2x.png -------------------------------------------------------------------------------- /Default-New@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/erkyrath/iosglulxe/HEAD/Default-New@2x.png -------------------------------------------------------------------------------- /Media/checkmark.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/erkyrath/iosglulxe/HEAD/Media/checkmark.png -------------------------------------------------------------------------------- /Media/col-12@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/erkyrath/iosglulxe/HEAD/Media/col-12@2x.png -------------------------------------------------------------------------------- /Media/col-34@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/erkyrath/iosglulxe/HEAD/Media/col-34@2x.png -------------------------------------------------------------------------------- /Media/col-full.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/erkyrath/iosglulxe/HEAD/Media/col-full.png -------------------------------------------------------------------------------- /Media/lead-wide.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/erkyrath/iosglulxe/HEAD/Media/lead-wide.png -------------------------------------------------------------------------------- /Default-Landscape.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/erkyrath/iosglulxe/HEAD/Default-Landscape.png -------------------------------------------------------------------------------- /Default-Portrait.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/erkyrath/iosglulxe/HEAD/Default-Portrait.png -------------------------------------------------------------------------------- /Icon-Small-50@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/erkyrath/iosglulxe/HEAD/Icon-Small-50@2x.png -------------------------------------------------------------------------------- /Media/baricon-edit.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/erkyrath/iosglulxe/HEAD/Media/baricon-edit.png -------------------------------------------------------------------------------- /Media/checkmark-s.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/erkyrath/iosglulxe/HEAD/Media/checkmark-s.png -------------------------------------------------------------------------------- /Media/checkmark@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/erkyrath/iosglulxe/HEAD/Media/checkmark@2x.png -------------------------------------------------------------------------------- /Media/col-12-sel.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/erkyrath/iosglulxe/HEAD/Media/col-12-sel.png -------------------------------------------------------------------------------- /Media/col-34-sel.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/erkyrath/iosglulxe/HEAD/Media/col-34-sel.png -------------------------------------------------------------------------------- /Media/col-full-sel.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/erkyrath/iosglulxe/HEAD/Media/col-full-sel.png -------------------------------------------------------------------------------- /Media/col-full@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/erkyrath/iosglulxe/HEAD/Media/col-full@2x.png -------------------------------------------------------------------------------- /Media/detail-arrow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/erkyrath/iosglulxe/HEAD/Media/detail-arrow.png -------------------------------------------------------------------------------- /Media/lead-narrow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/erkyrath/iosglulxe/HEAD/Media/lead-narrow.png -------------------------------------------------------------------------------- /Media/lead-wide@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/erkyrath/iosglulxe/HEAD/Media/lead-wide@2x.png -------------------------------------------------------------------------------- /Media/tabicon-game.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/erkyrath/iosglulxe/HEAD/Media/tabicon-game.png -------------------------------------------------------------------------------- /Media/tabicon-help.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/erkyrath/iosglulxe/HEAD/Media/tabicon-help.png -------------------------------------------------------------------------------- /Default-New-568h@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/erkyrath/iosglulxe/HEAD/Default-New-568h@2x.png -------------------------------------------------------------------------------- /Default-New-Portrait.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/erkyrath/iosglulxe/HEAD/Default-New-Portrait.png -------------------------------------------------------------------------------- /Media/baricon-styles.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/erkyrath/iosglulxe/HEAD/Media/baricon-styles.png -------------------------------------------------------------------------------- /Media/brightness-hi.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/erkyrath/iosglulxe/HEAD/Media/brightness-hi.png -------------------------------------------------------------------------------- /Media/brightness-lo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/erkyrath/iosglulxe/HEAD/Media/brightness-lo.png -------------------------------------------------------------------------------- /Media/checkmark-s@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/erkyrath/iosglulxe/HEAD/Media/checkmark-s@2x.png -------------------------------------------------------------------------------- /Media/col-12-sel@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/erkyrath/iosglulxe/HEAD/Media/col-12-sel@2x.png -------------------------------------------------------------------------------- /Media/col-34-sel@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/erkyrath/iosglulxe/HEAD/Media/col-34-sel@2x.png -------------------------------------------------------------------------------- /Media/lead-narrow@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/erkyrath/iosglulxe/HEAD/Media/lead-narrow@2x.png -------------------------------------------------------------------------------- /Media/tabicon-notes.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/erkyrath/iosglulxe/HEAD/Media/tabicon-notes.png -------------------------------------------------------------------------------- /Default-New-Landscape.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/erkyrath/iosglulxe/HEAD/Default-New-Landscape.png -------------------------------------------------------------------------------- /Media/background-notes.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/erkyrath/iosglulxe/HEAD/Media/background-notes.png -------------------------------------------------------------------------------- /Media/baricon-edit-old.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/erkyrath/iosglulxe/HEAD/Media/baricon-edit-old.png -------------------------------------------------------------------------------- /Media/baricon-edit@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/erkyrath/iosglulxe/HEAD/Media/baricon-edit@2x.png -------------------------------------------------------------------------------- /Media/baricon-edit@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/erkyrath/iosglulxe/HEAD/Media/baricon-edit@3x.png -------------------------------------------------------------------------------- /Media/baricon-styles@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/erkyrath/iosglulxe/HEAD/Media/baricon-styles@2x.png -------------------------------------------------------------------------------- /Media/baricon-styles@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/erkyrath/iosglulxe/HEAD/Media/baricon-styles@3x.png -------------------------------------------------------------------------------- /Media/brightness-hi@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/erkyrath/iosglulxe/HEAD/Media/brightness-hi@2x.png -------------------------------------------------------------------------------- /Media/brightness-lo@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/erkyrath/iosglulxe/HEAD/Media/brightness-lo@2x.png -------------------------------------------------------------------------------- /Media/button-detail-hi.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/erkyrath/iosglulxe/HEAD/Media/button-detail-hi.png -------------------------------------------------------------------------------- /Media/col-full-sel@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/erkyrath/iosglulxe/HEAD/Media/col-full-sel@2x.png -------------------------------------------------------------------------------- /Media/detail-arrow@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/erkyrath/iosglulxe/HEAD/Media/detail-arrow@2x.png -------------------------------------------------------------------------------- /Media/tabicon-game@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/erkyrath/iosglulxe/HEAD/Media/tabicon-game@2x.png -------------------------------------------------------------------------------- /Media/tabicon-game@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/erkyrath/iosglulxe/HEAD/Media/tabicon-game@3x.png -------------------------------------------------------------------------------- /Media/tabicon-help@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/erkyrath/iosglulxe/HEAD/Media/tabicon-help@2x.png -------------------------------------------------------------------------------- /Media/tabicon-help@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/erkyrath/iosglulxe/HEAD/Media/tabicon-help@3x.png -------------------------------------------------------------------------------- /Media/tabicon-notes@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/erkyrath/iosglulxe/HEAD/Media/tabicon-notes@2x.png -------------------------------------------------------------------------------- /Media/tabicon-notes@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/erkyrath/iosglulxe/HEAD/Media/tabicon-notes@3x.png -------------------------------------------------------------------------------- /Media/tabicon-settings.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/erkyrath/iosglulxe/HEAD/Media/tabicon-settings.png -------------------------------------------------------------------------------- /Media/background-notes-s.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/erkyrath/iosglulxe/HEAD/Media/background-notes-s.png -------------------------------------------------------------------------------- /Media/baricon-edit-old@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/erkyrath/iosglulxe/HEAD/Media/baricon-edit-old@2x.png -------------------------------------------------------------------------------- /Media/baricon-edit-old@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/erkyrath/iosglulxe/HEAD/Media/baricon-edit-old@3x.png -------------------------------------------------------------------------------- /Media/baricon-styles-old.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/erkyrath/iosglulxe/HEAD/Media/baricon-styles-old.png -------------------------------------------------------------------------------- /Media/button-detail-base.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/erkyrath/iosglulxe/HEAD/Media/button-detail-base.png -------------------------------------------------------------------------------- /Media/button-detail-hi@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/erkyrath/iosglulxe/HEAD/Media/button-detail-hi@2x.png -------------------------------------------------------------------------------- /Media/tabicon-settings@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/erkyrath/iosglulxe/HEAD/Media/tabicon-settings@2x.png -------------------------------------------------------------------------------- /Media/tabicon-settings@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/erkyrath/iosglulxe/HEAD/Media/tabicon-settings@3x.png -------------------------------------------------------------------------------- /Media/background-notesopaque.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/erkyrath/iosglulxe/HEAD/Media/background-notesopaque.png -------------------------------------------------------------------------------- /Media/baricon-styles-old@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/erkyrath/iosglulxe/HEAD/Media/baricon-styles-old@2x.png -------------------------------------------------------------------------------- /Media/baricon-styles-old@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/erkyrath/iosglulxe/HEAD/Media/baricon-styles-old@3x.png -------------------------------------------------------------------------------- /Media/button-detail-base@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/erkyrath/iosglulxe/HEAD/Media/button-detail-base@2x.png -------------------------------------------------------------------------------- /Media/background-notesopaque-s.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/erkyrath/iosglulxe/HEAD/Media/background-notesopaque-s.png -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "glulxe"] 2 | path = glulxe 3 | url = ../glulxe.git 4 | [submodule "iosglk"] 5 | path = iosglk 6 | url = ../iosglk.git 7 | -------------------------------------------------------------------------------- /iosglulxe_Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header for all source files of the 'iosglulxe' target in the 'iosglulxe' project 3 | // 4 | 5 | #ifdef __OBJC__ 6 | #import 7 | #import 8 | 9 | #import 10 | #else 11 | #define OS_UNIX // The Glulxe source likes this defined. 12 | #endif 13 | -------------------------------------------------------------------------------- /TerpSrc/HelpViewController.h: -------------------------------------------------------------------------------- 1 | /* HelpViewController.h: Interpreter help tab view controller 2 | for IosGlulxe, an IosGlk port of the Glulxe interpreter. 3 | Designed by Andrew Plotkin 4 | http://eblong.com/zarf/glk/ 5 | */ 6 | 7 | #import 8 | 9 | @interface HelpViewController : UIViewController 10 | 11 | @property (nonatomic, retain) IBOutlet UIWebView *webview; 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /TerpSrc/TerpGlkWindows.h: -------------------------------------------------------------------------------- 1 | /* TerpGlkWindows.h: Interpreter-specific window buffer subclasses, for the IosGlk library 2 | for IosGlulxe, an IosGlk port of the Glulxe interpreter. 3 | Designed by Andrew Plotkin 4 | http://eblong.com/zarf/glk/ 5 | */ 6 | 7 | #import 8 | #import "TerpGlkWindows.h" 9 | #import "GlkWinBufferView.h" 10 | 11 | @interface TerpGlkWinBufferView : GlkWinBufferView 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /TerpSrc/TerpGameOverView.h: -------------------------------------------------------------------------------- 1 | /* TerpGameOverView.h: "Game Over" pop-up dialog 2 | for IosGlulxe, an IosGlk port of the Glulxe interpreter. 3 | Designed by Andrew Plotkin 4 | http://eblong.com/zarf/glk/ 5 | */ 6 | 7 | #import 8 | #import "GameOverView.h" 9 | 10 | @interface TerpGameOverView : GameOverView 11 | 12 | - (IBAction) handleRestartButton:(id)sender; 13 | - (IBAction) handleQuitButton:(id)sender; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /TerpSrc/DisplayWebViewController.h: -------------------------------------------------------------------------------- 1 | /* DisplayWebViewController.h: HTML Display view controller 2 | for IosGlulxe, an IosGlk port of the Glulxe interpreter. 3 | Designed by Andrew Plotkin 4 | http://eblong.com/zarf/glk/ 5 | */ 6 | 7 | #import 8 | 9 | @interface DisplayWebViewController : UIViewController 10 | 11 | @property (nonatomic, retain) IBOutlet UIWebView *webview; 12 | @property (nonatomic, retain) NSString *filename; 13 | @property (nonatomic, retain) NSString *doctitle; 14 | 15 | - (id) initWithNibName:(NSString *)nibName filename:(NSString *)filename title:(NSString *)title bundle:(NSBundle *)nibBundle; 16 | 17 | @end 18 | -------------------------------------------------------------------------------- /TerpSrc/DisplayTextViewController.h: -------------------------------------------------------------------------------- 1 | /* DisplayTextViewController.h: Transcript display view controller 2 | for IosGlulxe, an IosGlk port of the Glulxe interpreter. 3 | Designed by Andrew Plotkin 4 | http://eblong.com/zarf/glk/ 5 | */ 6 | 7 | #import 8 | 9 | @class GlkFileThumb; 10 | 11 | @interface DisplayTextViewController : UIViewController 12 | 13 | @property (nonatomic, retain) IBOutlet UITextView *textview; 14 | @property (nonatomic, retain) IBOutlet UILabel *titlelabel; 15 | @property (nonatomic, retain) IBOutlet UILabel *datelabel; 16 | @property (nonatomic, retain) GlkFileThumb *thumb; 17 | 18 | - (id) initWithNibName:(NSString *)nibName thumb:(GlkFileThumb *)thumb bundle:(NSBundle *)nibBundle; 19 | 20 | @end 21 | -------------------------------------------------------------------------------- /TerpSrc/GradientView.h: -------------------------------------------------------------------------------- 1 | /* GradientView.h: A view that just displays a color gradient 2 | for IosGlulxe, an IosGlk port of the Glulxe interpreter. 3 | Designed by Andrew Plotkin 4 | http://eblong.com/zarf/glk/ 5 | */ 6 | 7 | #import 8 | 9 | 10 | @interface GradientView : UIView { 11 | int numcolors; 12 | UIColor *color0; 13 | UIColor *color1; 14 | UIColor *color2; 15 | UIColor *color3; 16 | UIColor *color4; 17 | } 18 | 19 | @property (nonatomic) int numcolors; 20 | @property (nonatomic, retain) UIColor *color0; 21 | @property (nonatomic, retain) UIColor *color1; 22 | @property (nonatomic, retain) UIColor *color2; 23 | @property (nonatomic, retain) UIColor *color3; 24 | @property (nonatomic, retain) UIColor *color4; 25 | 26 | - (BOOL) hasColors; 27 | - (void) setUpColorsPreset:(int)val; 28 | 29 | @end 30 | -------------------------------------------------------------------------------- /TerpSrc/TranscriptViewController.h: -------------------------------------------------------------------------------- 1 | /* TranscriptViewController.h: Transcript overview display view controller 2 | for IosGlulxe, an IosGlk port of the Glulxe interpreter. 3 | Designed by Andrew Plotkin 4 | http://eblong.com/zarf/glk/ 5 | */ 6 | 7 | #import 8 | 9 | @class GlkFileRefPrompt; 10 | @class GlkFileThumb; 11 | 12 | @interface TranscriptViewController : UIViewController { 13 | UITableView *tableView; 14 | 15 | NSMutableArray *filelist; // array of GlkFileThumb 16 | NSDateFormatter *dateformatter; 17 | } 18 | 19 | @property (nonatomic, retain) IBOutlet UITableView *tableView; 20 | @property (nonatomic, retain) NSMutableArray *filelist; 21 | @property (nonatomic, retain) NSDateFormatter *dateformatter; 22 | 23 | - (id) initWithNibName:(NSString *)nibName bundle:(NSBundle *)nibBundle; 24 | - (void) addBlankThumb; 25 | 26 | @end 27 | -------------------------------------------------------------------------------- /main.m: -------------------------------------------------------------------------------- 1 | /* main.m: Top main() function 2 | for Glulxe, the Glulx VM interpreter. 3 | Designed by Andrew Plotkin 4 | http://eblong.com/zarf/glulx/ 5 | */ 6 | 7 | /* 8 | The source code in this package is copyright 2011 by Andrew Plotkin. You 9 | may copy and distribute it freely, by any means and under any conditions, 10 | as long as the code and documentation is not changed. You may also 11 | incorporate this code into your own program and distribute that, or modify 12 | this code and use and distribute the modified version, as long as you retain 13 | a notice in your program or documentation which mentions my name and the 14 | URL shown above. 15 | */ 16 | 17 | #import 18 | 19 | int main(int argc, char *argv[]) { 20 | 21 | NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; 22 | int retVal = UIApplicationMain(argc, argv, nil, nil); 23 | [pool release]; 24 | return retVal; 25 | } 26 | -------------------------------------------------------------------------------- /TerpSrc/NotesViewController.h: -------------------------------------------------------------------------------- 1 | /* NotesViewController.h: Interpreter notes tab view controller 2 | for IosGlulxe, an IosGlk port of the Glulxe interpreter. 3 | Designed by Andrew Plotkin 4 | http://eblong.com/zarf/glk/ 5 | */ 6 | 7 | #import 8 | 9 | @class GradientView; 10 | @class MButton; 11 | 12 | @interface NotesViewController : UIViewController { 13 | BOOL textchanged; 14 | } 15 | 16 | @property (nonatomic, retain) IBOutlet GradientView *gradview; 17 | @property (nonatomic, retain) IBOutlet UITextView *textview; 18 | @property (nonatomic, retain) IBOutlet UITableView *buttontable; 19 | @property (nonatomic, retain) IBOutlet UITableViewCell *transcriptcell; 20 | 21 | @property (nonatomic, retain) NSString *notespath; 22 | 23 | - (IBAction) toggleKeyboard; 24 | - (IBAction) handleTranscripts; 25 | - (void) saveIfNeeded; 26 | 27 | - (void) adjustToKeyboardBox; 28 | 29 | @end 30 | -------------------------------------------------------------------------------- /TerpSrc/TerpGlkViewController.h: -------------------------------------------------------------------------------- 1 | /* TerpGlkViewController.h: Interpreter-specific subclass of the IosGlk view controller 2 | for IosGlulxe, an IosGlk port of the Glulxe interpreter. 3 | Designed by Andrew Plotkin 4 | http://eblong.com/zarf/glk/ 5 | */ 6 | 7 | #import 8 | #import "IosGlkViewController.h" 9 | 10 | @class NotesViewController; 11 | @class SettingsViewController; 12 | @class TerpGlkDelegate; 13 | @class GlkFileRefPrompt; 14 | 15 | @interface TerpGlkViewController : IosGlkViewController 16 | 17 | @property (nonatomic, retain) IBOutlet NotesViewController *notesvc; 18 | @property (nonatomic, retain) IBOutlet SettingsViewController *settingsvc; 19 | 20 | + (TerpGlkViewController *) singleton; 21 | 22 | - (TerpGlkDelegate *) terpDelegate; 23 | - (IBAction) showPreferences; 24 | - (void) handleSwipeLeft:(UIGestureRecognizer *)recognizer; 25 | - (void) handleSwipeRight:(UIGestureRecognizer *)recognizer; 26 | 27 | @end 28 | -------------------------------------------------------------------------------- /TerpSrc/TerpGameOverView.m: -------------------------------------------------------------------------------- 1 | /* TerpGameOverView.m: "Game Over" pop-up dialog 2 | for IosGlulxe, an IosGlk port of the Glulxe interpreter. 3 | Designed by Andrew Plotkin 4 | http://eblong.com/zarf/glk/ 5 | */ 6 | 7 | #import "TerpGameOverView.h" 8 | #import "TerpGlkViewController.h" 9 | #import "GlkAppWrapper.h" 10 | #import "GlkLibrary.h" 11 | #import "GlkFileRef.h" 12 | #import "GlkFrameView.h" 13 | #import "GlkFileTypes.h" 14 | 15 | #import "iosstart.h" 16 | 17 | @implementation TerpGameOverView 18 | 19 | - (void) dealloc { 20 | [super dealloc]; 21 | } 22 | 23 | - (NSString *) nibForContent { 24 | if (iosglk_can_restart_cleanly()) 25 | return @"GameOverView"; 26 | else 27 | return @"FatalGameOverView"; 28 | } 29 | 30 | - (IBAction) handleRestartButton:(id)sender { 31 | [self.superviewAsFrameView removePopMenuAnimated:YES]; 32 | [[GlkAppWrapper singleton] acceptEventRestart]; 33 | } 34 | 35 | - (IBAction) handleQuitButton:(id)sender { 36 | iosglk_shut_down_process(); 37 | } 38 | 39 | @end 40 | -------------------------------------------------------------------------------- /TerpSrc/SettingsViewController.h: -------------------------------------------------------------------------------- 1 | /* SettingsViewController.h: Interpreter settings tab view controller 2 | for IosGlulxe, an IosGlk port of the Glulxe interpreter. 3 | Designed by Andrew Plotkin 4 | http://eblong.com/zarf/glk/ 5 | */ 6 | 7 | #import 8 | 9 | @interface SettingsViewController : UIViewController 10 | 11 | @property (nonatomic, retain) IBOutlet UITableView *tableview; 12 | 13 | @property (nonatomic, retain) IBOutlet UITableViewCell *autocorrectcell; 14 | @property (nonatomic, retain) IBOutlet UITableViewCell *keepopencell; 15 | @property (nonatomic, retain) IBOutlet UITableViewCell *sharefilescell; 16 | @property (nonatomic, retain) IBOutlet UITableViewCell *licensecell; 17 | 18 | @property (nonatomic, retain) IBOutlet UISwitch *autocorrectswitch; 19 | @property (nonatomic, retain) IBOutlet UISwitch *keepopenswitch; 20 | 21 | - (IBAction) handleAutoCorrect:(id)sender; 22 | - (IBAction) handleKeepOpen:(id)sender; 23 | - (void) handleLicenses; 24 | - (void) handleShareFiles; 25 | - (void) handleShareFilesHighlightUsage:(int)usage name:(NSString *)filename; 26 | 27 | @end 28 | -------------------------------------------------------------------------------- /TerpSrc/TerpGlkWindows.m: -------------------------------------------------------------------------------- 1 | /* TerpGlkWindows.m: Interpreter-specific window buffer subclasses, for the IosGlk library 2 | for IosGlulxe, an IosGlk port of the Glulxe interpreter. 3 | Designed by Andrew Plotkin 4 | http://eblong.com/zarf/glk/ 5 | */ 6 | 7 | #import "TerpGlkWindows.h" 8 | #import "StyledTextView.h" 9 | #import "TerpGlkViewController.h" 10 | #import "TerpGlkDelegate.h" 11 | 12 | @implementation TerpGlkWinBufferView 13 | 14 | - (id) initWithWindow:(GlkWindowState *)winref frame:(CGRect)box margin:(UIEdgeInsets)margin { 15 | self = [super initWithWindow:winref frame:box margin:margin]; 16 | if (self) { 17 | TerpGlkViewController *glkviewc = [TerpGlkViewController singleton]; 18 | BOOL isdark = glkviewc.terpDelegate.hasDarkTheme; 19 | self.textview.indicatorStyle = (isdark ? UIScrollViewIndicatorStyleWhite : UIScrollViewIndicatorStyleDefault); 20 | } 21 | return self; 22 | } 23 | 24 | - (void) uncacheLayoutAndStyles { 25 | [super uncacheLayoutAndStyles]; 26 | 27 | TerpGlkViewController *glkviewc = [TerpGlkViewController singleton]; 28 | BOOL isdark = glkviewc.terpDelegate.hasDarkTheme; 29 | self.textview.indicatorStyle = (isdark ? UIScrollViewIndicatorStyleWhite : UIScrollViewIndicatorStyleDefault); 30 | } 31 | 32 | @end 33 | -------------------------------------------------------------------------------- /TerpSrc/TerpGlkDelegate.h: -------------------------------------------------------------------------------- 1 | /* TerpGlkDelegate.h: Interpreter-specific delegate for the IosGlk library 2 | for IosGlulxe, an IosGlk port of the Glulxe interpreter. 3 | Designed by Andrew Plotkin 4 | http://eblong.com/zarf/glk/ 5 | */ 6 | 7 | #import 8 | #import "IosGlkLibDelegate.h" 9 | #import "StyleSet.h" 10 | 11 | #define FONTSCALE_MAX (9) 12 | #define LEADING_MAX (5) 13 | 14 | @interface TerpGlkDelegate : NSObject { 15 | int maxwidth; // 0 for full-width, 1 for 3/4-ish, 2 for 1/2-ish. 16 | NSString *fontfamily; // as the user knows it -- not necessarily the true family name 17 | int fontscale; // a number from 1 to FONTSCALE_MAX 18 | int colorscheme; // 0:Bright, 1:Quiet, 2:Dark 19 | int leading; // 0 to LEADING_MAX 20 | } 21 | 22 | @property (nonatomic) int maxwidth; 23 | /* The following properties are read from multiple threads, so we declare them atomic. */ 24 | @property (retain) NSString *fontfamily; 25 | @property int fontscale; 26 | @property int colorscheme; 27 | @property int leading; 28 | 29 | - (NSString *) gameTitle; 30 | - (NSString *) gamePath; 31 | - (UIColor *) genBackgroundColor; 32 | - (UIColor *) genForegroundColor; 33 | - (FontVariants) fontVariantsForSize:(CGFloat)size label:(NSString *)label; 34 | 35 | @end 36 | -------------------------------------------------------------------------------- /Resources/en.lproj/TerpLocalize.strings: -------------------------------------------------------------------------------- 1 | /* TerpLocalize.strings: Interpreter-level localization strings 2 | for IosGlulxe, an IosGlk port of the Glulxe interpreter. 3 | Designed by Andrew Plotkin 4 | http://eblong.com/zarf/glk/ 5 | */ 6 | 7 | "button.cancel" = "Cancel"; 8 | "button.drat" = "Phooey"; 9 | 10 | "title.game" = "Adventure"; 11 | "title.transcript" = "Transcript"; 12 | "title.transcripts" = "Transcripts"; 13 | "title.noshareapps" = "Unable to Share"; 14 | "title.sharefiles" = "Share Files"; 15 | 16 | "label.text-styles" = "Text Styles"; 17 | "label.keyboard" = "Keyboard"; 18 | "label.no-transcripts" = "No stored transcripts"; 19 | "label.no-share-files" = "No stored files"; 20 | "label.copy-all" = "Copy All"; 21 | "label.email" = "Email"; 22 | "label.noshareapps" = "None of your apps can accept files of this type. (Try installing a file-management app such as Dropbox)."; 23 | 24 | "settings.section.settings" = "Text Entry and Display"; 25 | "settings.footer.settings" = "If you have Auto-Correction turned off in your iOS Settings, this option will not apply."; 26 | "settings.title.license" = "License Information"; 27 | 28 | "settings.cell.license" = "License Information"; 29 | "settings.cell.autocorrect" = "Auto-Correction"; 30 | "settings.cell.keepopen" = "Keyboard Stays Open"; 31 | "settings.cell.sharefiles" = "Share Saved Files"; 32 | -------------------------------------------------------------------------------- /TerpSrc/ShareFilesViewController.h: -------------------------------------------------------------------------------- 1 | /* ShareFilesViewController.h: Files list overview display view controller 2 | for IosGlulxe, an IosGlk port of the Glulxe interpreter. 3 | Designed by Andrew Plotkin 4 | http://eblong.com/zarf/glk/ 5 | */ 6 | 7 | #import 8 | 9 | @class GlkFileRefPrompt; 10 | @class GlkFileThumb; 11 | 12 | @interface ShareFilesViewController : UIViewController { 13 | UITableView *tableView; 14 | UIBarButtonItem *sendbutton; 15 | int highlightusage; 16 | NSString *highlightname; 17 | UIDocumentInteractionController *sharedocic; 18 | NSString *sharetemppath; 19 | 20 | NSMutableArray *filelists; // array of (nonempty) arrays of GlkFileThumb 21 | NSDateFormatter *dateformatter; 22 | } 23 | 24 | @property (nonatomic, retain) IBOutlet UITableView *tableView; 25 | @property (nonatomic, retain) UIBarButtonItem *sendbutton; 26 | @property (nonatomic) int highlightusage; 27 | @property (nonatomic, retain) NSString *highlightname; 28 | @property (nonatomic, retain) UIDocumentInteractionController *sharedocic; 29 | @property (nonatomic, retain) NSString *sharetemppath; 30 | @property (nonatomic, retain) NSMutableArray *filelists; 31 | @property (nonatomic, retain) NSDateFormatter *dateformatter; 32 | 33 | - (id) initWithNibName:(NSString *)nibName bundle:(NSBundle *)nibBundle; 34 | - (void) addBlankThumb; 35 | 36 | @end 37 | -------------------------------------------------------------------------------- /TODO: -------------------------------------------------------------------------------- 1 | (skip) Select/deselect the keyboard button as keyboard goes in/out. 2 | 3 | (skip) Don't select a blank line as a paragraph? 4 | 5 | (fuk dat) Can I use transitionFromViewController in the tab bar controller to animate swipes? 6 | 7 | (nope) Test bluetooth keyboard; see about up/down arrows 8 | 9 | (ignore) on iOS3, transcript viewer, action menu: "cancel" button doesn't work 10 | 11 | (nobody cares) Note achievement strangeness on support page? (How to refetch missed achievements; command chains don't work.) 12 | 13 | (enh) Stick a compass image behind the compass labels. 14 | 15 | (1.2?) iCloud support. Also, DropBox support. (Requires UI thinking.) 16 | 17 | Background color bug! (Changing color scheme when text is shorter than the screen.) Fixes on next layoutsubviews? 18 | 19 | Style breaks shouldn't necessarily be wrap breaks. (E.g. "*command*") 20 | 21 | While we're thinking about that, get images to work. 22 | 23 | On iOS3/4, the notes page doesn't inset properly when the keyboard is open. 24 | 25 | On iOS4, we should be retrying achievement failures. 26 | 27 | Add a context menu (when selecting a word) to stick it into various common commands? (In the edit menu, or change double-tap?) 28 | 29 | ...We kind of need a magnifying reticle for that. 30 | 31 | Can we make the bookmark button taller? Two-finger tap shortcut for that? 32 | 33 | Glulx: if the game calls glk_exit(), the VM uses the "exited uncleanly" dialog. (Which is true; the VM's clean-up code was bypassed. Can we work around this?) 34 | 35 | -------------------------------------------------------------------------------- /WebSite/license.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Software Licenses 5 | 6 | 7 | 8 | 9 | 10 | 11 |

12 | This game is presented to you by 13 | iOS Glulxe, 14 | an open-source interactive fiction 15 | interpreter created by Andrew Plotkin. 16 |

17 | 18 |

19 | This interpreter consists of 20 | iOS Glk 21 | (an IF display library) 22 | and 23 | Glulxe 24 | (a general-purpose IF interpreter). 25 |

26 | 27 |

28 | (This is Glulxe version 0.5.3.) 29 |

30 | 31 |

32 | iOS Glk 33 | is copyright 2011-2016 by Andrew Plotkin. 34 | Glulxe 35 | is copyright 1999-2016 by Andrew Plotkin. 36 | They are distributed under the MIT license. 37 |

38 | 39 |

40 | Permission is hereby granted, free of charge, to any person obtaining a copy 41 | of this software and associated documentation files (the "Software"), to deal 42 | in the Software without restriction, including without limitation the rights 43 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 44 | copies of the Software, and to permit persons to whom the Software is 45 | furnished to do so, subject to the following conditions:
46 | 47 | The above copyright notice and this permission notice shall be included in 48 | all copies or substantial portions of the Software. 49 |

50 |

51 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 52 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 53 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 54 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 55 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 56 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 57 | THE SOFTWARE. 58 |

59 | 60 | 61 | 62 | -------------------------------------------------------------------------------- /TerpSrc/PrefsMenuView.h: -------------------------------------------------------------------------------- 1 | /* PrefsMenuView.h: A popmenu subclass that can display the preferences menu 2 | for IosGlulxe, an IosGlk port of the Glulxe interpreter. 3 | Designed by Andrew Plotkin 4 | http://eblong.com/zarf/glk/ 5 | */ 6 | 7 | #import 8 | #import "PopMenuView.h" 9 | 10 | @class PrefsContainerView; 11 | @class MButton; 12 | 13 | @interface PrefsMenuView : PopMenuView 14 | 15 | @property (nonatomic, retain) IBOutlet PrefsContainerView *container; 16 | @property (nonatomic, retain) IBOutlet PrefsContainerView *fontscontainer; 17 | @property (nonatomic, retain) IBOutlet PrefsContainerView *colorscontainer; 18 | @property (nonatomic, retain) IBOutlet UIButton *colorsbutton; 19 | @property (nonatomic, retain) IBOutlet UIButton *fontsbutton; 20 | @property (nonatomic, retain) IBOutlet UISlider *brightslider; 21 | @property (nonatomic, retain) IBOutlet MButton *colbut_full; 22 | @property (nonatomic, retain) IBOutlet MButton *colbut_34; 23 | @property (nonatomic, retain) IBOutlet MButton *colbut_12; 24 | @property (nonatomic, retain) IBOutlet MButton *sizebut_small; 25 | @property (nonatomic, retain) IBOutlet MButton *sizebut_big; 26 | @property (nonatomic, retain) IBOutlet MButton *leadbut_small; 27 | @property (nonatomic, retain) IBOutlet MButton *leadbut_big; 28 | @property (nonatomic, retain) IBOutlet UIButton *fontbutton; 29 | @property (nonatomic, retain) IBOutlet UIButton *colorbutton; 30 | @property (nonatomic, retain) IBOutlet MButton *fontbut_sample1; 31 | @property (nonatomic, retain) IBOutlet MButton *fontbut_sample2; 32 | @property (nonatomic, retain) IBOutlet MButton *colorbut_bright; 33 | @property (nonatomic, retain) IBOutlet MButton *colorbut_quiet; 34 | @property (nonatomic, retain) IBOutlet MButton *colorbut_dark; 35 | 36 | @property (nonatomic) BOOL supportsbrightness; 37 | @property (nonatomic, retain) NSArray *fontnames; 38 | @property (nonatomic, retain) NSArray *fontbuttons; 39 | 40 | - (void) updateButtons; 41 | - (IBAction) handleColumnWidth:(id)sender; 42 | - (IBAction) handleFontSize:(id)sender; 43 | - (IBAction) handleFontLeading:(id)sender; 44 | - (IBAction) handleFonts:(id)sender; 45 | - (IBAction) handleFont:(id)sender; 46 | - (IBAction) handleColors:(id)sender; 47 | - (IBAction) handleColor:(id)sender; 48 | - (IBAction) handleBrightChanged:(id)sender; 49 | 50 | @end 51 | 52 | 53 | @interface PrefsContainerView : UIView 54 | 55 | @end 56 | -------------------------------------------------------------------------------- /WebSite/page.css: -------------------------------------------------------------------------------- 1 | body { 2 | font-family: "Helvetica Neue", Helvetica, sans-serif; 3 | font-size: 16px; 4 | background: #D8CC99; 5 | max-width: 688px; 6 | margin-left: auto; 7 | margin-right: auto; 8 | } 9 | 10 | h1 { 11 | color: #543; 12 | background: #F8E8B8; 13 | font-size: 20px; 14 | padding: 4px 40px; 15 | -moz-border-radius: 16px; 16 | border-radius: 16px; 17 | margin-top: 32px; 18 | } 19 | 20 | h2 { 21 | font-size: 20px; 22 | } 23 | 24 | .BulletList { 25 | list-style: none; 26 | padding-left: 0px; 27 | } 28 | 29 | .BulletList li:before { 30 | content: "\2043\00A0\00A0"; 31 | display: inline; 32 | } 33 | 34 | .BulletList li { 35 | text-indent: -15px; 36 | margin-left: 40px; 37 | } 38 | 39 | .CommandList { 40 | list-style: none; 41 | padding-left: 40px; 42 | } 43 | 44 | .CommandList li { 45 | color: #007; 46 | font-weight: bold; 47 | font-size: 14px; 48 | } 49 | 50 | .Command { 51 | color: #007; 52 | font-weight: bold; 53 | font-size: 14px; 54 | } 55 | 56 | .Term { 57 | color: #067; 58 | } 59 | 60 | .Gloss { 61 | color: black; 62 | font-weight: normal; 63 | font-style: italic; 64 | padding-left: 4px; 65 | padding-right: 4px; 66 | } 67 | 68 | .LinkLine { 69 | font-style: italic; 70 | font-size: 14px; 71 | background: #F8E8B8; 72 | padding: 8px 40px; 73 | -moz-border-radius: 16px; 74 | border-radius: 16px; 75 | } 76 | 77 | .LinkLine a { 78 | color: #22D; 79 | } 80 | 81 | .License { 82 | font-size: 13px; 83 | margin-left: 40px; 84 | } 85 | 86 | @media screen and (max-device-width: 480px) { 87 | body { 88 | font-size: 14px; 89 | margin-left: 10px; 90 | margin-right: 10px; 91 | } 92 | 93 | h1 { 94 | font-size: 17px; 95 | padding: 4px 20px; 96 | margin-top: 20px; 97 | } 98 | 99 | h2 { 100 | font-size: 17px; 101 | } 102 | 103 | .BulletList li { 104 | margin-left: 20px; 105 | } 106 | 107 | .CommandList { 108 | padding-left: 20px; 109 | } 110 | 111 | .CommandList li { 112 | font-size: 12px; 113 | } 114 | 115 | .Command { 116 | font-size: 12px; 117 | } 118 | 119 | .LinkLine { 120 | font-style: italic; 121 | font-size: 12px; 122 | padding: 4px 20px; 123 | } 124 | 125 | .License { 126 | font-size: 12px; 127 | margin-left: 20px; 128 | } 129 | 130 | } 131 | -------------------------------------------------------------------------------- /TerpSrc/DisplayWebViewController.m: -------------------------------------------------------------------------------- 1 | /* DisplayWebViewController.h: HTML Display view controller 2 | for IosGlulxe, an IosGlk port of the Glulxe interpreter. 3 | Designed by Andrew Plotkin 4 | http://eblong.com/zarf/glk/ 5 | */ 6 | 7 | #import "DisplayWebViewController.h" 8 | #import "IosGlkViewController.h" 9 | #import "TerpGlkViewController.h" 10 | #import "IosGlkAppDelegate.h" 11 | 12 | @implementation DisplayWebViewController 13 | 14 | @synthesize webview; 15 | @synthesize filename; 16 | @synthesize doctitle; 17 | 18 | - (id) initWithNibName:(NSString *)nibName filename:(NSString *)fileref title:(NSString *)titleref bundle:(NSBundle *)nibBundle 19 | { 20 | self = [super initWithNibName:nibName bundle:nibBundle]; 21 | if (self) { 22 | self.edgesForExtendedLayout = 0; // avoid navbar underrun 23 | self.filename = fileref; 24 | self.doctitle = titleref; 25 | } 26 | return self; 27 | } 28 | 29 | - (void) dealloc { 30 | self.filename = nil; 31 | self.doctitle = nil; 32 | if (webview) { 33 | webview.delegate = nil; 34 | self.webview = nil; 35 | } 36 | [super dealloc]; 37 | } 38 | 39 | - (void) viewDidLoad 40 | { 41 | [super viewDidLoad]; 42 | 43 | self.navigationItem.title = doctitle; 44 | 45 | NSBundle *bundle = [NSBundle mainBundle]; 46 | // Do this the annoying iOS3-compatible way 47 | NSString *path = [bundle pathForResource:filename ofType:@"html" inDirectory:@"WebSite"]; 48 | NSURL *url = [NSURL fileURLWithPath:path isDirectory:NO]; 49 | NSString *html = [NSString stringWithContentsOfURL:url encoding:NSUTF8StringEncoding error:nil]; 50 | [webview loadHTMLString:html baseURL:url]; 51 | webview.delegate = self; 52 | 53 | if (true) { 54 | UISwipeGestureRecognizer *recognizer; 55 | recognizer = [[[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(handleSwipeRight:)] autorelease]; 56 | recognizer.direction = UISwipeGestureRecognizerDirectionRight; 57 | [webview addGestureRecognizer:recognizer]; 58 | } 59 | } 60 | 61 | - (void) handleSwipeRight:(UIGestureRecognizer *)recognizer { 62 | [self.navigationController popViewControllerAnimated:YES]; 63 | } 64 | 65 | /* Ensure that all external URLs are sent to Safari. (UIWebView delegate method.) 66 | */ 67 | - (BOOL) webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType { 68 | if ([request.URL isFileURL]) { 69 | /* Let file:... URLs load normally */ 70 | return YES; 71 | } 72 | 73 | [[UIApplication sharedApplication] openURL:request.URL]; 74 | return NO; 75 | } 76 | 77 | - (BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)orientation 78 | { 79 | IosGlkViewController *glkviewc = [IosGlkViewController singleton]; 80 | return [glkviewc shouldAutorotateToInterfaceOrientation:orientation]; 81 | } 82 | 83 | @end 84 | 85 | -------------------------------------------------------------------------------- /TerpSrc/HelpViewController.m: -------------------------------------------------------------------------------- 1 | /* HelpViewController.m: Interpreter help tab view controller 2 | for IosGlulxe, an IosGlk port of the Glulxe interpreter. 3 | Designed by Andrew Plotkin 4 | http://eblong.com/zarf/glk/ 5 | */ 6 | 7 | #import "HelpViewController.h" 8 | #import "IosGlkViewController.h" 9 | #import "TerpGlkViewController.h" 10 | #import "IosGlkAppDelegate.h" 11 | 12 | @implementation HelpViewController 13 | 14 | @synthesize webview; 15 | 16 | - (void) dealloc { 17 | if (webview) { 18 | webview.delegate = nil; 19 | self.webview = nil; 20 | } 21 | [super dealloc]; 22 | } 23 | 24 | - (void) viewDidLoad 25 | { 26 | [super viewDidLoad]; 27 | 28 | NSBundle *bundle = [NSBundle mainBundle]; 29 | // Do this the annoying iOS3-compatible way 30 | NSString *path = [bundle pathForResource:@"index" ofType:@"html" inDirectory:@"WebSite"]; 31 | NSURL *url = [NSURL fileURLWithPath:path isDirectory:NO]; 32 | NSString *html = [NSString stringWithContentsOfURL:url encoding:NSUTF8StringEncoding error:nil]; 33 | [webview loadHTMLString:html baseURL:url]; 34 | webview.delegate = self; 35 | 36 | if (true) { 37 | TerpGlkViewController *mainviewc = [TerpGlkViewController singleton]; 38 | UISwipeGestureRecognizer *recognizer; 39 | recognizer = [[[UISwipeGestureRecognizer alloc] initWithTarget:mainviewc action:@selector(handleSwipeLeft:)] autorelease]; 40 | recognizer.direction = UISwipeGestureRecognizerDirectionLeft; 41 | [webview addGestureRecognizer:recognizer]; 42 | recognizer = [[[UISwipeGestureRecognizer alloc] initWithTarget:mainviewc action:@selector(handleSwipeRight:)] autorelease]; 43 | recognizer.direction = UISwipeGestureRecognizerDirectionRight; 44 | [webview addGestureRecognizer:recognizer]; 45 | } 46 | } 47 | 48 | /* Ensure that all external URLs are sent to Safari. (UIWebView delegate method.) 49 | */ 50 | - (BOOL) webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType { 51 | if ([request.URL isFileURL]) { 52 | /* Let file:... URLs load normally */ 53 | NSString *anchor = request.URL.fragment; 54 | if (navigationType == UIWebViewNavigationTypeLinkClicked && anchor && anchor.length) { 55 | /* But handle internal anchor links with JS. UIWebView stopped handling this right in iOS11? */ 56 | [webView stringByEvaluatingJavaScriptFromString:[NSString stringWithFormat:@"document.getElementsByName('%@')[0].scrollIntoView();", anchor]]; 57 | return NO; 58 | } 59 | return YES; 60 | } 61 | 62 | [[UIApplication sharedApplication] openURL:request.URL]; 63 | return NO; 64 | } 65 | 66 | - (BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)orientation 67 | { 68 | IosGlkViewController *glkviewc = [IosGlkViewController singleton]; 69 | return [glkviewc shouldAutorotateToInterfaceOrientation:orientation]; 70 | } 71 | 72 | @end 73 | -------------------------------------------------------------------------------- /TerpSrc/GradientView.m: -------------------------------------------------------------------------------- 1 | /* GradientView.m: A view that just displays a color gradient 2 | for IosGlulxe, an IosGlk port of the Glulxe interpreter. 3 | Designed by Andrew Plotkin 4 | http://eblong.com/zarf/glk/ 5 | */ 6 | 7 | #import "GradientView.h" 8 | 9 | 10 | @implementation GradientView 11 | 12 | @synthesize numcolors; 13 | @synthesize color0; 14 | @synthesize color1; 15 | @synthesize color2; 16 | @synthesize color3; 17 | @synthesize color4; 18 | 19 | + (Class) layerClass { 20 | return [CAGradientLayer class]; 21 | } 22 | 23 | - (id) initWithCoder:(NSCoder *)decoder { 24 | self = [super initWithCoder:decoder]; 25 | if (self) { 26 | } 27 | return self; 28 | } 29 | 30 | - (void) dealloc { 31 | self.color0 = nil; 32 | self.color1 = nil; 33 | self.color2 = nil; 34 | self.color3 = nil; 35 | self.color4 = nil; 36 | [super dealloc]; 37 | } 38 | 39 | - (BOOL) hasColors { 40 | if (numcolors == 0) 41 | return NO; 42 | if (numcolors > 0 && !color0) 43 | return NO; 44 | if (numcolors > 1 && !color1) 45 | return NO; 46 | if (numcolors > 2 && !color2) 47 | return NO; 48 | if (numcolors > 3 && !color3) 49 | return NO; 50 | if (numcolors > 4 && !color4) 51 | return NO; 52 | return YES; 53 | } 54 | 55 | - (void) setUpColorsPreset:(int)val { 56 | switch (val) { 57 | case 1: 58 | self.color0 = [UIColor colorWithRed:1.0 green:0.992 blue:0.651 alpha:1]; 59 | self.color1 = [UIColor colorWithRed:1.0 green:1.0 blue:0.500 alpha:1]; 60 | self.color2 = [UIColor colorWithRed:0.976 green:0.980 blue:0.470 alpha:1]; 61 | self.color3 = self.color1; 62 | self.color4 = self.color0; 63 | numcolors = 5; 64 | break; 65 | default: 66 | return; 67 | } 68 | 69 | self.backgroundColor = nil; 70 | 71 | CAGradientLayer *layer = (CAGradientLayer *)self.layer; 72 | 73 | layer.startPoint = CGPointMake(0.0, 0.5); 74 | layer.endPoint = CGPointMake(1.0, 0.5); 75 | 76 | switch (numcolors) { 77 | case 2: 78 | layer.colors = [NSArray arrayWithObjects: 79 | (id)color0.CGColor, 80 | (id)color1.CGColor, 81 | nil]; 82 | break; 83 | 84 | case 3: 85 | layer.colors = [NSArray arrayWithObjects: 86 | (id)color0.CGColor, 87 | (id)color1.CGColor, 88 | (id)color2.CGColor, 89 | nil]; 90 | break; 91 | 92 | case 4: 93 | layer.colors = [NSArray arrayWithObjects: 94 | (id)color0.CGColor, 95 | (id)color1.CGColor, 96 | (id)color2.CGColor, 97 | (id)color3.CGColor, 98 | nil]; 99 | break; 100 | 101 | case 5: 102 | layer.colors = [NSArray arrayWithObjects: 103 | (id)color0.CGColor, 104 | (id)color1.CGColor, 105 | (id)color2.CGColor, 106 | (id)color3.CGColor, 107 | (id)color4.CGColor, 108 | nil]; 109 | break; 110 | } 111 | } 112 | 113 | @end 114 | -------------------------------------------------------------------------------- /TerpSrc/DisplayTextViewController.m: -------------------------------------------------------------------------------- 1 | /* DisplayTextViewController.m: Transcript display view controller 2 | for IosGlulxe, an IosGlk port of the Glulxe interpreter. 3 | Designed by Andrew Plotkin 4 | http://eblong.com/zarf/glk/ 5 | */ 6 | 7 | #import "DisplayTextViewController.h" 8 | #import "IosGlkViewController.h" 9 | #import "RelDateFormatter.h" 10 | #import "GlkFileTypes.h" 11 | #import "IosGlkAppDelegate.h" 12 | 13 | @implementation DisplayTextViewController 14 | 15 | @synthesize textview; 16 | @synthesize titlelabel; 17 | @synthesize datelabel; 18 | @synthesize thumb; 19 | 20 | - (id) initWithNibName:(NSString *)nibName thumb:(GlkFileThumb *)thumbref bundle:(NSBundle *)nibBundle 21 | { 22 | self = [super initWithNibName:nibName bundle:nibBundle]; 23 | if (self) { 24 | self.edgesForExtendedLayout = 0; // avoid navbar underrun 25 | self.thumb = thumbref; 26 | } 27 | return self; 28 | } 29 | 30 | - (void) dealloc { 31 | self.thumb = nil; 32 | self.textview = nil; 33 | self.titlelabel = nil; 34 | self.datelabel = nil; 35 | [super dealloc]; 36 | } 37 | 38 | - (void) viewDidLoad 39 | { 40 | [super viewDidLoad]; 41 | 42 | self.navigationItem.title = NSLocalizedStringFromTable(@"title.transcript", @"TerpLocalize", nil); 43 | 44 | UIBarButtonItem *sendbutton = [[[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAction target:self action:@selector(buttonSend:)] autorelease]; 45 | self.navigationItem.rightBarButtonItem = sendbutton; 46 | 47 | titlelabel.text = thumb.label; 48 | 49 | if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone) { 50 | /* No room for this on the iphone layout */ 51 | datelabel.hidden = YES; 52 | } 53 | else { 54 | RelDateFormatter *dateformatter = [[[RelDateFormatter alloc] init] autorelease]; 55 | [dateformatter setDateStyle:NSDateFormatterMediumStyle]; 56 | [dateformatter setTimeStyle:NSDateFormatterShortStyle]; 57 | datelabel.text = [dateformatter stringFromDate:thumb.modtime]; 58 | } 59 | 60 | NSString *str = [NSString stringWithContentsOfFile:thumb.pathname encoding:NSUTF8StringEncoding error:nil]; 61 | if (str) 62 | textview.text = str; 63 | 64 | if (true) { 65 | UISwipeGestureRecognizer *recognizer; 66 | recognizer = [[[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(handleSwipeRight:)] autorelease]; 67 | recognizer.direction = UISwipeGestureRecognizerDirectionRight; 68 | [textview addGestureRecognizer:recognizer]; 69 | } 70 | } 71 | 72 | - (void) handleSwipeRight:(UIGestureRecognizer *)recognizer { 73 | [self.navigationController popViewControllerAnimated:YES]; 74 | } 75 | 76 | - (void) buttonSend:(id)sender 77 | { 78 | if ([UIActivityViewController class]) { 79 | // Available in iOS6+ 80 | NSArray *ls = [NSArray arrayWithObject:textview.text]; 81 | UIActivityViewController *actvc = [[[UIActivityViewController alloc] initWithActivityItems:ls applicationActivities:nil] autorelease]; 82 | if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone) { 83 | [self presentViewController:actvc animated:YES completion:nil]; 84 | } 85 | else { 86 | UIPopoverController *popover = [[[UIPopoverController alloc] initWithContentViewController:actvc] autorelease]; 87 | [popover presentPopoverFromBarButtonItem:sender permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES]; 88 | } 89 | return; 90 | } 91 | } 92 | 93 | - (BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)orientation { 94 | return [[IosGlkViewController singleton] shouldAutorotateToInterfaceOrientation:orientation]; 95 | } 96 | 97 | 98 | @end 99 | -------------------------------------------------------------------------------- /iosglulxe-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | Glulxe 9 | CFBundleDocumentTypes 10 | 11 | 12 | CFBundleTypeIconFiles 13 | 14 | CFBundleTypeName 15 | Glk Save File 16 | LSItemContentTypes 17 | 18 | com.eblong.glk.glksave 19 | 20 | 21 | 22 | UTExportedTypeDeclarations 23 | 24 | 25 | UTTypeIdentifier 26 | com.eblong.glk.glksave 27 | UTTypeDescription 28 | Glk save file 29 | UTTypeReferenceURL 30 | http://eblong.com/zarf/glk/ 31 | UTTypeConformsTo 32 | 33 | public.content 34 | public.data 35 | 36 | UTTypeTagSpecification 37 | 38 | public.filename-extension 39 | glksave 40 | public.mime-type 41 | application/x-glksave 42 | 43 | 44 | 45 | CFBundleExecutable 46 | ${EXECUTABLE_NAME} 47 | CFBundleIconFiles 48 | 49 | Icon.png 50 | Icon@2x.png 51 | Icon-72.png 52 | Icon-72@2x.png 53 | Icon-Small-50.png 54 | Icon-Small-50@2x.png 55 | Icon-Small.png 56 | Icon-Small@2x.png 57 | Icon-76.png 58 | Icon-76@2x.png 59 | Icon-40@2x.png 60 | Icon-60@2x.png 61 | 62 | CFBundleIdentifier 63 | $(PRODUCT_BUNDLE_IDENTIFIER) 64 | CFBundleInfoDictionaryVersion 65 | 6.0 66 | CFBundleName 67 | ${PRODUCT_NAME} 68 | CFBundlePackageType 69 | APPL 70 | CFBundleShortVersionString 71 | 1.0 72 | CFBundleSignature 73 | ???? 74 | CFBundleVersion 75 | 1.0 76 | LSRequiresIPhoneOS 77 | 78 | NSMainNibFile 79 | MainWindow 80 | UILaunchImages 81 | 82 | 83 | UILaunchImageMinimumOSVersion 84 | 7.0 85 | UILaunchImageName 86 | Default-New 87 | UILaunchImageSize 88 | {320, 480} 89 | 90 | 91 | UILaunchImageMinimumOSVersion 92 | 7.0 93 | UILaunchImageName 94 | Default-New 95 | UILaunchImageOrientation 96 | Portrait 97 | UILaunchImageSize 98 | {320, 568} 99 | 100 | 101 | UILaunchImages~ipad 102 | 103 | 104 | UILaunchImageMinimumOSVersion 105 | 7.0 106 | UILaunchImageName 107 | Default-New-Landscape 108 | UILaunchImageOrientation 109 | Landscape 110 | UILaunchImageSize 111 | {768, 1024} 112 | 113 | 114 | UILaunchImageMinimumOSVersion 115 | 7.0 116 | UILaunchImageName 117 | Default-New-Portrait 118 | UILaunchImageOrientation 119 | Portrait 120 | UILaunchImageSize 121 | {768, 1024} 122 | 123 | 124 | UIPrerenderedIcon 125 | 126 | UISupportedInterfaceOrientations 127 | 128 | UIInterfaceOrientationPortrait 129 | UIInterfaceOrientationPortraitUpsideDown 130 | UIInterfaceOrientationLandscapeLeft 131 | UIInterfaceOrientationLandscapeRight 132 | 133 | 134 | 135 | -------------------------------------------------------------------------------- /Resources/HelpVC.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 1536 5 | 12C60 6 | 2844 7 | 1187.34 8 | 625.00 9 | 10 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 11 | 1930 12 | 13 | 14 | IBProxyObject 15 | IBUIView 16 | IBUIWebView 17 | 18 | 19 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 20 | 21 | 22 | PluginDependencyRecalculationVersion 23 | 24 | 25 | 26 | 27 | IBFilesOwner 28 | IBCocoaTouchFramework 29 | 30 | 31 | IBFirstResponder 32 | IBCocoaTouchFramework 33 | 34 | 35 | 36 | 274 37 | 38 | 39 | 40 | 274 41 | {320, 460} 42 | 43 | _NS:693 44 | 45 | 3 46 | MC41AA 47 | 48 | 2 49 | 50 | 51 | IBCocoaTouchFramework 52 | 53 | 54 | {{0, 20}, {320, 460}} 55 | 56 | 57 | 58 | 3 59 | MC41AA 60 | 61 | 62 | IBCocoaTouchFramework 63 | 64 | 65 | 66 | 67 | 68 | 69 | view 70 | 71 | 72 | 73 | 3 74 | 75 | 76 | 77 | webview 78 | 79 | 80 | 81 | 5 82 | 83 | 84 | 85 | 86 | 87 | 0 88 | 89 | 90 | 91 | 92 | 93 | 1 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | -1 102 | 103 | 104 | File's Owner 105 | 106 | 107 | -2 108 | 109 | 110 | 111 | 112 | 4 113 | 114 | 115 | 116 | 117 | 118 | 119 | HelpViewController 120 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 121 | UIResponder 122 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 123 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 124 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 125 | 126 | 127 | 128 | 129 | 130 | 5 131 | 132 | 133 | 0 134 | IBCocoaTouchFramework 135 | 136 | com.apple.InterfaceBuilder.CocoaTouchPlugin.iPhoneOS 137 | 138 | 139 | 140 | com.apple.InterfaceBuilder.CocoaTouchPlugin.InterfaceBuilder3 141 | 142 | 143 | YES 144 | 3 145 | 1930 146 | 147 | 148 | -------------------------------------------------------------------------------- /Resources/WebDocVC.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 1536 5 | 12C60 6 | 2844 7 | 1187.34 8 | 625.00 9 | 10 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 11 | 1930 12 | 13 | 14 | IBProxyObject 15 | IBUIView 16 | IBUIWebView 17 | 18 | 19 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 20 | 21 | 22 | PluginDependencyRecalculationVersion 23 | 24 | 25 | 26 | 27 | IBFilesOwner 28 | IBCocoaTouchFramework 29 | 30 | 31 | IBFirstResponder 32 | IBCocoaTouchFramework 33 | 34 | 35 | 36 | 274 37 | 38 | 39 | 40 | 274 41 | {320, 460} 42 | 43 | _NS:693 44 | 45 | 3 46 | MC41AA 47 | 48 | 2 49 | 50 | 51 | IBCocoaTouchFramework 52 | 53 | 54 | {{0, 20}, {320, 460}} 55 | 56 | 57 | 58 | 3 59 | MC41AA 60 | 61 | 62 | IBCocoaTouchFramework 63 | 64 | 65 | 66 | 67 | 68 | 69 | view 70 | 71 | 72 | 73 | 3 74 | 75 | 76 | 77 | webview 78 | 79 | 80 | 81 | 5 82 | 83 | 84 | 85 | 86 | 87 | 0 88 | 89 | 90 | 91 | 92 | 93 | 1 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | -1 102 | 103 | 104 | File's Owner 105 | 106 | 107 | -2 108 | 109 | 110 | 111 | 112 | 4 113 | 114 | 115 | 116 | 117 | 118 | 119 | DisplayWebViewController 120 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 121 | UIResponder 122 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 123 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 124 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 125 | 126 | 127 | 128 | 129 | 130 | 5 131 | 132 | 133 | 0 134 | IBCocoaTouchFramework 135 | 136 | com.apple.InterfaceBuilder.CocoaTouchPlugin.iPhoneOS 137 | 138 | 139 | 140 | com.apple.InterfaceBuilder.CocoaTouchPlugin.InterfaceBuilder3 141 | 142 | 143 | YES 144 | 3 145 | 1930 146 | 147 | 148 | -------------------------------------------------------------------------------- /Resources/TranscriptVC.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 1536 5 | 12C60 6 | 2844 7 | 1187.34 8 | 625.00 9 | 10 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 11 | 1930 12 | 13 | 14 | IBProxyObject 15 | IBUITableView 16 | 17 | 18 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 19 | 20 | 21 | PluginDependencyRecalculationVersion 22 | 23 | 24 | 25 | 26 | IBFilesOwner 27 | IBCocoaTouchFramework 28 | 29 | 30 | IBFirstResponder 31 | IBCocoaTouchFramework 32 | 33 | 34 | 35 | 274 36 | {{0, 64}, {320, 416}} 37 | 38 | 39 | 3 40 | MQA 41 | 42 | NO 43 | YES 44 | NO 45 | 46 | 47 | NO 48 | 49 | IBCocoaTouchFramework 50 | NO 51 | 1 52 | 0 53 | YES 54 | 44 55 | 22 56 | 22 57 | 58 | 59 | 60 | 61 | 62 | 63 | view 64 | 65 | 66 | 67 | 5 68 | 69 | 70 | 71 | tableView 72 | 73 | 74 | 75 | 8 76 | 77 | 78 | 79 | dataSource 80 | 81 | 82 | 83 | 6 84 | 85 | 86 | 87 | delegate 88 | 89 | 90 | 91 | 7 92 | 93 | 94 | 95 | 96 | 97 | 0 98 | 99 | 100 | 101 | 102 | 103 | -1 104 | 105 | 106 | File's Owner 107 | 108 | 109 | -2 110 | 111 | 112 | 113 | 114 | 4 115 | 116 | 117 | 118 | 119 | 120 | 121 | TranscriptViewController 122 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 123 | UIResponder 124 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 125 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 126 | 127 | 128 | 129 | 130 | 131 | 8 132 | 133 | 134 | 0 135 | IBCocoaTouchFramework 136 | 137 | com.apple.InterfaceBuilder.CocoaTouchPlugin.iPhoneOS 138 | 139 | 140 | 141 | com.apple.InterfaceBuilder.CocoaTouchPlugin.InterfaceBuilder3 142 | 143 | 144 | YES 145 | 3 146 | 1930 147 | 148 | 149 | -------------------------------------------------------------------------------- /TerpSrc/TranscriptViewController.m: -------------------------------------------------------------------------------- 1 | /* TranscriptViewController.m: Transcript overview display view controller 2 | for IosGlulxe, an IosGlk port of the Glulxe interpreter. 3 | Designed by Andrew Plotkin 4 | http://eblong.com/zarf/glk/ 5 | */ 6 | 7 | #import "TranscriptViewController.h" 8 | #import "DisplayTextViewController.h" 9 | #import "IosGlkViewController.h" 10 | #import "RelDateFormatter.h" 11 | #import "GlkLibrary.h" 12 | #import "GlkFileRef.h" 13 | #import "GlkFileTypes.h" 14 | #import "GlkUtilities.h" 15 | 16 | @implementation TranscriptViewController 17 | 18 | @synthesize tableView; 19 | @synthesize filelist; 20 | @synthesize dateformatter; 21 | 22 | - (id) initWithNibName:(NSString *)nibName bundle:(NSBundle *)nibBundle { 23 | self = [super initWithNibName:nibName bundle:nibBundle]; 24 | if (self) { 25 | self.filelist = [NSMutableArray arrayWithCapacity:16]; 26 | self.dateformatter = [[[RelDateFormatter alloc] init] autorelease]; 27 | [dateformatter setDateStyle:NSDateFormatterMediumStyle]; 28 | [dateformatter setTimeStyle:NSDateFormatterShortStyle]; 29 | } 30 | return self; 31 | } 32 | 33 | - (void) dealloc { 34 | self.filelist = nil; 35 | self.dateformatter = nil; 36 | self.tableView = nil; 37 | [super dealloc]; 38 | } 39 | 40 | - (void) viewDidLoad { 41 | [super viewDidLoad]; 42 | 43 | self.navigationItem.title = NSLocalizedStringFromTable(@"title.transcripts", @"TerpLocalize", nil); 44 | 45 | self.navigationItem.rightBarButtonItem = [self editButtonItem]; 46 | 47 | /* We use an old-fashioned way of locating the Documents directory. (The NSManager method for this is iOS 4.0 and later.) */ 48 | 49 | NSArray *dirlist = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); 50 | if (!dirlist) { 51 | dirlist = [NSArray array]; 52 | } 53 | NSString *basedir = [dirlist objectAtIndex:0]; 54 | NSString *dirname = [GlkFileRef subDirOfBase:basedir forUsage:fileusage_Transcript gameid:[GlkLibrary singleton].gameId]; 55 | 56 | [filelist removeAllObjects]; 57 | NSArray *ls = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:dirname error:nil]; 58 | if (ls) { 59 | for (NSString *filename in ls) { 60 | NSString *pathname = [dirname stringByAppendingPathComponent:filename]; 61 | NSDictionary *attrs = [[NSFileManager defaultManager] attributesOfItemAtPath:pathname error:nil]; 62 | if (!attrs) 63 | continue; 64 | if (![NSFileTypeRegular isEqualToString:[attrs fileType]]) 65 | continue; 66 | 67 | /* We accept both dumbass-encoded strings (which were typed by the user) and "normal" strings (which were created by fileref_by_name). */ 68 | NSString *label = StringFromDumbEncoding(filename); 69 | if (!label) 70 | label = filename; 71 | 72 | GlkFileThumb *thumb = [[[GlkFileThumb alloc] init] autorelease]; 73 | thumb.filename = filename; 74 | thumb.pathname = pathname; 75 | thumb.usage = fileusage_Transcript; 76 | thumb.modtime = [attrs fileModificationDate]; 77 | thumb.label = label; 78 | 79 | [filelist addObject:thumb]; 80 | } 81 | } 82 | 83 | [filelist sortUsingSelector:@selector(compareModTime:)]; 84 | 85 | if (filelist.count == 0) 86 | [self addBlankThumb]; 87 | } 88 | 89 | - (void) addBlankThumb { 90 | GlkFileThumb *thumb = [[[GlkFileThumb alloc] init] autorelease]; 91 | thumb.isfake = YES; 92 | thumb.modtime = [NSDate date]; 93 | thumb.label = NSLocalizedStringFromTable(@"label.no-transcripts", @"TerpLocalize", nil); 94 | [filelist insertObject:thumb atIndex:0]; 95 | } 96 | 97 | - (void) setEditing:(BOOL)editing animated:(BOOL)animated { 98 | [super setEditing:editing animated:animated]; 99 | [tableView setEditing:editing animated:animated]; 100 | } 101 | 102 | // Table view data source methods (see UITableViewDataSource) 103 | 104 | - (NSInteger) tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { 105 | return filelist.count; 106 | } 107 | 108 | - (BOOL) tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath { 109 | GlkFileThumb *thumb = nil; 110 | 111 | int row = indexPath.row; 112 | if (row >= 0 && row < filelist.count) 113 | thumb = [filelist objectAtIndex:row]; 114 | 115 | return (thumb && !thumb.isfake); 116 | } 117 | 118 | - (UITableViewCell *) tableView:(UITableView *)tableview cellForRowAtIndexPath:(NSIndexPath *)indexPath { 119 | static NSString *CellIdentifier = @"File"; 120 | 121 | // This is boilerplate and I haven't touched it. 122 | UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; 123 | if (cell == nil) { 124 | cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier] autorelease]; 125 | } 126 | 127 | GlkFileThumb *thumb = nil; 128 | 129 | int row = indexPath.row; 130 | if (row >= 0 && row < filelist.count) 131 | thumb = [filelist objectAtIndex:row]; 132 | 133 | /* Make the cell look right... */ 134 | 135 | if (!thumb) { 136 | // shouldn't happen 137 | cell.accessoryType = UITableViewCellAccessoryNone; 138 | cell.selectionStyle = UITableViewCellSelectionStyleBlue; 139 | cell.textLabel.text = @"(null)"; 140 | cell.textLabel.textColor = [UIColor blackColor]; 141 | cell.detailTextLabel.text = @"?"; 142 | } 143 | else if (thumb.isfake) { 144 | cell.accessoryType = UITableViewCellAccessoryNone; 145 | cell.selectionStyle = UITableViewCellSelectionStyleNone; 146 | cell.textLabel.text = thumb.label; 147 | cell.textLabel.textColor = [UIColor lightGrayColor]; 148 | cell.detailTextLabel.text = @""; 149 | } 150 | else { 151 | cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator; 152 | cell.selectionStyle = UITableViewCellSelectionStyleBlue; 153 | cell.textLabel.text = thumb.label; 154 | cell.textLabel.textColor = [UIColor blackColor]; 155 | cell.detailTextLabel.text = [dateformatter stringFromDate:thumb.modtime]; 156 | } 157 | 158 | return cell; 159 | } 160 | 161 | - (void) tableView:(UITableView *)tableview commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath { 162 | if (editingStyle == UITableViewCellEditingStyleDelete) { 163 | GlkFileThumb *thumb = nil; 164 | int row = indexPath.row; 165 | if (row >= 0 && row < filelist.count) 166 | thumb = [filelist objectAtIndex:row]; 167 | if (thumb && !thumb.isfake) { 168 | GlkFileThumb *thumb = [filelist objectAtIndex:row]; 169 | //NSLog(@"selector: deleting file \"%@\" (%@)", thumb.label, thumb.pathname); 170 | BOOL res = [[NSFileManager defaultManager] removeItemAtPath:thumb.pathname error:nil]; 171 | if (res) { 172 | [filelist removeObjectAtIndex:row]; 173 | [tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationFade]; 174 | if (filelist.count == 0) { 175 | [self addBlankThumb]; 176 | [tableView insertRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationFade]; 177 | } 178 | } 179 | } 180 | } 181 | } 182 | 183 | // Table view delegate (see UITableViewDelegate) 184 | 185 | - (void) tableView:(UITableView *)tableview didSelectRowAtIndexPath:(NSIndexPath *)indexPath { 186 | GlkFileThumb *thumb = nil; 187 | int row = indexPath.row; 188 | if (row >= 0 && row < filelist.count) 189 | thumb = [filelist objectAtIndex:row]; 190 | if (!thumb) 191 | return; 192 | if (thumb.isfake) 193 | return; 194 | 195 | /* The user has selected a file. */ 196 | DisplayTextViewController *viewc = [[[DisplayTextViewController alloc] initWithNibName:@"DisplayTextVC" thumb:thumb bundle:nil] autorelease]; 197 | [self.navigationController pushViewController:viewc animated:YES]; 198 | } 199 | 200 | - (BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)orientation { 201 | return [[IosGlkViewController singleton] shouldAutorotateToInterfaceOrientation:orientation]; 202 | } 203 | 204 | @end 205 | -------------------------------------------------------------------------------- /TerpSrc/SettingsViewController.m: -------------------------------------------------------------------------------- 1 | /* SettingsViewController.h: Interpreter settings tab view controller 2 | for IosGlulxe, an IosGlk port of the Glulxe interpreter. 3 | Designed by Andrew Plotkin 4 | http://eblong.com/zarf/glk/ 5 | */ 6 | 7 | #import "SettingsViewController.h" 8 | #import "TerpGlkViewController.h" 9 | #import "DisplayWebViewController.h" 10 | #import "ShareFilesViewController.h" 11 | #import "GlkFrameView.h" 12 | #import "IosGlkAppDelegate.h" 13 | 14 | @implementation SettingsViewController 15 | 16 | @synthesize tableview; 17 | @synthesize autocorrectcell; 18 | @synthesize keepopencell; 19 | @synthesize sharefilescell; 20 | @synthesize licensecell; 21 | @synthesize autocorrectswitch; 22 | @synthesize keepopenswitch; 23 | 24 | - (void) dealloc { 25 | self.tableview = nil; 26 | self.autocorrectcell = nil; 27 | self.keepopencell = nil; 28 | self.sharefilescell = nil; 29 | self.licensecell = nil; 30 | self.autocorrectswitch = nil; 31 | self.keepopenswitch = nil; 32 | [super dealloc]; 33 | } 34 | 35 | - (void) viewDidLoad 36 | { 37 | [super viewDidLoad]; 38 | 39 | if ([tableview respondsToSelector:@selector(backgroundView)]) { 40 | /* This is only available in iOS 3.2 and up */ 41 | tableview.backgroundView = [[[UIView alloc] initWithFrame:tableview.backgroundView.frame] autorelease]; 42 | tableview.backgroundView.backgroundColor = [UIColor colorWithRed:0.85 green:0.8 blue:0.6 alpha:1]; 43 | } 44 | 45 | /* Create the cells... */ 46 | self.licensecell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"Settings"] autorelease]; 47 | licensecell.backgroundColor = [UIColor colorWithRed:1.0 green:0.98 blue:0.92 alpha:1]; 48 | licensecell.textLabel.text = NSLocalizedStringFromTable(@"settings.cell.license", @"TerpLocalize", nil); 49 | licensecell.textLabel.textColor = [UIColor colorWithRed:0.35 green:0.215 blue:0 alpha:1]; 50 | licensecell.accessoryType = UITableViewCellAccessoryDisclosureIndicator; 51 | 52 | self.sharefilescell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"Settings"] autorelease]; 53 | sharefilescell.backgroundColor = licensecell.backgroundColor; 54 | sharefilescell.textLabel.text = NSLocalizedStringFromTable(@"settings.cell.sharefiles", @"TerpLocalize", nil); 55 | sharefilescell.textLabel.textColor = licensecell.textLabel.textColor; 56 | sharefilescell.accessoryType = UITableViewCellAccessoryDisclosureIndicator; 57 | 58 | self.autocorrectcell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"Settings"] autorelease]; 59 | autocorrectcell.backgroundColor = licensecell.backgroundColor; 60 | autocorrectcell.textLabel.text = NSLocalizedStringFromTable(@"settings.cell.autocorrect", @"TerpLocalize", nil); 61 | autocorrectcell.textLabel.textColor = licensecell.textLabel.textColor; 62 | autocorrectcell.selectionStyle = UITableViewCellSelectionStyleNone; 63 | autocorrectcell.accessoryView = autocorrectswitch; 64 | 65 | self.keepopencell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"Settings"] autorelease]; 66 | keepopencell.backgroundColor = licensecell.backgroundColor; 67 | keepopencell.textLabel.text = NSLocalizedStringFromTable(@"settings.cell.keepopen", @"TerpLocalize", nil); 68 | keepopencell.textLabel.textColor = licensecell.textLabel.textColor; 69 | keepopencell.selectionStyle = UITableViewCellSelectionStyleNone; 70 | keepopencell.accessoryView = keepopenswitch; 71 | 72 | if (true) { 73 | TerpGlkViewController *mainviewc = [TerpGlkViewController singleton]; 74 | UISwipeGestureRecognizer *recognizer; 75 | recognizer = [[[UISwipeGestureRecognizer alloc] initWithTarget:mainviewc action:@selector(handleSwipeLeft:)] autorelease]; 76 | recognizer.direction = UISwipeGestureRecognizerDirectionLeft; 77 | [tableview addGestureRecognizer:recognizer]; 78 | recognizer = [[[UISwipeGestureRecognizer alloc] initWithTarget:mainviewc action:@selector(handleSwipeRight:)] autorelease]; 79 | recognizer.direction = UISwipeGestureRecognizerDirectionRight; 80 | [tableview addGestureRecognizer:recognizer]; 81 | } 82 | } 83 | 84 | - (void) viewWillAppear:(BOOL)animated 85 | { 86 | [super viewWillAppear:animated]; 87 | 88 | NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; 89 | autocorrectswitch.on = ![defaults boolForKey:@"NoAutocorrect"]; 90 | keepopenswitch.on = ![defaults boolForKey:@"NoKeepOpen"]; 91 | } 92 | 93 | - (BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)orientation 94 | { 95 | IosGlkViewController *glkviewc = [IosGlkViewController singleton]; 96 | return [glkviewc shouldAutorotateToInterfaceOrientation:orientation]; 97 | } 98 | 99 | - (IBAction) handleAutoCorrect:(id)sender 100 | { 101 | NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; 102 | [defaults setBool:!autocorrectswitch.on forKey:@"NoAutocorrect"]; 103 | 104 | IosGlkViewController *glkviewc = [IosGlkViewController singleton]; 105 | if (glkviewc.frameview) 106 | [glkviewc.frameview updateInputTraits]; 107 | } 108 | 109 | - (IBAction) handleKeepOpen:(id)sender 110 | { 111 | NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; 112 | [defaults setBool:!keepopenswitch.on forKey:@"NoKeepOpen"]; 113 | } 114 | 115 | - (void) handleLicenses 116 | { 117 | NSString *title = NSLocalizedStringFromTable(@"settings.title.license", @"TerpLocalize", nil); 118 | DisplayWebViewController *viewc = [[[DisplayWebViewController alloc] initWithNibName:@"WebDocVC" filename:@"license" title:title bundle:nil] autorelease]; 119 | [self.navigationController pushViewController:viewc animated:YES]; 120 | } 121 | 122 | - (void) handleShareFiles 123 | { 124 | [self handleShareFilesHighlightUsage:0 name:nil]; 125 | } 126 | 127 | - (void) handleShareFilesHighlightUsage:(int)usage name:(NSString *)filename 128 | { 129 | ShareFilesViewController *viewc = [[[ShareFilesViewController alloc] initWithNibName:@"ShareFilesVC" bundle:nil] autorelease]; 130 | BOOL animated = YES; 131 | if (filename) { 132 | // It so happens that if filename exists, this is an arriving file (and the caller is displayGlkFileUsage). Don't animate in that case. 133 | animated = NO; 134 | viewc.highlightusage = usage; 135 | viewc.highlightname = filename; 136 | } 137 | [self.navigationController pushViewController:viewc animated:animated]; 138 | } 139 | 140 | /* UITableViewDataSource methods */ 141 | 142 | #define SECTION_PREFS (0) 143 | #define SECTION_FILES (1) 144 | #define SECTION_LICENSE (2) 145 | #define NUM_SECTIONS (3) 146 | 147 | - (NSInteger) numberOfSectionsInTableView:(UITableView *)tableView 148 | { 149 | return NUM_SECTIONS; 150 | } 151 | 152 | - (NSString *) tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section 153 | { 154 | if (section == SECTION_PREFS) 155 | return NSLocalizedStringFromTable(@"settings.section.settings", @"TerpLocalize", nil); 156 | return nil; 157 | } 158 | 159 | - (NSString *) tableView:(UITableView *)tableView titleForFooterInSection:(NSInteger)section 160 | { 161 | if (section == SECTION_PREFS) 162 | return NSLocalizedStringFromTable(@"settings.footer.settings", @"TerpLocalize", nil); 163 | return nil; 164 | } 165 | 166 | - (NSInteger) tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section 167 | { 168 | switch (section) { 169 | case SECTION_PREFS: 170 | return 2; 171 | case SECTION_FILES: 172 | return 1; 173 | case SECTION_LICENSE: 174 | return 1; 175 | default: 176 | return 0; 177 | } 178 | } 179 | 180 | - (UITableViewCell *) tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexpath 181 | { 182 | switch (indexpath.section) { 183 | case SECTION_PREFS: 184 | switch (indexpath.row) { 185 | case 0: 186 | return keepopencell; 187 | case 1: 188 | return autocorrectcell; 189 | default: 190 | return nil; 191 | } 192 | 193 | case SECTION_FILES: 194 | switch (indexpath.row) { 195 | case 0: 196 | return sharefilescell; 197 | default: 198 | return nil; 199 | } 200 | 201 | case SECTION_LICENSE: 202 | switch (indexpath.row) { 203 | case 0: 204 | return licensecell; 205 | default: 206 | return nil; 207 | } 208 | 209 | default: 210 | return nil; 211 | } 212 | } 213 | 214 | /* UITableViewDelegate methods */ 215 | 216 | - (void) tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexpath 217 | { 218 | [tableview deselectRowAtIndexPath:indexpath animated:NO]; 219 | if (indexpath.section == SECTION_LICENSE && indexpath.row == 0) 220 | [self handleLicenses]; 221 | if (indexpath.section == SECTION_FILES && indexpath.row == 0) 222 | [self handleShareFiles]; 223 | } 224 | 225 | 226 | @end 227 | -------------------------------------------------------------------------------- /Resources/IosGlkViewController.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 1536 5 | 12C60 6 | 2844 7 | 1187.34 8 | 625.00 9 | 10 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 11 | 1930 12 | 13 | 14 | IBProxyObject 15 | IBUIView 16 | 17 | 18 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 19 | 20 | 21 | PluginDependencyRecalculationVersion 22 | 23 | 24 | 25 | 26 | IBFilesOwner 27 | IBCocoaTouchFramework 28 | 29 | 30 | IBFirstResponder 31 | IBCocoaTouchFramework 32 | 33 | 34 | 35 | 274 36 | 37 | 38 | 39 | 274 40 | {320, 460} 41 | 42 | 43 | _NS:196 44 | 45 | 3 46 | MC43NDM0NDU2OTI5AA 47 | 48 | NO 49 | IBCocoaTouchFramework 50 | 51 | 52 | {{0, 20}, {320, 460}} 53 | 54 | 55 | 56 | 3 57 | MC42OTA2OTc2NzQ0AA 58 | 59 | 60 | IBCocoaTouchFramework 61 | 62 | 63 | 64 | 65 | 66 | 67 | view 68 | 69 | 70 | 71 | 7 72 | 73 | 74 | 75 | frameview 76 | 77 | 78 | 79 | 11 80 | 81 | 82 | 83 | 84 | 85 | 0 86 | 87 | 88 | 89 | 90 | 91 | -1 92 | 93 | 94 | File's Owner 95 | 96 | 97 | -2 98 | 99 | 100 | 101 | 102 | 6 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 10 111 | 112 | 113 | 114 | 115 | 116 | 117 | IosGlkViewController 118 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 119 | UIResponder 120 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 121 | GlkFrameView 122 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 123 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 124 | 125 | 126 | 127 | 128 | 129 | 11 130 | 131 | 132 | 133 | 134 | GlkFrameView 135 | UIView 136 | 137 | IBProjectSource 138 | ./Classes/GlkFrameView.h 139 | 140 | 141 | 142 | IosGlkViewController 143 | UIViewController 144 | 145 | toggleKeyboard 146 | id 147 | 148 | 149 | toggleKeyboard 150 | 151 | toggleKeyboard 152 | id 153 | 154 | 155 | 156 | GlkFrameView 157 | id 158 | 159 | 160 | 161 | frameview 162 | GlkFrameView 163 | 164 | 165 | glkdelegate 166 | id 167 | 168 | 169 | 170 | IBProjectSource 171 | ./Classes/IosGlkViewController.h 172 | 173 | 174 | 175 | 176 | 0 177 | IBCocoaTouchFramework 178 | 179 | com.apple.InterfaceBuilder.CocoaTouchPlugin.iPhoneOS 180 | 181 | 182 | 183 | com.apple.InterfaceBuilder.CocoaTouchPlugin.InterfaceBuilder3 184 | 185 | 186 | YES 187 | 3 188 | 1930 189 | 190 | 191 | -------------------------------------------------------------------------------- /WebSite/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | How to Play IF 5 | 6 | 7 | 8 | 9 | 10 | 11 |

12 | (Jump to:   13 | Quick start 14 | ... 15 | How to play 16 | ... 17 | What commands look like 18 | ... 19 | Orienting yourself 20 | ... 21 | Moving around the world 22 | ... 23 | Common actions 24 | ... 25 | Special commands) 26 |

27 | 28 |

Quick start

29 | 30 |

31 | Already know how IF works? Here’s the scoop for this app: 32 |

33 | 34 |
    35 |
  • You’ve got four tabs: the game, a note-taking journal, this 36 | help screen, and app preferences. 37 |
  • Swipe left or right to switch tabs. 38 |
  • Double-tap any word on the screen to copy-and-paste it into your command. 39 |
  • Tap the bookmark input button to bring up command shortcuts. 40 | There’s a palette of common IF commands, 41 | and a list of the commands you’ve recently used. 42 |
  • Font and theme preferences are in the menu in the top left. 43 |
  • VoiceOver output and voice dictation input are fully supported (on 44 | devices that offer them). Try them! 45 |
46 | 47 |

How to play

48 | 49 |

50 | In this game, you are the center of a story. You will type commands 51 | in simple English; the game will respond, and tell you what happens. 52 |

53 | 54 |

55 | What commands does this game understand? Well, it depends on the game. 56 | You can try nearly anything you can think of, if it makes sense in the 57 | situation you find yourself in. 58 |

59 | 60 |

61 | Most interactive fiction follows some simple rules, though. Once you’re 62 | familiar with the pattern and the common commands, you can explore freely, 63 | and you’ll have a good idea how to experiment further. 64 |

65 | 66 |

What commands look like

67 | 68 |

69 | The simplest IF commands are usually one or two words: 70 |

71 | 72 |
    73 |
  • LOOK 74 |
  • TAKE SWORD 75 |
  • EAT CUPCAKE 76 |
  • PUSH BUTTON 77 |
78 | 79 |

80 | But sometimes you need more: 81 |

82 | 83 |
    84 |
  • LOOK UNDER BED 85 |
  • PUT LETTER IN ENVELOPE 86 |
87 | 88 |

89 | In a more complicated scene, you might have to get more specific: 90 |

91 | 92 |
    93 |
  • EAT THE SMALL BLUE JELLYBEAN 94 |
  • PUT COPPER COIN IN SLOT 4 95 |
96 | 97 |

98 | You will almost always be dealing with concrete things that you see in 99 | the game world. Work with what you see around you. If you try wild 100 | abstractions like 101 | “GO SEE A MOVIE” or 102 | “RUN FOR PRESIDENT”, the game will probably not 103 | understand you. 104 |

105 | 106 |

Orienting yourself

107 | 108 |

109 | If you are completely at sea, you can always try these commands: 110 |

111 | 112 |
    113 |
  • LOOK 114 | or 115 | L 116 | : Look around the room — repeat the description of 117 | everything you see. 118 |
  • INVENTORY 119 | or 120 | I 121 | : List everything you’re carrying. 122 |
  • EXAMINE thing 123 | or 124 | X thing 125 | : Look more closely at something — learn more about 126 | it. 127 |
128 | 129 |

130 | Because these actions are so common, they have one-letter 131 | abbreviations: 132 | “L”, 133 | “I”, and 134 | “X”. 135 |

136 | 137 |

138 | Again, your actions should focus on the objects and exits that you see 139 | in the game world. 140 |

141 | 142 |

Moving around the world

143 | 144 |

145 | The game world is divided into locations — usually called 146 | “rooms”, although 147 | they might be indoors or outdoors. A room is everything you can see at 148 | one time, and everything you can conveniently reach. Don’t worry about 149 | crossing the room, turning around, or standing near things; that sort of 150 | movement is automatic. 151 |

152 | 153 |

154 | To move to a different location, you’ll usually type simple compass 155 | directions: 156 |

157 | 158 |
    159 |
  • NORTH 160 |
  • SOUTH 161 |
  • EAST 162 |
  • WEST 163 |
  • NORTHEAST 164 |
  • SOUTHWEST 165 |
  • UP 166 |
  • DOWN 167 |
168 | 169 |

170 | You can abbreviate these directions as 171 | “N”, 172 | “NE”, and so on; also 173 | “U” and 174 | “D”. 175 |

176 | 177 |

178 | More specific commands sometimes make sense: 179 |

180 | 181 |
    182 |
  • IN 183 |
  • OUT 184 |
  • ENTER BANK VAULT 185 |
  • GO THROUGH ARCHWAY 186 |
  • CLIMB LADDER 187 |
188 | 189 |

Common actions

190 | 191 |

192 | You’re probably staring at your dictionary and shuddering in terror 193 | (or anticipation!) of the infinite possibilities. Sometimes IF works 194 | that way. More often, you’ll run through a small list of common 195 | commands — some of which you’ve already seen. 196 |

197 | 198 |
    199 |
  • EXAMINE thing 200 |
  • GET thing, 201 | DROP thing 202 |
  • PUT this IN that, 203 | PUT this ON that 204 |
  • PUSH thing, 205 | PULL thing, 206 | TURN thing 207 |
  • OPEN thing, 208 | CLOSE thing 209 |
  • LOCK this WITH that, 210 | UNLOCK this WITH that 211 |
  • TOUCH thing, 212 | SMELL thing, 213 | LISTEN TO thing 214 |
  • EAT thing, 215 | DRINK thing 216 |
  • WEAR thing, 217 | REMOVE thing 218 |
  • SEARCH thing, 219 | LOOK IN thing, 220 | LOOK UNDER thing, 221 | LOOK BEHIND thing 222 |
  • ENTER thing, 223 | SIT ON thing, 224 | CLIMB thing 225 |
  • GET IN thing, 226 | GET OFF thing, 227 | GET OUT OF thing 228 |
  • BREAK thing, 229 | CUT thing, 230 | CRUSH thing 231 |
  • WAIT 232 |
233 | 234 |

Special commands

235 | 236 |
    237 |
  • SAVE 238 | : Save your current game position. 239 |
  • RESTORE 240 | : Restore a saved game; return to the saved position. 241 |
242 | 243 |

244 | You can save any number of positions; you’ll see a list when you type the 245 | “RESTORE” command. 246 | (Of course, when you launch the app you’ll be where you left off. 247 | You don’t need to 248 | “SAVE” 249 | for that. But it’s usually wise to save every once in a while, in case you 250 | make a mistake or want to try something different ways.) 251 |

252 | 253 |
    254 |
  • UNDO 255 | : Take back your last move. 256 |
  • RESTART 257 | : Start the game over from the beginning. 258 |
259 | 260 |

261 | These are handy, but not as flexible as 262 | “RESTORE” and 263 | “SAVE”. 264 |

265 | 266 |
    267 |
  • SCRIPT 268 | : Begin saving a transcript of your game session. 269 |
  • SCRIPT OFF 270 | : Turn off “script” mode. 271 |
272 | 273 |

274 | A transcript is a text log of your game. To see the list of saved transcripts, 275 | switch to the Notes tab and tap the Transcripts button in the top left. 276 |

277 | 278 |
    279 |
  • ABOUT 280 | : Read a brief introduction to the game. 281 |
  • VERBOSE 282 | : See a detailed description of each room you enter, every time. 283 |
  • BRIEF 284 | : Turn off “verbose”. 285 | 286 |
287 | 288 | 289 | 290 | -------------------------------------------------------------------------------- /Resources/ShareFilesVC.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 1296 5 | 14B25 6 | 6250 7 | 1343.16 8 | 755.00 9 | 10 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 11 | 6244 12 | 13 | 14 | IBProxyObject 15 | IBUITableView 16 | 17 | 18 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 19 | 20 | 21 | PluginDependencyRecalculationVersion 22 | 23 | 24 | 25 | 26 | IBFilesOwner 27 | IBCocoaTouchFramework 28 | 29 | 30 | IBFirstResponder 31 | IBCocoaTouchFramework 32 | 33 | 34 | 35 | 274 36 | {{0, 64}, {320, 416}} 37 | 38 | 39 | 40 | 41 | 1 42 | MC45MzcyNTQ5MDIgMC45MzcyNTQ5MDIgMC45NTY4NjI3NDUxAA 43 | groupTableViewBackgroundColor 44 | 45 | NO 46 | YES 47 | NO 48 | 49 | 50 | NO 51 | 52 | 53 | IBUISimulatedFreeformSizeMetricsSentinel 54 | Freeform 55 | 56 | IBCocoaTouchFramework 57 | NO 58 | 1 59 | 2 60 | 0 61 | YES 62 | 44 63 | 10 64 | 10 65 | 66 | 67 | 68 | 69 | 70 | 71 | view 72 | 73 | 74 | 75 | 5 76 | 77 | 78 | 79 | tableView 80 | 81 | 82 | 83 | 8 84 | 85 | 86 | 87 | dataSource 88 | 89 | 90 | 91 | 6 92 | 93 | 94 | 95 | delegate 96 | 97 | 98 | 99 | 7 100 | 101 | 102 | 103 | 104 | 105 | 0 106 | 107 | 108 | 109 | 110 | 111 | -1 112 | 113 | 114 | File's Owner 115 | 116 | 117 | -2 118 | 119 | 120 | 121 | 122 | 4 123 | 124 | 125 | 126 | 127 | 128 | 129 | ShareFilesViewController 130 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 131 | UIResponder 132 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 133 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 134 | 135 | 136 | 137 | 138 | 139 | 8 140 | 141 | 142 | 143 | 144 | UIGestureRecognizer 145 | NSObject 146 | 147 | IBFrameworkSource 148 | UIKit.framework/Headers/UIGestureRecognizer.h 149 | 150 | 151 | 152 | UIResponder 153 | NSObject 154 | 155 | IBFrameworkSource 156 | UIKit.framework/Headers/UIResponder.h 157 | 158 | 159 | 160 | UIScrollView 161 | UIView 162 | 163 | IBFrameworkSource 164 | UIKit.framework/Headers/UIScrollView.h 165 | 166 | 167 | 168 | UITableView 169 | UIScrollView 170 | 171 | IBFrameworkSource 172 | UIKit.framework/Headers/UITableView.h 173 | 174 | 175 | 176 | UIView 177 | UIResponder 178 | 179 | IBFrameworkSource 180 | UIKit.framework/Headers/UIView.h 181 | 182 | 183 | 184 | 185 | 0 186 | IBCocoaTouchFramework 187 | NO 188 | 189 | com.apple.InterfaceBuilder.CocoaTouchPlugin.InterfaceBuilder3 190 | 191 | 192 | YES 193 | 3 194 | 195 | 196 | -------------------------------------------------------------------------------- /TerpSrc/TerpGlkViewController.m: -------------------------------------------------------------------------------- 1 | /* TerpGlkViewController.m: Interpreter-specific subclass of the IosGlk view controller 2 | for IosGlulxe, an IosGlk port of the Glulxe interpreter. 3 | Designed by Andrew Plotkin 4 | http://eblong.com/zarf/glk/ 5 | */ 6 | 7 | #import "TerpGlkViewController.h" 8 | #import "TerpGlkDelegate.h" 9 | #import "GlkLibrary.h" 10 | #import "GlkAppWrapper.h" 11 | #import "GlkFileTypes.h" 12 | #import "TerpGameOverView.h" 13 | #import "IosGlkAppDelegate.h" 14 | #import "GlkFrameView.h" 15 | #import "GlkWinBufferView.h" 16 | #import "NotesViewController.h" 17 | #import "SettingsViewController.h" 18 | #import "PrefsMenuView.h" 19 | 20 | #import "iosstart.h" 21 | 22 | @implementation TerpGlkViewController 23 | 24 | @synthesize notesvc; 25 | @synthesize settingsvc; 26 | 27 | + (TerpGlkViewController *) singleton { 28 | return (TerpGlkViewController *)([IosGlkAppDelegate singleton].glkviewc); 29 | } 30 | 31 | - (TerpGlkDelegate *) terpDelegate { 32 | return (TerpGlkDelegate *)self.glkdelegate; 33 | } 34 | 35 | - (void) didFinishLaunching { 36 | [super didFinishLaunching]; 37 | 38 | NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; 39 | 40 | /* Set some reasonable defaults, if none have ever been set. */ 41 | if (UI_USER_INTERFACE_IDIOM() != UIUserInterfaceIdiomPhone) { 42 | /* On the iPad, use a 3/4 column and bump the leading a little. */ 43 | if (![defaults objectForKey:@"FrameMaxWidth"]) 44 | [defaults setInteger:1 forKey:@"FrameMaxWidth"]; 45 | if (![defaults objectForKey:@"FontLeading"]) 46 | [defaults setInteger:1 forKey:@"FontLeading"]; 47 | } 48 | else { 49 | /* On the iPhone, leave everything as-is. */ 50 | } 51 | 52 | int maxwidth = [defaults integerForKey:@"FrameMaxWidth"]; 53 | self.terpDelegate.maxwidth = maxwidth; 54 | 55 | /* Font-scale values are arbitrarily between 1 and 5. We default to 3. */ 56 | int fontscale = [defaults integerForKey:@"FontScale"]; 57 | if (fontscale == 0) 58 | fontscale = 3; 59 | self.terpDelegate.fontscale = fontscale; 60 | 61 | /* Leading is between 0 and 5. */ 62 | int leading = [defaults integerForKey:@"FontLeading"]; 63 | self.terpDelegate.leading = leading; 64 | 65 | /* Color-scheme values are 0 to 2. */ 66 | int colorscheme = [defaults integerForKey:@"ColorScheme"]; 67 | self.terpDelegate.colorscheme = colorscheme; 68 | 69 | NSString *fontfamily = [defaults stringForKey:@"FontFamily"]; 70 | if (!fontfamily) 71 | fontfamily = @"Georgia"; 72 | self.terpDelegate.fontfamily = fontfamily; 73 | 74 | self.navigationController.navigationBar.barStyle = (self.terpDelegate.hasDarkTheme ? UIBarStyleBlack : UIBarStyleDefault); 75 | 76 | // Yes, this is in two places. 77 | self.frameview.backgroundColor = [self.terpDelegate genBackgroundColor]; 78 | } 79 | 80 | - (void) becameInactive { 81 | [notesvc saveIfNeeded]; 82 | } 83 | 84 | - (void) enteredBackground { 85 | [super enteredBackground]; 86 | 87 | /* If the interpreter hit a "fatal error" state, and we're just waiting around to tell the user about it, we want the Home button to shut down the app. That is, the user can kill the app by backgrounding it. */ 88 | GlkLibrary *library = [GlkLibrary singleton]; 89 | if (library && library.vmexited && !iosglk_can_restart_cleanly()) { 90 | iosglk_shut_down_process(); 91 | } 92 | } 93 | 94 | - (void) viewDidLoad { 95 | [super viewDidLoad]; 96 | 97 | self.frameview.backgroundColor = [self.terpDelegate genBackgroundColor]; 98 | 99 | if (true) { 100 | UISwipeGestureRecognizer *recognizer; 101 | recognizer = [[[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(handleSwipeLeft:)] autorelease]; 102 | recognizer.direction = UISwipeGestureRecognizerDirectionLeft; 103 | recognizer.delegate = self; 104 | [frameview addGestureRecognizer:recognizer]; 105 | recognizer = [[[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(handleSwipeRight:)] autorelease]; 106 | recognizer.direction = UISwipeGestureRecognizerDirectionRight; 107 | recognizer.delegate = self; 108 | [frameview addGestureRecognizer:recognizer]; 109 | } 110 | 111 | /* Set the title of the game tab. */ 112 | NSString *maintitle = self.navigationItem.title; 113 | if (maintitle.length <= 2) { 114 | /* Use a title from the delegate */ 115 | maintitle = [self.terpDelegate gameTitle]; 116 | /* ...If that's not provided, pull it from TerpLocalize.strings. */ 117 | if (!maintitle) 118 | maintitle = NSLocalizedStringFromTable(@"title.game", @"TerpLocalize", nil); 119 | self.navigationItem.title = maintitle; 120 | } 121 | 122 | /* Interface Builder currently doesn't allow us to set the voiceover labels for bar button items. We do it in code. */ 123 | UIBarButtonItem *stylebutton = self.navigationItem.leftBarButtonItem; 124 | if (stylebutton && [stylebutton respondsToSelector:@selector(setAccessibilityLabel:)]) { 125 | [stylebutton setAccessibilityLabel:NSLocalizedStringFromTable(@"label.text-styles", @"TerpLocalize", nil)]; 126 | } 127 | UIBarButtonItem *keyboardbutton = self.navigationItem.rightBarButtonItem; 128 | if (keyboardbutton && [keyboardbutton respondsToSelector:@selector(setAccessibilityLabel:)]) { 129 | [keyboardbutton setAccessibilityLabel:NSLocalizedStringFromTable(@"label.keyboard", @"TerpLocalize", nil)]; 130 | } 131 | 132 | if ([IosGlkAppDelegate oldstyleui]) { 133 | /* Use the old-style drop-shadowed buttons in the navbar. */ 134 | if (stylebutton) 135 | [stylebutton setImage:[UIImage imageNamed:@"baricon-styles-old"]]; 136 | if (keyboardbutton) 137 | [keyboardbutton setImage:[UIImage imageNamed:@"baricon-edit-old"]]; 138 | } 139 | } 140 | 141 | - (void) postGameOver { 142 | CGRect rect = frameview.bounds; 143 | TerpGameOverView *menuview = [[[TerpGameOverView alloc] initWithFrame:frameview.bounds centerInFrame:rect] autorelease]; 144 | [frameview postPopMenu:menuview]; 145 | } 146 | 147 | /* UITabBarController delegate method */ 148 | - (void) tabBarController:(UITabBarController *)tabBarController didSelectViewController:(UIViewController *)viewc { 149 | if (![viewc isKindOfClass:[UINavigationController class]]) 150 | return; 151 | UINavigationController *navc = (UINavigationController *)viewc; 152 | NSArray *viewcstack = navc.viewControllers; 153 | if (!viewcstack || !viewcstack.count) 154 | return; 155 | UIViewController *rootviewc = [viewcstack objectAtIndex:0]; 156 | //NSLog(@"### tabBarController did select %@ (%@)", navc, rootviewc); 157 | 158 | if (rootviewc != notesvc) { 159 | /* If the notesvc was drilled into the transcripts view or subviews, pop out of there. */ 160 | [notesvc.navigationController popToRootViewControllerAnimated:NO]; 161 | } 162 | if (rootviewc != settingsvc) { 163 | /* If the settingsvc was drilled into a web subview, pop out of there. */ 164 | [settingsvc.navigationController popToRootViewControllerAnimated:NO]; 165 | } 166 | } 167 | 168 | /* UIGestureRecognizer delegate method */ 169 | - (BOOL) gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch { 170 | /* Turn off tab-swiping if an input menu is open. */ 171 | if (!frameview) 172 | return NO; 173 | if (frameview.menuview) 174 | return NO; 175 | /* Reject the swipe if it's on a window's text-selection rectangle. */ 176 | if (self.textselecttag) { 177 | GlkWindowView *winv = [frameview windowViewForTag:textselecttag]; 178 | if (winv) { 179 | CGRect rect = winv.textSelectArea; 180 | if (rect.size.width > 0 && rect.size.height > 0) { 181 | CGPoint loc = [touch locationInView:winv]; 182 | if (loc.y >= rect.origin.y - 32 && loc.y < rect.origin.y+rect.size.height + 32 183 | && loc.x >= rect.origin.x && loc.x < rect.origin.x+rect.size.width) { 184 | return NO; 185 | } 186 | } 187 | } 188 | } 189 | return YES; 190 | } 191 | 192 | - (IBAction) toggleKeyboard { 193 | if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone) { 194 | /* Can't have the prefs menu up at the same time as the keyboard -- the iPhone screen is too small. */ 195 | if (frameview.menuview && [frameview.menuview isKindOfClass:[PrefsMenuView class]]) { 196 | [frameview removePopMenuAnimated:YES]; 197 | } 198 | } 199 | [super toggleKeyboard]; 200 | } 201 | 202 | - (void) keyboardWillBeShown:(NSNotification*)notification { 203 | [super keyboardWillBeShown:notification]; 204 | //NSLog(@"Keyboard will be shown (terp)"); 205 | 206 | if (notesvc) { 207 | [notesvc adjustToKeyboardBox]; 208 | } 209 | } 210 | 211 | - (void) keyboardWillBeHidden:(NSNotification*)notification { 212 | [super keyboardWillBeHidden:notification]; 213 | //NSLog(@"Keyboard will be hidden (terp)"); 214 | 215 | if (notesvc) { 216 | [notesvc adjustToKeyboardBox]; 217 | } 218 | } 219 | 220 | - (IBAction) showPreferences { 221 | if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone) { 222 | /* Can't have the prefs menu up at the same time as the keyboard */ 223 | [self hideKeyboard]; 224 | } 225 | 226 | if (frameview.menuview && [frameview.menuview isKindOfClass:[PrefsMenuView class]]) { 227 | [frameview removePopMenuAnimated:YES]; 228 | return; 229 | } 230 | 231 | CGRect rect = CGRectMake(4, 0, 40, 4); 232 | PrefsMenuView *menuview = [[[PrefsMenuView alloc] initWithFrame:frameview.bounds buttonFrame:rect belowButton:YES] autorelease]; 233 | [frameview postPopMenu:menuview]; 234 | } 235 | 236 | - (void) handleSwipeLeft:(UIGestureRecognizer *)recognizer { 237 | if (self.tabBarController) { 238 | int count = self.tabBarController.viewControllers.count; 239 | int val = (self.tabBarController.selectedIndex + 1) % count; 240 | self.tabBarController.selectedIndex = val; 241 | } 242 | } 243 | 244 | - (void) handleSwipeRight:(UIGestureRecognizer *)recognizer { 245 | if (self.tabBarController) { 246 | int count = self.tabBarController.viewControllers.count; 247 | int val = (self.tabBarController.selectedIndex + count - 1) % count; 248 | self.tabBarController.selectedIndex = val; 249 | } 250 | } 251 | 252 | @end 253 | -------------------------------------------------------------------------------- /TerpSrc/NotesViewController.m: -------------------------------------------------------------------------------- 1 | /* NotesViewController.m: Interpreter notes tab view controller 2 | for IosGlulxe, an IosGlk port of the Glulxe interpreter. 3 | Designed by Andrew Plotkin 4 | http://eblong.com/zarf/glk/ 5 | */ 6 | 7 | #import "NotesViewController.h" 8 | #import "TerpGlkViewController.h" 9 | #import "IosGlkViewController.h" 10 | #import "TranscriptViewController.h" 11 | #import "GradientView.h" 12 | #import "MButton.h" 13 | #import "IosGlkAppDelegate.h" 14 | 15 | #define NOTES_SAVE_DELAY (60) 16 | 17 | @implementation NotesViewController 18 | 19 | @synthesize textview; 20 | @synthesize gradview; 21 | @synthesize buttontable; 22 | @synthesize transcriptcell; 23 | @synthesize notespath; 24 | 25 | - (void) dealloc { 26 | self.textview = nil; 27 | self.gradview = nil; 28 | self.buttontable = nil; 29 | self.transcriptcell = nil; 30 | [super dealloc]; 31 | } 32 | 33 | - (void) viewDidLoad 34 | { 35 | [super viewDidLoad]; 36 | 37 | textview.delegate = self; 38 | 39 | UIEdgeInsets insets = UIEdgeInsetsMake(buttontable.bounds.size.height, 0, 0, 0); 40 | textview.contentInset = insets; 41 | textview.scrollIndicatorInsets = insets; 42 | 43 | if ([buttontable respondsToSelector:@selector(backgroundView)]) { 44 | /* This is only available in iOS 3.2 and up */ 45 | buttontable.backgroundView = [[[UIView alloc] initWithFrame:buttontable.backgroundView.frame] autorelease]; 46 | if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone) { 47 | buttontable.backgroundView.backgroundColor = [UIColor colorWithRed:1.0 green:0.98 blue:0.92 alpha:1]; 48 | } 49 | else { 50 | buttontable.backgroundView.backgroundColor = [UIColor colorWithRed:0.85 green:0.8 blue:0.6 alpha:1]; 51 | } 52 | } 53 | 54 | /* Create the cells... */ 55 | self.transcriptcell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"Notes"] autorelease]; 56 | transcriptcell.backgroundColor = [UIColor colorWithRed:1.0 green:0.98 blue:0.92 alpha:1]; 57 | transcriptcell.textLabel.text = NSLocalizedStringFromTable(@"title.transcripts", @"TerpLocalize", nil); 58 | transcriptcell.textLabel.textColor = [UIColor colorWithRed:0.35 green:0.215 blue:0 alpha:1]; 59 | if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone) 60 | transcriptcell.textLabel.font = [transcriptcell.textLabel.font fontWithSize:17]; 61 | transcriptcell.accessoryType = UITableViewCellAccessoryDisclosureIndicator; 62 | 63 | /* Bang on font if Noteworthy is not available. I don't know why Marker Felt needs to be so enormous to fit the same grid as Noteworthy, though. */ 64 | if ([textview.font.familyName isEqualToString:@"Helvetica"]) { 65 | CGFloat fontsize; 66 | if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone) 67 | fontsize = 21; 68 | else 69 | fontsize = 25; 70 | UIFont *font = [UIFont fontWithName:@"MarkerFelt-Thin" size:fontsize]; 71 | if (font) 72 | textview.font = font; 73 | else 74 | textview.font = [UIFont systemFontOfSize:fontsize]; 75 | } 76 | 77 | NSString *reqSysVer = @"5.0"; 78 | NSString *currSysVer = [[UIDevice currentDevice] systemVersion]; 79 | BOOL hasios5 = ([currSysVer compare:reqSysVer options:NSNumericSearch] != NSOrderedAscending); 80 | 81 | UIImage *stripeimg = nil; 82 | if (hasios5) { 83 | if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone) 84 | stripeimg = [UIImage imageNamed:@"background-notes-s"]; 85 | else 86 | stripeimg = [UIImage imageNamed:@"background-notes"]; 87 | if (stripeimg) 88 | textview.backgroundColor = [UIColor colorWithPatternImage:stripeimg]; 89 | 90 | [gradview setUpColorsPreset:1]; 91 | } 92 | else { 93 | /* Transparent background colors won't load properly. We substitute opaque ones, which handily cover up the missing gradient view. */ 94 | if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone) 95 | stripeimg = [UIImage imageNamed:@"background-notesopaque-s"]; 96 | else 97 | stripeimg = [UIImage imageNamed:@"background-notesopaque"]; 98 | if (stripeimg) 99 | textview.backgroundColor = [UIColor colorWithPatternImage:stripeimg]; 100 | } 101 | 102 | /* We use an old-fashioned way of locating the Documents directory. (The NSManager method for this is iOS 4.0 and later.) */ 103 | 104 | if (!notespath) { 105 | NSArray *dirlist = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); 106 | if (dirlist.count) { 107 | NSString *dir = [dirlist objectAtIndex:0]; 108 | self.notespath = [dir stringByAppendingPathComponent:@"PlayerNotes.txt"]; 109 | } 110 | } 111 | 112 | textchanged = NO; 113 | 114 | if (notespath) { 115 | NSString *str = [NSString stringWithContentsOfFile:notespath encoding:NSUTF8StringEncoding error:nil]; 116 | if (str) 117 | textview.text = str; 118 | } 119 | 120 | /* Interface Builder currently doesn't allow us to set the voiceover labels for bar button items. We do it in code. */ 121 | UIBarButtonItem *keyboardbutton = self.navigationItem.rightBarButtonItem; 122 | if (keyboardbutton && [keyboardbutton respondsToSelector:@selector(setAccessibilityLabel:)]) { 123 | [keyboardbutton setAccessibilityLabel:NSLocalizedStringFromTable(@"label.keyboard", @"TerpLocalize", nil)]; 124 | } 125 | 126 | if ([IosGlkAppDelegate oldstyleui]) { 127 | /* Use the old-style drop-shadowed buttons in the navbar. */ 128 | if (keyboardbutton) 129 | [keyboardbutton setImage:[UIImage imageNamed:@"baricon-edit-old"]]; 130 | } 131 | 132 | if (true) { 133 | TerpGlkViewController *mainviewc = [TerpGlkViewController singleton]; 134 | UISwipeGestureRecognizer *recognizer; 135 | recognizer = [[[UISwipeGestureRecognizer alloc] initWithTarget:mainviewc action:@selector(handleSwipeLeft:)] autorelease]; 136 | recognizer.direction = UISwipeGestureRecognizerDirectionLeft; 137 | [textview addGestureRecognizer:recognizer]; 138 | recognizer = [[[UISwipeGestureRecognizer alloc] initWithTarget:mainviewc action:@selector(handleSwipeRight:)] autorelease]; 139 | recognizer.direction = UISwipeGestureRecognizerDirectionRight; 140 | [textview addGestureRecognizer:recognizer]; 141 | } 142 | } 143 | 144 | - (void) viewWillUnload 145 | { 146 | [super viewWillUnload]; 147 | [self saveIfNeeded]; 148 | textview.delegate = nil; 149 | } 150 | 151 | /* Called both when you leave the Notes tab, and when the notes view is covered by a pushed transcript view. 152 | */ 153 | - (void) viewDidDisappear:(BOOL)animated 154 | { 155 | [super viewDidDisappear:animated]; 156 | [self saveIfNeeded]; 157 | } 158 | 159 | - (void) viewDidAppear:(BOOL)animated 160 | { 161 | [super viewDidAppear:animated]; 162 | [self adjustToKeyboardBox]; 163 | } 164 | 165 | - (BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)orientation 166 | { 167 | IosGlkViewController *glkviewc = [IosGlkViewController singleton]; 168 | return [glkviewc shouldAutorotateToInterfaceOrientation:orientation]; 169 | } 170 | 171 | - (IBAction) toggleKeyboard 172 | { 173 | if ([textview isFirstResponder]) { 174 | [textview resignFirstResponder]; 175 | } 176 | else { 177 | [textview becomeFirstResponder]; 178 | } 179 | } 180 | 181 | - (void) adjustToKeyboardBox { 182 | CGRect keyboardbox = [IosGlkViewController singleton].keyboardbox; 183 | /* This rect is in window coordinates. */ 184 | 185 | if (textview) { 186 | CGFloat offset = 0; 187 | 188 | if (keyboardbox.size.width > 0 && keyboardbox.size.height > 0) { 189 | CGRect box = textview.bounds; 190 | CGFloat bottom = box.origin.y + box.size.height; 191 | CGRect rect = [textview convertRect:keyboardbox fromView:nil]; 192 | if (rect.origin.y < bottom) { 193 | offset = bottom - rect.origin.y; 194 | } 195 | } 196 | 197 | UIEdgeInsets insets = UIEdgeInsetsMake(buttontable.bounds.size.height, 0, offset, 0); 198 | textview.contentInset = insets; 199 | textview.scrollIndicatorInsets = insets; 200 | } 201 | } 202 | 203 | - (IBAction) handleTranscripts 204 | { 205 | TranscriptViewController *transviewc = [[[TranscriptViewController alloc] initWithNibName:@"TranscriptVC" bundle:nil] autorelease]; 206 | [self.navigationController pushViewController:transviewc animated:YES]; 207 | } 208 | 209 | - (void) saveIfNeeded 210 | { 211 | if (!textchanged) 212 | return; 213 | textchanged = NO; 214 | [NSObject cancelPreviousPerformRequestsWithTarget:self selector:@selector(saveIfNeeded) object:nil]; 215 | if (notespath && textview.text) { 216 | [textview.text writeToFile:notespath atomically:YES encoding:NSUTF8StringEncoding error:nil]; 217 | } 218 | } 219 | 220 | - (void) scrollViewDidScroll:(UIScrollView *)scrollView 221 | { 222 | CGRect rect = buttontable.frame; 223 | rect.origin.y = -textview.contentOffset.y - rect.size.height; 224 | if (rect.origin.y > 0) 225 | rect.origin.y = 0; 226 | buttontable.frame = rect; 227 | } 228 | 229 | /* UITextView delegate method */ 230 | 231 | - (void) textViewDidChange:(UITextView *)textView 232 | { 233 | if (!textchanged) { 234 | textchanged = YES; 235 | [self performSelector:@selector(saveIfNeeded) withObject:nil afterDelay:NOTES_SAVE_DELAY]; 236 | } 237 | } 238 | 239 | /* UITableViewDataSource methods */ 240 | 241 | - (NSInteger) tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section 242 | { 243 | return 1; 244 | } 245 | 246 | - (UITableViewCell *) tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexpath 247 | { 248 | switch (indexpath.row) { 249 | case 0: 250 | return transcriptcell; 251 | default: 252 | return nil; 253 | } 254 | } 255 | 256 | /* UITableViewDelegate methods */ 257 | 258 | - (void) tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexpath 259 | { 260 | [buttontable deselectRowAtIndexPath:indexpath animated:NO]; 261 | if (indexpath.row == 0) 262 | [self handleTranscripts]; 263 | } 264 | 265 | - (NSString *) tableView:(UITableView *)tableView titleForFooterInSection:(NSInteger)section 266 | { 267 | return nil; 268 | } 269 | 270 | - (NSString *) tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section 271 | { 272 | return nil; 273 | } 274 | 275 | 276 | @end 277 | 278 | -------------------------------------------------------------------------------- /Resources/Base.lproj/FatalGameOverView.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 1536 5 | 12C60 6 | 2844 7 | 1187.34 8 | 625.00 9 | 10 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 11 | 1930 12 | 13 | 14 | IBProxyObject 15 | IBUIButton 16 | IBUILabel 17 | IBUIView 18 | 19 | 20 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 21 | 22 | 23 | PluginDependencyRecalculationVersion 24 | 25 | 26 | 27 | 28 | IBFilesOwner 29 | IBIPadFramework 30 | 31 | 32 | IBFirstResponder 33 | IBIPadFramework 34 | 35 | 36 | 37 | 274 38 | 39 | 40 | 41 | 306 42 | {200, 63} 43 | 44 | 45 | _NS:9 46 | NO 47 | YES 48 | 7 49 | NO 50 | IBIPadFramework 51 | The game has encountered a serious error. Please press the Home button to leave the app. 52 | 53 | 1 54 | MCAwIDAAA 55 | darkTextColor 56 | 57 | 58 | 0 59 | 10 60 | 0 61 | 1 62 | 63 | 1 64 | 14 65 | 66 | 67 | Helvetica 68 | 14 69 | 16 70 | 71 | 200 72 | 73 | 74 | 75 | 269 76 | {{45, 71}, {110, 37}} 77 | 78 | _NS:9 79 | NO 80 | IBIPadFramework 81 | 0 82 | 0 83 | Leave App 84 | 85 | 1 86 | MC4xNjg5ODk2ODgyIDAuMTAxNzU0NTE2NCAwLjA0MzgzMTk3Nzk5AA 87 | 88 | 89 | 1 90 | MC40NDQzMjI4MjQ1IDAuMzEzNDIzMTI2OSAwLjE5MzIyNzYwNAA 91 | 92 | 93 | 3 94 | MC41AA 95 | 96 | 97 | NSImage 98 | button-pref-hi.png 99 | 100 | 101 | NSImage 102 | button-pref-base.png 103 | 104 | 105 | 2 106 | 15 107 | 108 | 109 | Helvetica-Bold 110 | 15 111 | 16 112 | 113 | 114 | 115 | {200, 108} 116 | 117 | 118 | 119 | 3 120 | MCAwAA 121 | 122 | NO 123 | IBIPadFramework 124 | 125 | 126 | 127 | 128 | 129 | 130 | container 131 | 132 | 133 | 134 | 20 135 | 136 | 137 | 138 | handleQuitButton: 139 | 140 | 141 | 7 142 | 143 | 66 144 | 145 | 146 | 147 | 148 | 149 | 0 150 | 151 | 152 | 153 | 154 | 155 | 1 156 | 157 | 158 | 159 | 160 | 161 | 162 | Container 163 | 164 | 165 | -1 166 | 167 | 168 | File's Owner 169 | 170 | 171 | -2 172 | 173 | 174 | 175 | 176 | 60 177 | 178 | 179 | 180 | 181 | 65 182 | 183 | 184 | 185 | 186 | 187 | 188 | TerpGameOverView 189 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 190 | UIResponder 191 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 192 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 193 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 194 | MButton 195 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 196 | 197 | 198 | 199 | 200 | 201 | 202 | 66 203 | 204 | 205 | 0 206 | IBIPadFramework 207 | 208 | com.apple.InterfaceBuilder.CocoaTouchPlugin.iPhoneOS 209 | 210 | 211 | 212 | com.apple.InterfaceBuilder.CocoaTouchPlugin.InterfaceBuilder3 213 | 214 | 215 | YES 216 | 3 217 | 218 | {32, 32} 219 | {32, 32} 220 | 221 | 1930 222 | 223 | 224 | -------------------------------------------------------------------------------- /Resources/Base.lproj/SettingsVC.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 1536 5 | 12C60 6 | 2844 7 | 1187.34 8 | 625.00 9 | 10 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 11 | 1930 12 | 13 | 14 | IBProxyObject 15 | IBUISwitch 16 | IBUITableView 17 | IBUIView 18 | 19 | 20 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 21 | 22 | 23 | PluginDependencyRecalculationVersion 24 | 25 | 26 | 27 | 28 | IBFilesOwner 29 | IBCocoaTouchFramework 30 | 31 | 32 | IBFirstResponder 33 | IBCocoaTouchFramework 34 | 35 | 36 | 37 | 274 38 | 39 | 40 | 41 | 274 42 | {320, 460} 43 | 44 | _NS:9 45 | 46 | 1 47 | MCAwIDAgMAA 48 | groupTableViewBackgroundColor 49 | 50 | YES 51 | IBCocoaTouchFramework 52 | 1 53 | 2 54 | 0 55 | YES 56 | 44 57 | 10 58 | 10 59 | 60 | 61 | {{0, 20}, {320, 460}} 62 | 63 | 64 | 65 | 3 66 | MC41AA 67 | 68 | 69 | IBCocoaTouchFramework 70 | 71 | 72 | 73 | 292 74 | {79, 27} 75 | 76 | _NS:9 77 | NO 78 | IBCocoaTouchFramework 79 | 0 80 | 0 81 | YES 82 | 83 | 1 84 | MC42MzEyNzUyOTYyIDAuNTAzMjI5NTU4NSAwAA 85 | 86 | 87 | 88 | 89 | 292 90 | {79, 27} 91 | 92 | _NS:9 93 | NO 94 | IBCocoaTouchFramework 95 | 0 96 | 0 97 | YES 98 | 99 | 1 100 | MC42MzEyNzUyOTYyIDAuNTAzMjI5NTU4NSAwAA 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | view 109 | 110 | 111 | 112 | 3 113 | 114 | 115 | 116 | tableview 117 | 118 | 119 | 120 | 7 121 | 122 | 123 | 124 | autocorrectswitch 125 | 126 | 127 | 128 | 27 129 | 130 | 131 | 132 | keepopenswitch 133 | 134 | 135 | 136 | 31 137 | 138 | 139 | 140 | dataSource 141 | 142 | 143 | 144 | 12 145 | 146 | 147 | 148 | delegate 149 | 150 | 151 | 152 | 13 153 | 154 | 155 | 156 | handleAutoCorrect: 157 | 158 | 159 | 13 160 | 161 | 29 162 | 163 | 164 | 165 | handleKeepOpen: 166 | 167 | 168 | 13 169 | 170 | 32 171 | 172 | 173 | 174 | 175 | 176 | 0 177 | 178 | 179 | 180 | 181 | 182 | 1 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | -1 191 | 192 | 193 | File's Owner 194 | 195 | 196 | -2 197 | 198 | 199 | 200 | 201 | 6 202 | 203 | 204 | 205 | 206 | 23 207 | 208 | 209 | Autocorrect Switch 210 | 211 | 212 | 25 213 | 214 | 215 | Keep Open Switch 216 | 217 | 218 | 219 | 220 | SettingsViewController 221 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 222 | UIResponder 223 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 224 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 225 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 226 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 227 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 228 | 229 | 230 | 231 | 232 | 233 | 32 234 | 235 | 236 | 0 237 | IBCocoaTouchFramework 238 | 239 | com.apple.InterfaceBuilder.CocoaTouchPlugin.iPhoneOS 240 | 241 | 242 | 243 | com.apple.InterfaceBuilder.CocoaTouchPlugin.InterfaceBuilder3 244 | 245 | 246 | YES 247 | 3 248 | 1930 249 | 250 | 251 | -------------------------------------------------------------------------------- /TerpSrc/TerpGlkDelegate.m: -------------------------------------------------------------------------------- 1 | /* TerpGlkDelegate.m: Interpreter-specific delegate for the IosGlk library 2 | for IosGlulxe, an IosGlk port of the Glulxe interpreter. 3 | Designed by Andrew Plotkin 4 | http://eblong.com/zarf/glk/ 5 | */ 6 | 7 | #import "TerpGlkDelegate.h" 8 | #import "TerpGlkViewController.h" 9 | #import "SettingsViewController.h" 10 | #import "IosGlkLibDelegate.h" 11 | #import "TerpGlkWindows.h" 12 | #import "GlkWindowState.h" 13 | #import "StyleSet.h" 14 | 15 | #import "iosstart.h" 16 | 17 | @implementation TerpGlkDelegate 18 | 19 | @synthesize maxwidth; 20 | @synthesize fontfamily; 21 | @synthesize fontscale; 22 | @synthesize colorscheme; 23 | @synthesize leading; 24 | 25 | - (void) dealloc { 26 | self.fontfamily = nil; 27 | [super dealloc]; 28 | } 29 | 30 | - (NSString *) gameId { 31 | return nil; 32 | } 33 | 34 | #define IFFID(c1, c2, c3, c4) \ 35 | ( (((glui32)c1) << 24) \ 36 | | (((glui32)c2) << 16) \ 37 | | (((glui32)c3) << 8) \ 38 | | (((glui32)c4)) ) 39 | 40 | /* Check whether the given file is a Glulx save file matching our game. 41 | 42 | This replicates the Quetzal-parsing code in glulxe. It's a stable algorithm and I don't want to go chopping additional entry points into the interpreter. 43 | */ 44 | - (GlkSaveFormat) checkGlkSaveFileFormat:(NSString *)path { 45 | NSFileHandle *fhan = [NSFileHandle fileHandleForReadingAtPath:path]; 46 | if (!fhan) 47 | return saveformat_Unreadable; 48 | 49 | // Let's do this using a block. 50 | BOOL (^Read4)(glui32 *) = ^(glui32 *val) { 51 | NSData *dat = [fhan readDataOfLength:4]; 52 | if (!dat || dat.length < 4) { 53 | *val = 0; 54 | return NO; 55 | } 56 | const unsigned char *bytes = dat.bytes; 57 | *val = ((bytes[0] << 24) | (bytes[1] << 16) | (bytes[2] << 8) | (bytes[3])); 58 | return YES; 59 | }; 60 | 61 | BOOL res; 62 | glui32 val; 63 | 64 | res = Read4(&val); 65 | if (!res || val != IFFID('F', 'O', 'R', 'M')) { 66 | [fhan closeFile]; 67 | return saveformat_UnknownFormat; 68 | } 69 | 70 | glui32 filelen; 71 | res = Read4(&filelen); 72 | if (!res) { 73 | [fhan closeFile]; 74 | return saveformat_UnknownFormat; 75 | } 76 | glui32 filestart = fhan.offsetInFile; 77 | 78 | res = Read4(&val); 79 | if (!res || val != IFFID('I', 'F', 'Z', 'S')) { 80 | [fhan closeFile]; 81 | return saveformat_UnknownFormat; 82 | } 83 | 84 | GlkSaveFormat result = saveformat_UnknownFormat; 85 | 86 | while (fhan.offsetInFile < filestart+filelen) { 87 | /* Read a chunk and deal with it. */ 88 | glui32 chunktype=0, chunkstart=0, chunklen=0; 89 | 90 | res = Read4(&chunktype); 91 | if (!res) { 92 | result = saveformat_UnknownFormat; 93 | break; 94 | } 95 | res = Read4(&chunklen); 96 | if (!res) { 97 | result = saveformat_UnknownFormat; 98 | break; 99 | } 100 | chunkstart = fhan.offsetInFile; 101 | 102 | if (chunktype == IFFID('I', 'F', 'h', 'd')) { 103 | /* Read the value, compare to the game file. If it matches, we're good. */ 104 | NSData *dat = [fhan readDataOfLength:chunklen]; 105 | if (!dat || dat.length < chunklen) { 106 | result = saveformat_UnknownFormat; 107 | break; 108 | } 109 | result = saveformat_UnknownFormat; 110 | NSFileHandle *gamehan = [NSFileHandle fileHandleForReadingAtPath:[self gamePath]]; 111 | if (gamehan) { 112 | int len = dat.length; 113 | NSData *gamedat = [gamehan readDataOfLength:len]; 114 | if (gamedat && gamedat.length == len) { 115 | int ix; 116 | const unsigned char *bytes = dat.bytes; 117 | const unsigned char *gamebytes = gamedat.bytes; 118 | result = saveformat_Ok; 119 | for (ix=0; ix 64 && rect.size.width > limit) { 346 | rect.origin.x = (rect.origin.x+0.5*rect.size.width) - 0.5*limit; 347 | rect.size.width = limit; 348 | } 349 | return rect; 350 | } 351 | 352 | - (UIEdgeInsets) viewMarginForWindow:(GlkWindowState *)win rect:(CGRect)rect framebounds:(CGRect)framebounds { 353 | if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone) 354 | return UIEdgeInsetsZero; 355 | 356 | if ([win isKindOfClass:[GlkWindowBufferState class]]) { 357 | CGFloat left = rect.origin.x - framebounds.origin.x; 358 | CGFloat right = (framebounds.origin.x+framebounds.size.width) - (rect.origin.x+rect.size.width); 359 | if (left >= 32 && right >= 32) { 360 | return UIEdgeInsetsMake(0, left, 0, right); 361 | } 362 | } 363 | 364 | return UIEdgeInsetsZero; 365 | } 366 | 367 | /* This is called when the library leaves glk_main(), either by returning or by a glk_exit() exception. 368 | */ 369 | - (void) vmHasExited { 370 | iosglk_clear_autosave(); 371 | } 372 | 373 | @end 374 | 375 | -------------------------------------------------------------------------------- /Resources/Base.lproj/NotesVC.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 1536 5 | 12C60 6 | 2844 7 | 1187.34 8 | 625.00 9 | 10 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 11 | 1930 12 | 13 | 14 | IBProxyObject 15 | IBUITableView 16 | IBUITextView 17 | IBUIView 18 | 19 | 20 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 21 | 22 | 23 | PluginDependencyRecalculationVersion 24 | 25 | 26 | 27 | 28 | IBFilesOwner 29 | IBCocoaTouchFramework 30 | 31 | 32 | IBFirstResponder 33 | IBCocoaTouchFramework 34 | 35 | 36 | 37 | 274 38 | 39 | 40 | 41 | 274 42 | {320, 416} 43 | 44 | 45 | _NS:9 46 | 47 | 1 48 | MC45NDc0Njg0IDAuOTE2OTIzMDQ2MSAwLjczNTg3OTI0MjQAA 49 | 50 | NO 51 | NO 52 | IBCocoaTouchFramework 53 | 54 | 55 | 56 | 274 57 | {320, 416} 58 | 59 | 60 | _NS:9 61 | 62 | 3 63 | MCAwAA 64 | 65 | NO 66 | YES 67 | YES 68 | IBCocoaTouchFramework 69 | YES 70 | TXkgam91cm5leSBiZWdhbi4uLgooWW91IGNhbiB0YWtlIG5vdGVzIG9uIHRoaXMgcGFnZS4pA 71 | 72 | 2 73 | 1 74 | IBCocoaTouchFramework 75 | 76 | 77 | Noteworthy-Bold 78 | Noteworthy 79 | 2 80 | 14 81 | 82 | 83 | Noteworthy-Bold 84 | 14 85 | 16 86 | 87 | 88 | 89 | 90 | 290 91 | {320, 38} 92 | 93 | _NS:9 94 | 95 | 3 96 | MQA 97 | 98 | YES 99 | IBCocoaTouchFramework 100 | NO 101 | NO 102 | NO 103 | NO 104 | 1 105 | 0 106 | YES 107 | 38 108 | 22 109 | 22 110 | 111 | 112 | {{0, 64}, {320, 416}} 113 | 114 | 115 | 116 | 3 117 | MQA 118 | 119 | 2 120 | 121 | 122 | 123 | 124 | NO 125 | 126 | IBCocoaTouchFramework 127 | 128 | 129 | 130 | 131 | 132 | 133 | view 134 | 135 | 136 | 137 | 3 138 | 139 | 140 | 141 | textview 142 | 143 | 144 | 145 | 7 146 | 147 | 148 | 149 | gradview 150 | 151 | 152 | 153 | 9 154 | 155 | 156 | 157 | buttontable 158 | 159 | 160 | 161 | 19 162 | 163 | 164 | 165 | dataSource 166 | 167 | 168 | 169 | 21 170 | 171 | 172 | 173 | delegate 174 | 175 | 176 | 177 | 22 178 | 179 | 180 | 181 | 182 | 183 | 0 184 | 185 | 186 | 187 | 188 | 189 | 1 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | -1 200 | 201 | 202 | File's Owner 203 | 204 | 205 | -2 206 | 207 | 208 | 209 | 210 | 6 211 | 212 | 213 | 214 | 215 | 8 216 | 217 | 218 | 219 | 220 | 18 221 | 222 | 223 | 224 | 225 | 226 | 227 | NotesViewController 228 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 229 | UIResponder 230 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 231 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 232 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 233 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 234 | GradientView 235 | 236 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 237 | 238 | 239 | 240 | 241 | 242 | 22 243 | 244 | 245 | 0 246 | IBCocoaTouchFramework 247 | 248 | com.apple.InterfaceBuilder.CocoaTouchPlugin.iPhoneOS 249 | 250 | 251 | 252 | com.apple.InterfaceBuilder.CocoaTouchPlugin.InterfaceBuilder3 253 | 254 | 255 | YES 256 | 3 257 | 1930 258 | 259 | 260 | -------------------------------------------------------------------------------- /Resources/Base.lproj/NotesVC~ipad.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 1536 5 | 12C60 6 | 2844 7 | 1187.34 8 | 625.00 9 | 10 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 11 | 1930 12 | 13 | 14 | IBProxyObject 15 | IBUITableView 16 | IBUITextView 17 | IBUIView 18 | 19 | 20 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 21 | 22 | 23 | PluginDependencyRecalculationVersion 24 | 25 | 26 | 27 | 28 | IBFilesOwner 29 | IBCocoaTouchFramework 30 | 31 | 32 | IBFirstResponder 33 | IBCocoaTouchFramework 34 | 35 | 36 | 37 | 274 38 | 39 | 40 | 41 | 274 42 | {320, 416} 43 | 44 | 45 | _NS:9 46 | 47 | 1 48 | MC45NDc0Njg0IDAuOTE2OTIzMDQ2MSAwLjczNTg3OTI0MjQAA 49 | 50 | NO 51 | NO 52 | IBCocoaTouchFramework 53 | 54 | 55 | 56 | 274 57 | {320, 416} 58 | 59 | 60 | _NS:9 61 | 62 | 3 63 | MCAwAA 64 | 65 | NO 66 | YES 67 | YES 68 | IBCocoaTouchFramework 69 | YES 70 | TXkgam91cm5leSBiZWdhbi4uLgoKKFlvdSBjYW4gdGFrZSBub3RlcyBvbiB0aGlzIHBhZ2UuKQ 71 | 72 | 2 73 | 1 74 | IBCocoaTouchFramework 75 | 76 | 77 | Noteworthy-Bold 78 | Noteworthy 79 | 2 80 | 16 81 | 82 | 83 | Noteworthy-Bold 84 | 16 85 | 16 86 | 87 | 88 | 89 | 90 | 290 91 | {320, 92} 92 | 93 | _NS:9 94 | 95 | 1 96 | MCAwIDAgMAA 97 | groupTableViewBackgroundColor 98 | 99 | YES 100 | IBCocoaTouchFramework 101 | NO 102 | NO 103 | NO 104 | NO 105 | 1 106 | 2 107 | 0 108 | YES 109 | 44 110 | 2 111 | 2 112 | 113 | 114 | {{0, 64}, {320, 416}} 115 | 116 | 117 | 118 | 3 119 | MQA 120 | 121 | 2 122 | 123 | 124 | 125 | 126 | NO 127 | 128 | IBCocoaTouchFramework 129 | 130 | 131 | 132 | 133 | 134 | 135 | view 136 | 137 | 138 | 139 | 3 140 | 141 | 142 | 143 | textview 144 | 145 | 146 | 147 | 7 148 | 149 | 150 | 151 | gradview 152 | 153 | 154 | 155 | 9 156 | 157 | 158 | 159 | buttontable 160 | 161 | 162 | 163 | 22 164 | 165 | 166 | 167 | dataSource 168 | 169 | 170 | 171 | 24 172 | 173 | 174 | 175 | delegate 176 | 177 | 178 | 179 | 25 180 | 181 | 182 | 183 | 184 | 185 | 0 186 | 187 | 188 | 189 | 190 | 191 | 1 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | 201 | -1 202 | 203 | 204 | File's Owner 205 | 206 | 207 | -2 208 | 209 | 210 | 211 | 212 | 6 213 | 214 | 215 | 216 | 217 | 8 218 | 219 | 220 | 221 | 222 | 15 223 | 224 | 225 | 226 | 227 | 228 | 229 | NotesViewController 230 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 231 | UIResponder 232 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 233 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 234 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 235 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 236 | GradientView 237 | 238 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 239 | 240 | 241 | 242 | 243 | 244 | 25 245 | 246 | 247 | 0 248 | IBCocoaTouchFramework 249 | 250 | com.apple.InterfaceBuilder.CocoaTouchPlugin.iPhoneOS 251 | 252 | 253 | 254 | com.apple.InterfaceBuilder.CocoaTouchPlugin.InterfaceBuilder3 255 | 256 | 257 | YES 258 | 3 259 | 1930 260 | 261 | 262 | -------------------------------------------------------------------------------- /TerpSrc/PrefsMenuView.m: -------------------------------------------------------------------------------- 1 | /* PrefsMenuView.m: A popmenu subclass that can display the preferences menu 2 | for IosGlulxe, an IosGlk port of the Glulxe interpreter. 3 | Designed by Andrew Plotkin 4 | http://eblong.com/zarf/glk/ 5 | */ 6 | 7 | #import "PrefsMenuView.h" 8 | #import "TerpGlkViewController.h" 9 | #import "IosGlkAppDelegate.h" 10 | #import "TerpGlkDelegate.h" 11 | #import "GlkFrameView.h" 12 | #import "GlkWinBufferView.h" 13 | #import "StyledTextView.h" 14 | #import "MButton.h" 15 | 16 | @implementation PrefsMenuView 17 | 18 | @synthesize container; 19 | @synthesize fontscontainer; 20 | @synthesize colorscontainer; 21 | @synthesize colorsbutton; 22 | @synthesize fontsbutton; 23 | @synthesize brightslider; 24 | @synthesize colbut_full; 25 | @synthesize colbut_34; 26 | @synthesize colbut_12; 27 | @synthesize sizebut_small; 28 | @synthesize sizebut_big; 29 | @synthesize leadbut_small; 30 | @synthesize leadbut_big; 31 | @synthesize fontbutton; 32 | @synthesize colorbutton; 33 | @synthesize fontbut_sample1; 34 | @synthesize fontbut_sample2; 35 | @synthesize colorbut_bright; 36 | @synthesize colorbut_quiet; 37 | @synthesize colorbut_dark; 38 | @synthesize supportsbrightness; 39 | @synthesize fontnames; 40 | @synthesize fontbuttons; 41 | 42 | - (void) dealloc { 43 | self.container = nil; 44 | self.fontscontainer = nil; 45 | self.colorscontainer = nil; 46 | self.colorsbutton = nil; 47 | self.fontsbutton = nil; 48 | self.brightslider = nil; 49 | self.colbut_full = nil; 50 | self.colbut_34 = nil; 51 | self.colbut_12 = nil; 52 | self.sizebut_small = nil; 53 | self.sizebut_big = nil; 54 | self.leadbut_small = nil; 55 | self.leadbut_big = nil; 56 | self.fontbutton = nil; 57 | self.colorbutton = nil; 58 | self.fontbut_sample1 = nil; 59 | self.fontbut_sample2 = nil; 60 | self.colorbut_bright = nil; 61 | self.colorbut_quiet = nil; 62 | self.colorbut_dark = nil; 63 | 64 | self.fontnames = nil; 65 | self.fontbuttons = nil; 66 | 67 | [super dealloc]; 68 | } 69 | 70 | - (void) loadContent { 71 | NSString *reqSysVer = @"5.0"; 72 | NSString *currSysVer = [[UIDevice currentDevice] systemVersion]; 73 | supportsbrightness = ([currSysVer compare:reqSysVer options:NSNumericSearch] != NSOrderedAscending); 74 | 75 | [[NSBundle mainBundle] loadNibNamed:@"PrefsMenuView" owner:self options:nil]; 76 | TerpGlkViewController *glkviewc = [TerpGlkViewController singleton]; 77 | 78 | UIImage *checkimage = [UIImage imageNamed:@"checkmark"]; 79 | [colorbut_bright setSelectImage:checkimage]; 80 | [colorbut_quiet setSelectImage:checkimage]; 81 | [colorbut_dark setSelectImage:checkimage]; 82 | 83 | checkimage = [UIImage imageNamed:@"checkmark-s"]; 84 | [colbut_full setSelectImage:checkimage]; 85 | [colbut_34 setSelectImage:checkimage]; 86 | [colbut_12 setSelectImage:checkimage]; 87 | 88 | if (faderview) { 89 | faderview.alpha = ((glkviewc.glkdelegate.hasDarkTheme) ? 1.0 : 0.0); 90 | faderview.hidden = NO; 91 | } 92 | 93 | if (!supportsbrightness) { 94 | /* Shrink the container box to exclude the brightness slider. */ 95 | CGFloat val = CGRectGetMaxY(colorsbutton.frame); 96 | CGRect rect = container.frame; 97 | rect.size.height = val - rect.origin.y; 98 | container.frame = rect; 99 | } 100 | 101 | [self updateButtons]; 102 | [self resizeContentTo:container.frame.size animated:YES]; 103 | [content addSubview:container]; 104 | } 105 | 106 | - (void) updateButtons { 107 | TerpGlkViewController *glkviewc = [TerpGlkViewController singleton]; 108 | 109 | CGFloat maxwidth = glkviewc.terpDelegate.maxwidth; 110 | colbut_full.selected = (maxwidth == 0); 111 | colbut_34.selected = (maxwidth == 1); 112 | colbut_12.selected = (maxwidth == 2); 113 | 114 | int colorscheme = glkviewc.terpDelegate.colorscheme; 115 | colorbut_bright.selected = (colorbut_bright.tag == colorscheme); 116 | colorbut_quiet.selected = (colorbut_quiet.tag == colorscheme); 117 | colorbut_dark.selected = (colorbut_dark.tag == colorscheme); 118 | 119 | if (fontnames) { 120 | NSString *family = glkviewc.terpDelegate.fontfamily; 121 | for (int count = 0; count < fontnames.count; count++) { 122 | NSString *str = [fontnames objectAtIndex:count]; 123 | UIButton *button = [fontbuttons objectAtIndex:count]; 124 | button.selected = [family isEqualToString:str]; 125 | } 126 | } 127 | 128 | if (supportsbrightness) { 129 | brightslider.value = [UIScreen mainScreen].brightness; 130 | } 131 | else { 132 | brightslider.hidden = YES; 133 | } 134 | } 135 | 136 | - (IBAction) handleColumnWidth:(id)sender { 137 | TerpGlkViewController *glkviewc = [TerpGlkViewController singleton]; 138 | 139 | int maxwidth; 140 | 141 | if (sender == colbut_34) { 142 | maxwidth = 1; 143 | } 144 | else if (sender == colbut_12) { 145 | maxwidth = 2; 146 | } 147 | else { 148 | maxwidth = 0; 149 | } 150 | 151 | glkviewc.terpDelegate.maxwidth = maxwidth; 152 | NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; 153 | [defaults setInteger:maxwidth forKey:@"FrameMaxWidth"]; 154 | 155 | [self updateButtons]; 156 | [glkviewc.frameview setNeedsLayout]; 157 | } 158 | 159 | - (IBAction) handleFontSize:(id)sender { 160 | TerpGlkViewController *glkviewc = [TerpGlkViewController singleton]; 161 | 162 | int fontscale = glkviewc.terpDelegate.fontscale; 163 | 164 | if (sender == sizebut_small) { 165 | fontscale -= 1; 166 | } 167 | else if (sender == sizebut_big) { 168 | fontscale += 1; 169 | } 170 | fontscale = MAX(fontscale, 1); 171 | fontscale = MIN(fontscale, FONTSCALE_MAX); 172 | 173 | if (fontscale == glkviewc.terpDelegate.fontscale) 174 | return; 175 | 176 | glkviewc.terpDelegate.fontscale = fontscale; 177 | NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; 178 | [defaults setInteger:fontscale forKey:@"FontScale"]; 179 | 180 | [glkviewc.frameview updateWindowStyles]; 181 | } 182 | 183 | - (IBAction) handleFontLeading:(id)sender { 184 | TerpGlkViewController *glkviewc = [TerpGlkViewController singleton]; 185 | 186 | int leading = glkviewc.terpDelegate.leading; 187 | 188 | if (sender == leadbut_small) { 189 | leading -= 1; 190 | } 191 | else if (sender == leadbut_big) { 192 | leading += 1; 193 | } 194 | leading = MAX(leading, 0); 195 | leading = MIN(leading, LEADING_MAX); 196 | 197 | if (leading == glkviewc.terpDelegate.leading) 198 | return; 199 | 200 | glkviewc.terpDelegate.leading = leading; 201 | NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; 202 | [defaults setInteger:leading forKey:@"FontLeading"]; 203 | 204 | [glkviewc.frameview updateWindowStyles]; 205 | } 206 | 207 | - (IBAction) handleColor:(id)sender { 208 | TerpGlkViewController *glkviewc = [TerpGlkViewController singleton]; 209 | 210 | int val = ((UIView *)sender).tag; 211 | 212 | glkviewc.terpDelegate.colorscheme = val; 213 | NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; 214 | [defaults setInteger:val forKey:@"ColorScheme"]; 215 | 216 | BOOL isdark = glkviewc.terpDelegate.hasDarkTheme; 217 | 218 | [self updateButtons]; 219 | glkviewc.navigationController.navigationBar.barStyle = (isdark ? UIBarStyleBlack : UIBarStyleDefault); 220 | glkviewc.frameview.backgroundColor = glkviewc.terpDelegate.genBackgroundColor; 221 | [glkviewc.frameview updateWindowStyles]; 222 | 223 | if (faderview) { 224 | if (/* DISABLES CODE */ (true)) { 225 | [UIView animateWithDuration:0.15 226 | animations:^{ faderview.alpha = (isdark ? 1.0 : 0.0); } ]; 227 | } 228 | else { 229 | faderview.alpha = (isdark ? 1.0 : 0.0); 230 | } 231 | } 232 | } 233 | 234 | - (IBAction) handleFont:(id)sender { 235 | TerpGlkViewController *glkviewc = [TerpGlkViewController singleton]; 236 | 237 | int val = ((UIView *)sender).tag; 238 | if (!fontnames || val < 0 || val >= fontnames.count) 239 | return; 240 | NSString *name = [fontnames objectAtIndex:val]; 241 | 242 | glkviewc.terpDelegate.fontfamily = name; 243 | NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; 244 | [defaults setObject:name forKey:@"FontFamily"]; 245 | 246 | [self updateButtons]; 247 | [glkviewc.frameview updateWindowStyles]; 248 | } 249 | 250 | - (void) setUpFontMenu { 251 | TerpGlkViewController *glkviewc = [TerpGlkViewController singleton]; 252 | 253 | NSMutableArray *arr = [NSMutableArray arrayWithObjects:@"Times", @"Helvetica", @"Georgia", nil]; 254 | /*if ([UIFont fontWithName:@"Palatino" size:14]) 255 | [arr addObject:@"Palatino"];*/ 256 | if ([UIFont fontWithName:@"Baskerville" size:14]) 257 | [arr addObject:@"Baskerville"]; 258 | if ([UIFont fontWithName:@"HoeflerText-Regular" size:14]) 259 | [arr addObject:@"Hoefler Text"]; 260 | if ([UIFont fontWithName:@"EuphemiaUCAS" size:14]) 261 | [arr addObject:@"Euphemia"]; 262 | else 263 | [arr addObject:@"Verdana"]; 264 | self.fontnames = arr; 265 | 266 | CGRect baserect = fontbut_sample1.frame; 267 | CGFloat buttonspacing = fontbut_sample2.frame.origin.y - fontbut_sample1.frame.origin.y; 268 | CGFloat postbuttonspacing = fontscontainer.frame.size.height - fontbut_sample2.frame.origin.y; 269 | [fontbut_sample1 removeFromSuperview]; 270 | [fontbut_sample2 removeFromSuperview]; 271 | 272 | arr = [NSMutableArray arrayWithCapacity:fontnames.count]; 273 | self.fontbuttons = arr; 274 | 275 | UIColor *normalcolor = [fontbut_sample1 titleColorForState:UIControlStateNormal]; 276 | UIColor *selectedcolor = [fontbut_sample1 titleColorForState:UIControlStateSelected]; 277 | UIColor *highlightedcolor = [fontbut_sample1 titleColorForState:UIControlStateHighlighted]; 278 | 279 | UIImage *normalbackimg = [fontbut_sample1 backgroundImageForState:UIControlStateNormal]; 280 | UIImage *highlightedbackimg = [fontbut_sample1 backgroundImageForState:UIControlStateHighlighted]; 281 | 282 | CGFloat fontsize = fontbut_sample1.titleLabel.font.pointSize; 283 | UIImage *checkimage = [UIImage imageNamed:@"checkmark"]; 284 | 285 | int count = 0; 286 | for (NSString *name in fontnames) { 287 | MButton *button = [MButton buttonWithType:fontbut_sample1.buttonType]; 288 | [button setTitle:name forState:UIControlStateNormal]; 289 | button.tag = count; 290 | CGRect rect = baserect; 291 | rect.origin.y += count*buttonspacing; 292 | button.frame = rect; 293 | [button setSelectImage:checkimage]; 294 | button.titleLabel.font = [glkviewc.terpDelegate fontVariantsForSize:fontsize label:name].normal; 295 | button.contentVerticalAlignment = UIControlContentVerticalAlignmentCenter; 296 | [button setTitleColor:normalcolor forState:UIControlStateNormal]; 297 | [button setTitleColor:selectedcolor forState:UIControlStateSelected]; 298 | [button setTitleColor:highlightedcolor forState:UIControlStateHighlighted]; 299 | [button setBackgroundImage:normalbackimg forState:UIControlStateNormal]; 300 | [button setBackgroundImage:highlightedbackimg forState:UIControlStateHighlighted]; 301 | [button setBackgroundImage:highlightedbackimg forState:UIControlStateHighlighted|UIControlStateSelected]; 302 | [button addTarget:self action:@selector(handleFont:) forControlEvents:UIControlEventTouchUpInside]; 303 | [fontscontainer addSubview:button]; 304 | [arr addObject:button]; 305 | count++; 306 | } 307 | 308 | CGRect rect = fontscontainer.frame; 309 | rect.size.height = (count-1)*buttonspacing+postbuttonspacing; 310 | fontscontainer.frame = rect; 311 | } 312 | 313 | - (IBAction) handleFonts:(id)sender { 314 | if (!fontnames) { 315 | [self setUpFontMenu]; 316 | [self updateButtons]; 317 | } 318 | 319 | CGFloat curheight = content.frame.size.height; 320 | [self resizeContentTo:fontscontainer.frame.size animated:YES]; 321 | 322 | if (/* DISABLES CODE */ (true)) { 323 | CGRect oldrect = container.frame; 324 | CGRect rect = fontscontainer.frame; 325 | fontscontainer.frame = CGRectMake(rect.origin.x, rect.origin.y+curheight, rect.size.width, rect.size.height); 326 | [content addSubview:fontscontainer]; 327 | [UIView animateWithDuration:0.35 328 | animations:^{ 329 | fontscontainer.frame = rect; 330 | container.alpha = 0; 331 | container.frame = CGRectMake(oldrect.origin.x, oldrect.origin.y-oldrect.size.height, oldrect.size.width, oldrect.size.height); } 332 | completion: ^(BOOL finished){ [container removeFromSuperview]; } ]; 333 | } 334 | else { 335 | [content addSubview:fontscontainer]; 336 | container.hidden = YES; 337 | } 338 | } 339 | 340 | - (IBAction) handleColors:(id)sender { 341 | CGFloat curheight = content.frame.size.height; 342 | [self resizeContentTo:colorscontainer.frame.size animated:YES]; 343 | 344 | if (/* DISABLES CODE */ (true)) { 345 | CGRect oldrect = container.frame; 346 | CGRect rect = colorscontainer.frame; 347 | colorscontainer.frame = CGRectMake(rect.origin.x, rect.origin.y+curheight, rect.size.width, rect.size.height); 348 | [content addSubview:colorscontainer]; 349 | [UIView animateWithDuration:0.35 350 | animations:^{ 351 | colorscontainer.frame = rect; 352 | container.alpha = 0; 353 | container.frame = CGRectMake(oldrect.origin.x, oldrect.origin.y-oldrect.size.height, oldrect.size.width, oldrect.size.height); } 354 | completion: ^(BOOL finished){ [container removeFromSuperview]; } ]; 355 | } 356 | else { 357 | [content addSubview:colorscontainer]; 358 | container.hidden = YES; 359 | } 360 | } 361 | 362 | - (IBAction) handleBrightChanged:(id)sender { 363 | if (supportsbrightness) { 364 | [UIScreen mainScreen].brightness = brightslider.value; 365 | } 366 | } 367 | 368 | @end 369 | 370 | @implementation PrefsContainerView 371 | 372 | - (void) touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { 373 | } 374 | 375 | @end 376 | --------------------------------------------------------------------------------