Jump to content
Xtreme .Net Talk

Recommended Posts

  • Leaders
Posted
I am learning directx, and im making a sidescroller as my first game. My program draws my level. I am just not exactly sure as to the difference between the DrawFastFlags.Wait and DrawFastFlags.DoNotWait flags. When should i use which? Also, any tips for making a side scroller for a directx newbie would be great.
[sIGPIC]e[/sIGPIC]
Posted
Always use the Wait flag, Wait means the program will wait until nothing else is using the surface (or at least that particular part of it) before using it. If you use DoNotWait and another thread is drawing to the surface and it overlaps where you're drawing then the program will crash, it may improve performance slightly but isn't really worth the risk
.Net allows software to be written for any version of Windows and not break like Unmanaged applications unless using Unmanaged procedures like APIs. If your program uses large amounts of memory but releases it when something else needs it, then what's the problem?
  • *Experts*
Posted

I'd suggestion making it a user option. If you don't want that trouble, use Wait. I've never heard of DoNotWait crashing a program but it might cause "tearing". In a 2D game that will look especially bad. It means drawing may occur during a screen retrace, which means the top half of the screen (or some portion, maybe not exactly half) will be slightly ahead of or behind the bottom half. Sometimes it's only a few pixels, sometimes 8, 16, 32 or more! Even a few pixels in 3D games can look quite noticable especially during laggy portions (where the time between frames is greater, the tearing will be worse).

 

-Ner

"I want to stand as close to the edge as I can without going over. Out on the edge you see all the kinds of things you can't see from the center." - Kurt Vonnegut
  • *Gurus*
Posted
The "tearing" happens when your program doesn't wait for the VSync of the monitor before drawing. That is actually a different flag (WaitFlags.NoVSync or something) and nothing to do with DoNotWait, if memory serves.

MVP, Visual Developer - .NET

 

Now you see why evil will always triumph - because good is dumb.

 

My free .NET Windows Forms Controls and Articles

Posted

To wait or not to wait; that's a good question. :confused:

 

While making my tetris, I asked myself the same question. I didn't see any difference between the two. I used both. My code was greatly based on tutorials from DirectX9 SDK. From what I've seen in those tutorials, they often use the DoNotWait flag. I had no crash, no tearing or any other problems using DoNotWait.

 

I'll be looking into it.

  • Leaders
Posted

Tetris is also windowed, not that that necessarily matters, i dont know; I've never made a windowed program in directx.

 

But a question about those tutorials: where are they? The only directx tutorials that came with the sdk that i can find are for direct3d. Worse yet, the only documentation I can find is the C++ documentation. Microsoft.com is very lacking in Directx9 documentation, as well as the rest of the internet.

[sIGPIC]e[/sIGPIC]
Posted

DirectDraw tutorials or samples are located in %DXSDK%\Samples\VB.Net\DirectDraw\ where %DXSDK% is the directory in which you installed DirectX 9 SDK (In my case, C:\DXSKD).

 

As for documentation, you can read on msdn that it is still a preliminary documentation.

 

I'm not sure but you might not have downloaded the complete sdk if you lack some samples.

Posted
I've been told not to use DoNotWait because drawing functions lock surface memory while drawing, and locked memory can't be locked a second time. Sorry if I was wrong
.Net allows software to be written for any version of Windows and not break like Unmanaged applications unless using Unmanaged procedures like APIs. If your program uses large amounts of memory but releases it when something else needs it, then what's the problem?

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...