View previous topic :: View next topic |
Author |
Message |
iPromise Grandmaster Cheater
Reputation: -1
Joined: 27 Jun 2009 Posts: 529 Location: Canada
|
Posted: Sun Apr 25, 2010 3:24 pm Post subject: TextOut not flickery? |
|
|
Okay so what I do is I use GetDC() to obtain my DC, and use TextOut() to write. THe problem here is that it flickers, I tried using DrawText() because it works faster with the DT_NOCLIP flag, but same results, flickerness.
Anybody know an alternative?
|
|
Back to top |
|
 |
hcavolsdsadgadsg I'm a spammer
Reputation: 26
Joined: 11 Jun 2007 Posts: 5801
|
Posted: Sun Apr 25, 2010 3:43 pm Post subject: |
|
|
what are you trying to draw on?
you can solve your flickering problems by double buffering.
|
|
Back to top |
|
 |
iPromise Grandmaster Cheater
Reputation: -1
Joined: 27 Jun 2009 Posts: 529 Location: Canada
|
Posted: Sun Apr 25, 2010 5:37 pm Post subject: |
|
|
I am drawing on a game (Combat Arms). What do you mean by double buffering?
|
|
Back to top |
|
 |
Slugsnack Grandmaster Cheater Supreme
Reputation: 71
Joined: 24 Jan 2007 Posts: 1857
|
|
Back to top |
|
 |
iPromise Grandmaster Cheater
Reputation: -1
Joined: 27 Jun 2009 Posts: 529 Location: Canada
|
Posted: Sun Apr 25, 2010 6:31 pm Post subject: |
|
|
Sorta lost there..
So double buffering is drawing your image on to memory (buffer) and then displaying that memory into the screen, so drawing on to a image and displaying the image?
Code: |
TextOut(GetDC(hWnd), 10, 10, "TEST", 4);
|
I don't get how I can double buffer TextOut(), really lost can somebody explain further more?
|
|
Back to top |
|
 |
AtheistCrusader Grandmaster Cheater
Reputation: 6
Joined: 23 Sep 2006 Posts: 681
|
Posted: Sun Apr 25, 2010 7:01 pm Post subject: |
|
|
iPromise wrote: | Sorta lost there..
So double buffering is drawing your image on to memory (buffer) and then displaying that memory into the screen, so drawing on to a image and displaying the image?
Code: |
TextOut(GetDC(hWnd), 10, 10, "TEST", 4);
|
I don't get how I can double buffer TextOut(), really lost can somebody explain further more? |
First of all, GetDC(hWnd)
get rid of that.
HDC dc = GetDC(hWnd);
....
DeleteDC(dc);
|
|
Back to top |
|
 |
iPromise Grandmaster Cheater
Reputation: -1
Joined: 27 Jun 2009 Posts: 529 Location: Canada
|
Posted: Sun Apr 25, 2010 7:13 pm Post subject: |
|
|
Okay that was just some pseudo code on the spot, can you help me on getting it non flickery?
Code: |
//pseudo
//flickery
HDC DC = GetDC ( hWnd );
while ( 1 )
{
TextOut ( DC, 10, 10, L"TEST", 4 );
Sleep(1);
}
DeleteDC(DC);
|
|
|
Back to top |
|
 |
AtheistCrusader Grandmaster Cheater
Reputation: 6
Joined: 23 Sep 2006 Posts: 681
|
Posted: Sun Apr 25, 2010 7:20 pm Post subject: |
|
|
Create a memoryDC
TextOut to that DC
bitblt to the real window.
oi hey
didnt u like master C++?
|
|
Back to top |
|
 |
hcavolsdsadgadsg I'm a spammer
Reputation: 26
Joined: 11 Jun 2007 Posts: 5801
|
Posted: Sun Apr 25, 2010 7:54 pm Post subject: |
|
|
iPromise wrote: | Sorta lost there..
So double buffering is drawing your image on to memory (buffer) and then displaying that memory into the screen, so drawing on to a image and displaying the image?
Code: |
TextOut(GetDC(hWnd), 10, 10, "TEST", 4);
|
I don't get how I can double buffer TextOut(), really lost can somebody explain further more? |
you do all your drawing into a memory DC instead. when you're done, blit the memory DC into the DC. the end result is that you're always 100% done drawing before you're putting something on the screen.
... but you're going to have trouble drawing it over a game, period.
you're flickering because you're out of sync with the frames being drawn by the game. you draw something, it gets drawn over, etc etc, and it's not at the same time. the game isn't flipping to a frame with your text already drawn on it. it's a constant struggle.
you probably won't really be able to get a very good result outside of hooking the rendering api in one way or another.
|
|
Back to top |
|
 |
|