Archived

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

Gilzu

DirectDraw's Flip()

Recommended Posts

so far ive managed to learn DDraw, theory from the DX7 SDK, now when i come to do the actual work, ive noticed some bug(ing) stuff, i wonder if you can shed some light on it: 1. when the Primary surface is on, topmost proggies still draw themselves.. i thought the EXCLUSIVE switch should''ve handle it. 2. mouse pointer only exists on the primary surface, like (mouse appears) flip (doesnt) flip (appears), should i bother writing a mouse interface for it? 3. since my aim is to write a game, what is the best timer interval to do the Heartbeat func? and in heartbeat i mean calculate things->write on surface->flip 4. how MUCH using triple buffering help? as far as i got it it should be alot faster, but it''s memory consumption is high(er). so i wonder if it worth the bother (of writing extra 10 lines). 10x alot Gil

Share this post


Link to post
Share on other sites
All right, lemme take a crack at this...

quote:
Original post by Gilzu
1. when the Primary surface is on, topmost proggies still
draw themselves.. i thought the EXCLUSIVE switch should''ve
handle it.



If you are in Windowed Mode, you should NOT be using Exclusive. In fact, I don''t believe DirectX will let you. Anyway, Exclusive mode is for full screen applications and does now behave the same way in Windowed mode.

quote:

2. mouse pointer only exists on the primary surface, like
(mouse appears) flip (doesnt) flip (appears), should
i bother writing a mouse interface for it?



This is another mostly Windowed mode problem. I have seen this come up in Full-Screen mode apps as well. The mouse draw is a GDI call, so it will not draw with the same frequency as your program. Your best bet is to create your own cursor and use Direct Input to track the mouse and draw your own. This will take away the flicker.

quote:

3. since my aim is to write a game, what is the best timer
interval to do the Heartbeat func? and in heartbeat i mean
calculate things->write on surface->flip



Windows has the high performance timer which can be accessed many different ways. The most common way is by using the function GetTickCount(). This function returns the current number of ticks that have passed since Windows was started. This makes for a wonderfull comparision point for various tasks, like drawing and animating items.

quote:

4. how MUCH using triple buffering help? as far as i got it
it should be alot faster, but it''s memory consumption is high(er).
so i wonder if it worth the bother (of writing extra 10 lines).



This is something I have never tried. I''m not sure how much it will affect your performance. It depends on what you are doing. If you are doing some simple 2D sprite work, it won''t affect your performance much. If you are doing 3D work with a great deal of textures, you may see and improvement, but I mostly stick to 2D work so don''t take my word on it . Hope this helps.


-----------------------------
kevin@mayday-anime.com
http://dainteractive.mayday-anime.com

Share this post


Link to post
Share on other sites