Would anyone be so kind enough to decribe generally how PocketFrog works?
More specifically, an overview of its architecture and how the DisplayDevice, Surface, Rasterizer etc. relate to one another?
It's far from documentation, but it'll help give some of us some sort of visualisation from which we can build (or something).
Hi Dave, I'm equally interested in this topic but also very interested in the roadmap for PocketFrog about which I will post separately.
I have been up & down the current & previous source a few times now and I am getting comfortable with how the system works. Not being an OO programmer has not been too big a drawback. From a game development point of view I don;t need to know much more before I start coding for real.
I'm not the person to answer your post but I can offer the following simple & no doubt flawed overview most of which I'm sure you know already
1. PocketFrog (PF) uses the concept of surfaces. eg: if you have a graphic you put it on a surface to do something with it, usually drawing to the screen. Surfaces can be used with CE GDI features as well as the built-in PF ones.
2. PF controls the running game & 'jumps' to the init & loop parts to let the game programmer do his/her own thing.
3. There are some other fundamental features including RECT & POINT which make many operations easier.
4. Each time round the game loop, like in most games, the screen is setup on a hidden page which is copied to the actual display once everything is ready to go.
5. Screen taps & hard buttons are handled by built-in functions.
So it's a simple & fast system to use with little or no complex stuff to stop you getting into it but of course not enough documentation. (When I wrote games in the 80's it was all in assembler & every line was commented. I still have the habit)
Conan wrote:
1. PocketFrog (PF) uses the concept of surfaces. eg: if you have a graphic you put it on a surface to do something with it, usually drawing to the screen. Surfaces can be used with CE GDI features as well as the built-in PF ones.
The Surface/DisplayDevice/Rasterizer stuff is the sort of thing I REALLY want to understand completely before using them 'properly' - I like to have crystal-clear understanding of fundamental ideas! I guess I could just look up some DirectX tutorials and see their definitions... but would it be safe to assume that Surface's are essentially scratch areas prior to drawing?
BTW, could anyone offer any clues on how would be the best way to implement rotation? I'm thinking along the lines of adding a BlitRotate method (I have the maths all sorted from my EasyCE version of this game) - or is there a better method? I'm used to the low-level access to PIXEL arrays in EasyCE!
My top priority right now is to write documentation about PocketFrog... Meanwhile, here some basic info about how the classes interacts:
1) A Surface is just that, an array of pixels. The thing is that it is oriented along your device's display memory for optimal performances when doing blits. If you want to directly access the pixels, you use the Lock()/Unlock() methods. This won't be optimal if you do this each frame, it's better to use a rasterizer to draw your stuff.
2) The DisplayDevice class abstract the display hardware found in your PocketPC. The most interesting methods are BeginScene()/EndScene() that must be called at around your scene drawing and Update() that does the "flip" from backbuffer to frontbuffer.
3) A Rasterizer is an object that take cares of 2D rasterization primitives such as blits, line drawing, etc. In most cases you don't need to understand rasterizers completely as DisplayDevice is itself a rasterizer attached to the display's backbuffer. Drawing to the backbuffer is easily done using DisplayDevice::Blit(), Line(), ... The reason to separate the rasterizer concept from the Surface or DisplayDevice will become apparent in the future when new kind of rasterizers appear (3D anyone?)
To recap, Surface = array of pixels, DisplayDevice = your PocketPC's display hardware, Rasterizer = something you use to draw on a surface. Class DisplayDevice is itself a rasterizer that automatically link it's drawing primitives to the backbuffer surface.
Hope this helps!