Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

2 direct draw surface in a game

This topic is 6022 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I''d like to make 2 direct draw surface in my game (1 for the menu and 1 for the game) to have a better vision of the code. I kill the first instance of the direct drawsurface and i make another one, but i''ve got an error : error in window class . ps : The error is in french so maybe the translating is not good :-) please help.

Share this post


Link to post
Share on other sites
Advertisement
Ma connaissance de DirectX est extrèmement limitée, mais je peux peut-être t''aider à décrypter le message d''erreur.

Share this post


Link to post
Share on other sites
lol oki je t ecris le message d''erreur exact : Erreur a l inscription d une classe de fenetre
voila

ps: Tiens au fait tu habite ou??

Share this post


Link to post
Share on other sites
Ok, so the translation of the error message is
"Error while registering a window class".

A possibility is that you are trying to register the window class twice (i.e. with the same name), instead of just creating a second instance of the window using the class you registered in the first place.

Ps:
Réponse en anglais pour le bénéfice de tous.
J''habite à Charlottesville, Virginie, USA depuis 2 ans 1/2.
J''y poursuis un doctorat en info.

Share this post


Link to post
Share on other sites
Yeah okay, the problem is that i use the HINSTANCE give by the WinMain function to create my DirectDraw Interface (yes it s not the surface sorry :-).
So what should i do ??
I explain once again : I want one interface for the menu and when i click on "play" i destroy it and i create a new one.

thx

Share this post


Link to post
Share on other sites
Using your HINSTANCE to create the surface? I don''t think so.

1) Use the HINSTANCE from WinMain to create a window class (WNDCLASS or WNDCLASSEX), and then a window (HWND)

2) Create your directdraw object (LPDIRECTDRAWn).

3) Set the cooperative level (SetCooperativeLevel(DDSCL_myCoopLevel, hMyWindow))

4) Create your surface

when you need to switch them,

5) Destroy the surface (not the directdraw object) and then recreate.

Although if I were to do this I''d keep one surface at all times - the primary surface - and just switch the buffer I''m copying from.

Superpig
- saving pigs from untimely fates
- sleeps in a ham-mock at www.thebinaryrefinery.cjb.net

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!