imSimReal

The imSimReal framework and projects built from it

imSimReal: A Cocoa Framework for Mac Games

imGravityGame Flipside mostly Done

February 8th, 2009 · No Comments · imGravityGame

At least for now. I need some more text for the instructions, and I am having trouble when switching from the landscape orientation in the main window and the portrait orientation in the flipside view, but that will be fixed soon. Here are some images of the flipside:

Flipside view with Instructions alert box open

As you can see, the instructions are not helpful. Here is the About box:

Flipside view with the about alert box open.

This box contains enough text to require a scrolling box.

//
// FlipsideViewController.h
// imGravityGame
//
// Created by John Ahrens on 1/9/09.
// Copyright John Ahrens, LLC 2009. All rights reserved.
//

#import

@class AppController;

@interface FlipsideViewController : UIViewController

{
IBOutlet UIPickerView *planetView;
IBOutlet UISlider *slider;
IBOutlet UILabel *sliderLabel;
IBOutlet UIButton *instructionsButton;
IBOutlet UIButton *aboutButton;

AppController *controller;
NSArray *planets;
}

@property (nonatomic, retain)UIPickerView *planetView;
@property (nonatomic, retain)UISlider *slider;
@property (nonatomic, retain)UILabel *sliderLabel;
@property (nonatomic, retain)UIButton *instructionsButton;
@property (nonatomic, retain)UIButton *aboutButton;

@property (nonatomic, retain)AppController *controller;
@property (nonatomic, retain)NSArray *planets;

- (IBAction)sliderChanged: (id)sender;
- (IBAction)buttonPressed: (id)sender;

@end

Also of interest at this time is the -(IBAction)buttonPressed: (id)sender method:

- (IBAction)buttonPressed: (id)sender
{
NSString *title = [sender currentTitle];
NSBundle *bundle = [NSBundle mainBundle];
NSString *file;

if ([title hasPrefix: @"About"])
{
// This is the About button
file = [bundle pathForResource: @"about" ofType: @"txt"];
}
else
{
// This is the Instructions button
file = [bundle pathForResource: @"instructions" ofType: @"txt"];
}

NSString *text = [NSString stringWithContentsOfFile: file
encoding: NSUTF8StringEncoding
error:nil];
UIAlertView *alert = [[UIAlertView alloc] initWithTitle: title
message: text
delegate: nil
cancelButtonTitle: @"Close"
otherButtonTitles: nil];
[alert show];

[alert release];
}

Note that it determines which button was pressed, then gets the appropriate file and opens the alert box. The message in the alert box is the contents of the file.

Technorati Tags:
, ,

Tags:

There are no comments yet...Kick things off by filling out the form below.

Leave a Comment

Please copy the string bPGkt0 to the field below: