Game Loop Control
Hi I''ve got a problem with program flow
My program goes through a process that keeps watch of the timer and keeps
page flipping
each frame I''ve got
{
check keys // this is somewhat out of place
if (time == right) UpdateFrame
}
UpdateFrame
{
PaintScreen
if (Menu) PaintMenu
get mouseinfo
process_page(mouseinfo)
}
process_page(mouseinfo)
{
// this moves process control over to the MenuFunction
if (have Menulist on screen) DoMenuFunction(); return;
LoopThruActors { Actor-Check out my web-site
If you''re talking about the MessageBox api call, you have to acknowledge the message before you can continue processing your screen. Otherwise the best thing to do would be to draw your own message and when the user clicks the mouse go through your list of objects to see which one has been hit and act accordingly.
Hope this helps.
--Antz
Quanta
http://quanta.virtualave.net
Hope this helps.
--Antz
Quanta
http://quanta.virtualave.net
Ya, I''ve decided that the best way to do what I want is
to set up a MessageBox Object
Besides initializing the size, message, Yes/No buttons etc. I''ve decided to store the pointer to a ScreenPaint() function in the object.
so in the main Process
process_page(mouseinfo)
{
// this moves process control over to the MenuFunction
if (have Menulist on screen) DoMenuFunction(); return;
LoopThruActors
{ Actor-
From mousinfo findAreaonScreen
Process Screen + Mouse interactions //clicking and the rest
{
case AREA: OnArea()
pMessageBox = New MessageBox(initvalues)
int nResult = pMessageBox->Process()
}
And in pMessageBox->Process()
int MessageBox:rocess()
{
GetMousInfo(MouseInfo);
while (TestMessage(MouseInfo) != YESorNOorCANCEL)
{
PaintScreen(); // making sure I don''t do process_map or I''m endlessly hooped
GetMousInfo(MouseInfo);
}
Thanks for letting me talk it out
ZoomBoy
A 2D RPG with skills, weapons, and adventure.
See my character editor, Tile editor and diary at
Check out my web-site
to set up a MessageBox Object
Besides initializing the size, message, Yes/No buttons etc. I''ve decided to store the pointer to a ScreenPaint() function in the object.
so in the main Process
process_page(mouseinfo)
{
// this moves process control over to the MenuFunction
if (have Menulist on screen) DoMenuFunction(); return;
LoopThruActors
{ Actor-
From mousinfo findAreaonScreen
Process Screen + Mouse interactions //clicking and the rest
{
case AREA: OnArea()
pMessageBox = New MessageBox(initvalues)
int nResult = pMessageBox->Process()
}
And in pMessageBox->Process()
int MessageBox:rocess()
{
GetMousInfo(MouseInfo);
while (TestMessage(MouseInfo) != YESorNOorCANCEL)
{
PaintScreen(); // making sure I don''t do process_map or I''m endlessly hooped
GetMousInfo(MouseInfo);
}
Thanks for letting me talk it out
ZoomBoy
A 2D RPG with skills, weapons, and adventure.
See my character editor, Tile editor and diary at
Check out my web-site
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement