DrawText()

Everything else that doesn't fall into one of the other PB categories.
mestnyi
Addict
Addict
Posts: 1000
Joined: Mon Nov 25, 2013 6:41 am

DrawText()

Post by mestnyi »

In Mac, drawtext draws multi-line
in Linux 3 lines
in Windows 1 line
Wy???

Code: Select all

Global Text.s = "line_1"+Chr(10)+
"line__2"+Chr(10)+
"line___3 it was a long, very long string, so we will transfer it"+Chr(10)+
"line_4"+#CRLF$+
"line__5"+#LF$


If OpenWindow(0, 0, 0, 220, 620, "CanvasGadget", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
  CanvasGadget(0, 10, 10, 200, 600)
  
  If StartDrawing(CanvasOutput(0))
    Box(0,0,OutputWidth(), OutputHeight(), $FFFFFF)
    
    DrawText(10,10,Text.s, $000000, $FFFFFF)
    
    StopDrawing() 
  EndIf
  
  Repeat
    Event = WaitWindowEvent()
  Until Event = #PB_Event_CloseWindow
EndIf
User avatar
Mijikai
Addict
Addict
Posts: 1360
Joined: Sun Sep 11, 2016 2:17 pm

Re: DrawText()

Post by Mijikai »

subsystems...
thats another reason why a common base would make sense...
like sdl / glfw - or any other widely used library would drastically ease the development of
2d and even 3d content - something that is actually supported by a huge community, vastly
available resources and infos.
User avatar
mk-soft
Always Here
Always Here
Posts: 5406
Joined: Fri May 12, 2006 6:51 pm
Location: Germany

Re: DrawText()

Post by mk-soft »

The OS are all slightly different. Thus the APIs used are not uniform in their behavior.
I don't think we can ask the PB team to do everything down to the smallest denominator.

For multiline DrawText function I wrote myself a new function which also supports a word wrap.

Link to DrawTextBox: https://www.purebasic.fr/german/viewtop ... =8&t=27954
My Projects ThreadToGUI / OOP-BaseClass / EventDesigner V3
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
User avatar
Mijikai
Addict
Addict
Posts: 1360
Joined: Sun Sep 11, 2016 2:17 pm

Re: DrawText()

Post by Mijikai »

mk-soft wrote:The OS are all slightly different. Thus the APIs used are not uniform in their behavior.
I don't think we can ask the PB team to do everything down to the smallest denominator.
It would open up huge possibilities and resources, instead PB is driving a limited, subset of functions
that don't even work consistent on different OS or even the same (dx - gl).
Giving access to one of those libraries should not be that hard (iic. sdl is used somewhere already).
Post Reply