Re: GFX_Wizzard_BF - [Modules - All OS]
Posted: Fri Oct 16, 2020 7:01 am
New archive with updated module and demo codes is online!
Download see first post.
Download see first post.
http://www.purebasic.com
https://www.purebasic.fr/english/
Code: Select all
; FontWizzard_BF - Demo code - Formatted lists
XIncludeFile("./FontWizzard_BF.pbi")
EnableExplicit
Define DR.f=DesktopResolutionX(), i
Define scaling.f=1.0 ; List output size
Define x=100*scaling*DR ; List output x pos
Define y=80*scaling*DR ; List output y pos
Define window_ID=OpenWindow(#PB_Any, 0, 0, 950*scaling, 600*scaling, "Font_Wizzard_BF", #PB_Window_ScreenCentered|#PB_Window_SystemMenu|#PB_Window_Invisible)
Define canvas_ID=CanvasGadget(#PB_Any, 0, 0, WindowWidth(window_ID), WindowHeight(window_ID))
SetGadgetColor(canvas_ID, #PB_Gadget_BackColor, $CDCDCD)
PresetMaxFontsize_FW(12*scaling)
SetCursor_Y_FW(y)
For i=1 To 10
AddFrame_FW(2*scaling*DR, #Black)
DrawText_FW(canvas_ID, ; output_ID
"", ; Font$
0, ; font_flag
x, ; output_x
GetCursor_Y_FW()-2*DR*scaling, ; output_y
50*scaling*DR, ; output_width
45*scaling*DR, ; output_height
#Blue, ; text_color
0, ; text_adjustment
#White, ; background_color -1 = invisible
Str(i), ; text$
-16, ; padding_x
0, ; padding_y
1) ; resize_factor.f
Next i
TextColor_Line_FW(1, #Blue) ; Set Line 1 blue
Define x=GetCursor_X_FW()-2*DR*scaling
SetCursor_Y_FW(y)
For i=1 To 10
If i>3 : TextColor_Line_FW(1, -1) : EndIf ; Deactivate again
AddFrame_FW(2*scaling*DR, #Black)
DrawText_FW(canvas_ID, ; output_ID
"", ; Font$
0, ; font_flag
x, ; output_x
GetCursor_Y_FW()-2*DR*scaling, ; output_y
150*scaling*DR, ; output_width
45*scaling*DR, ; output_height
#Black, ; text_color
1, ; text_adjustment
#Yellow, ; background_color -1 = invisible
"Hello World", ; text$
-16, ; padding_x
-5, ; padding_y
1) ; resize_factor.f
Next i
Define x=GetCursor_X_FW()-2*DR*scaling
SetCursor_Y_FW(y)
For i=1 To 10
AddFrame_FW(2*scaling*DR, #Black)
DrawText_FW(canvas_ID, ; output_ID
"", ; Font$
0, ; font_flag
x, ; output_x
GetCursor_Y_FW()-2*DR*scaling, ; output_y
150*scaling*DR, ; output_width
45*scaling*DR, ; output_height
#Black, ; text_color
1, ; text_adjustment - 0=center - 1=left - 2=right
#Green, ; background_color - -1 = invisible
"How are you", ; text$
-16, ; padding_x
-5, ; padding_y
1) ; resize_factor.f
Next i
TextColor_Line_FW(2, #Red)
Define x=GetCursor_X_FW()-2*DR*scaling
SetCursor_Y_FW(y)
Define text$="Hey"+#LF$+"We hope you are well"
For i=1 To 10
AddFrame_FW(2*scaling*DR, #Black)
DrawText_FW(canvas_ID, ; output_ID
"", ; Font$
0, ; font_flag
x, ; output_x
GetCursor_Y_FW()-2*DR*scaling, ; output_y
150*scaling*DR, ; output_width
45*scaling*DR, ; output_height
#Black, ; text_color
1, ; text_adjustment - 0=center - 1=left - 2=right
#Yellow, ; background_color - -1 = invisible
text$, ; text$
-16, ; padding_x
-5, ; padding_y
1) ; resize_factor.f
Next i
TextColor_Line_FW(2, #Blue)
Define x=GetCursor_X_FW()-2*DR*scaling
SetCursor_Y_FW(y)
For i=1 To 10
Select i
Case 1
Define text$="Created with FontWizzard_BF"
Case 2
Define text$="A new way for text output on PB"
Case 3
Define text$="All you can eat"+#LF$+"Many advanced features"
EndSelect
AddFrame_FW(2*scaling*DR, #Black)
DrawText_FW(canvas_ID, ; output_ID
"", ; Font$
0, ; font_flag
x, ; output_x
GetCursor_Y_FW()-2*DR*scaling, ; output_y
250*scaling*DR, ; output_width
45*scaling*DR, ; output_height
#White, ; text_color
1, ; text_adjustment - 0=center - 1=left - 2=right
#Red, ; background_color - -1 = invisible
text$, ; text$
-16, ; padding_x
-5, ; padding_y
1) ; resize_factor.f
Next i
HideWindow(window_ID, 0)
Repeat
Until WaitWindowEvent()=#PB_Event_CloseWindow