Getting the SCREEN mode
#31
Quote:Somebody edited the "NIBBLES.BAS" that came with QBasic long ago...

Yes, I know that as well. You can still download the game. I compiled it with QB64 3.2.1, but something doesn't work there. Will put it under programs.
Reply
#32
(10-07-2022, 09:56 AM)SMcNeill Wrote: Try this:

Code: (Select All)
Data 0,1,2,7,8,9,10,11,12,13,256,32
Dim mode(11)

For i = 0 To 11
    Read mode(i)
Next

Dim m As _MEM

For i = 0 To 11
    If i < 10 Then
        Screen mode(i)
    Else
        Screen _NewImage(640, 400, mode(i))
    End If
    Print "ACTUAL MODE:"; mode(i)
    w = _Width(0)
    h = _Height(0)
    bpp = _PixelSize
    Select Case bpp
        Case 0 'text screen
            Print "SCREEN 0"
        Case 1
            For j = 1 To 255
                If _PaletteColor(j, 0) = &HFF000000 Then Exit For
            Next

            Select Case j
                Case 4: Print "SCREEN 1"
                Case 2: If h = 200 Then Print "SCREEN 2" Else Print "SCREEN 11"
                Case 1: Print "SCREEN 10"
                Case 16
                    If w = 320 Then
                        If _PaletteColor(17, 0) = &HFF000000 Then Print "SCREEN 7" Else Print "SCREEN 13"
                    Else
                        Select Case h
                            Case 200: Print "SCREEN 8"
                            Case 350: Print "SCREEN 9"
                            Case 480: Print "SCREEN 12"
                            Case Else
                                Print "SCREEN _NEWIMAGE("; w; ","; h; ", 256)"
                        End Select
                    End If
            End Select
        Case 4
            Print "SCREEN _NEWIMAGE("; w; ","; h; ",32)"
    End Select
    Sleep
Next

Hi Steve
fine your version of GetScreenMode with new _QB64keywords....
_PaletteColor
_PixelSize

and the _MEM type of data assembled together with DATA into code. 
A fantastic example of how to mix old Qbasic and QB64!
Thanks for sharing it.
Reply
#33
(10-07-2022, 03:14 PM)Kernelpanic Wrote:
Quote:Somebody edited the "NIBBLES.BAS" that came with QBasic long ago...

Yes, I know that as well. You can still download the game. I compiled it with QB64 3.2.1, but something doesn't work there. Will put it under programs.

I have taken a look at it and it seems only the old Nibbles.bas
And it runs ok, only too fast.
We slow it into main loop of game in SUB Playnibbles  using a _LIMIT 10, maybe after the comment 'delay game

Nibbles.bas fixed and posted as code in your thread
Reply




Users browsing this thread: 4 Guest(s)