[B2D] Textmode (QBasic like)

Übersicht BlitzBasic Codearchiv

Neue Antwort erstellen

SpionAtom

Betreff: [B2D] Textmode (QBasic like)

BeitragSa, Aug 13, 2016 16:29
Antworten mit Zitat
Benutzer-Profile anzeigen
In einem Wahn von Nostalgie hatte ich Lust auf den guten alten DOS mäßigen Textmodus:
- Schriftart Terminal (8x16 Pixel pro Zeichen)
- 25 Zeilen, 80 Spalten
- 16 Farben
- optimiert für Auflösung 640x400

Ich habe mich lose an diese Informationen gehalten : https://en.wikipedia.org/wiki/..._text_mode

user posted image

Da Blitzbasic leider kein Terminalfont laden kann, musste ich etwas in die Trickkiste greifen.

Anleitung:
Anleitung hat Folgendes geschrieben:
;VGA 8x16 Fonts
;Bitmapfont taken from: http://dwarffortresswiki.org/T...#8.C3.9716
;
;SpionAtom - August 2o16
;
;
;--------------------------------------------------------------------------------
;Setup:
;
; - simply include this file (after settings Graphics)
; - set VGAGERMAN = True to have ÄäÖöÜüß on the correct German ascii position
; (t's True by default)
;
; Please notice that standard Print and Locate will be overwritten.
;
;--------------------------------------------------------------------------------
;
;How to use Text Commands:
;
; - for Standard white font draw image method (faster)
;
; VGAText(x_offset, y_offset, txt$)
;
;
; - for writepixel draw method with optional foreground/background colors (slower)
;
; VGATextRaw(x_offset, y_offset, txt$, backgroundVisible = False, foregroundRGB = $FFFFFFFF, backgroundRGB = $FF000000)
;
; Just like you would use the normal Text command.
;
;
;--------------------------------------------------------------------------------
;
;How to use Print Commands:
;
; Print commands are oriented at the QBasic usage.
;
; use Locate to set a new Cursor Position
;
; Locate row, col
; - row: [1 - 25]
; - col: [1 - 80]
;
; use Print to print the text at current location
;
; Print txt$ - prints text
;
; PrintLn txt$ - prints text and enters next line
;
; use PrintColor to set the color:
;
; PrintColor foreGroundColor, [BackgroundColor = 0]
;
; CGA Color palette:
; 0 Black (#000000) 8 gray (#555555)
; 1 blue (#0000AA) 9 light blue (#5555FF)
; 2 green (#00AA00) 10 light green (#55FF55)
; 3 cyan (#00AAAA) 11 light cyan (#55FFFFFF)
; 4 red (#AA0000) 12 light red (#FF5555)
; 5 magenta (#AA00AA) 13 light magenta (#FF55FF)
; 6 brown (#AA5500) 14 yellow (#FFFF55)
; 7 light gray (#AAAAAA) 15 white (#FFFFFF)
;
;--------------------------------------------------------------------------------



Include-Datei
VGATextInclude.bb

Beispielprogramm:
Code: [AUSKLAPPEN]
;VGA 8x16 Fonts
;Bitmapfont taken from: http://dwarffortresswiki.org/Tileset_repository#8.C3.9716
;
;SpionAtom - August 2o16
;

Graphics 640, 400, 0, 2
Include "VGATextInclude.bb"

   SetBuffer BackBuffer()

   Cls
   ;Print All available Characters
   For i = 0 To 255
   Print Chr(i)
   Next


   PrintColor 1, 0
   Locate 12, 1
   Print "Dies ist ein Text der so ellenlang ist, dass er bei weitem die achtzig Spalten ueberdecken tüt."
   PrintLn "Und dieses ist ein weiterer langer Text, der auch furchtbar lang ist, nur um zu zeigen, das PrintLn einen Zeilenumbruch erwirkt."
   PrintColor 14
   Print "Vorhergehende Zeile hatte einen Zeilenumbruch."
   PrintColor 15, 1
   Print "Texte können auch eine Hintergrundfarbe haben."

   Flip(0)
   WaitKey
   End
os: Windows 10 Home cpu: Intel Core i7 6700K 4.00Ghz gpu: NVIDIA GeForce GTX 1080
 

feider

ehemals "Decelion"

BeitragSa, Apr 18, 2020 16:22
Antworten mit Zitat
Benutzer-Profile anzeigen
ASCII-Power! Very Happy

Bonuspunkte dafür, dass die DF-Schrift verwendet wird!
Ich muss dabei an curses/ncurses denken!

LG
feider

Neue Antwort erstellen


Übersicht BlitzBasic Codearchiv

Gehe zu:

Powered by phpBB © 2001 - 2006, phpBB Group