Anlässlich zum Bac habe ich einen kleine Code gepostet wie man eine BitMap font anzeigt, nun habe ich ne Gui gebaut und um ein paar tolle Funktionen erweitert!
Features:
+Maskier Farbe einstellbar
+Hintergrund Farbe einstellbar
+Pangramm einsetz button
+Details einblenden
+Dynamisches verändern vom Text
+Einfache Bedienung
+Mehrzeilen unterstützung
+Screenshot Funktion (mit aufsteigender nummerierung)
+Unterstütz 26 Zeichen, leicht abänderbar
So Bilder sagen mehr als tausend Worte:
Eventuell lass ich mir noch was einfallen, sodass mit kleinem Aufwand auch BitMaps mit anderem Layout / mehr Zeichen importier werden können.
Für die welche kein Blitz Plus haben
Download BitMap Viewer(exe)
Sooo und hier mal der Code
BlitzBasic: [AUSKLAPPEN] [EINKLAPPEN]
window = CreateWindow("Text eingeben", 50, 50, 300, 340, 0,1) textarea = CreateTextArea(10, 10, 270, 190, window)
bgcolour = CreateButton("BG Farbe", 100, 210, 80, 30, window, 1) maskcolour = CreateButton("Mask Farbe", 10, 210, 80, 30, window, 1) ok = CreateButton("Ok", 199, 270, 80, 30, window, 1) random = CreateButton("Panagramm einsetzen", 10, 270, 170, 30, window, 1)
details = CreateButton("Details?", 199, 210, 100, 30, window, 2)
bgpanel = CreatePanel(100, 240, 80, 20, window, 1) maskpanel = CreatePanel(10, 240, 80, 20, window, 1)
Global font,row,fontf$ numb=1
SetPanelColor bgpanel, 70,70,70 SetPanelColor maskpanel, 255,0,255
Repeat If GetKey() = 27 Then End
event=WaitEvent()
If event = $401 Then Select EventSource() Case bgcolour flagbg=RequestColor() bg_r=RequestedRed() bg_g=RequestedGreen() bg_b=RequestedBlue() If flagbg=1 bgcolchange=1 DebugLog ("bgcolchange!") SetPanelColor bgpanel, bg_r,bg_g,bg_b EndIf Case random AddTextAreaText (textarea,"the quick brown fox jumps over the lazy dog"+Chr$(13)+Chr$(10)) Case maskcolour flagmask=RequestColor() mk_r=RequestedRed() mk_g=RequestedGreen() mk_b=RequestedBlue() If flagmask=1 maskcolchange=1 masked=1 DebugLog ("maskcolchange!") SetPanelColor maskpanel, mk_r,mk_g,mk_b EndIf Case ok
row=0 If bgcolchange=0 bg_r=70 bg_g=70 bg_b=70 EndIf If maskcolchange=0 mk_r=255 mk_g=0 mk_b=255 EndIf If flagrender=0 fontf$=RequestFile ("Font wählen","jpg;*.bmp;*.png") AppTitle("BitMap Viewer - by Ozzi - F1: Screenshot") Graphics 1024,400,32,2 font=LoadAnimImage (fontf$,32,32,0,26) MaskImage font, mk_r,mk_g,mk_b
EndIf font=LoadAnimImage (fontf$,32,32,0,26) MaskImage font, mk_r,mk_g,mk_b
ClsColor bg_r,bg_g,bg_b flagrender=1 Cls fullText$= TextAreaText$ (textarea) DebugLog("render "+fullText$+" - Details:"+ButtonState (details)) printf(fullText$,ButtonState (details)) Flip End Select EndIf
If event=$803 Then End
If KeyHit(59) .again If FileType("screenshot"+numb+".bmp")=0 SaveBuffer FrontBuffer(), "screenshot"+numb+".bmp" Else numb=numb+1 Goto again EndIf EndIf
Forever
Function printf(tp$,showdet) Local pos=-1 For b=0 To Len(tp$)-back pos=pos+1 buchstabe$=Upper(Mid(tp$,b,1)) ascb=Asc(buchstabe$) If ascb=13 row=row+1 DebugLog ("+Row") pos=-1 EndIf If ascb-65 < 26 And ascb-65>=0 Then frame=ascb-65 DrawImage font,(pos*32)-32,33*row,frame EndIf Next filename$=file$
oldpos=1 backslashpos=0 succes=0 Repeat backslashpos=Instr(fontf$,"\",oldpos) If backslashpos=0 Then succes=1:Exit Else oldpos=backslashpos+1 Forever If succes=1 Then namefont$=Mid(fontf$,oldpos)
If showdet=1 size#=FileSize(fontf$) detailstxt$=namefont$+" - "+size#/1000+"kb" Color 30,30,30 Rect 1022-StringWidth(detailstxt$),380,1024,390 Color 255,255,255 Text 1023-StringWidth(detailstxt$),385,detailstxt$ EndIf
End Function
|