_TITLE "get points from map.bas for QB64 by B+ 2018-10-15" CONST mw
= 700 'map width CONST mh
= 391 ' map hieght SCREEN _NEWIMAGE(700, 391, 32) 'these were map dimensions from file properties setting up a graphics screen for map _PUTIMAGE , m&
'fill screen with map 1 to 1 ratio
'now find corners of map inside frame borders
PRINT "Click top left corner." getClick tlx, tly, qkeycode ' top corner: tlx = top left x, tly = top left y
PRINT "Ok now click bottom right corner." getClick brx, bry, qkeycode ' bottom right corner: brx, bry
'debug check our clicked points
'PRINT tlx, tly, brx, bry
'using corners divide distance left x and right x by 360
dx## = (brx - tlx) / 360
'using corners divide distance bottom y to top y by 180
dy## = (bry - tly) / 180
'map dots array
'for color of point x, y
'fill array with point data 1 or 0 depending if line there or not
ding = 0 'signal a line hit in area
'search around the dot for a line, otherwise too mang gaps in outlines
FOR yy
= -1 TO 0 'try -1 to 1, -1 to 0, or 0 to 0 to adjust number of dots on same line FOR xx
= -1 TO -1 'try -1 to 1, -1 to 0, or 0 to 0 to adjust number of dots on same line p
= POINT(INT(tlx
+ x
* dx##
) + xx
, INT(tly
+ y
* dy##
) + yy
) skipout:
'draw map of dots exactly where the map.png was set
IF mp
(x
, y
) = 1 THEN PSET (tlx
+ x
* dx##
, tly
+ y
* dy##
), _RGB32(255, 255, 255)
'frame the dots in a box
LINE (tlx
+ 180 * dx##
, tly
)-(tlx
+ 180 * dx##
, bry
), _RGB32(0, 0, 200) LINE (tlx
, tly
+ 90 * dy##
)-(brx
, tly
+ 90 * dy##
), _RGB32(0, 0, 200)
'Write results to file, actually this is 361 x data points by 181 y data points
'this gets mouse click location
mx = -1: my = -1: q = 0