Switch to full style
Would you like to see changes or additions to BASIC! This is place to make those requests.
Post a reply

Locate y,x

Tue May 16, 2017 8:41 am

Only needed for the text console.
Would be very handy for certain programming tasks.

Like Matrix ??

Re: Locate y,x

Tue May 16, 2017 6:27 pm

I found this in the "Libraries" section.

Roy, pick up the white courtesy phone?
And 'splain how this works???

Code:



Console_Mode_Emulator_Roy

Rem Console Library
Rem With RFO Basic!
Rem September / October 2015
Rem Version 1.00
Rem By Roy Shepherd


!!
This is my 'ConLib.bas' include file.
It is a console mode emulator that works in RFO-BASIC graphic mode.
Works with 'typeface 2' monospace as this font as a fixed-pitch font, the letters
and characters each occupy the same amount of horizontal space

It is important to insert the  'ConLib.bas' include file in the right place, as shown below.

!----------------------------------------------------------------------


!-------------------------------------------------
! Set global variables.
!-------------------------------------------------
! 'globalVar' bundle pointer = 1.
bundle.create globalVar
bundle.put globalVar, "ScaleX", scale_x
bundle.put globalVar, "ScaleY", scale_y
bundle.put globalVar, "Device_W", di_width
bundle.put globalVar, "Device_H", di_height
bundle.put globalVar, "Screen", screen

bundle.put globalVar, "Pos_X", 0
bundle.put globalVar, "Pos_Y", textHeight + (textHeight / 5)
bundle.put globalVar, "TextHeight", textHeight
bundle.put globalVar, "TextWidth", textWidth
bundle.put globalVar, "MaxChrX", maxChr_X

!-------------------------------------------------
! Move to text_x, text_y.
!-------------------------------------------------
fn.def Con_Locate(text_x, text_y)
   bundle.get 1, "TextHeight", textHeight
   bundle.get 1, "TextWidth", textWidth
   textHeight += textHeight / 5
   text_x -= 1
   text_x *= textWidth
   text_y *= textHeight
   
   bundle.put 1, "Pos_X", text_x
   bundle.put 1, "Pos_Y", text_y
   
   gr.move null, text_x, text_y
fn.end
!-------------------------------------------------
! Print text at x, y
!-------------------------------------------------
fn.def Con_PrintAt(x, y, t$)
   Con_Locate(x, y)
   Con_Print(t$)
fn.end
!-------------------------------------------------



Post a reply