From 4d840b3f822cf7dd79d1e3053b9cfb9089e6d0cb Mon Sep 17 00:00:00 2001 From: Stephen MacKenzie Date: Tue, 16 Apr 2019 14:16:17 -0700 Subject: [PATCH] added better comments for GetCoords --- AFRICA_FIXED.BAS | 8 ++++---- README.md | 6 +++++- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/AFRICA_FIXED.BAS b/AFRICA_FIXED.BAS index 4b812cc..29af721 100644 --- a/AFRICA_FIXED.BAS +++ b/AFRICA_FIXED.BAS @@ -219,10 +219,10 @@ REM 349 WAVE 0,SIN 553 PRINT "CHOOSE YOUR AREA NOW.": GOSUB 400 554 CHX = 0: CHY = 0: B = 0 555 _KEYCLEAR +REM To get coordinates, comment next line (GetXY), then uncomment the line after that (GetCoords) +REM Be sure to restore for normal use. Uncomment out GetXY, comment out GetCoords 557 GetXY CHX, CHY -REM 559 IF B <> -1 THEN 555 -REM use GetCoords to determine mouse coordinates 560 GetCoords -REM dummy to exit while getting coordinates 561 GOSUB 20000 +REM 560 GetCoords ' use this to run in a loop to determine mouse coordinates REM 570 IF CHX > 210 AND CHX < 225 AND CHY > 200 AND CHY < 220 THEN 1000 570 IF CHX > 236 AND CHX < 252 AND CHY > 75 AND CHY < 100 THEN 1000 @@ -910,7 +910,7 @@ SUB GetXY (x, y) LOOP UNTIL NOT _MOUSEBUTTON(1) END SUB SUB GetCoords - x = 0: y = 0 + x = -1: y = -1 WHILE x <> 0 GetXY x, y PRINT x diff --git a/README.md b/README.md index f0e56e5..7cf4b3c 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,11 @@ You need to set the screen mode. SCREEN 11 on the first line. Mouse input needs to be refactored, mouse handling is more complex now. I added a subroutine that gets the CHX, CHY, and B params. -Mouse x,y coordinates need to be recalculated due to resolution differences. Added sub GetCoords that prints the coords as you click. +Mouse x,y coordinates need to be recalculated due to resolution differences. Added sub GetCoords that prints the coords as you click: +REM To get coordinates, comment next line (GetXY), then uncomment the line after that (GetCoords) +REM Be sure to restore for normal use. Uncomment out GetXY, comment out GetCoords +557 GetXY CHX, CHY +REM 560 GetCoords ' use this to run in a loop to determine mouse coordinates Replaced delay loops with sleep calls. 5 second delay, or press any key to advance (after music finishes).Need to flush keys afterwards _KEYCLEAR.