This is what came out of that:
Code: Select all
#PRINT Kazusoft.bi v2.2
''
''This is the standard Kazusoft header for FreeBASIC
''
''
''
''
''
''
''
''Behaves like "#INCLUDE ONCE"
#PRAGMA ONCE
''You know what this does...
#INCLUDE "fbgfx.bi"
Using FB
''Common variables:
Dim Shared As String progtitle, progversion
Dim Shared As Boolean DEBUG_ENABLED
Dim Shared As Double menupos = 0
Dim Shared As UInteger menunum = 0, result
Const ww = 450, wh = 460
Const TB_W = 430, TB_H = 70, TB_X = 10, TB_Y = 380
Const wincolor = RGBA( 0, 0, 150, 225 )
Const red = RGB( 255, 0, 0 ), green = RGB( 0, 255, 0 ), blue = RGB( 0, 0, 255 ), _
white = RGB( 255, 255, 255 ), black = RGB( 0, 0, 0 )
''Sets the value of DEBUG_ENABLED by the presence of -g on the command line
#IF __FB_DEBUG__ <> 0
#PRINT Compiling in debug mode.
DEBUG_ENABLED = true
#ELSE
#PRINT Compiling in release mode.
DEBUG_ENABLED = false
#ENDIF
Shell "TITLE Console"
''<=====]=+::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::+=[=====>
'' : Simple logging info: :
''<=====]=+::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::+=[=====>
''Sets up a log with some basic information
Sub startlog( ByVal logname As String, ByVal fnum As ULong )
Open logname For Output As #fnum
Print #fnum, progtitle
Print #fnum, progversion
Print #fnum, ""
Print #fnum, "Compiled with: " & __FB_SIGNATURE__ & " From: " & __FB_BUILD_DATE__
If DEBUG_ENABLED = true Then
Print #fnum, " In debug mode"
Else
Print #fnum, " In release mode"
End If
Print #fnum, " On: "; __DATE__; " "; __TIME__
Print #fnum, ""
Print #fnum, " Run time: "; Date; " "; Time
Print #fnum, ""
End Sub
''Adds some text to the current file selected in "fnum"
Sub putlog( ByVal text As String, ByVal fnum As ULong )
Print #fnum, Time; " -"; text
End Sub
''<=====]=+::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::+=[=====>
''Clears the inkey($) buffer
Sub emptyinkey
While Inkey <> "" : WEnd
End Sub
''<=====]=+::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::+=[=====>
'' : BASIC DOS-esque GUI :
''<=====]=+::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::+=[=====>
''This exists because I got really, really bored with constantly typing "Draw String {You know the rest}"
Sub btext( ByVal text As String, ByVal buffer As Any Ptr, ByVal linenumber As UShort )
Dim y_val As UInteger = linenumber * 10
Draw String buffer, ( 10, y_val ), text
End Sub
''A rudementary vertical menu scrolling controller:
Sub arrowmenu( ByVal topval As Single, ByVal bottomval As Single )
Sleep
If Multikey( SC_UP ) And menupos > topval Then menupos -= 1
If Multikey( SC_DOWN ) And menupos < bottomval Then menupos += 1
End Sub
''Draws cursor to said rudementary vertical menu:
Sub drawcursor( ByVal buffer As Any Ptr, ByVal buffer_width As UInteger, ByVal cursor_color As ULong )
Dim As UInteger x1, y1, x2, y2
x1 = 10 : y1 = ( menupos + 1 ) * 10
x2 = buffer_width - 11 : y2 = y1 + 9
Line buffer, ( x1, y1 )-( x2, y2 ), cursor_color, BF
End Sub
''<=====]=+::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::+=[=====>
''Allows for a more Sinclair BASIC like BEEP command:
Declare Sub sound Lib "YetiBeeper" ( freq As UInteger, dur As UInteger ) ''See Yetifoot on the FB fourms!
''I just packed his winAPI beep interface sub-thing into a static library
''EOF