Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


TextOut not flickery?

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
iPromise
Grandmaster Cheater
Reputation: -1

Joined: 27 Jun 2009
Posts: 529
Location: Canada

PostPosted: Sun Apr 25, 2010 3:24 pm    Post subject: TextOut not flickery? Reply with quote

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
View user's profile Send private message MSN Messenger
hcavolsdsadgadsg
I'm a spammer
Reputation: 26

Joined: 11 Jun 2007
Posts: 5801

PostPosted: Sun Apr 25, 2010 3:43 pm    Post subject: Reply with quote

what are you trying to draw on?

you can solve your flickering problems by double buffering.
Back to top
View user's profile Send private message
iPromise
Grandmaster Cheater
Reputation: -1

Joined: 27 Jun 2009
Posts: 529
Location: Canada

PostPosted: Sun Apr 25, 2010 5:37 pm    Post subject: Reply with quote

I am drawing on a game (Combat Arms). What do you mean by double buffering?
Back to top
View user's profile Send private message MSN Messenger
Slugsnack
Grandmaster Cheater Supreme
Reputation: 71

Joined: 24 Jan 2007
Posts: 1857

PostPosted: Sun Apr 25, 2010 5:40 pm    Post subject: Reply with quote

http://www.codeproject.com/KB/cpp/DoubleBuffering.aspx
Back to top
View user's profile Send private message
iPromise
Grandmaster Cheater
Reputation: -1

Joined: 27 Jun 2009
Posts: 529
Location: Canada

PostPosted: Sun Apr 25, 2010 6:31 pm    Post subject: Reply with quote

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
View user's profile Send private message MSN Messenger
AtheistCrusader
Grandmaster Cheater
Reputation: 6

Joined: 23 Sep 2006
Posts: 681

PostPosted: Sun Apr 25, 2010 7:01 pm    Post subject: Reply with quote

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
View user's profile Send private message
iPromise
Grandmaster Cheater
Reputation: -1

Joined: 27 Jun 2009
Posts: 529
Location: Canada

PostPosted: Sun Apr 25, 2010 7:13 pm    Post subject: Reply with quote

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
View user's profile Send private message MSN Messenger
AtheistCrusader
Grandmaster Cheater
Reputation: 6

Joined: 23 Sep 2006
Posts: 681

PostPosted: Sun Apr 25, 2010 7:20 pm    Post subject: Reply with quote

Create a memoryDC
TextOut to that DC
bitblt to the real window.

oi hey
didnt u like master C++?
Back to top
View user's profile Send private message
hcavolsdsadgadsg
I'm a spammer
Reputation: 26

Joined: 11 Jun 2007
Posts: 5801

PostPosted: Sun Apr 25, 2010 7:54 pm    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
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


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites