PDA

View Full Version : FullScreen DXDraw



BaronBigman
19-10-2006, 03:07 PM
I have a 640*480 fullscreen game (in development), if I use a ShowMessage or a MessageDlg command, then the little dialog appears nicely, and the screenmode remains unaffected. I want to use other forms in my app, and I am currently using the following code inside a button:

var
f : form2.TClientForm;
begin
f:=TClientForm.Create(self);
try
f.ShowModal;
finally
f.Release;
end;
end; // buttonclick

now this code works, but before the form becomes visible, the monitor flashes and the screenmode goes back to windows settings, while the form is open. when the form finishes its operation, and control is handed back to the game form (form with a dxdraw) fullscreen resumes.
I would ideally like the form to leave the screenmode alone, and just appear over the other form, much like the message boxes I described already. I have tried to change the parent of the new form, but the behaviour of the form persists. I tried to make the game MDI forms, but this completly dident work.

If anyone can help, it would be appreciated....

technomage
19-10-2006, 03:44 PM
Is the form style a Dialog? with StayOnTop?

Just a observation of the code it is safer to do this


var
f : form2.TClientForm;
begin
f:=TClientForm.Create(nil);
try
f.ShowModal;
finally
f.Free;
end;
end; // buttonclick


the main reason is that if you use Self as the Form Owner it will have to add the form you created to the Parent forms Owner objects list. There is little point in doing this if you are going to free the form manually. There is also the posibilty of a "double free" if the Owning form does not know that child for has been free'd already.

Also I would always call free rather than release this is considered good practice.

BaronBigman
19-10-2006, 07:38 PM
I made the changes you suggest, thanks for the tips on best practice.

However I still get the same problem.

What are the dialogs? are they even forms?

technomage
19-10-2006, 09:47 PM
There is a boarder style property, it is usually bsSizeable, I usally change this to bsDialog. There are also some stuff on positioning you might want to check out.

It might be worth looking at the source for for SHowMessage to see what kind of form it creates

Speeeder
19-10-2006, 11:05 PM
Showmessage applys an internal windows dialog... I think it's one pure API call in the end... If I'm right... :)

Clootie
20-10-2006, 08:34 AM
I believe that Windows minimizes your fullscreen application, because dialog doen't have your 3D window set as a parent window for it.

Another hint: watch for FlipToGDISurface. :!:

PS. Generally combining fullscreen 3D applications and Windows GDI dialogs never worked fine for anyone. I'm afraid what you will loose too much time with no 100% working solution in the end. So, if you definetly looking for WinAPI dialogs using with D3D application - it's better to just use maximized window without borders to simulate "fullscreen mode".