PocketMatrix forums

A read-only archive of the PocketMatrix forums (2001–2014). Posting and accounts are closed.

Framework & Direct, what's the difference?

Firstly you should know that I am not an 'OO' programmer. (for example when I was doing a 3D landscape I carefully removed all classes etc from the source & turned it back into regular old fashioned code) Which approach 9FrameWork or Direct) is best for me and what's the difference between them?

I've seen the Asteroids source & though I can follow it it's all class driven so a bit alien to me. I will have a look at the other demos in the downloads later today.

My first job is to discover all the commands and try them out and then I start a conversion of Space Treker. During the discovery phase I will write up what I find out & post on my website (so long as you are happy with this)

Regards
Let me give view a brief overview of the two modes:

1) Framework mode. This is a C++ view of the game. To use this mode, you derive your own class from class Game. (i.e. class MyGame : public Game).

Class Game will take care of creating the window for you and initialize the display device and input device. This is really useful to quickly test PocketFrog's functionality.

The program is event driven: callbacks are used to notify you of input events. Callbacks are also used for the game flow (ex:GameLoop()). By overriding these callbacks (they are virtual), you feed the functionality you need back into the framework.



2) Direct mode. This is more a "C" like approach. Basically, you need to do more work to get started, but you gain more controls over things.

Using class PocketPC, you can create display and input device objects.

To "open" the display, you would use:

Code:

DisplayDevice* display = PocketPC::CreateDisplay( hwnd, ORIENTATION_NORTH );

To "close" the display, you would simply destroy the object.

As you can see, there is more work involved (you must register a window class, create the window, and feed the handle to CreateDisplay).

You also need to handle the window proc yourself to access the stylus and buttons.

Finally, you must be careful when using direct mode as there is some differences between a PocketPC and a desktop PC. (The framework mode handles this for you).