Page 1 of 1

DrawText()

Posted: Sun Dec 23, 2018 1:21 pm
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

Re: DrawText()

Posted: Sun Dec 23, 2018 1:32 pm
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.

Re: DrawText()

Posted: Sun Dec 23, 2018 2:24 pm
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

Re: DrawText()

Posted: Sun Dec 23, 2018 3:31 pm
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).