flat assembler
Message board for the users of flat assembler.
 Home   FAQ   Search   Register 
 Profile   Log in to check your private messages   Log in 
flat assembler > High Level Languages > [solved]learning directdraw

Author
Thread Post new topic Reply to topic
vivik



Joined: 29 Oct 2016
Posts: 381

[solved]learning directdraw

I will ask all directdraw related questions here.

Don't get how clippers work in directdraw windowed mode. When I draw a surface, if even one pixel of it is outside the screen, nothing gets drawn.

This is how I initialize everything:


Code:
                // Create the clipper using the DirectDraw object
                res = g_pDD->CreateClipper(0, &g_pClipperNULL);
                if (DDFailedCheck(res"Create clipper"))
                        FUCK();
                
                // Assign your window's HWND to the clipper
                res = g_pClipper->SetHWnd(0g_hwnd);
                if (DDFailedCheck(res"Assign hWnd to clipper"))
                        FUCK();
                
                // Attach the clipper to the primary surface
                res = g_pDDS->SetClipper(g_pClipper);
                if (DDFailedCheck(res"Set clipper"))
                        FUCK();



And this is how I draw:


Code:
        int off_y = 200;

        RECT where;
        where.left = 0;
        where.top = 0 + off_y;
        where.right = g_image_w;
        where.bottom = g_image_h + off_y;

        g_pDDSBack->Blt(&whereg_pDDS_imageNULLDDBLT_WAITNULL);



BltFast doesn't work either:


Code:
        g_pDDSBack->BltFast(0200g_pDDS_imageNULLDDBLTFAST_NOCOLORKEY);



Last edited by vivik on 03 Apr 2018, 17:36; edited 1 time in total
Post 03 Apr 2018, 07:46
View user's profile Send private message Reply with quote
vivik



Joined: 29 Oct 2016
Posts: 381

Got it working. Just added the same clipper to the backbuffer as well. BltFast doesn't work, but Blt works.
Post 03 Apr 2018, 17:36
View user's profile Send private message Reply with quote
vivik



Joined: 29 Oct 2016
Posts: 381

Not a question, just wanted to say. DirectDraw reacted very weirdly to trying to draw beyond the borders of the window. I tried to draw image of width 60 to rect [-60...0] or [-60...-1], that is just to the left of window border, and it lagged, and after a while screen went black for a few seconds. And after that, explorer didn't run, could only see mouse. Alt-tab and windows key didn't work, but ctrl-shift-escape and ctrl-alt-delete did. Also, ctrl-alt-del, closing session and reopening it actually caused bsod

Probably just a buggy driver.

Also, don't try to draw without Sleep(1); at the end, it draws too fast to notice, only 1/7 of frames actually get visible. I know there are other ways to do delay, Sleep works fine for me for now. Need to measure fps somehow though.

I need examples of games/programs that use directdraw. Or games for windows in general.
Post 10 May 2018, 16:34
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


Main index   Download   Documentation   Examples   Message board
Copyright © 2004-2018, Tomasz Grysztar.
Powered by rwasa.