ASCII-Art

Übersicht BlitzMax, BlitzMax NG Codearchiv & Module

Neue Antwort erstellen

Ninja

Betreff: ASCII-Art

BeitragMi, Aug 17, 2005 12:34
Antworten mit Zitat
Benutzer-Profile anzeigen
Hab ein kleines programm geschrieben mit dem man sogenannte Ascii art erzeugen kann, das sind bilder die aus Text bestehen Smile
Mein 1. Werk:
http://www.blitz-pasting.net/u...ii_art.txt

Mit dem mausrad pinselgröße ändern.
Linke maustaste malen, Rechte löschen.
Und für den buchstaben den man will einfach die taste auf dem Keyboard drücken (eventuel auch shift)!
Zum speichern Leertaste drücken.

Code: [AUSKLAPPEN]


Graphics 800,600,0,60


Global text$[150,150] 'Text Array erstellen <>

For I = 0 To 149
   For I2 = 0 To 59
      text[I,I2] = " " ' Mit leerzeichen füllen
   Next
Next

Global draw$
draw = "O"
Global brush
brush = 1


Repeat
Cls

For I = 8 To 149 'Malen
   For I2 = 0 To 59
      DrawText text[I,I2],I*6-50,I2*10
   Next
Next



char = GetChar()
If char <> 0 Then draw = Chr(char)


brush = MouseZ()
If brush < 0 Then brush = 0
If brush > 5 Then brush = 5
DrawText brush,0,0



If MouseDown(1) Then   'Malen
   For I = 0 To brush
      For I2 = 0 To brush
         text((MouseX()+50)/6+I,MouseY()/10+I2) = draw$
      Next
   Next
EndIf

If MouseDown(2) Then   'Löschen
   For I = 0 To brush
      For I2 = 0 To brush
         text((MouseX()+50)/6+I,MouseY()/10+I2) = " "
      Next
   Next
EndIf




If KeyHit(KEY_SPACE) = 1 Then 'Speichern...
   file = WriteFile("ascii_art.txt")
   
   For I = 0 To 59
      save_s$ = ""
      For I2 = 8 To 149
         save_s$ = save_s$ + text(I2,I)
      Next
      
      WriteLine file,save_s
   Next
   
closefile(file)
EndIf


FlushMem()
Flip
Until KeyHit(KEY_ESCAPE)
 





Viel Spass damit Smile
mfg Ninja

Neue Antwort erstellen


Übersicht BlitzMax, BlitzMax NG Codearchiv & Module

Gehe zu:

Powered by phpBB © 2001 - 2006, phpBB Group