Teen Programmers Unite  
 

 

Return to forum top

DirectDraw Questions

Posted by Cortez [send private reply] at June 17, 2003, 10:42:28 AM

Exams are finished and I'm finally free! :)

CViper, I've read the entire code (it IS cool, however I don't know Euler stuff yet...), and I've some questions:

1. When do we get to lock buffers (before drawing dots and stuff, ie direct memory access?)
2. After running, I use alt+tab, but I can't go back to the game again. (I still have DX5.0 SDK. I don't wanna try downloading the latest 80+MB SDK with 56K, I'm planning to get it when I have a cable(or DSL!) in 3-4 months)
3. It indeed worked fine without DD7 surfaces. What's so special about them?
4. A little bit unrelated but, is there a way of using pointers with functions that takes parameters?

Posted by regretfuldaydreamer [send private reply] at June 17, 2003, 10:53:03 AM

I finished my exams today and so am on Summer Holidays now - Just thought I'd point it out

Posted by CViper [send private reply] at June 17, 2003, 12:54:55 PM

1) You lock buffers/surfaces when you need - as you said - to access the memory directly. However several other functions don't work on locked surfaces, Blt() and BltFast() for instance.

2) Yeah, I don't handle alt-tab in the demo. When you alt-tab out, DirectDraw may invalidate all your surfaces, which one has to restore later again. (My demo doesn't do that)

3) I just used the newest version of DirectDraw available (AFAIK DirectDraw was dropped in DirectX 8 and newer versions). There are some functions new to DD7 if you go searching for them =)

Sorry, didn't get the last one :/ Do you mean pointers to functions that take parameters?

And what euler stuff? =)

Posted by Cortez [send private reply] at June 18, 2003, 08:05:47 AM

I have 3 months of holiday, mwahaha! :P

"Do you mean pointers to functions that take parameters?"

Yup, exactly! I thought no, but...And, how do we handle alt+tab? :D

I'll try to peek at MSDN to see what these new functions though.

Posted by CViper [send private reply] at June 18, 2003, 09:38:25 AM

Function Pointers:

bool (*FuncPointer)( int a_parameter, const char* another_parameter );

bool TheFunction( int a, const char* b );

FuncPointer myFunctionPointer = TheFunction;


Handling alt-tab is a mess, first you have to iterate through all surfaces and check if they're lost. If they are lost, you call Restore() to restore the memory, however, all contents are still lost (you have to reload sprites, ...).
Posted by Cortez [send private reply] at June 22, 2003, 09:30:11 AM

Igh! '_^ I just remembered, it's the same trick when getting the address of a function of a .dll..

Well, I have new questions anyways (I swear, I will not sleep and read comics/manga in the lessons anymore! ;P)

1. What is this?

DDSurface() : size( 0, 0 ), theSurface( 0 ) {}

(it was inside you DDsurface struct) I mean, didn't get anything. What does the ":" stands for? What "theSurface(0)"? ????

2. Should store the tileset in ddsurfaces? bitmaps are smaller but slower, isn't it?
3. Can I use some basic stuff from your code (like clock class, dd_create, etc) for SFFC Remake? (of course you'll be credited, man :)

Posted by 142857 [send private reply] at June 22, 2003, 11:36:40 AM

DDSurface() : size( 0, 0 ), theSurface( 0 ) {}
I've seen this form in constructors. When you do a function like that, it means you're initializing "size" with (0,0), and theSurface with (0), instead of automatically calling the default constructor and then manually setting their values. So it's the same thing as saying:
someType theSurface(0);
instead of:
someType theSurface;
theSurface = 0;
assuming that the = operator is already defined, etc.
Is that clear?

Posted by Mike_L [send private reply] at June 22, 2003, 07:06:36 PM

Cortez, have you considered trying out SDL? It handles all the silly stuff that DirectX makes u do.

If you're intent on learning DirectX, then you need to understand at least the basics of the Win32 windowing system. This involves understanding the messages and actions that any Windows program must receive and do when it is started, minimized, restored, and stopped.

Try making a regular non-DirectX program that behaves properly.

Posted by Cortez [send private reply] at June 23, 2003, 06:34:22 AM

I don't know what SDL is, i'll look for it. And on the other side, i don't like big M_S and it's products and it's systems and their stuff, so I'm not interested in learning much about Windows and it's systems. DirectX is cool (espcially for driver problems) and I'll try to learn only what I need about it. (i have a sense that i'll have no chance other that learning them to advance the next class though :D)

BTW, thanks 142857!

Posted by 142857 [send private reply] at June 23, 2003, 11:04:04 AM

no prob :-)

You must be logged in to post messages and see which you have already read.

Log on
Username:
Password:
Save for later automatic logon

Register as a new user
 
Copyright TPU 2002. See the Credits and About TPU for more information.