imGravityGame and more updates to imSimReal

Started working on imGravityGame, a demonstration of the use of IMSRGravity in the imSimReal framework. I’m working on the flipSide where I start with a Picker to pick the body providing the gravitational attraction, such as a planet. In -initWithNibName:Bundle:, I load the IMSRGravity object.

gravity = [IMSRGravity alloc] init];

In -viewDidLoad:, I construct an NSArray using the keys from gravity:

planets = [gravity allKeys];

The FlipSide implements two data source methods:

-numberOfComponentsInPickerView:

which returns 1, and

-pickerView:numberOfRowsInComponent:

which returns the number of planets in the gravity:

return [planets count];

It also implements one UIPickerViewDelegateMethod

:

-pickerView:titleForRow:forComponent:

which returns the name of the planet indicated by the NSInteger row

return [planets objectAtIndex: row];

At this point I realized that IMSRGravity needs a place to store the currently selected planet, so I will be going back to imSimReal and preparing 0.1RC3 soon (like tomorrow, hopefully).

Here is the current status of FlipSideViewController class:

@interface FlipsideViewController : UIViewController

{
IBOutlet UIPickerView *planetView;
IMSRGravity *gravity;
NSArray *planets;
}

@property (nonatomic, retain) UIPickerView *planetView;
@property (nonatomic, retain) IMSRGravity *gravity;
@property (nonatomic, retain) NSArray *planets;

@end

Technorati Tags:
, ,

This entry was posted in imGravityGames. Bookmark the permalink.

Comments are closed.