Dim SoundHandle As Long
$Unstable:Midi
$MidiSoundFont:Default
Print "Enter midi file";
Input Midi$
Midi$ = UCase$(Midi$)
If Right$(Midi$, 4) = ".MID" Then
If _FileExists(Midi$) Then
Print "Playing.."
Print " Enter <space>=pause/+plus 10/-minus 10."
Print " Press <escape> to exit."
'_SndPlayFile Midi$
SoundHandle = _SndOpen(Midi$)
If SoundHandle Then
_SndPlay SoundHandle
Do
_Limit 50
x$ = InKey$
If Len(x$) Then
If x$ = Chr$(27) Then Exit Do
If x$ = "+" Then
z! = _SndGetPos(SoundHandle)
z! = z! + 10!
_SndSetPos SoundHandle, z!
End If
If x$ = "-" Then
z! = _SndGetPos(SoundHandle)
z! = z! - 10!
If z! < 0! Then z! = 0!
_SndSetPos SoundHandle, z!
End If
If x$ = " " Then
If _SndPaused(SoundHandle) Then
_SndPlay SoundHandle
Else
_SndPause (SoundHandle)
End If
End If
End If
Loop
End If
End If
End If
End
note the included $metacommands..
attached is midiplay.zip which contains the midi player and midi.zip with some .mid files.
Enhancements
#478, #484 - Added support for _NEGATE, _ANDALSO, & _ORELSE Boolean operators. - @a740g, @mkilgore
#468 - Added support for _MOUSEWHEEL on macOS. - @a740g
#475 - Added support for _CLIPBOARDIMAGE on macOS & Linux. - @a740g
Bug Fixes
#468 - Fixed _MOUSEMOVEMENTx behavior on macOS. - @a740g
#470 - Fixed an issue where the IDE would lock up if the source code had too many DATA statements on macOS. - @a740g
#473 - Fixed the "Export As" menu state in the IDE. - @RhoSigma-QB64
#474 - Fixed the GLUT thread to redraw at an accurate 60 FPS. - @mkilgore
#476 - Fixed an issue on Windows where special keys were monitored even when the window was not in focus. - @a740g
#477 - Fixed the IDE to open the GUI file dialog when Ctrl+S was pressed and GUI Dialogs were enabled. - @a740g
#480, #487 - Fixed mono-mode font rendering and quality issues, and corrected font width calculations when loading monospaced fonts. - @a740g
#481 - Fixed an issue that would cause LLVM-MinGW to incorrectly generate Windows GUI applications when $CONSOLE was used. - @a740g
#484 - Fixed macOS startup script bugs. - @tothebin
#485 - Fixed various wiki issues. - @RhoSigma-QB64
#486 - Fixed an issue where the IDE was reporting an incorrect error. - @SteveMcNeill
Other Fixes
#467, #483 - Corrected multiple typos in the source code. - @RainRat
Full Changelog: v3.12.0...v3.13.0
Steve Note: For all those who were seeing issues with the font rendering with the last version, you might want to grab a copy of this version and test things out. I *think* the issue with those faded/blurred fonts has now been fixed and should no longer be an issue for anyone. To me, that makes this version one which I'd almost consider to be an "essential update" for folks to grab and make use of.
Uh, hello guys, name's Hash, im 24 years old and im pure basic gw_basic text adventure programmer i just love text and games so i merged those both, my current project is my test project which i will add text based gore, violence and toilet humor
say i made a character whom has 0 stats and he faced a slime the slime had 50 hp and he dealt only 2 hits how do i put that on the code im very new to GW_BASIC
DO
LOCATE 1, 1
FOR count = 1 TO 22
PRINT maze$(count)
NEXT count
LOCATE row, column
COLOR 2
PRINT ""
COLOR 7
LOCATE ghostRow, ghostColumn
COLOR 4
PRINT "²"
COLOR 7
IF dots = 0 THEN
LOCATE 8, 1
PRINT "You won!"
SLEEP
SLEEP
END
END IF
IF ((row = ghostRow) AND (column = ghostColumn)) THEN
LOCATE 8, 1
BEEP
PRINT "You got caught!"
SLEEP
CLS
Exit do
End If
keyed$ = INKEY$
_DELAY .055
oldRow = row
oldColumn = column
REM examine the keys
SELECT CASE keyed$
CASE IS = "w"
row = row - 1
CASE IS = "s"
row = row + 1
CASE IS = "a"
column = column - 1
CASE IS = "d"
column = column + 1
END SELECT
REM examine the maze
SELECT CASE MID$(maze$(row), column, 1)
CASE IS = "±"
row = oldRow
column = oldColumn
CASE IS = "ù"
MID$(maze$(row), column, 1) = " "
dots = dots - 1
END SELECT
: REM new
IF RND < 0.30 THEN
: REM
REM move ghost closer to PACMAN
oldRow = ghostRow
SELECT CASE ghostRow
CASE IS < row
ghostRow = ghostRow + 1
CASE IS > row
ghostRow = ghostRow - 1
END SELECT
IF MID$(maze$(ghostRow), ghostColumn, 1) = "±" THEN ghostRow = oldRow
IF ghostRow = oldRow THEN
oldColumn = ghostColumn
SELECT CASE ghostColumn
CASE IS < column
ghostColumn = ghostColumn + 1
CASE IS > column
ghostColumn = ghostColumn - 1
END SELECT
IF MID$(maze$(ghostRow), ghostColumn, 1) = "±" THEN ghostColumn = oldColumn
END IF
END IF: REM <ÄÄÄ new
I’ve been toying with the idea of rendering graphics to SCREEN 0 for a while and have figured out quite a few things on how to accomplish this at a reasonably good speed. However, one of those experiments turned out to be the most fun of all. So much so that I decided to convert it into a tiny library and share it here. You can use this to give your programs a retro artistic look.
The library has just two functions: AAFB_Render and AAFB_SetupScreen0.
The AAFB_Render function is used to render any graphics image onto a SCREEN 0 image. It takes two parameters: srcImage and dstImage. The srcImage parameter is the handle of the graphics image to be rendered, and the dstImage parameter is the handle of the destination SCREEN 0 image where the ASCII art image will be rendered onto. dstImage can be 0 (i.e. the real SCREEN). srcImage and dstImage must have the same dimensions.
Code: (Select All)
SUB AAFB_Render (BYVAL srcImage AS LONG, BYVAL dstImage AS LONG)
The AAFB_SetupScreen0 is just a convenience function that quickly sets up SCREEN 0 with optimal settings.
Code: (Select All)
SUB AAFB_SetupScreen0 (screenWidth AS _UNSIGNED INTEGER, screenHeight AS _UNSIGNED INTEGER)
QB64-PE 3.12 is required. To use an older compiler, remove the "$INCLUDEONCE" lines from AAFB.bi and AAFB.bas.
There are some demos included in the Demo folder.
RokCoder's Galaga running on top of AAFB.
FishTank demo running on top of AAFB.
Limitations:
There is no built-in scaling. However, this can be easily done with _PUTIMAGE
Although it is quite fast, the rendering is done on the CPU and hence may not be suitable for high-resolution rendering (e.g. WIDTH 1920, 1080). However, lots of performance can be gained if you compile with the QB64-PE optimization option enabled.
It does not render to the console / terminal. There are other of libraries that do that. However, they are limited to a reduced set of ASCII characters. AAFB uses all 256 ASCII characters.