Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > C# and C > C++ and Visual C++ > C++ Programming
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
C++ Programming General discussions for the C++ language. For questions specific to Microsoft's Visual C++ variant, see the Visual C++ forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the C++ Programming section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old October 9th, 2005, 11:24 AM
Registered User
 
Join Date: Oct 2005
Location: , , .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default How to speed up 10 times using directX?

void TForm1::Draw(void)
{
    HDC DC;
    if (lpDDSPrimary->IsLost() == DDERR_SURFACELOST)
        lpDDSPrimary->Restore();
    if (lpDDSBack->GetDC(&DC) == DD_OK)
    {
        Canvas->Handle = DC;
        if(phase)
        {
            top=1;
            for(int i=0;i<Canvas->ClipRect.Bottom;i+=deltah)
            {
                left=1;
                for(int j=0;j<Canvas->ClipRect.Right;j+=deltaw)
                {
                    Canvas->Brush->Color=(TColor)RGB(255-i,255-j,255-i*j);
                    Canvas->FillRect(Rect(left,top,left+deltaw,top+deltah)) ;
                    left+=deltaw;
                }
                top+=deltah;
            }
            Canvas->TextOutA(50,100,"Front");
            phase = 0;
        }
        else
        {
            top=1;
            for(int i=0;i<Canvas->ClipRect.Bottom;i+=deltah)
            {
                left=1;
                for(int j=0;j<Canvas->ClipRect.Right;j+=deltaw)
                {
                    Canvas->Brush->Color=(TColor)RGB(255-i*j,255-j,255-i);
                    Canvas->FillRect(Rect(left,top,left+deltaw,top+deltah)) ;
                    left+=deltaw;
                }
                top+=deltah;
            }
            Canvas->TextOutA(50,150,"Back");
            phase = 1;
        }
        lpDDSBack->ReleaseDC(DC);
    }
}


Reply With Quote
  #2 (permalink)  
Old October 9th, 2005, 11:26 AM
Registered User
 
Join Date: Oct 2005
Location: , , .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

How to FillRect not use Canvas?

Reply With Quote
  #3 (permalink)  
Old October 19th, 2005, 10:47 PM
Registered User
 
Join Date: Oct 2005
Location: , , .
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Use MFC long FillRect Lib "User32" (long &hdc ,const RECT& lpRect ,Long& hBrush )

Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Develop 3D game with C# + DirectX + .NET skywalker1987 C# 1 July 18th, 2013 02:39 AM
about directx Innaorouk C# 2 August 27th, 2007 08:39 PM
Help. How to play media files using DirectX dextergaisie Pro VB 6 0 May 15th, 2007 06:09 AM
managed directx 9drawsubset problem? mmmobasher C# 0 December 1st, 2005 05:29 AM
directx programing bcmaverik VB.NET 5 January 28th, 2004 07:07 AM



All times are GMT -4. The time now is 07:26 AM.


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.