Page 1 of 1

Posted: Thu Apr 11, 2002 2:59 pm
by BackupUser
Restored from previous forum. Originally posted by Ralf.

Would be good if there was a funktion DrawTextN().
So i draws a new line.

Posted: Thu Apr 11, 2002 9:33 pm
by BackupUser
Restored from previous forum. Originally posted by PB.

> Would be good if there was a funktion DrawTextN().
> So i draws a new line.

A lot of the time you can create a procedure to get your own custom commands,
until Fred graciously decides to add them internally to PureBasic. For example,
to get your own DrawTextN() command, just put this at the start of your code:

Code: Select all

Procedure DrawTextN(text$)
  DrawText(text$+Chr(13))
EndProcedure

PB - Registered PureBasic Coder

Posted: Fri Apr 12, 2002 11:38 am
by BackupUser
Restored from previous forum. Originally posted by Ralf.

i tried that but it's not working.
It prints only a square instead going to the next line.

Posted: Fri Apr 12, 2002 12:27 pm
by BackupUser
Restored from previous forum. Originally posted by Danilo.

Sure, Ralf.

You have to do _something like_ that:

Code: Select all

Procedure DrawTextN(text$)
   DrawText(text$)
   DrawTextY + #FontHeight
   Locate(0,DrawTextY)
EndProcedure
to Update your "virtual Cursor" automatically.

Just move your cursor with locate( 0 , currentYposition+FontHeight ).
You have to integrate this yourself in your application, but its
not that hard. Well, its easy....

You should use some GLOBAL variables for the "cursor"
position, so you can update it at every time.

And dont tell me the code above doesnt run -
its only an example to give you an idea...

BTW, Fred: Is there a command to GET the actual Locate()
Position ?? Maybe something like

Code: Select all

x = LocateX()
 and
y = LocateY()
would help in such situations. Thanks.


cya,
...Danilo

(registered PureBasic user)

Posted: Sat Apr 13, 2002 2:08 am
by BackupUser
Restored from previous forum. Originally posted by PB.

> i tried that but it's not working.
> It prints only a square instead going to the next line.

To be honest I didn't try my tip before posting it, since I don't normally use
the 2D drawing functions. I see that Danilo has answered your question though,
so I'll leave it at that. But my tip about being able to create custom commands
via Procedures still stands.


PB - Registered PureBasic Coder