Wrox Programmer Forums
Go Back   Wrox Programmer Forums > C# and C > C++ and Visual C++ > C++ Programming
|
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 software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old October 9th, 2005, 11:24 AM
Registered User
 
Join Date: Oct 2005
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
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
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





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





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