Code: Alles auswählen
;Author: Falko Lünsmann
;API and PB4: Draws simple Text on circle
; changed for PB4: ts-soft
Procedure DrawRText(DC.l,x,y,Text.s,fFont.s,fangle.l,fHeight)
Font = CreateFont_(fHeight,0,fangle*10,0,0,0,0,0,0,0,0,0,0,fFont)
GetWindowRect_(WindowID(0),r.RECT)
OldFont = SelectObject_(DC,Font)
SetTextAlign_(DC,#TA_BASELINE )
SetBkMode_(DC,#TRANSPARENT)
ExtTextOut_(DC, x,y,0 ,r,Text,Len(Text),0 )
SelectObject_(DC,OldFont)
DeleteObject_(Font)
EndProcedure
OpenWindow(0, 0, 0, 400, 400, "Arc and bezier curves", #PB_Window_SystemMenu|#PB_Window_ScreenCentered)
Procedure Circle_Text(String$)
hDc=StartDrawing(WindowOutput(0))
If hDc
FrontColor(RGB(0,255,0))
Radius=180
String$="Purebasic 4 you"
For i=1 To Len(string$)
Zeichen$=Mid(String$,i,1)
Winkel=-20 * i
X = Radius*Sin(Winkel/360*2*#PI)
Y = Radius*Cos(Winkel/360*2*#PI)
DrawRText(hDc,WindowWidth(0)/2-X,WindowHeight(0)/2-Y,Zeichen$,"Arial",Winkel,40)
Next i
StopDrawing()
EndIf
EndProcedure
Circle_Text("Happy Purebasic4")
Repeat
Event=WaitWindowEvent()
If Event=#PB_Event_MoveWindow : Circle_Text("Happy Purebasic4") : EndIf ; Redraw Windows!
Until Event = #PB_Event_CloseWindow