QB64.org Forum

Active Forums => QB64 Discussion => Topic started by: hanness on March 26, 2021, 06:02:37 pm

Title: 2nd Ques for today - Can I capture the char at a specific location on screen?
Post by: hanness on March 26, 2021, 06:02:37 pm
I know that I can use "Location" to move my cursor to any row and column on the screen so that I can display characters in specific locations. However, once I move to a particular location, is there any way that I can somehow retrieve the current character at that location?

Failing that, is there a way that I can simply dump the entire contents of the QB64 program screen to a text file? If so, I can then simply parse that text file to find what characters are in various spots.
Title: Re: 2nd Ques for today - Can I capture the char at a specific location on screen?
Post by: FellippeHeitor on March 26, 2021, 06:08:27 pm
Code: QB64: [Select]

X and Y being the coordinates you're checking.
Title: Re: 2nd Ques for today - Can I capture the char at a specific location on screen?
Post by: SMcNeill on March 26, 2021, 06:19:10 pm
Code: QB64: [Select]

X and Y being the coordinates you're checking.

Note:  this is only guaranteed to work in SCREEN 0.  Text screens store info in memory in 2 bytes per color&character.  All other screens only store info on a color per pixel basis, so character information has to basically be retrieved via OCR — which is quite limited in QB64.

Title: Re: 2nd Ques for today - Can I capture the char at a specific location on screen?
Post by: Cobalt on March 27, 2021, 12:06:38 am
Really want to be fancy use MEM functions. Or be cool and old skool using DEFSEG and PEEK!
Steve can help with the fancy stuff, I could show you the old skool way.

Or you can be boring and take the beaten path. :)
Title: Re: 2nd Ques for today - Can I capture the char at a specific location on screen?
Post by: bplus on March 27, 2021, 02:04:04 am
And for graphics you can setup virtual screen array.

Modify your print command to write in both screen and virtual screen.


Title: Re: 2nd Ques for today - Can I capture the char at a specific location on screen?
Post by: hanness on March 27, 2021, 02:14:41 am
Thanks!
Title: Re: 2nd Ques for today - Can I capture the char at a specific location on screen?
Post by: hanness on March 27, 2021, 03:02:55 am
Turns out that I am using screen 0 so this works perfectly.

My program sets up a bunch of information on the screen by using locate commands to put various elements in exactly the right spots. After everything is displayed I use a simple loop to capture each character and print it to a file as you have shown me here. That file can then be printed as a really good duplicate of the screen contents.

Thanks again.