Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / peek screen command

Author
Message
Brux
14
Years of Service
User Offline
Joined: 12th Oct 2011
Location:
Posted: 19th Aug 2014 19:19
:\'( there is a command in DBPro to detect the color of the screen coordinates
x, y (example 0.0) and then the following (1,0 / 2,0) etc. ?

for example I would write a sentence "darkbasic" at coordinates 10,10
and then detect starting at x = 0 and y = 0 the colors of the pixels on the screen
for a routine that I had already 'created with AMOSPro
was the command 'peek screen x,y' or something like that
Van B
Moderator
23
Years of Service
User Offline
Joined: 8th Oct 2002
Location: Sunnyvale
Posted: 21st Aug 2014 10:06
The command your looking for is POINT(x,y) - this will return the RGB value, so to work out the red green and blue components...

c=POINT(x,y)
r=rgbr(c)
g=rgbg(c)
b=rgbb(c)

It's slow, but I guess it depends on how you use it. The faster option is usually to grab the screen as an image then reference it directly with a memblock or plugin, I think POINT needs to update the screen each time it's used, so it can cause real problems if used in your main loop.

I am the one who knocks...
Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 21st Aug 2014 12:06
Quote: "I think POINT needs to update the screen each time it's used"


Surely not?



Powered by Free Banners
Libervurto
20
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 22nd Aug 2014 08:21
Quote: "The faster option is usually to grab the screen as an image then reference it directly with a memblock"

Yes, MUCH faster. Memblocks are a bit tricky for newbies though. I have written some functions to make this easier (for DBC but should work with DBP) I will dig them out if asked.

Also I am thinking maybe locking pixels will help the speed?

Formerly OBese87.

Login to post a reply

Server time is: 2026-07-05 17:32:51
Your offset time is: 2026-07-05 17:32:51