Buchempfehlung
Windows-Programmierung. Das Entwicklerhandbuch zur WIN32-API
Windows-Programmierung. Das Entwicklerhandbuch zur WIN32-API
"Der" Petzold, das über 1000 Seiten starke Standardwerk zum Win32-API - besonders nützlich u. a. bei der GUI-Programmierung in FreeBASIC! [Mehr Infos...]
FreeBASIC-Chat
Es sind Benutzer im FreeBASIC-Chat online.
(Stand:  )
FreeBASIC bei Twitter
Twitter FreeBASIC-Nachrichten jetzt auch über Twitter erhalten. Follow us!

Code-Beispiel

Code-Beispiele » Grafik und Fonts

Draw_String Sub für indiv.Größen

Lizenz:Erster Autor:Letzte Bearbeitung:
k. A.MitgliedSamson40 28.12.2018

' Text_Plot V1.1
' 28.12.2018 Samson40 (Zabel.Spiele@GMAIL.COM)
' mit diesee SUB lassen sich einfach Draw_String Texte in andere Größen verändern.
'

screen 20,32,2
declare sub text_plot(byval start_x as integer,byval start_y as integer,byval text as string,byval tf as double,byval farbe as integer)


dim as double puffer,puffer1
puffer1=10
for puffer= .5 to 10 step.5
puffer1= puffer*16+5+puffer1

text_plot(100,puffer1,"Faktor "+str(puffer),puffer,rgb(200,200,200))

next
sleep
end


'###############################################################################
'# #
'# TEXT_PLOT #
'# #
'# x .... X-Koordinate #
'# y .... Y-Koordinate #
'# TEXT ... auszugebender Text #
'# tf...... Textfaktor (verkleinern <1 / vergrössern >1) #
'# bei überschreitung der max. X/Y Koordinaten ist ein Sub Abbruch #
'# farbe... Textfarbe #
'# #
'##############################################################################

[color=yellow][color=yellow][color=yellow][color=yellow]sub text_plot(byval start_x as integer,byval start_y as integer,byval text as string,byval tf as double,byval farbe as integer)
dim as double tx,tx1,ty,ty1
dim as integer max_bild_x,max_bild_y
screeninfo max_bild_x,max_bild_y
DIM AS any PTR txt,txt_ur
ty1=0:tx1=0
if (start_y+16*tf >max_bild_y) or (start_x+(len(text)*8*tf) > max_bild_x) then exit sub
txt_ur=IMAGECREATE((len(text)*8+1),16+1)
txt = IMAGECREATE((len(text)*8*tf+1),16*tf+1)
GET (start_x,start_y)-(start_x+(len(text)*8*tf),start_y+16*tf), txt
draw string txt_ur,(0,0),text,farbe

for tx=0 to len(text)*8
tx1=tf*tx
for ty= 0 to 15
ty1=tf*ty
if point (tx,ty,txt_ur) =farbe then
line txt,(tx1,ty1)-(tx1-1+tf,ty1-1+tf),farbe,bf
endif
next
next
put (start_x,start_y),txt,pset
IMAGEDESTROY txt
IMAGEDESTROY txt_ur
end sub
[/color][/color][/color][/color]

Einfache Veränderung
Vergrößern
Einfache Veränderung

Zusätzliche Informationen und Funktionen
  • Das Code-Beispiel wurde am 28.12.2018 von MitgliedSamson40 angelegt.
  • Die aktuellste Version wurde am 28.12.2018 von MitgliedSamson40 gespeichert.
  Bearbeiten Bearbeiten  

  Versionen Versionen