Console example modified for Gnome Terminal
Posted: Thu Nov 02, 2023 7:04 pm
Even though the console commands are marked as Windows only in the documentation, they will work under Linux with Gnome Terminal from Ubuntu 22.04. Use the Create Executable option, then open Gnome Terminal, make the file executable and run from there.
Code: Select all
;
; ------------------------------------------------------------
;
; PureBasic - Console example file
;
; (c) Fantaisie Software
;
; Modified for Gnome Terminal - Ubuntu 22.04
; by Donald Montaine - 2 Nov 2023
;
; ------------------------------------------------------------
;
text$ = "Feel the Power of PureBasic!"
exittext$ = "Press any key to exit. "
dlay = 4000
;
;-------- Open our Console --------
;
OpenConsole()
ConsoleTitle ("PureBasic - Console Example:")
EnableGraphicalConsole(1)
;
;-------- Ask and display the UserName --------
;
ClearConsole()
ConsoleLocate (18,12)
Print ("Please enter your name: ")
name$=Input()
ClearConsole()
ConsoleLocate (24,10)
PrintN ("Welcome "+name$)
ConsoleLocate (24,12)
PrintN (text$)
Delay (dlay)
;
;-------- Cls and Cycle the Text-BG-Color 0 to 15 --------
;
ClearConsole()
For i = 0 To 15
ConsoleColor (0,i)
ConsoleLocate (24,4+i)
Print (text$)
Next i
Delay (dlay)
;
;-------- Cls and Cycle the Text-FG-Color 0 to 15 --------
;
ConsoleColor(0,0)
ClearConsole()
For i = 0 To 15
ConsoleColor (i,0)
ConsoleLocate (24,4+i)
Print (text$)
Next i
Delay (dlay)
;
;-------- Cls and Cycle the Background-Color 0 to 15 --------
;
For a = 1 To 15
ConsoleColor(a,a)
ClearConsole()
For i = 0 To 15
ConsoleColor (i,a)
ConsoleLocate (24,4+i)
Print (text$)
Next i
;
Delay(dlay/10)
Next a
;
;-------- Exit --------
;
ConsoleColor(15,0)
ClearConsole()
ConsoleLocate(0,0)
Print(exittext$)
Repeat
RetVal$ = Inkey()
Delay(2)
Until RetVal$ <> ""
ConsoleColor(15,0)
ClearConsole()
ConsoleLocate(0,0)
EnableGraphicalConsole(0)
CloseConsole()
End