Jump to content
  • Advertisement

Archived

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

OberonZ

YANQ -- Yet Another Newbie Question (about CDX)

This topic is 6875 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

Guest Anonymous Poster
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 ?

Share this post


Link to post
Share on other sites
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:

// Global
CDXScreen * Screen = 0;
CDXMappy * Map = 0;

// In init function
Screen = 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 key
Map = new CDXMappy ();
Map->SetColorKey (0);

// Load the Map
if (Map->LoadMap (Screen, TEXT ("test.FMP"), 0, 0, SCREENXMAX, SCREENYMAX) == -1)
CDXError (Screen , TEXT ("Could not load map!"));

// Load a parallax surface
if (Map->CreateParallax (TEXT ("parallax.bmp")) == FALSE)
CDXError (Screen, TEXT ("Could not load parallax graphics"));

// Center the map
cxMap = (Map->GetMapWidth() - Screen->GetWidth() ) / 2;
cxMap = (Map->GetMapHeight() - Screen->GetHeight() ) / 2;

//Finally, in the rendering loop
Map->MapMoveTo (cxMap, cyMap);

// First draw the parallax surface
if (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).]

Share this post


Link to post
Share on other sites
*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

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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!