Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Using the Screen function
#1
Can  the Screen(row,column) function be used to find the character at a screen location after using _newImage and setting a font?
When I try to run these few lines, I don't get the results I expect:
Code: (Select All)
WWidth = 1120: WHeight = 820: Mode = 32: Size = 24
Screen _NewImage(WWidth, WHeight, Mode)
SetFont: f& = _LoadFont("C:\WINDOWS\fonts\courbd.ttf", Size, "monospace"): _Font f&

Locate 15, 40: Print "X"
p% = Screen(15, 40)
Print "screen(15,40) is"; p%: Sleep

' with lines 3 and 4 both in, an Illegal Function message is shown.
' with line 3 in, and line 4 out, the  char number is reported as 219.
' with line 4 in and  line 3 out, the expected code (88) is shown.
Of all the places on Earth, and all the planets in the Universe, I'd rather live here (Perth, Western Australia.) Big Grin
Please visit my Website at: http://oldendayskids.blogspot.com/
Reply
#2
maybe if you use mode = 0 not mode 32

hey it's 7;07 am what are you doing up so early ? lol

yeah ok change wwidth and hheight to screen 0 columns and rows
Code: (Select All)
'WWidth = 1120: WHeight = 820:
Mode = 0: Size = 24
Screen _NewImage(80, 30, Mode)
SetFont: f& = _LoadFont("C:\WINDOWS\fonts\courbd.ttf", Size, "monospace"): _Font f&

Locate 15, 40: Print "X"
p% = Screen(15, 40)
Print "screen(15,40) is"; p%: Sleep

' with lines 3 and 4 both in, an Illegal Function message is shown.
' with line 3 in, and line 4 out, the  char number is reported as 219.
' with line 4 in and  line 3 out, the expected code (88) is shown.

must be the banner inspiring this crap! lol
  724  855  599  923  575  468  400  206  147  564  878  823  652  556 bxor cross forever
Reply
#3
the only good reason to use screen 0 is for screen function Big Grin
  724  855  599  923  575  468  400  206  147  564  878  823  652  556 bxor cross forever
Reply
#4
(04-05-2024, 11:13 AM)bplus Wrote: the only good reason to use screen 0 is for screen function Big Grin

Thanks bplus. Screen  0 works for this example. But I need text and graphics, and this mode doesn't provide the features I need.
I want to use thiis font, and this screen size, and a set number of chars per line.. Then I need to look at a screen row and see 
what character is at position P of that row.

I think maybe the simplest way is to map the row, call it RefRow$(), then when chars are printed on it, place the char in this array.

Code: (Select All)
WWidth = 1120: WHeight = 820: Mode = 32: Size = 24
Screen _NewImage(WWidth, WHeight, Mode)
SetFont: f& = _LoadFont("C:\WINDOWS\fonts\courbd.ttf", Size, "monospace"): _Font f&
lhs = (_DesktopWidth - WWidth) / 2
_ScreenMove lhs, 86 ' centre display on screen
CPL = WWidth / _PrintWidth("X")
Print "cpl is"; CPL

Ref = 15: p = 40
Dim RefRow$(80): Locate Ref, p: Print "X": RefRow$(p) = "X"

Print RefRow$(40)

A bit simplistic, but it works ok. What do you think?
Of all the places on Earth, and all the planets in the Universe, I'd rather live here (Perth, Western Australia.) Big Grin
Please visit my Website at: http://oldendayskids.blogspot.com/
Reply
#5
+1 yep exactly what I would do!

I'd go a step further and make a function that saves the text in an array and prints to screen.
  724  855  599  923  575  468  400  206  147  564  878  823  652  556 bxor cross forever
Reply
#6
I'd just dual print to 2 different screens, and keep the SCREEN 0 screen hidden so I could read back from it at any time, without the user knowing.  Big Grin
Reply
#7
+1 good idea
  724  855  599  923  575  468  400  206  147  564  878  823  652  556 bxor cross forever
Reply
#8
I'm jus gladd to sea peeple who dont usze SCREEN 0 our FOCKED. 

Peat
Reply
#9
hey what happened to the points?
  724  855  599  923  575  468  400  206  147  564  878  823  652  556 bxor cross forever
Reply
#10
Just Steve messing with us. Wink
Shoot first and shoot people who ask questions, later.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
Star Suggestion for new REPLACE$() function zaadstra 3 262 01-26-2026, 05:11 PM
Last Post: grymmjack
  Is there a menu function? Mad Axeman 17 1,095 12-17-2025, 04:43 AM
Last Post: SMcNeill
  Problem with one function Kernelpanic 3 865 08-29-2023, 11:26 PM
Last Post: Kernelpanic
  No warning to mix screen 0 and screen graphic commands! TempodiBasic 8 1,825 06-16-2023, 11:36 PM
Last Post: TempodiBasic
Brick Is there an inconsistency in the Locate function? PhilOfPerth 3 799 05-25-2023, 02:57 PM
Last Post: TempodiBasic

Forum Jump:


Users browsing this thread: 1 Guest(s)