I always like to distribute my final program as just one single exe.
Therefore I include (small)images in DATA statements most of the time, by reading them in a Long array and _PutImage that array:
Is something like that also possible for ogg/wav/mp3 files?
Storing them in code in DATA statements, reading them in the correct (_MEM) structure and provide a Long pointer to that?
Therefore I include (small)images in DATA statements most of the time, by reading them in a Long array and _PutImage that array:
Code: (Select All)
Function data2image&
Read iWidth%, iHeight%
Dim alpha As _Byte, cval As Long, imgArray(iWidth% * iHeight%) As Long: imgArray(0) = iHeight% * 2 ^ 16 + iWidth%
Read lin$: i64$ = String$(6 * iWidth% * iHeight%, 0): i64pos~& = 1
Do While lin$ <> "*"
l% = Len(lin$): Mid$(i64$, i64pos~&, l%) = lin$: i64pos~& = i64pos~& + l%: Read lin$
Loop
i$ = _Inflate$(base64decode$(Left$(i64$, i64pos~& - 1))): cn& = -3
Do While n& < iWidth% * iHeight%
cn& = cn& + 4: cval = CVL(Mid$(i$, cn&, 4)): alpha = _Alpha32(cval)
If alpha = &H10 Then
it& = cval - &H10000000: cn& = cn& + 4: cval = CVL(Mid$(i$, cn&, 4))
Do While it& > 0
n& = n& + 1: imgArray(n&) = cval: it& = it& - 1
Loop
Else
n& = n& + 1: imgArray(n&) = cval
End If
Loop
hImg& = _NewImage(iWidth%, iHeight%, 32): _Dest hImg&: Put (0, 0), imgArray(): _Dest 0: data2image& = hImg&
End Function
Is something like that also possible for ogg/wav/mp3 files?
Storing them in code in DATA statements, reading them in the correct (_MEM) structure and provide a Long pointer to that?
45y and 2M lines of MBASIC>BASICA>QBASIC>QBX>QB64 experience