Bitmap-Font
Übersicht

![]() |
Der EisvogelBetreff: Bitmap-Font |
![]() Antworten mit Zitat ![]() |
---|---|---|
Hallo
kann mir jemand einen ansatz für eine Bitmapfont geben oder meinen Fehler beheben. Ich bekomm es leider nicht hin. Die Buchstaben werden gezeichnet bleiben aber nicht. Code: [AUSKLAPPEN] Graphics 1024,768,32,2
SetBuffer BackBuffer() Global lettersgold=LoadAnimImage("data\images\status\letters-gold.png",16,18,0,96) Global Antwort$,WarteZeit ,CursorZeit ,CursorStatus Repeat Cls Abfrage = New_Input(50,30,"Gib bitte deinen Namen ein.",20) If Abfrage = 1 Then Exit Flip Forever Function New_Input$ ( Rahmen_X,Rahmen_Y,Frage$,max_Lang) Rahmenbreite =StringWidth (Frage$+"XYZ") Rahmenhoehe =(FontHeight ()*4) Color 255,0,0 Rect (1024-Rahmenbreite)/2, Rahmen_Y,Rahmenbreite,Rahmenhoehe ,1 Color 0,0,255 Rect (1024-Rahmenbreite)/2+2,Rahmen_Y+2, Rahmenbreite -4 , Rahmenhoehe -4,1 Color 0,0,0 Text (1024-Rahmenbreite)/2 + Rahmenbreite /2+2, Rahmen_Y+ Rahmenhoehe/4 +2 , Frage$,1,1 Color 255,255,0 Text (1024-Rahmenbreite)/2 + Rahmenbreite /2, Rahmen_Y+ Rahmenhoehe/4 , Frage$,1,1 Antwortbreite = StringWidth(antwort$) Startpos_der_Antwort = (1024-Rahmenbreite)/2 + (Rahmenbreite /2) - (Antwortbreite/2) a = GetKey() If a > 31 And a < 256 And Len(antwort$) < max_Lang Then antwort$ = antwort$ + Chr(a) DrawImage lettersgold,Startpos_der_Antwort,Rahmen_Y+ Rahmenhoehe/4 *2.2,a-32 EndIf I f KeyDown(14) And Len(antwort$) > 0 And MilliSecs() - WarteZeit > 125 Then antwort$ = Left(antwort$,(Len(antwort$)-1)) WarteZeit = MilliSecs() End If If KeyDown(28) Then Return 1 Color 255,0,0 Text Startpos_der_Antwort,Rahmen_Y+ Rahmenhoehe/4 *2.2, Antwort$ If MilliSecs() - CursorZeit > 500 Then CursorStatus =CursorStatus Xor 1 CursorZeit= MilliSecs() End If If CursorStatus = 1 Then StartCursorX =Startpos_der_Antwort + StringWidth(antwort$) +1 texthoehe =StringHeight (antwort$) Color 255,255,0 Rect StartCursorX , Rahmen_Y+ Rahmenhoehe/4 *2.1+texthoehe*.1, 2, texthoehe *1 End If End Function |
||
Ungarische Notation kann nützlich sein.
BlitzMax ; Blitz3D Win 7 Pro 64 Bit ; Intel Core i7-860 ; 8 GB Ram ; ATI HD 5750 1 GB Projekte: Window-Crasher Ich liebe es mit der WinAPI zu spielen. |
Dreamora |
![]() Antworten mit Zitat ![]() |
|
---|---|---|
was bleibt genau nicht? wenn du meinst das der text verschwindet: du musst ihn halt immer wieder zeichnen.
Im grafikfenster ist der text weg nach dem cls es gibt mehrere einträge im codearchiv hier und auf bb.com mit bitmap fonts und grafik input routinen |
||
Ihr findet die aktuellen Projekte unter Gayasoft und könnt mich unter @gayasoft auf Twitter erreichen. |
![]() |
prolapper |
![]() Antworten mit Zitat ![]() |
---|---|---|
Du musst den Code so verändern :
(Garantiere für Nichts, aber du müsstest es so verstehen) Code: [AUSKLAPPEN] Graphics 1024,768,32,2
SetBuffer BackBuffer() Global lettersgold=LoadAnimImage("...\bitmapfont.png",16,18,0,96); ACHTUNG ... erst Link verändern !!! Global Antwort$,WarteZeit ,CursorZeit ,CursorStatus Repeat Cls Abfrage = New_Input(50,30,"Gib bitte deinen Namen ein.",20) If Abfrage = 1 Then Exit Flip Until KeyHit(1) End Function New_Input$ ( Rahmen_X,Rahmen_Y,Frage$,max_Lang) Rahmenbreite =StringWidth (Frage$+"XYZ") Rahmenhoehe =(FontHeight ()*4) Color 255,0,0 Rect(1024-Rahmenbreite)/2, Rahmen_Y,Rahmenbreite,Rahmenhoehe ,1 Color 0,0,255 Rect (1024-Rahmenbreite)/2+2,Rahmen_Y+2, Rahmenbreite -4 , Rahmenhoehe -4,1 Color 0,0,0 Text (1024-Rahmenbreite)/2 + Rahmenbreite /2+2, Rahmen_Y+ Rahmenhoehe/4 +2 , Frage$,1,1 Color 255,255,0 Text (1024-Rahmenbreite)/2 + Rahmenbreite /2, Rahmen_Y+ Rahmenhoehe/4 , Frage$,1,1 Antwortbreite = StringWidth(antwort$) Startpos_der_Antwort = (1024-Rahmenbreite)/2 + (Rahmenbreite /2) - (Antwortbreite/2) a = GetKey() If a > 31 And a < 256 And Len(antwort$) < max_Lang Then antwort$ = antwort$ + Chr(a) ;Diese Zeile ist überflüssig -->> DrawImage lettersgold,Startpos_der_Antwort,Rahmen_Y+ Rahmenhoehe/4 *2.2,a-32 EndIf If KeyDown(14) And Len(antwort$) > 0 And MilliSecs() - WarteZeit > 125 Then antwort$ = Left(antwort$,(Len(antwort$)-1)) WarteZeit = MilliSecs() End If If KeyDown(28) Then Return 1 Color 255,0,0 For I = 1 To Len(antwort$) DrawImage Startpos_der_Antwort + I*16 , Rahmen_Y+Rahmenhoehe/4*2.2, (Asc(Mid$(antwort$,I,1))-32) Next ; Diese Zeil musst du entpfernen -->> Text Startpos_der_Antwort,Rahmen_Y+ Rahmenhoehe/4 *2.2, Antwort$ If MilliSecs() - CursorZeit > 500 Then CursorStatus = CursorStatus Xor 1 CursorZeit= MilliSecs() End If If CursorStatus = 1 Then StartCursorX =Startpos_der_Antwort + StringWidth(antwort$) +1 texthoehe = StringHeight (antwort$) Color 255,255,0 Rect StartCursorX , Rahmen_Y+ Rahmenhoehe/4 *2.1+texthoehe*.1, 2, texthoehe *1 End If End Function Wie Dreamora schon gesagt hat musst du den String speichern und immer wieder neu ausgeben. Wichtig ist, dass der Font eigentlich kein Font in dem Sinne ist, sondern immer noch ein plumpes Bild ist, dass du in mehrere Teile ( in dem Fall Buchstaben) teilst. Wenn du nun einen bestimmten Buchstaben ausgeben willst, musst du einfach den passenden Teilauscshnitt aus dem (Font-) Bild ausgeben. Also musst du den "Font" we ganz normlae Bilder verwenden. Mfg Prolap (Mir war grad a bissi langweilig und wollt selbst a bissi rumtüffteln.) |
||
P.S: ICH SUCHE NOCH EINEN GRAFIKER UND EINEN PROGRAMMIERER FÜR EIN RPG
E-Mail: prolapper@gmx.net |
Übersicht


Powered by phpBB © 2001 - 2006, phpBB Group