Please,
Because when a Drawtext() is done, the next Drawtext() (without x,y params) should be printed after it, contiguous.
[Implemented] Optional x,y for Drawtext()
- Psychophanta
- Always Here
- Posts: 5153
- Joined: Wed Jun 11, 2003 9:33 pm
- Location: Anare
- Contact:
imagine you do a drawtext...
x = 10
y = 10
drawtext(x,y,"this ")
now the issue is: where does the next part go?
x = 10
y = 10
x = drawtext(x,y,"this ")
x = drawtext(x,y,"a test")
x = 10
y = 10
drawtext(x,y,"this ")
now the issue is: where does the next part go?
x = 10
y = 10
x = drawtext(x,y,"this ")
x = drawtext(x,y,"a test")
( PB6.00 LTS Win11 x64 Asrock AB350 Pro4 Ryzen 5 3600 32GB GTX1060 6GB)
( The path to enlightenment and the PureBasic Survival Guide right here... )
( The path to enlightenment and the PureBasic Survival Guide right here... )
- Psychophanta
- Always Here
- Posts: 5153
- Joined: Wed Jun 11, 2003 9:33 pm
- Location: Anare
- Contact:
Oh, I didn't know that the new DrawText() returned an X value, however since I already made it...
Code: Select all
Global Locate.POINT
Procedure Locate(x, y)
Locate\x = x
Locate\y = y
EndProcedure
Procedure DrawTextCont(text.s)
DrawText(Locate\x, Locate\y, text.s)
Locate\x + TextWidth(text.s)
EndProcedure
CreateImage(0, 400, 300)
StartDrawing(ImageOutput(0))
Locate(10, 10)
DrawTextCont("Apple pie ")
DrawTextCont("tastes good!")
StopDrawing()
OpenWindow(0,0,0,245,105,#PB_Window_SystemMenu|#PB_Window_ScreenCentered,"ImageGadget")
CreateGadgetList(WindowID(0))
ImageGadget(0, 10, 10, 100, 83, ImageID(0))
Repeat : Until WaitWindowEvent()=#PB_Event_CloseWindow