PocketMatrix forums

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

blit sample understanding

Hello I'm new at PF and I'd like to understand more about this awesome program. I must admit that I am also fairly new at the C++ language (I've coded a few programs but nothing major). Here are my questions about the blit sample that I'm modifing to learn...

1. How do I get rid of the splash screen (I understand that the splash screen time of 0 is no longer available as the pocketfrog website suggests).

2. If I add buttondown even then I can capture the keys that are pressed. While compiling in VC++ 6.0 and testing for vkRight and vkLeft I can press them and the program won't end. If I also test for all the available keys (directional, A,B,C,Start, and Aux1-8) then no key will end the program. If I compile this same code to evc and run it on my a620BT then if I press the Action button the program will end. Also (strangely) if I press any diaganol direction (up+left or up+right...) the program ends. If I only use one direction the program won't end. I really don't understand this.

2a. Where in the Blit sample code (not modified) is the routine to close the program when a button is pressed?

3. How do most of you setup the game as far as menu vs. gameplay? Do you have the menu routine inside game.Run() or do you create your own i.e. ...

Code:

int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE, LPTSTR, int )
{
_Module.Init( 0, hInstance );

BlitSample game;

menu();
game.Run();

return 0;
}


so that when menu runs the game automatically starts?

Please be patient with me I'm rather new at programing.

-amdzero
the keydown & keyup events are declared in pf to quit automatically. when you override this with your own keydown/up, you have to handle exiting the app by calling shutdown.

your menus and gameloops can both be in the game loop. either use function pointers or case statements to run the correct code.

I think conan's tutorials will help, so look for those (search the forums)
what he said

http://www.sundialsoft.freeserve.co.uk/pocket_frog.htm

The exit code is in the game class, have a look at the pocket frog framework code , you need to override this function in your derived class

Code:

void Game::ButtonDown( int button )
{
Shutdown();
}
void Game::StylusDown( Point p )
{
Shutdown();
}


To get rid of the pockethal spash you need to donate to the project see the pockethal website,

For the menu, have a look around Gamedev for changing game states,
Thanks for the quick response. I understand that the diagonal key press was producing an error that closed the program. I had each button code number blitted to the screen so I could see the numbers. for somereason It crashed when displaying certain numbers. I don't need the numbers anymore so I just remmed those statements out.

I had another question about the blit sample. It is counting the FPS and blitting the numbers to the screen. Is there anyway to control the fps say if I had an older device and a brand new dell axim x30, could the timing in the gameplay be the same on both of them?

Thanks.

BTW is there anyway I could get some source code for a freeware game so I can learn more?
search for 'GetTickCount()' in this forum.

look for my post in the game framework thread about limiting framerate (or the other method of frame based animation)