Welcome, Guest
You have to register before you can post on our site.

Username/Email:
  

Password
  





Search Forums

(Advanced Search)

Forum Statistics
» Members: 308
» Latest member: Donaldvem
» Forum threads: 1,741
» Forum posts: 17,901

Full Statistics

Latest Threads
The QB64 IDE shell
Forum: Utilities
Last Post: JasonPag
09-16-2024, 05:37 PM
» Replies: 9
» Views: 764
Importance regarding Ches...
Forum: Utilities
Last Post: JasonPag
09-01-2024, 06:34 PM
» Replies: 0
» Views: 31
Chess and Analysis and En...
Forum: Utilities
Last Post: JasonPag
08-28-2024, 02:37 PM
» Replies: 0
» Views: 32
DAY 009:_PutImage
Forum: Keyword of the Day!
Last Post: grymmjack
09-02-2023, 02:57 PM
» Replies: 54
» Views: 2,034
Fall Banner Contest?
Forum: Site Suggestions
Last Post: grymmjack
08-31-2023, 11:50 PM
» Replies: 36
» Views: 1,262
ColorPicker - Function th...
Forum: Dav
Last Post: Dav
08-31-2023, 11:04 PM
» Replies: 3
» Views: 316
Goals(1) = New Tile()
Forum: Works in Progress
Last Post: RhoSigma
08-31-2023, 09:45 PM
» Replies: 3
» Views: 127
micro(A)v11
Forum: QBJS, BAM, and Other BASICs
Last Post: bplus
08-31-2023, 09:14 PM
» Replies: 90
» Views: 3,589
Updating The Single Most ...
Forum: QBJS, BAM, and Other BASICs
Last Post: bplus
08-31-2023, 09:13 PM
» Replies: 7
» Views: 254
QBJS Image Question
Forum: QBJS, BAM, and Other BASICs
Last Post: bplus
08-31-2023, 05:49 PM
» Replies: 5
» Views: 155

 
  Set Of More DOS Utilities
Posted by: eoredson - 10-20-2022, 11:58 PM - Forum: Utilities - No Replies

Find attached a file called the set of more dos utilities..

First, this is not QB64. Instead it is QB45/QB71/VBdos..

Next, you get what you see. Some utilities work. Some do not.

There is an imbedded \examples directory with 50 sample files.

Erik.

The packing list is:

Code: (Select All)
More public domain Dos utilities v65.0a packing list:

Runtime files:

  Filters: (delete any old TEE*.COM first)..

  TEE.EXE      --  Piping redirection program
    (sends tee stdin to screen/file)
  TEE2.EXE      --  Piping redirection program
    (sends tee stdin to screen/printer/file)
  TEE3.EXE      --  Piping redirection program
    (sends tee stdin to screen/printer/aux/file)

  PD Swap Utility:

  SHROOM.COM    --  Program swapping utility
  SHROOM.DOC    --  Program documentation
  SHROOM.TXT    --  Program text info

  More DOS Utilities (streaming pipe programs):

  FINDY.EXE    --  Pipe find utility
    (sends piped searched stdin to output)
  ZSORT.EXE    --  Pipe sort utility
    (sends piped sorted stdin to output)

  More DOS Utilities (streaming):

  DELDIR.EXE    --  Directory delete utility
  DELETE.EXE    --  File delete utility
  DIRATTR.EXE  --  File/directory attribute display utility
  DIRS.EXE      --  Directory display utility
  DRIVES.EXE    --  Drive display utility
  LISTVOLS.EXE  --  Volume display utility
  MAKDIR.EXE    --  Directory make utility
  MKSERIAL.EXE  --  Volume serial change utility
  MKVOLBPB.EXE  --  Volume bpb update utility
  NAMEIT.EXE    --  File rename utility
  NEWDIR.EXE    --  Directory change utility
  NEWNAME.EXE  --  Dos 8.3 file rename utility
  NEWVOL.EXE    --  Volume update utility
  PARSE.EXE    --  Stdin parse example utility
  RDSERIAL.EXE  --  Volume serial display utility
  RDVOLUME.EXE  --  Volume findfirst label display utility
  READDLL2.EXE  --  .dll file description utility
  READQLB.EXE  --  .qlb file description utility
  RENDIR.EXE    --  Directory rename utility
  RENVOL.EXE    --  Volume rename utility
  SETATTR.EXE  --  File/directory attribute change utility
  TOUCH.EXE    --  File update utility
  TOUCHDIR.EXE  --  Directory update utility
  TOUCHVOL.EXE  --  Volume update utility
  TREEDEL.EXE  --  Directory delete utility
  TYPEA.EXE    --  ANSI file content display utility
  TYPEY.EXE    --  File content display utility
  WHEREIS.EXE  --  File search utility
  XCOUNT.EXE    --  Directory/file count utility
  XDIR.EXE      --  File display utility
  XTREE.EXE    --  Directory sort utility
  ZIPLOOK.EXE  --  Zip file description utility

  More DOS Utilities (non-streaming):

  ASCII.EXE    --  Ascii chart maker
  BIOS.EXE      --  Reads bios list using inline assembly
  CLOCK1.EXE    --  Display current date\time in window.
  COUNT.EXE    --  Counts files/lines/bytes of code
  DISKCOMP.EXE  --  Compares diskettes in drive A:
  DISKCOPY.EXE  --  Copies diskette from A: to A:
  FILECOMP.EXE  --  Compares byte values of two files
  FINDCODE.EXE  --  Program to locate SUB statements
  FINDDOC.EXE  --  Program to locate keywords
  FINDVAR.EXE  --  Program to locate variables
    FIND.DOC      --  Documentation for find utilities
  HEXCALC.EXE  --  Hex-to-Dec calculator
  HEXLIST.EXE  --  Hex chart maker
  LOWERDTR.EXE  --  Modem port utility
  MACHINE.EXE  --  Local workstation name display utility
  RAISEDTR.EXE  --  Modem port utility
  RUNPROG.EXE  --  Starts command line programs
  SCRNSAVE.EXE  --  Starts Windows screen saver
  SERIAL.BAS    --  Creates a serial number from date/time
  UNINSTAL.EXE  --  Generic uninstal utility for DOS
    SAMPLE.CFG    --  Uninstal config file
  WHATIS.EXE    --  Expression parser
    TROOLEAN.DOC  --  Extended boolean charts

  Windows utilities:

  LIB.EXE      --  Library program to create and edit .lib files
  MEM.EXE      --  Displays various DOS memory settings
  NMAKE.EXE    --  Compiles programs based on makefile instructions
  START.EXE    --  Windows utility to launch programs

  Misc. files:

  AUTHOR.BAT    --  Author information program
  AUTHOR.TXT    --  Author information file
  BIOS.TXT      --  BIOS equipment list
  BREAK.TXT    --  Notes on DOS break flag
  COHESION.TXT  --  Info for utility usage
  COMPILE.LST  --  Compiler switches list
  COMPILE.TXT  --  Instructions on compiling
  CTRL.TXT      --  Short note on Control-Break
  DATETIME.TXT  --  Further date\time explanations
  ERROR.TXT    --  List of DOS error codes
  EXAMPLE?.BAT  --  Examples using utilities
  PSPTRICK.TXT  --  Text on file handles
  SERIAL.TXT    --  Info on disk serial number
  UPGRADE1.TXT  --  Latest upgrade notes
  UPGRADE2.TXT  --  Old upgrade notes
  US.TXT        --  U.S. Constitution
  VERSION.LST  --  Most recent upgrade notes

  Misc. list files:

  ASCII.TXT    --  Text file of ascii codes
    ASCII1.TXT    --  Ascii codes 0 to 127
    ASCII2.TXT    --  Ascii codes 128 to 255
  HEX.TXT      --  Text file of hex codes
    HEX1.TXT      --  Hex codes 0 to 127
    HEX2.TXT      --  Hex codes 128 to 255

  Misc. readme list files:

  README.COM    --  Readme program for readme.txt
    README.TXT    --  Description of utilities
  READIT2.COM  --  Readme program for disclaim.doc

  Misc. utilities:

  DOBREAK.BAT  --  Example to check DOS break flag state
  CHECKBRK.COM  --  Returns Errorlevel of break flag
  CLEARBRK.COM  --  Clears break flag in DOS
  COUNTBRK.COM  --  Displays actual value of break flag
  SETBRK.COM    --  Sets break flag in DOS
  ZIPCHECK.BAT  --  Batch program to check .zip files
    BADCHECK.DAT  --  Used by Zipcheck.bat
    ZIPCHECK.DAT  --  Used by Zipcheck.bat

  Misc. imbedded file source:

  \Examples\*.Zip  --  Over 50 examples in BASIC programming.

  \Copyit55\*.Zip  --  File copy utility.
  \Hexxit80\*.Zip  --  Hex editor utility.
  \Stree32\*.Zip    --  Directory display utility.
  \Whatis36\*.Zip  --  Whatis expression parser.

Source files:

  BC7.INC      --  Backward compatible file for BC7 (PDS v7.10) compiling
  BC71.INC      --  Backward compatible file for BC7 (PDS v7.10) compiling

  WHATIS.INC    --  Include file for Whatis

  ERROR.BAS    --  Error function source for VB
  ERROR.LIB    --  Error function library for VB
  ERROR2.BAS    --  Error function source for QB
  ERROR2.LIB    --  Error function library for QB

  *.BAS        --  Program sources
  *.BI          --  Source headers

  MAKEALL.BAT  --  Makes all programs.
  LINKALL.BAT  --  Links all programs.

  MAKEFILE      --  Compiler directives for NMAKE.EXE with VB Pro v1.00
  MAKEFILE.NMK  --  Compiler directives for NMAKE.EXE with VB Pro v1.00
  MAKEFILE.BC7  --  Compiler directives for making with BC7 (PDS v7.10)
  MAKEZIP.BAT  --  Makes Ziplook.exe w/ BC7 (PDS v7.10)
  NOEDIT.OBJ    --  Line input editing stub file
  KEYTRAP.ASM  --  Assembly program to trap Control-Break
  KEYTRAP.OBJ  --  Precompiled source to Keytrap.asm
  SWAPBAS.ASM  --  Source to Runprog.exe swapper
  SWAPBAS.OBJ  --  Precompiled Runprog.exe swapper
  ZIPVIEW.ASM  --  Source to .zip viewing
  ZIPVIEW.OBJ  --  Precompiled .zip viewing source

Auxiliary files:

  *.ASI        --  ASIC v5.00 program source
  *.BAT        --  Batch programs
  *.DOC        --  Documentation files
  *.PRJ        --  ASIC v5.00 project files
  *.LST        --  List files
  *.TXT        --  Text files

Temporary files:

  *.BAK        --  Text editor backup files
  *.MAP        --  Linker map files
  *.OBJ        --  Compiler object files

Required compiling files for VB Pro v1.00:

  BC.EXE        --  The VB Pro v1.00 compiler
  LINK.EXE      --  Most recent Linker
  VBDOS.LIB    --  VB Pro v1.00 interrupt assembly library
  VBDCL10E.LIB  --  VB Pro v1.00 standalone library
  VBDRT10E.LIB  --  VB Pro v1.00 runtime library
  VBDRT10E.EXE  --  VB Pro v1.00 runtime module

Required compiling files for Ziplook.exe or for BC7 (PDS v7.10) compiling:

  BC.EXE        --  The BC v7.10 compiler
  LINK.EXE      --  Most recent Linker
  DTFMTER.LIB  --  BC v7.10 date/time format library
  QBX.LIB      --  BC v7.10 interrupt assembly ibrary
  BCL71EFR.LIB  --  BC v7.10 standalone library
  BCL71ENR.LIB  -  BC v7.10 standalone library
  BRT71EFR.LIB  --  BC v7.10 runtime library
  BRT71EFR.EXE  --  BC v7.10 runtime module

Required compiling files for assembly source:

  TASM.EXE      --  Turbo assembler 4.0, or any later MASM compilers

Filegate project files:

  FILE_ID.DIZ  --  Standard distribution text file

These programs and source are hereby placed into the public domain 2014.

The Author respects the Authors of included PD/Shareware programs.

-end-



Attached Files
.zip   MORUTL65.ZIP (Size: 6.29 MB / Downloads: 34)
Print this item

  Fun with hardware acceleration.
Posted by: Pete - 10-20-2022, 10:25 PM - Forum: General Discussion - No Replies

One nice effect is you can have 2 font sizes/styles in the same program. Here is a flow-through example with a large and small lucon font.

Code: (Select All)
$COLOR:32
DIM SHARED overlay, ii
f1 = 22 ' Sets font size to 22 and calculates the max screen height and width for your desktop.
h = (_DESKTOPHEIGHT - 60) \ f1
w = _DESKTOPWIDTH \ (f1 / 1.66)
WIDTH w, h
_SCREENMOVE 0, 0
fontpath$ = ENVIRON$("SYSTEMROOT") + "\fonts\lucon.ttf" 'Find Windows Folder Path.
font& = _LOADFONT(fontpath$, f1 - 2, "monospace") ' - 2 to shorten the screen height just a bit.
_FONT font&
_DELAY .25
swtch = 1

DO
    _LIMIT 30
    SELECT CASE swtch
        CASE 1
            CALL prog1
            IF INKEY$ = CHR$(27) THEN SYSTEM
        CASE -1
            CALL prog2
    END SELECT

    swtch = swtch * -1
LOOP

SUB prog1
    ii = ii + 1
    IF i > 300 THEN END ' Safety in case of memory leak.
    IF ABS(TIMER - z1) > .5 THEN LOCATE 2, 2: PRINT LTRIM$(STR$(ii)); "  ";
END SUB

SUB prog2
    STATIC target$, z2, bxx!
    hardware_top = 34
    bxy! = hardware_top

    overlay = _NEWIMAGE(_WIDTH * _FONTWIDTH, _HEIGHT * _FONTHEIGHT, 32)

    _DEST overlay

    font& = _LOADFONT("lucon.ttf", 12, "monospace")
    _FONT font&

    SELECT CASE target$
        CASE ""
            bxx! = RND * 80 + 5
            target$ = "on"
            z2 = TIMER
        CASE "on"
            COLOR Yellow, 0
            t$ = " " + CHR$(218) + STRING$(11, CHR$(196)) + CHR$(191) + " "
            PSL bxy!, bxx! - 1, t$
            FOR i = 1 TO 2
                t$ = " " + CHR$(179) + STRING$(11, CHR$(32)) + CHR$(179) + " "
                PSL bxy! + i, bxx! - 1, t$
            NEXT
            t$ = " " + CHR$(192) + STRING$(11, CHR$(196)) + CHR$(217) + " "
            PSL bxy! + i, bxx! - 1, t$
            t$ = LTRIM$(STR$(ii))
            PSL bxy! + 1.5, bxx! + 7.5 - LEN(LTRIM$(STR$(ii))) \ 2 - 1, t$
            IF ABS(z2 - TIMER) > 4 THEN
                z2 = TIMER
                target$ = "wait"
            ELSE
            END IF
        CASE "wait"
            IF ABS(z2 - TIMER) > 2 THEN
                z2 = TIMER
                target$ = ""
            END IF
    END SELECT

    _DISPLAY
    _FREEIMAGE overlay
    _DEST 0
END SUB

SUB PSL (y!, x, t$)
    _PRINTSTRING ((x - 1) * _FONTWIDTH, (y! - 1) * _FONTHEIGHT), t$
    Overlay_Hardware = _COPYIMAGE(overlay, 33)
    _PUTIMAGE (0, 0), Overlay_Hardware
    _FREEIMAGE Overlay_Hardware
END SUB

It's more fun and versatile than the old way of using PCOPY, because the screen properties like font size can be separated.

Pete

Print this item

  DEMO ZAPPER- early use of Inform
Posted by: James D Jarvis - 10-20-2022, 03:03 PM - Forum: Programs - No Replies

I saw a couple posts on inform recently so I dug this out.
It's one of my first attempts at using qb64 and Inform from several months ago during the before times.   It's pretty crude and not remotely amazing but nonetheless semi-functional  and shows how I tried to make use of Inform.

DemoZapper

Code: (Select All)
'Demo Zapper
'just fiddling with inform a several months back and whipped this up while still rediscovering QB64
'it's crude, I've gotten a little better witrh qb64 since I did this,  but someone may find it useful as a samplen to figure out inform
'one "alien" and one cannon/ship
'
'  you are going to need the form (which is posted alogn with this) and you are going to need inform installed to make use of this.
'
'
'
': This program uses
': InForm - GUI library for QB64 - v1.3
': Fellippe Heitor, 2016-2021 - fellippe@qb64.org - @fellippeheitor
': https://github.com/FellippeHeitor/InForm
'-----------------------------------------------------------

': Controls' IDs: ------------------------------------------------------------------
Dim Shared DEMOZAPPER As Long
Dim Shared DEMOZAPPERPX As Long
Dim Shared BT2 As Long
Dim Shared BT As Long
Dim Shared FIREBT As Long
Dim Shared MessageBoxTB As Long
Dim Shared SCORELB As Long
Dim Shared ScoreT As Long
Dim Shared POWERLB As Long
Dim Shared ScoreT2 As Long
Dim Shared HULLLB As Long
Dim Shared ScoreT3 As Long

Dim Shared gamescore As Long
Dim Shared power As Long
Dim Shared hull As Long
Dim Shared shipx As Long
Dim Shared shipY As Long

Dim Shared shipshape$, alienshape$, zapshape$
Dim Shared ax, ay, zx(10), zy(10) As Long
Dim Shared shot, allshots
Dim Shared ASPEED
Dim Shared mess$(5)

mess$(1) = "My Totally lame shooter demo"
mess$(2) = "Take Careful Aim"
mess$(3) = "only one alien for now"
mess$(4) = "Power drain does nothing...yet"
mess$(5) = "Hmmm...."
Randomize Timer

': External modules: ---------------------------------------------------------------
'$INCLUDE:'InForm\InForm.bi'
'$INCLUDE:'InForm\xp.uitheme'
'$INCLUDE:'demozapper.frm'

': Event procedures: ---------------------------------------------------------------
Sub __UI_BeforeInit

End Sub

Sub __UI_OnLoad
    'here's where I initialize my part of the program.
    gamescore = 0
    power = 1000
    hull = 100
    shipx = 256
    shipY = 240
    shot = 0
    allshots = 0
    shipshape$ = "R4D8F6D8H6U4L4D4G6U8E6U8"
    alienshape$ = "R8F6G3H3G3H3E6"
    zapshape$ = "R4D6L4U6"
    ax = 30
    ay = 30
    zx = -1
    zy = -1
    ASPEED = 1
    Caption(MessageBoxTB) = " "
End Sub

Sub __UI_BeforeUpdateDisplay
    'This event occurs at approximately 60 frames per second.
    'You can change the update frequency by calling SetFrameRate DesiredRate%

    ' this looked like a good spot in what is effectively the main event loop to pur most of the program.
    Caption(ScoreT) = Str$(gamescore)
    Caption(ScoreT2) = Str$(power)
    Caption(ScoreT3) = Str$(hull)
    mm = Int(Rnd * 500) + 1
    If mm < 6 Then Caption(MessageBoxTB) = mess$(mm)

    'drawship
    _Dest Control(Canvas).HelperCanvas
    k = _RGB(111, 200, 200)
    BeginDraw DEMOZAPPERPX
    Cls , _RGB32(0, 0, 50)
    PSet (shipx, shipY), k
    Draw shipshape$
    If ax > 0 Then
        PSet (ax, ay), k
        Draw alienshape$
    End If
    If shot > 0 Then
        For z = 1 To shot
            If zx(z) > 0 Then
                k = _RGB(200, 20, 20)
                PSet (zx(z), zy(z)), k
                Draw zapshape$
                If Int(zx(z) / 8) = Int((ax + 2.5) / 8) And Int(zy(z) / 8) = Int(ay / 8) Then
                    Beep
                    ax = -1
                    ay = -1
                    gamescore = gamescore + 100
                    zx(z) = -1
                    zy(z) = -1
                End If
            End If
        Next z
    End If
    EndDraw DEMOZAPPERPX
    'move game elements
    If ax < 500 Then
        ax = ax + ASPEED
    Else
        ax = -10
        ay = Int(Rnd * 20) + 20
    End If
    If shot > 0 Then
        For z = 1 To shot
            If zy(z) > 0 Then
                zy(z) = zy(z) - 4
            Else
                zx(z) = -1
                zy(z) = -1
            End If
        Next z
        If zy(shot) = -1 And shot = 10 Then shot = 0
    End If
End Sub

Sub __UI_BeforeUnload
    'If you set __UI_UnloadSignal = False here you can
    'cancel the user's request to close.

End Sub


Sub __UI_Click (id As Long)
    Select Case id
        Case DEMOZAPPER

        Case DEMOZAPPERPX

        Case BT2
            shipx = shipx - 4
        Case BT
            shipx = shipx + 4

        Case FIREBT
            'if the fire button is pressed do this!
            If power > 0 And shot < 10 Then
                shot = shot + 1
                zx(shot) = shipx
                zy(shot) = shipY - 8
                power = power - 1

            End If

        Case MessageBoxTB

        Case SCORELB

        Case ScoreT

        Case POWERLB

        Case ScoreT2

        Case HULLLB

        Case ScoreT3

    End Select
End Sub

Sub __UI_MouseEnter (id As Long)
    Select Case id
        Case DEMOZAPPER

        Case DEMOZAPPERPX

        Case BT2

        Case BT

        Case FIREBT

        Case MessageBoxTB

        Case SCORELB

        Case ScoreT

        Case POWERLB

        Case ScoreT2

        Case HULLLB

        Case ScoreT3

    End Select
End Sub

Sub __UI_MouseLeave (id As Long)
    Select Case id
        Case DEMOZAPPER

        Case DEMOZAPPERPX

        Case BT2

        Case BT

        Case FIREBT

        Case MessageBoxTB

        Case SCORELB

        Case ScoreT

        Case POWERLB

        Case ScoreT2

        Case HULLLB

        Case ScoreT3

    End Select
End Sub

Sub __UI_FocusIn (id As Long)
    Select Case id
        Case BT2

        Case BT

        Case FIREBT

        Case MessageBoxTB

    End Select
End Sub

Sub __UI_FocusOut (id As Long)
    'This event occurs right before a control loses focus.
    'To prevent a control from losing focus, set __UI_KeepFocus = True below.
    Select Case id
        Case BT2

        Case BT

        Case FIREBT

        Case MessageBoxTB

    End Select
End Sub

Sub __UI_MouseDown (id As Long)
    Select Case id
        Case DEMOZAPPER

        Case DEMOZAPPERPX

        Case BT2
            'go that way
            shipx = shipx - 1
        Case BT
            'go this way
            shipx = shipx + 1
        Case FIREBT

        Case MessageBoxTB

        Case SCORELB

        Case ScoreT

        Case POWERLB

        Case ScoreT2

        Case HULLLB

        Case ScoreT3

    End Select
End Sub

Sub __UI_MouseUp (id As Long)
    Select Case id
        Case DEMOZAPPER

        Case DEMOZAPPERPX

        Case BT2

        Case BT

        Case FIREBT

        Case MessageBoxTB

        Case SCORELB

        Case ScoreT

        Case POWERLB

        Case ScoreT2

        Case HULLLB

        Case ScoreT3

    End Select
End Sub

Sub __UI_KeyPress (id As Long)
    'When this event is fired, __UI_KeyHit will contain the code of the key hit.
    'You can change it and even cancel it by making it = 0
    Select Case id
        Case BT2

        Case BT

        Case FIREBT

        Case MessageBoxTB

    End Select
End Sub

Sub __UI_TextChanged (id As Long)
    Select Case id
        Case MessageBoxTB

    End Select
End Sub

Sub __UI_ValueChanged (id As Long)
    Select Case id
    End Select
End Sub

Sub __UI_FormResized

End Sub

'$INCLUDE:'InForm\InForm.ui'


and the form so that works. 

Code: (Select All)
': This form was generated by
': InForm - GUI library for QB64 - v1.3
': Fellippe Heitor, 2016-2021 - fellippe@qb64.org - @fellippeheitor
': https://github.com/FellippeHeitor/InForm
'-----------------------------------------------------------
Sub __UI_LoadForm

    Dim __UI_NewID As Long, __UI_RegisterResult As Long

    __UI_NewID = __UI_NewControl(__UI_Type_Form, "DEMOZAPPER", 889, 494, 0, 0, 0)
    __UI_RegisterResult = 0
    SetCaption __UI_NewID, "DEMO ZAPPER"
    Control(__UI_NewID).Font = SetFont("segoeui.ttf", 12)
    Control(__UI_NewID).HasBorder = False

    __UI_NewID = __UI_NewControl(__UI_Type_PictureBox, "DEMOZAPPERPX", 520, 320, 31, 26, 0)
    __UI_RegisterResult = 0
    Control(__UI_NewID).Stretch = True
    Control(__UI_NewID).HasBorder = True
    Control(__UI_NewID).Align = __UI_Center
    Control(__UI_NewID).VAlign = __UI_Middle
    Control(__UI_NewID).BorderSize = 1

    __UI_NewID = __UI_NewControl(__UI_Type_Button, "BT2", 80, 40, 605, 332, 0)
    __UI_RegisterResult = 0
    SetCaption __UI_NewID, "<"
    Control(__UI_NewID).Font = SetFont("segoeui.ttf", 24)
    Control(__UI_NewID).HasBorder = False
    Control(__UI_NewID).CanHaveFocus = True

    __UI_NewID = __UI_NewControl(__UI_Type_Button, "BT", 80, 38, 715, 332, 0)
    __UI_RegisterResult = 0
    SetCaption __UI_NewID, ">"
    Control(__UI_NewID).Font = SetFont("segoeui.ttf", 24)
    Control(__UI_NewID).HasBorder = False
    Control(__UI_NewID).CanHaveFocus = True

    __UI_NewID = __UI_NewControl(__UI_Type_Button, "FIREBT", 190, 49, 605, 392, 0)
    __UI_RegisterResult = 0
    SetCaption __UI_NewID, "FIRE !"
    Control(__UI_NewID).Font = SetFont("segoeui.ttf", 18)
    Control(__UI_NewID).HasBorder = False
    Control(__UI_NewID).CanHaveFocus = True

    __UI_NewID = __UI_NewControl(__UI_Type_TextBox, "MessageBoxTB", 520, 85, 31, 374, 0)
    __UI_RegisterResult = 0
    SetCaption __UI_NewID, "Message Box"
    Control(__UI_NewID).HasBorder = True
    Control(__UI_NewID).CanHaveFocus = True
    Control(__UI_NewID).BorderSize = 1

    __UI_NewID = __UI_NewControl(__UI_Type_Label, "SCORELB", 150, 29, 592, 15, 0)
    __UI_RegisterResult = 0
    SetCaption __UI_NewID, "SCORE"
    Control(__UI_NewID).Font = SetFont("segoeui.ttf", 18)
    Control(__UI_NewID).HasBorder = False
    Control(__UI_NewID).VAlign = __UI_Middle

    __UI_NewID = __UI_NewControl(__UI_Type_Label, "ScoreT", 237, 37, 592, 49, 0)
    __UI_RegisterResult = 0
    SetCaption __UI_NewID, "0"
    Control(__UI_NewID).Font = SetFont("segoeui.ttf", 18)
    Control(__UI_NewID).HasBorder = False
    Control(__UI_NewID).Align = __UI_Right
    Control(__UI_NewID).VAlign = __UI_Middle

    __UI_NewID = __UI_NewControl(__UI_Type_Label, "POWERLB", 150, 29, 592, 91, 0)
    __UI_RegisterResult = 0
    SetCaption __UI_NewID, "POWER"
    Control(__UI_NewID).Font = SetFont("segoeui.ttf", 18)
    Control(__UI_NewID).HasBorder = False
    Control(__UI_NewID).VAlign = __UI_Middle

    __UI_NewID = __UI_NewControl(__UI_Type_Label, "ScoreT2", 227, 37, 605, 125, 0)
    __UI_RegisterResult = 0
    SetCaption __UI_NewID, "0"
    Control(__UI_NewID).Font = SetFont("segoeui.ttf", 18)
    Control(__UI_NewID).HasBorder = False
    Control(__UI_NewID).Align = __UI_Right
    Control(__UI_NewID).VAlign = __UI_Middle

    __UI_NewID = __UI_NewControl(__UI_Type_Label, "HULLLB", 150, 29, 592, 179, 0)
    __UI_RegisterResult = 0
    SetCaption __UI_NewID, "HULL"
    Control(__UI_NewID).Font = SetFont("segoeui.ttf", 18)
    Control(__UI_NewID).HasBorder = False
    Control(__UI_NewID).VAlign = __UI_Middle

    __UI_NewID = __UI_NewControl(__UI_Type_Label, "ScoreT3", 224, 37, 605, 223, 0)
    __UI_RegisterResult = 0
    SetCaption __UI_NewID, "0"
    Control(__UI_NewID).Font = SetFont("segoeui.ttf", 18)
    Control(__UI_NewID).HasBorder = False
    Control(__UI_NewID).Align = __UI_Right
    Control(__UI_NewID).VAlign = __UI_Middle

END SUB

SUB __UI_AssignIDs
    DEMOZAPPER = __UI_GetID("DEMOZAPPER")
    DEMOZAPPERPX = __UI_GetID("DEMOZAPPERPX")
    BT2 = __UI_GetID("BT2")
    BT = __UI_GetID("BT")
    FIREBT = __UI_GetID("FIREBT")
    MessageBoxTB = __UI_GetID("MessageBoxTB")
    SCORELB = __UI_GetID("SCORELB")
    ScoreT = __UI_GetID("ScoreT")
    POWERLB = __UI_GetID("POWERLB")
    ScoreT2 = __UI_GetID("ScoreT2")
    HULLLB = __UI_GetID("HULLLB")
    ScoreT3 = __UI_GetID("ScoreT3")
END SUB

Print this item

  New Music Player in the works? (Maybe)
Posted by: SpriggsySpriggs - 10-20-2022, 02:36 AM - Forum: Works in Progress - Replies (2)

Even though they've had FLAC in QB64pe for a while I'm just now getting into it. Which is weird because I love FLAC files. The majority of my music library is FLAC format because I'm a big audiophile. Anyways, I decided to look into the FLAC format for tags and such as well as the embedded album art stuff. Turns out, super easy to grab data from a FLAC file. Here's the test code I've used:

Code: (Select All)
Option Explicit
$NoPrefix
$Console

Dim As String file: file = "07 - Project 86 - Team Black.flac"

Dim As Long hfile: hfile = FreeFile
Open "B", hfile, file
Dim As String rawdata: rawdata = Space$(LOF(hfile))
Get hfile, , rawdata
Close

Dim As String SOI: SOI = Chr$(&HFF) + Chr$(&HD8)
Dim As String EOI: EOI = Chr$(&HFF) + Chr$(&HD9)

Dim As String lyrics: lyrics = Mid$(rawdata, InStr(rawdata, "LYRICS=") + Len("LYRICS=")): lyrics = Mid$(lyrics, 1, InStr(lyrics, Chr$(0)) - 2)
Dim As Long tracknumber: Dim As String track: track = Mid$(rawdata, InStr(rawdata, "TRACKNUMBER=") + Len("TRACKNUMBER=")): track = Mid$(track, 1, InStr(track, Chr$(0))): tracknumber = Val(track)
Dim As String songtitle: songtitle = Mid$(rawdata, InStr(rawdata, "TITLE=") + Len("TITLE=")): songtitle = Mid$(songtitle, 1, InStr(songtitle, Chr$(0)) - 2)
Dim As String albumtitle: albumtitle = Mid$(rawdata, InStr(rawdata, "ALBUM=") + Len("ALBUM=")): albumtitle = Mid$(albumtitle, 1, InStr(albumtitle, Chr$(0)) - 2)
Dim As String artist: artist = Mid$(rawdata, InStr(rawdata, "ARTIST=") + Len("ARTIST=")): artist = Mid$(artist, 1, InStr(artist, Chr$(0)) - 2)
Dim As String albumdate: albumdate = Mid$(rawdata, InStr(rawdata, "DATE=") + Len("DATE=")): albumdate = Mid$(albumdate, 1, InStr(albumdate, Chr$(6)) - 1)

Dim As String image: image = Mid$(rawdata, InStr(rawdata, SOI)): image = Mid$(image, 1, InStr(image, EOI) + Len(EOI))
If Len(image) > 0 Then
    Dim As Long hpic: hpic = FreeFile
    If FileExists("cover.jpg") Then Kill "cover.jpg"
    Open "B", hpic, "cover.jpg"
    Put hpic, , image
    Close
    Dim As Long i: i = LoadImage("cover.jpg", 32)
    If i < -1 Then Screen i Else Beep
    rawdata = ""
    Echo lyrics
    Print "Artist:", artist
    Print "Album :", albumtitle
    Print "Track :", tracknumber
    Print "Title :", songtitle
    Print "Date  :", albumdate
    Title artist + " - " + songtitle
    ConsoleTitle Title$ + " lyrics"
    Dim As Long snd: snd = SndOpen(file, "stream")
    If snd Then SndPlay snd
End If

And a test video:


I hope to make me a new project with the code. Obviously a point-and-click GUI. Probably Win32. I will have a trackbar for changing song position as well as a popup window for the lyrics and such. If I get really ambitious then I'll see about making me a tag editor for FLAC/MP3/WAV/etc files.
To download the song for testing: Project 86 - Team Black

Print this item

  Default Command Line Experience in Windows is Now Windows Terminal
Posted by: hanness - 10-19-2022, 12:35 AM - Forum: General Discussion - Replies (21)

As of today, with Windows 11 22H2 October 18th Moment 1 Update, Windows Terminal is now the default command line experience.

In view of this, are there any plans to update QB64PE to better support Windows Terminal for apps that output to the console.

I brought up this question probably about two years ago since we knew back then already that this day was coming, and now it's here.

Print this item

  Calculating the High and Low of it all
Posted by: Dimster - 10-18-2022, 06:44 PM - Forum: Help Me! - Replies (15)

So, I have a massive data base of decimal value with 5 digits after the decimal. I have routine which is trying to find the highest and the lowest of these values. Here is the algorythm that I am using but for some reason it's giving me the Highest value as the Lowest and the Lowest as the Highest. 

        HL = DataBaseValue
        If HL < 1 And HL < Low Then Low = HL
        Low = (_Round(Low * 100000)) / 100000
        If HL < 1 And HL > High Then High = HL 

        High = (_Round(High * 100000)) / 100000

The rounding is to avoid scientific notation and be sure result will be 5 digit decimal value.

I can't see why this algorythm would give the High as Low and the Low as High.

Print this item

Sad Inter-Program Data Sharing
Posted by: Ikerkaz - 10-18-2022, 02:37 PM - Forum: Help Me! - Replies (6)

Hi to all!!!

I am making a space shooter game, and my idea is to make it online for playing with friends... but I have a very big problem, I don't know how to communicate one pc to another Sad

I tried with the Inter-Program Data Sharing Demo (the example listed on the Wiki):
Inter-Program Data Sharing Demo - QB64 Phoenix Edition Wiki

I changed the line "TCP/IP:1234:localhost" and tried everything... my last one was "TCP/IP:8080:xxx.yyy.zzz.nnn" (where xxx.yyy.zzz.nnn is my current IP), but it is useless.

Any ideas? 

Both PCs are NOT in the same LAN, one is mine and the other is from a work colleague.

Thank you very much Smile

Print this item

  Inform for QB64pe Script fix
Posted by: cage - 10-18-2022, 04:22 AM - Forum: General Discussion - Replies (25)

Inform now no longer works with QB64pe. I found the website that suppose to have the fix for it, but I am unable to download it.  Seems there is some java script involved that my browser refuses to allow.  Is there any way I can get that script so I can fix Inform so it will work?

Print this item

  Drawing with Lines of Variable Thickness
Posted by: James D Jarvis - 10-17-2022, 06:27 PM - Forum: Utilities - Replies (6)

A method to draw lines of variable thickness making use of rotozoom2

has routines to draw a line of any pixel thickness, outlined polygons, and filled polygons with a few different fill methods.,

I've made heavy use of B+'s code to get this working.

Code: (Select All)
_Title "Drawing with lines of variable thickness"
'by James D. Jarvis adapted using code by B+
' this uses RotoZoom2 to draw a line of any thickness.
'
Randomize Timer
Const xmax = 800
Const ymax = 600
Screen _NewImage(xmax, ymax, 32)

_ScreenMove _Middle
px = 0: py = 0: t = 0
Do
    Cls
    _Limit 30
    dline 100, 100, 300, 300, _RGB32(100, 200, 200), 20
    dline 100, 300, 300, 300, _RGB32(100, 200, 200), 20
    rotopoly2 300, 300, 150, 90, 0, _RGB32(100, 200, 200), 6.5
    tripoly 300, 300, 50, 90, 0, _RGB32(200, 100, 100)
    rotopoly2 300, 300, 50, 90, 0, _RGB32(100, 200, 200), 1.5
    fillpoly 300, 100, 40, 72, 0, _RGB32(100, 100, 200), _RGB32(80, 0, 0), 1.5, "noise"
    fillpoly 400, 100, 40, 60, 0, _RGB32(180, 180, 0), _RGB32(180, 180, 0), 1.5, "af"
    fillpoly 500, 100, 40, 120, 0, _RGB32(100, 100, 200), _RGB32(250, 250, 0), 4, "VV"
    fillpoly 600, 100, 40, 90, 0, _RGB32(100, 100, 200), _RGB32(0, 180, 180), 6, "hh"
    px = px + 3: py = py + 2: t = t + 1
    If px > _Width Then px = 0
    If py > _Height Then py = 0
    If t > 360 Then t = 1
    fillpoly px, py, 20, 90, t, _RGB32(250, 250, 250), _RGB32(200, 200, 0), 4, "AH"
    _Display
    kk$ = InKey$
Loop Until kk$ = Chr$(27)

Function Rtan2 (x1, y1, x2, y2)
    'get the angle (in radians) from x1,y1 to x2,y2
    deltaX = x2 - x1
    deltaY = y2 - y1
    rtn = _Atan2(deltaY, deltaX)
    If rtn < 0 Then Rtan2 = rtn + (2 * _Pi) Else Rtan2 = rtn
End Function
Sub circleBF (cx As Long, cy As Long, r As Long, klr As _Unsigned Long)
    rsqrd = r * r
    y = -r
    While y <= r
        x = Sqr(rsqrd - y * y)
        Line (cx - x, cy + y)-(cx + x, cy + y), klr, BF
        y = y + 1
    Wend
End Sub
'====================================================================
' draw a line of color klr and thickness thk
'====================================================================
Sub dline (x1, y1, x2, y2, klr As _Unsigned Long, thk)
    storeDest& = _Dest
    hyp = Sqr((x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1)) 'detrmine the length of the line
    yy = 1 * thk
    xx = Int(hyp + .9)
    II& = _NewImage(xx, Int(yy + .5), 32)
    _Dest II&
    Line (0, 0)-(xx, yy), klr, BF 'draw the line in the temporary image buffer
    centerx = (x1 + x2) / 2
    centery = (y1 + y2) / 2
    _Dest storeDest&
    rotation = Rtan2(x1, y1, x2, y2) 'find the angle of the line in radians as rotozoom2 uses radians
    RotoZoom2 centerx, centery, II&, 1, 1, rotation 'copy the line to it's position on the screen using rotozoom2
    _FreeImage II&
End Sub

'This sub gives really nice control over displaying an Image.
Sub RotoZoom2 (centerX As Long, centerY As Long, Image As Long, xScale As Single, yScale As Single, Rotation As Single)
    Dim px(3) As Single: Dim py(3) As Single
    W& = _Width(Image&): H& = _Height(Image&)
    px(0) = -W& / 2: py(0) = -H& / 2: px(1) = -W& / 2: py(1) = H& / 2
    px(2) = W& / 2: py(2) = H& / 2: px(3) = W& / 2: py(3) = -H& / 2
    sinr! = Sin(-Rotation): cosr! = Cos(-Rotation)
    For i& = 0 To 3
        x2& = (px(i&) * cosr! + sinr! * py(i&)) * xScale + centerX: y2& = (py(i&) * cosr! - px(i&) * sinr!) * yScale + centerY
        px(i&) = x2&: py(i&) = y2&
    Next
    _MapTriangle (0, 0)-(0, H& - 1)-(W& - 1, H& - 1), Image& To(px(0), py(0))-(px(1), py(1))-(px(2), py(2))
    _MapTriangle (0, 0)-(W& - 1, 0)-(W& - 1, H& - 1), Image& To(px(0), py(0))-(px(3), py(3))-(px(2), py(2))
End Sub
'====================================================================
' rotopoly2 draws a  polygon wit variable line thickness
'====================================================================
Sub rotopoly2 (cx, cy, rr, shapedeg, turn, klr As _Unsigned Long, thk)
    x = 0
    y = 0
    For deg = turn To turn + 360 Step shapedeg
        x2 = rr * Cos(0.01745329 * deg)
        y2 = rr * Sin(0.01745329 * deg)
        'If x <> 0 Then Line (cx + x, cy + y)-(cx + x2, cy + y2), klr
        If x <> 0 Then dline cx + x, cy + y, cx + x2, cy + y2, klr, thk
        x = x2
        y = y2
        circleBF (cx + x2), (cy + y2), (thk) \ 2, klr 'fills in the open gap at polygon line intersections
    Next
End Sub
'====================================================================
' triploy draw a filled polygon by rendereing multiple triangles of the same color
'====================================================================
Sub tripoly (cx, cy, rr, shapedeg, turn, klr As _Unsigned Long)
    storeDest& = _Dest
    I& = _NewImage(3, 3, 32)
    _Dest I&
    Line (0, 0)-(_Width, _Height), klr, BF
    x = 0
    y = 0
    _Dest storeDest&
    For deg = turn To turn + 360 Step shapedeg
        x2 = rr * Cos(0.01745329 * deg)
        y2 = rr * Sin(0.01745329 * deg)
        If x <> 0 Then _MapTriangle (0, 0)-(0, 2)-(2, 2), I& To(cx, cy)-(cx + x, cy + y)-(cx + x2, cy + y2)
        x = x2
        y = y2
    Next
    _FreeImage I&
End Sub

'====================================================================
'fillpoly creates filled polygons
'a temporary image is created and trignels for each segment of that tmeporary image are copied to the screen
'currently   7 modes are defined
'CF- color fill,  HH -  horizontal line fill, VV- vertical line fill
'AF - alternating segment color fill, AH & AV are alternationg horizonatl or vetical
'noise- creaes a fill of randomly colore points
'======================================================================
Sub fillpoly (cx, cy, rr, shapedeg, turn, klr1 As _Unsigned Long, klr2 As _Unsigned Long, thk, mode$)
    storeDest& = _Dest
    siz = (rr * Cos(0.01745329 * deg)) * 2
    sx = siz / 2: sy = siz / 2
    I& = _NewImage(siz, siz, 32)
    _Dest I&
    Select Case UCase$(mode$)
        Case "CF", "AF"
            Line (0, 0)-(siz, siz), klr2, BF
        Case "HH", "AH"
            For y = 0 To siz Step thk
                Line (0, y)-(siz, y - 1 + thk / 2), klr2, BF
            Next
        Case "VV", "AV"
            For x = 0 To siz Step thk
                Line (x, 0)-(x - 1 + thk / 2, siz), klr2, BF
            Next
        Case "NOISE"
            For y = 0 To siz
                For x = 0 To siz
                    PSet (x, y), _RGB32(Rnd * 256, Rnd * 256, Rnd * 256)
                Next x
            Next y
    End Select
    x = 0
    y = 0
    _Dest storeDest&
    sc = 0
    For deg = turn To turn + 360 Step shapedeg
        sc = sc + 1
        x2 = rr * Cos(0.01745329 * deg)
        y2 = rr * Sin(0.01745329 * deg)
        If x <> 0 Then
            Select Case UCase$(mode$)
                Case "AF", "AH", "AV"
                    If (sc Mod 2) <> 0 Then _MapTriangle (sx, sy)-(sx + x, sy + y)-(sx + x2, sy + y2), I& To(cx, cy)-(cx + x, cy + y)-(cx + x2, cy + y2)
                Case Else
                    _MapTriangle (sx, sy)-(sx + x, sy + y)-(sx + x2, sy + y2), I& To(cx, cy)-(cx + x, cy + y)-(cx + x2, cy + y2)
            End Select
        End If
        x = x2
        y = y2
    Next
    _FreeImage I&
    If klr1 <> 0 Then rotopoly2 cx, cy, rr, shapedeg, turn, klr1, thk
End Sub

Print this item

  Memory problem with hardware acceleration. [Resolved] Thanks Mark!
Posted by: Pete - 10-17-2022, 06:25 PM - Forum: Help Me! - Replies (2)

This example will not write to your drive. It is a high score hardware overlay, but I stripped out the file stuff.

The overlay is called repeatedly to mimic a flashing cursor. See CALL underline() sub.

What I find is the repeated call keeps copying a new image, one with the cursor showing, and one hidden. That's just 2 images, but since it keeps getting called, instead of switching images (I don;t no how of if that's possible) it just keeps making more of the same alternating screen copy images, which keeps multiplying the memory usage until other OS systems are affected.

You can monitor what I'm talking about by running Windows Task Manager with this code.

Now according to the wiki, I can't use _FREEIMAGE in the loop because I'm not changing screens. I do use it after the original screen is reactivated.

So is there a way to accomplish this flashing cursor effect in the hardware image without burning up the system's memory?

Code: (Select All)
$COLOR:32
REM Main
f1 = 22 ' Sets font size to 22 and calculates the max screen height and width for your desktop.
h = (_DESKTOPHEIGHT - 60) \ f1
w = _DESKTOPWIDTH \ (f1 / 1.66)
WIDTH w, h
_SCREENMOVE 0, 0
fontpath$ = ENVIRON$("SYSTEMROOT") + "\fonts\lucon.ttf" 'Find Windows Folder Path.
font& = _LOADFONT(fontpath$, f1, "monospace")
_FONT font&
_DELAY .25
_RESIZE ON , _SMOOTH ' Allows resizing. Note: this is for slight adjustments. As of this version there is no compensatory function to change the font size during screen size changes.

DIM SHARED Overlay, g.population
g.population = 100000

CALL displayhighscores

SUB displayhighscores
    hardware_top = v.top + 7
    hardware_left = v.left + 35
    score$ = LTRIM$(STR$(g.population))

    DIM hs AS STRING * 25
    REDIM highscore$(6), hsdata$(6)
    DO
        FOR i = 1 TO 5
            hsdata$(i) = SPACE$(25)
        NEXT

        IF VAL(score$) > VAL(highscore$(5)) THEN

            GOSUB hiscore

            i = 14
            OUT &H3C8, 0
            OUT &H3C9, 20 - i
            OUT &H3C9, 20 - i
            OUT &H3C9, 20 - i

            OUT &H3C8, 8
            OUT &H3C9, 30 - i
            OUT &H3C9, 30 - i
            OUT &H3C9, 30 - i

            OUT &H3C8, 7
            OUT &H3C9, 30 - i
            OUT &H3C9, 30 - i
            OUT &H3C9, 30 - i

            OUT &H3C8, 3
            OUT &H3C9, 30 - i
            OUT &H3C9, 30 - i
            OUT &H3C9, 30 - i

            GOSUB hardware_overlay

            COLOR White, 0
            t$ = msg$
            PSLC 4.6, 41 - LEN(msg$) \ 2, t$

            lscr = hardware_left + 6
            z3 = TIMER
            WHILE -1
                initials$ = "": i = 0: nxt = 0
                COLOR , _RGB(24, 24, 24): t$ = "   " ' Blank initials for redo. Okay to blank at start.
                PSL hardware_top + 2 + rank * 2, lscr, t$
                _DISPLAY
                DO
                    _LIMIT 30
                    IF ABS(z3 - TIMER) > .3 THEN ' Flashing cursor
                        underline hardware_top + 2 + rank * 2, lscr + nxt, 0
                        _DISPLAY
                        z3 = TIMER
                    END IF

                    ky$ = UCASE$(INKEY$)
                    IF LEN(ky$) THEN
                        IF ky$ = CHR$(13) THEN
                            kflag = 3
                        ELSEIF ky$ = CHR$(8) AND LEN(initials$) THEN
                            kflag = 2
                        ELSEIF ky$ = CHR$(27) THEN
                            kflag = 4
                        ELSEIF ky$ >= "A" AND ky$ <= "Z" AND LEN(initials$) < 3 THEN
                            initials$ = initials$ + ky$
                            kflag = 1
                        ELSE
                            ky$ = "": kflag = 0
                        END IF
                    END IF

                    SELECT CASE kflag
                        CASE 1
                            COLOR , _RGB(24, 24, 24)
                            PSL hardware_top + 2 + rank * 2, lscr + nxt, " "
                            COLOR Yellow
                            SOUND 1000, .1
                            PSL hardware_top + 2 + rank * 2, lscr + nxt, ky$
                            underline hardware_top + 2 + rank * 2, lscr + nxt, -1
                            nxt = nxt + 1
                            underline hardware_top + 2 + rank * 2, lscr + nxt, 0
                            _DISPLAY
                            kflag = 0
                        CASE 2
                            COLOR , _RGB(24, 24, 24)
                            underline hardware_top + 2 + rank * 2, lscr + nxt, -1
                            initials$ = MID$(initials$, 1, LEN(initials$) - 1)
                            nxt = nxt - 1
                            PSL hardware_top + 2 + rank * 2, lscr + nxt, " "
                            COLOR Yellow
                            SOUND 1000, .1
                            underline hardware_top + 2 + rank * 2, lscr + nxt, 0
                            _DISPLAY
                            kflag = 0
                        CASE 3
                            _DELAY 1
                            l$ = "8"
                            n$ = "n24": PLAY "L" + l$ + n$
                            n$ = "n28": PLAY "L" + l$ + n$
                            n$ = "n28": PLAY "L" + l$ + n$
                            l$ = "7"
                            n$ = "n31": PLAY "L" + l$ + n$
                            l$ = "9"
                            n$ = "n28": PLAY "L" + l$ + n$
                            l$ = "3"
                            n$ = "n31": PLAY "L" + l$ + n$
                            kflag = 1
                            _DELAY 1: EXIT DO
                        CASE 4
                            EXIT WHILE
                    END SELECT
                LOOP
                hsname$ = initials$

                MID$(hsdata$(rank), 5, 3) = hsname$ + SPACE$(3 - LEN(hsname$))
                OPEN "ascii-invaders-high-score.dat" FOR RANDOM AS #1 LEN = 25
                FOR i = 1 TO 5
                    hs = hsdata$(i)
                    IF LEFT$(hs, 1) = "" THEN MID$(hs, 1, 2) = "0" + LTRIM$(STR$(i))
                    PUT #1, i, hs
                NEXT
                CLOSE #1
                EXIT WHILE
            WEND

            _DISPLAY ' Remove scoreboard.
            _DELAY .5
            _FREEIMAGE Overlay

            _DEST 0 'Reset dest back to the normal screen 0.

            _AUTODISPLAY
            PALETTE
            _DELAY .5

            EXIT DO
        ELSE
            EXIT DO ' Not in the top 5 highest scores so exit sub.
        END IF
    LOOP
    EXIT SUB

    hardware_overlay:
    Overlay = _NEWIMAGE(_WIDTH * _FONTWIDTH, _HEIGHT * _FONTHEIGHT, 32)

    _DEST Overlay
    _DISPLAY ' Turn autodisplay off.

    font = _LOADFONT("lucon.ttf", 24, "monospace")
    IF font <= 0 THEN font = 16
    _FONT font

    bxy% = hardware_top
    bxx% = hardware_left

    IF VAL(score$) > VAL(highscore$(1)) THEN
        t$ = "HIGH SCORE! Enter Initials!"
    ELSE
        t$ = "Top 5 Score Enter Initials!"
    END IF

    COLOR White, 0
    PSL bxy% + .8, bxx% + 1, t$

    COLOR Yellow, 0
    t$ = " " + CHR$(218) + STRING$(27, CHR$(196)) + CHR$(191) + " "
    PSL bxy%, bxx% - 1, t$
    FOR i = 1 TO 12
        t$ = " " + CHR$(179) + STRING$(27, CHR$(32)) + CHR$(179) + " "
        PSL bxy% + i, bxx% - 1, t$
    NEXT
    t$ = " " + CHR$(192) + STRING$(27, CHR$(196)) + CHR$(217) + " "
    PSL bxy% + i, bxx% - 1, t$

    bxy% = hardware_top + 1
    COLOR Black, Yellow
    t$ = "    NAME   SCORE    DATE   "
    PSL bxy% + 1, bxx% + 1, t$

    COLOR Yellow, 0
    FOR i = 1 TO 5
        t$ = hsdata$(i)
        PSL bxy% + 1 + i * 2, bxx% + 2, t$
    NEXT
    _DISPLAY
    RETURN

    hiscore:
    FOR i = 1 TO 5
        IF VAL(score$) > VAL(highscore$(i)) THEN rank = i: EXIT FOR
    NEXT

    hsdata$(6) = SPACE$(25)
    MID$(hsdata$(6), 10, 6) = score$
    MID$(hsdata$(6), 18, 8) = MID$(DATE$, 1, 6) + MID$(DATE$, 9, 2)
    highscore$(6) = score$
    FOR i = 1 TO 6
        FOR j = 1 TO 6
            IF i <> j THEN
                IF VAL(highscore$(i)) > VAL(highscore$(j)) THEN
                    SWAP highscore$(i), highscore$(j)
                    SWAP hsdata$(i), hsdata$(j)
                END IF
            END IF
        NEXT
    NEXT
    FOR i = 1 TO 5
        MID$(hsdata$(i), 1, 2) = "0" + LTRIM$(STR$(i))
    NEXT
    RETURN
END SUB

SUB PSLC (y!, x, t$)
    _PRINTSTRING ((x - 1) * 8, (y! - 1) * 16), t$
END SUB

SUB PSL (y!, x, t$)
    _PRINTSTRING ((x - 1) * _FONTWIDTH, (y! - 1) * _FONTHEIGHT), t$
    Overlay_Hardware = _COPYIMAGE(Overlay, 33)
    _PUTIMAGE (0, 0), Overlay_Hardware
END SUB

SUB underline (y, x, uflag)
    STATIC ucnt
    ucnt = -ucnt - 1
    IF ucnt OR uflag THEN
        LINE ((x - 1) * _FONTWIDTH, y * _FONTHEIGHT)-((x - 1) * _FONTWIDTH + 12, y * _FONTHEIGHT), _RGB(24, 24, 24), BF
    ELSE
        LINE ((x - 1) * _FONTWIDTH, y * _FONTHEIGHT)-((x - 1) * _FONTWIDTH + 12, y * _FONTHEIGHT), Yellow, BF
    END IF

    Overlay_Hardware = _COPYIMAGE(Overlay, 33)
    _PUTIMAGE (0, 0), Overlay_Hardware
END SUB



Pete

Print this item