Use Point with a DC

Just starting out? Need help? Post your questions and find answers here.
willib
User
User
Posts: 39
Joined: Mon Sep 15, 2003 7:04 pm
Location: Bielefeld

Use Point with a DC

Post by willib »

HI all

I want to Programm something that reads out the Top screen and analyse it ( in real I want to find a chess board )
I can get the primary screen in a DC
now i must find a rectangle in it
therefor I need the point(X,Y) colors of the DC but
I cant find a function for this.

The sense of the Project is to let 2 Chess Programms play against each other over IP.

Can someone give me a hint
Kale
PureBasic Expert
PureBasic Expert
Posts: 3000
Joined: Fri Apr 25, 2003 6:03 pm
Location: Lincoln, UK
Contact:

Post by Kale »

The sense of the Project is to let 2 Chess Programms play against each other over IP.
Maybe a better way to achieve this is to break the board down into a simple 2d array (x,y) 'Dim'ed from a Structure describing that square (empty/what piece is there). Then just communicate this array between programs and let the AI use the opponents array for making descisions. Then display the results to the screen in a nicely drawn chess board. Maybe a little easier than trying to find out what is being displayed on the screen, etc. :)
--Kale

Image
willib
User
User
Posts: 39
Joined: Mon Sep 15, 2003 7:04 pm
Location: Bielefeld

Post by willib »

HI again

I do not want to code the chess programm itselfs.
There are several programs like Fritz or Genius but then do not communicate with all of them. So I like to make them play against each other that way ;-)

Its a long way to go ......
LarsG
Enthusiast
Enthusiast
Posts: 713
Joined: Mon Jun 02, 2003 1:06 pm
Location: Norway
Contact:

Post by LarsG »

Isn't there some API call to get the width and height of a DC?! I would assume there is some anyways.. then you'd be able to grab it as an image, and transmit this as a file over the network.. I think?!? :lol:

AMD Athlon XP2400, 512 MB RAM, Hercules 3D Prophet 9600 256MB RAM, WinXP
PIII 800MHz, 320 MB RAM, Nvidia Riva Tnt 2 Mach 64 (32MB), WinXP + Linux
17" iMac, 1.8 GHz G5, 512 MB DDR-RAM, 80 GB HD, 64 MB Geforce FX 5200, SuperDrive, OSX
Kale
PureBasic Expert
PureBasic Expert
Posts: 3000
Joined: Fri Apr 25, 2003 6:03 pm
Location: Lincoln, UK
Contact:

Post by Kale »

To retrieve a colour at the given coord (WinAPI):

Code: Select all

RGBValue = GetPixel_(HDC, XPos, YPos);
To retrieve the width and height of the device context use (WinAPI):

Code: Select all

GetBoundsRect_(HDC, Bounds.RECT, #NULL)
Debug Bounds\Right
Debug Bounds\Bottom
Get a Good WinAPI reference and all can be found, try here:
http://www.garyw.uklinux.net/PB/WIN32.zip
or
http://www.mentalis.org/agnet/apiguide.shtml
--Kale

Image
willib
User
User
Posts: 39
Joined: Mon Sep 15, 2003 7:04 pm
Location: Bielefeld

Post by willib »

:D Thanks I will try it out next week ;-)

Willi
Post Reply