🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

YANQ -- Yet Another Newbie Question (about CDX)

Started by
1 comment, last by OberonZ 24 years, 9 months ago
Hi OberonZ !

I have very little knowledge about object-orientatet programming, so I can only give you my guess :
I had a similar problem with a DOS program :
black screen, no error reported.
I was using a graphic buffer and it revealed that I didn't write from buffer to screen but vice versa, because I had swapped the arguments of a memcopy-command.
Maybe you too write to a buffer ?

Advertisement
Hello everyone,
My story is not much different than that of most people here... Yep, I too am writing a game.

I've done some thinking and decided that instead of totaly diving into the DirectX API, I'd start with CDX, this gives me more time to work on the game... besides I can always go back and write my own stuff later (although the incentive might not be too great)

Anyway, it brings to me my problem. After creating a CDXScreen (without getting errors) I can't seem to do anything with it. What I mean is that if I try to draw lines, output text to it, load a map (using CDXMappy) nothing happens. I get a black screen which I'm assuming is the surface's default color. Mind you, I receive no errors from any of the aforementioned CDX calls.

This leads me to believe that there is something wrong with CDXScreen (Not the class, just my instance of it). Interestingly enough, all the CDX examples compile and run fine with no problem.

Here is a snipped showing what I do, if anybody has any idea, I'd greatly appreaciate it.

code:
// GlobalCDXScreen  * Screen = 0;CDXMappy   * Map    = 0;// In init functionScreen = new CDXScreen ();if (Screen == NULL)     CDXError (NULL, TEXT ("Could not initialize screen"));	if (!Screen->CreateFullScreen (g_hWnd, SCREENXMAX, SCREENYMAX, SCREENBBP))     CDXError (Screen, TEXT ("Could not set the video mode"));// Create Mappy object and set the color keyMap =  new CDXMappy ();Map->SetColorKey (0);// Load the Mapif (Map->LoadMap (Screen, TEXT ("test.FMP"), 0, 0, SCREENXMAX, SCREENYMAX) == -1)		CDXError (Screen , TEXT ("Could not load map!")); 	// Load a parallax surfaceif (Map->CreateParallax (TEXT ("parallax.bmp")) == FALSE)     CDXError (Screen, TEXT ("Could not load parallax graphics"));// Center the mapcxMap = (Map->GetMapWidth() - Screen->GetWidth() ) / 2;cxMap = (Map->GetMapHeight()  - Screen->GetHeight() ) / 2;//Finally, in the rendering loopMap->MapMoveTo (cxMap, cyMap);	// First draw the parallax surfaceif (Map->DrawParallax (Screen->GetBack ()) == -1)     Map->RestoreParallax ();// Then draw the background layer (transparently)if (Map->MapDrawBGT (Screen->GetBack ()) == -1)     Map->MapRestore ();

Sorry for the long post. I've compared my code with the sample but I can't find out what I'm doing wrong, thanks again in advance.

-OberonZ

PS: If I breiched any etiquette, I've done so unknowingly and beg your (non-existent?) mercy

[This message has been edited by OberonZ (edited September 19, 1999).]

---
PAGE FAULT: Please insert "Swap File, Disk 2"
and press any key to continue.
*feels really foolish*

ACK!
I can't believe it! Of all the things, I forgot to flip the backbuffer to the front! You were absolutely right, thanks man. I guess I should not try coding at 4am, even if I feel inspired.

I guess it goes to show that once you understand the theory...

Thanks again!
-OberonZ

---
PAGE FAULT: Please insert "Swap File, Disk 2"
and press any key to continue.

This topic is closed to new replies.

Advertisement