Wurzelausdruck zeichnen

Übersicht BlitzBasic Codearchiv

Neue Antwort erstellen

SpionAtom

Betreff: Wurzelausdruck zeichnen

BeitragMi, Jul 19, 2006 12:08
Antworten mit Zitat
Benutzer-Profile anzeigen
Habe mir mal erlaubt, die Wurzelzeichnen-Routine ins Code-Archiev zu stellen

Die Position ist übrigens die Position des Radikanten. Kann ich aber noch ändern Laughing

Damit der Exponent eine kleinere Schrift hat, als der Radikant, lade ich vorher zwei verschiedengroße Schriften. Du kannst diese ganze Schriftensache rausnehmen, dann siehts aber schei- doof aus.

Code: [AUSKLAPPEN]

Graphics 400, 300, 16, 2
SetBuffer BackBuffer()

Global fnt_radikant = LoadFont("Arial", 32) ;Zahl, die unter dem Bruch steht
Global fnt_exponent = LoadFont("Arial", 14) ;Der Exponent, der links auf dem Bruch steht

   Cls
   wurzelZeichnen 100, 100, "72342465", "343"
   Flip()
   WaitKey()
   End


Function wurzelZeichnen(posx%, posy%, radikant$, exponent$ = "")

   SetFont fnt_radikant
   radw = StringWidth(Left$(radikant$, 1))
   radh = StringHeight(radikant$)
   
   Text posx, posy, radikant$
   Line posx-2, posy-2, posx + StringWidth(radikant$), posy-2 ;langer Strich über dem Radikanten
   Line posx-2, posy-2, posx - radw / 2.0, posy + StringHeight(radikant$) ;Häkchen
   Line posx - radw / 2.0, posy + StringHeight(radikant$), posx - radw, posy + StringHeight(radikant$) / 2.0

   SetFont fnt_exponent   
   Text posx - radw - StringWidth(exponent$), posy + radh / 2.0 - 2 - StringHeight(exponent$), exponent$
   Line posx - radw, posy + radh / 2.0, posx - radw - StringWidth(exponent)-2, posy + radh / 2.0
End Function
os: Windows 10 Home cpu: Intel Core i7 6700K 4.00Ghz gpu: NVIDIA GeForce GTX 1080

Triton

BeitragMi, Jul 19, 2006 13:54
Antworten mit Zitat
Benutzer-Profile anzeigen
Schön. Ne einfache, aber zumindest für mich, nützliche Sache.
Coding: silizium-net.de | Portfolio: Triton.ch.vu

Neue Antwort erstellen


Übersicht BlitzBasic Codearchiv

Gehe zu:

Powered by phpBB © 2001 - 2006, phpBB Group