Friday, August 19, 2011

Casting power

One of the great advantages in dynamic casting is that you can move between capabilities of any object with any one of its handles.

UIWindow * pWindow = UIWindowNew();
UIElement * pElement = UIElementCast(pWindow);
pWindow = UIWindowCast(pElement);

You can see how I can move from the element to the window to the element easily and safe.
This simplifies code a lot since I don't have to pass objects down the pipe.
Its a lot like a C++ dynamic_cast call but in ANSI C!

It makes the components that I have to write small and simple.

Tuesday, August 16, 2011

Power without a manual

I am waiting for september before I buy an iPad to allow my brother to draw graphics for the game.
In the meanwhile I am fixing code bugs, rewriting components and adding new components into the mix.

It is taking me a while to get used to the power of association relationships. Everyone is more or less used to inheritance and containment relationships. Association relationships is not used very much at all even in high level languages. So its not like I can use the web to find out what oppertunities are available for me. I have to find them out one at a time.

Friday, August 05, 2011

Component C Extensions

Using Extensions in Component C makes it so easy to have separation of concerns.

Here is code how to start a specific application component:

- (void)viewDidLoad {
    [super viewDidLoad];
    /* Link application to ios view */
    UIAppComponent->pExtension = IOSViewComponent;
    /* Link ios view to engine */
    IOSViewComponent->pExtension = MyGameComponent;
    /* Start the application and set up the view handle */
    self.view = (id) IOSViewHandle(IOSViewCast(UIAppStart()));

The second line links the IOS platform specific implementation to the application engine.
The third line links the game component to the IOS platform.
The fourth line starts the application and links the view to the controller.

Neither the application component or the game  are aware of the platform it is running on.
And the platform does not know what game is running.

This is a separation of concerns and allows me to port code to run on the mac and then run it on the simulator without having to modify the game code itself in any way.

Note that the application component creates the object and does not need to be passed the platform or game to run. It all works behind the scenes and that is the way it should be done.

Thursday, August 04, 2011

Great Progress


As you can see by my source forge status, I have working on the Screens components for quite a while. I am playing around with a simple game for the iPhone to test and write new components. I have finished an initial version of the application but I still lack some good graphics that I need to import before I can publish it to the AppStore. It was written using only Component C components. The game is really simple but I just wanted something to try out to test the AppStore process.

I have uploaded all the components to source forge anyway as I progress.