Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 20:33 22 Nov 2024 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : Problems with mm.info(hpos|vpos)

Author Message
frankenfone
Newbie

Joined: 26/09/2024
Location: France
Posts: 3
Posted: 10:45am 13 Oct 2024
Copy link to clipboard 
Print this post

Hi All.

PicoMite VGA on RP2350
Software version 6.00.00RC1
Mode 3

I am trying to write a piece of software which requires specific positioning of the cursor on the screen. However I am getting very inconsistent and confusing results. Having tried multiple approaches (short software test routines) to define and comprehend the problem I am having, I have not made very much progress. Hence my first post to the shed. For example the following code

Do

Line 100,100,200,200,,rgb(white)
currx=mm.info(hpos)
curry=mm.info(vpos)

Print @(-8,0),"xpos=";currx;" ypos=";curry

Loop


results in output (line drawn OK)

xpos= 256 ypos= 0

...including the strange spacing in the output which to me shouldn't really be there.

Also I have found it is necessary to print starting at -8 for x, as otherwise the output string is placed one character to the right.

However, more importantly, should this code not report 200 200 following the line draw?


Yours, confused in Finistère  
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 9087
Posted: 10:52am 13 Oct 2024
Copy link to clipboard 
Print this post

HPOS and VPOS give the position where the next character would be written. They are only impacted by text output
 
robert.rozee
Guru

Joined: 31/12/2012
Location: New Zealand
Posts: 2350
Posted: 11:09am 13 Oct 2024
Copy link to clipboard 
Print this post

try:

Print @(0,0) "xpos=";Str$(currx);" ypos=";Str$(curry)


the reasons your version behaved oddly are that (1) the comma after your @(-8,0) inserts a tab that immediately moves the cursor right by 8 characters, and (2) when printing a positive number a leading space is always added - think of it as an invisible "+" sign. to clarify, run the following:

For I=-5 to 5: Print I;: Next I
Print
For I=-5 to 5: Print Str$(I);: Next I
Print


also observe the results of:

Print "a" "b" "c" "d" "e"
Print "a"; "b"; "c"; "d"; "e"


btw, strictly speaking @(-8,0) should generate an error as -8 is a starting position off the left of the screen, but i guess there is no range checking in the @() function.


cheers,
rob   :-)
Edited 2024-10-13 21:17 by robert.rozee
 
frankenfone
Newbie

Joined: 26/09/2024
Location: France
Posts: 3
Posted: 12:12pm 13 Oct 2024
Copy link to clipboard 
Print this post

  matherp said  HPOS and VPOS give the position where the next character would be written. They are only impacted by text output


Ah... well, that makes sense, thanks. Indeed it is the text position that I require, graphics are I suppose explicitly stated.
 
frankenfone
Newbie

Joined: 26/09/2024
Location: France
Posts: 3
Posted: 12:13pm 13 Oct 2024
Copy link to clipboard 
Print this post

  robert.rozee said  try:

Print @(0,0) "xpos=";Str$(currx);" ypos=";Str$(curry)


the reasons your version behaved oddly are that (1) the comma after your @(-8,0) inserts a tab that immediately moves the cursor right by 8 characters, and (2) when printing a positive number a leading space is always added - think of it as an invisible "+" sign. to clarify, run the following:

For I=-5 to 5: Print I;: Next I
Print
For I=-5 to 5: Print Str$(I);: Next I
Print


also observe the results of:

Print "a" "b" "c" "d" "e"
Print "a"; "b"; "c"; "d"; "e"


btw, strictly speaking @(-8,0) should generate an error as -8 is a starting position off the left of the screen, but i guess there is no range checking in the @() function.


cheers,
rob   :-)



Thanks. I am still trying to figure out how this works!
 
Print this page


To reply to this topic, you need to log in.

© JAQ Software 2024