flat assembler
Message board for the users of flat assembler.

Index > Windows > DirectDraw windowed

Author
Thread Post new topic Reply to topic
madmatt



Joined: 07 Oct 2003
Posts: 1045
Location: Michigan, USA
madmatt
Hi everyone,
I'm having a problem with my windowed directdraw code. Everything works fine except that blitting always goes to the upperleft hand corner of the desktop and not in the client area of the window where it should be.
Any Ideas? Confused
MadMatt
Post 21 Mar 2006, 20:05
View user's profile Send private message Reply with quote
bogdanontanu



Joined: 07 Jan 2004
Posts: 403
Location: Sol. Earth. Europe. Romania. Bucuresti
bogdanontanu
Remember that the Primary surface is the whole screen so you will have to offset the Blit with target window position. You can use GetClientRect API to obtain your window position on screen.

However you do not know in what resolution the screen it hold by the user and this will slow down and complicate things.

In HE Map Editor (windowed) I recall dropping DirectDraw for the finnal Blit and using GDI... aparently it was more compatible and well suited for a windowed application. It also eliminated artifacts and color mapping / conversion problems.
Post 22 Mar 2006, 04:13
View user's profile Send private message Visit poster's website Reply with quote
madmatt



Joined: 07 Oct 2003
Posts: 1045
Location: Michigan, USA
madmatt
All right, I'll give that a try, thanks.
MadMatt
Post 22 Mar 2006, 07:46
View user's profile Send private message Reply with quote
madmatt



Joined: 07 Oct 2003
Posts: 1045
Location: Michigan, USA
madmatt
Seems to be working real good, thanks!!! Very Happy
Post 22 Mar 2006, 08:44
View user's profile Send private message Reply with quote
madmatt



Joined: 07 Oct 2003
Posts: 1045
Location: Michigan, USA
madmatt
Spoke too soon, If the formats are different then it Blits REAL sloooow. Even if there the same format, blitting goes slower than it ddraws blit. So I'll goe back to using ddraw blits and try and figure out how to get the primary surface and the window's client area to work together
Post 22 Mar 2006, 15:50
View user's profile Send private message Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid
yes, be sure to blit always 1:1, backbuffer must have same bits per pixel and area blitted from must be same size as area blitted to
Post 22 Mar 2006, 16:49
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
madmatt



Joined: 07 Oct 2003
Posts: 1045
Location: Michigan, USA
madmatt
Figured out the problem, I discovered that "GetClientRect" was giving me the wrong kind of coordinates that I needed for the blit (Flip) to work right. Instead I used the "GetWindowInfo" function that returned the correct "full screen" offset coordinates I needed. The code below shows what I mean.

FLIP WINDOWED
Code:
proc DDWFlipV
     .if     dword [ddprimary], ne, NULL
             .if     dword [ddback], ne, NULL
                     mov     [wininfo.cbSize], sizeof.WINDOWINFO
                     invoke  GetWindowInfo, [winhandle], wininfo ;Use this instead of GetClientRect
                     DDCALL  ddprimary, Blt, wininfo.rcClient, [ddback], NULL, DDBLT_WAIT, NULL
             .endif
             return  DD_OK
     .else
             return  -2
     .endif
endp    
Post 23 Mar 2006, 01:07
View user's profile Send private message Reply with quote
Madis731



Joined: 25 Sep 2003
Posts: 2140
Location: Estonia
Madis731
What are you workin' on? A game??? I LOVE GAMES Very HappyVery HappyVery Happy
Post 23 Mar 2006, 07:51
View user's profile Send private message Visit poster's website Yahoo Messenger MSN Messenger Reply with quote
madmatt



Joined: 07 Oct 2003
Posts: 1045
Location: Michigan, USA
madmatt
Hi, Vid
No, Just a dll library of directdraw/direct3d/utility functions, which is comming along rather nicely now. Just need to update the documentation and make some kind of tutorial for it. Of course, though, you CAN make games/demos with it. It's primary purpose. It also allows you to use direct3d for your blitting as well. Which means rotations and special effects. I'll post some examples in a while. Can't say exactly when though.
Post 24 Mar 2006, 08:04
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2020, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.

Website powered by rwasa.