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 


[C++] Pixels

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming -> Binaries
View previous topic :: View next topic  
Author Message
TraxMate
Master Cheater
Reputation: 0

Joined: 01 Mar 2008
Posts: 363

PostPosted: Sun Oct 26, 2008 3:00 am    Post subject: [C++] Pixels Reply with quote

This is a little program I made to master(kinda..) GetPixel Razz. It allows you to read the RGB value from a certain point and I made it so you can draw at the screen ^^.


Source is included.



The Extension 'rar' was deactivated by an board admin, therefore this Attachment is not displayed.


The Extension 'rar' was deactivated by an board admin, therefore this Attachment is not displayed.

Back to top
View user's profile Send private message
Noz3001
I'm a spammer
Reputation: 26

Joined: 29 May 2006
Posts: 6220
Location: /dev/null

PostPosted: Sun Oct 26, 2008 4:08 am    Post subject: Reply with quote

You should draw a line between the pixels in the Draw part. Will make it look better. ^_^
Back to top
View user's profile Send private message MSN Messenger
TraxMate
Master Cheater
Reputation: 0

Joined: 01 Mar 2008
Posts: 363

PostPosted: Sun Oct 26, 2008 4:22 am    Post subject: Reply with quote

noz3001 wrote:
You should draw a line between the pixels in the Draw part. Will make it look better. ^_^
How do you mean? I don't understand :S. Could you explain better? Razz
Back to top
View user's profile Send private message
blackmorpheus
Expert Cheater
Reputation: 0

Joined: 05 Apr 2008
Posts: 159

PostPosted: Sun Oct 26, 2008 4:30 pm    Post subject: Reply with quote

doesnt work
Back to top
View user's profile Send private message
--Pillboi--
Grandmaster Cheater Supreme
Reputation: 0

Joined: 06 Mar 2007
Posts: 1383
Location: I don't understand the question. Is this a 1 to 10 thing?

PostPosted: Mon Oct 27, 2008 1:30 pm    Post subject: Reply with quote

Don't spam blackmorpheus Evil or Very Mad
_________________

Enter darkness, leave the light, Here be nightmare, here be fright...
Earth and Water, Fire and Air. Prepare to meet a creature rare.
Enter now if you dare, Enter now the dragon's lair.
Back to top
View user's profile Send private message
hcavolsdsadgadsg
I'm a spammer
Reputation: 26

Joined: 11 Jun 2007
Posts: 5801

PostPosted: Mon Oct 27, 2008 4:48 pm    Post subject: Reply with quote

1. You never release your DC.

2. Sleeping your main loop is pointless, since it will just wait for input at the start.

3. Why are you using printf instead of cout?

4. You can use the RGB macro instead of splitting up your COLORREF.

instead of:
Code:
   COLORREF Color = GetPixel(hdc, x, y);
   BYTE Red, Green, Blue;
   Red = GetRValue(Color);
   Green = GetGValue(Color);
   Blue = GetBValue(Color);
   if(Red == r, Green == g, Blue == b)


You can just do
Code:
if(Color == RGB(r, g, b))


or even

Code:
if(GetPixel(hdc, x, y) == RGB(r, g, b))


5. ERROR_SUCCESS may be more descriptive than FALSE...

6. You can do:
Code:
while(!GetAsyncKeyState(VK_F12))
instead of
Code:
if(GetAsyncKeyState(VK_F12))
      draw = false;
within the loop.

7. Just get the DC once instead of OVER AND OVER.

8. You'll probably find a switch statement neater.


SOME FOOD FOR THOUGHT. GDI is fun.
Back to top
View user's profile Send private message
TraxMate
Master Cheater
Reputation: 0

Joined: 01 Mar 2008
Posts: 363

PostPosted: Tue Oct 28, 2008 7:03 am    Post subject: Reply with quote

Thanks slovach, that was some usefull tips.
Back to top
View user's profile Send private message
--Pillboi--
Grandmaster Cheater Supreme
Reputation: 0

Joined: 06 Mar 2007
Posts: 1383
Location: I don't understand the question. Is this a 1 to 10 thing?

PostPosted: Tue Oct 28, 2008 9:26 am    Post subject: Reply with quote

slovach wrote:
6. You can do:
Code:
while(!GetAsyncKeyState(VK_F12))
instead of
Code:
if(GetAsyncKeyState(VK_F12))
      draw = false;
within the loop.

I haven't looked at his code, but those statements do different things.
Your code will only draw while F12 is not down, where as his code will stop drawing all together. Rolling Eyes

_________________

Enter darkness, leave the light, Here be nightmare, here be fright...
Earth and Water, Fire and Air. Prepare to meet a creature rare.
Enter now if you dare, Enter now the dragon's lair.
Back to top
View user's profile Send private message
TraxMate
Master Cheater
Reputation: 0

Joined: 01 Mar 2008
Posts: 363

PostPosted: Tue Oct 28, 2008 10:40 am    Post subject: Reply with quote

--Pillboi-- wrote:
slovach wrote:
6. You can do:
Code:
while(!GetAsyncKeyState(VK_F12))
instead of
Code:
if(GetAsyncKeyState(VK_F12))
      draw = false;
within the loop.

I haven't looked at his code, but those statements do different things.
Your code will only draw while F12 is not down, where as his code will stop drawing all together. Rolling Eyes
If you look at my code you can see that that method is better than the one I used.
Back to top
View user's profile Send private message
hcavolsdsadgadsg
I'm a spammer
Reputation: 26

Joined: 11 Jun 2007
Posts: 5801

PostPosted: Tue Oct 28, 2008 12:26 pm    Post subject: Reply with quote

--Pillboi-- wrote:
slovach wrote:
6. You can do:
Code:
while(!GetAsyncKeyState(VK_F12))
instead of
Code:
if(GetAsyncKeyState(VK_F12))
      draw = false;
within the loop.

I haven't looked at his code, but those statements do different things.
Your code will only draw while F12 is not down, where as his code will stop drawing all together. Rolling Eyes


Wrong. The condition is met, so the loop stops. Rolling Eyes
Back to top
View user's profile Send private message
--Pillboi--
Grandmaster Cheater Supreme
Reputation: 0

Joined: 06 Mar 2007
Posts: 1383
Location: I don't understand the question. Is this a 1 to 10 thing?

PostPosted: Tue Oct 28, 2008 3:00 pm    Post subject: Reply with quote

Sorry, yes your right. For some reason I was thinking that those statements were within a constant loop.
_________________

Enter darkness, leave the light, Here be nightmare, here be fright...
Earth and Water, Fire and Air. Prepare to meet a creature rare.
Enter now if you dare, Enter now the dragon's lair.
Back to top
View user's profile Send private message
nog_lorp
Grandmaster Cheater
Reputation: 0

Joined: 26 Feb 2006
Posts: 743

PostPosted: Tue Oct 28, 2008 4:37 pm    Post subject: Reply with quote

slovach wrote:
3. Why are you using printf instead of cout?


stdio is faster?

_________________
Mutilated lips give a kiss on the wrist of the worm-like tips of tentacles expanding in my mind
I'm fine accepting only fresh brine you can get another drop of this yeah you wish
Back to top
View user's profile Send private message
hcavolsdsadgadsg
I'm a spammer
Reputation: 26

Joined: 11 Jun 2007
Posts: 5801

PostPosted: Tue Oct 28, 2008 4:54 pm    Post subject: Reply with quote

nog_lorp wrote:
slovach wrote:
3. Why are you using printf instead of cout?


stdio is faster?


Yeah, who needs to use ASM or anything in speed critical parts? Just replace your cout's with printf's. Smile
Back to top
View user's profile Send private message
Silent Storm
Advanced Cheater
Reputation: 0

Joined: 03 Jan 2008
Posts: 61
Location: registry

PostPosted: Sun Mar 29, 2009 6:11 am    Post subject: Reply with quote

Could you reupp the files pls dislike
Back to top
View user's profile Send private message
TraxMate
Master Cheater
Reputation: 0

Joined: 01 Mar 2008
Posts: 363

PostPosted: Sat Apr 18, 2009 2:09 pm    Post subject: Reply with quote

Silent Storm wrote:
Could you reupp the files pls dislike
No I don't have the files left on my pc, sorry.
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 -> Binaries 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