forked from QB64-Phoenix-Edition/QB64pe
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
41 changed files
with
1,169 additions
and
99 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,3 @@ | ||
!slick.ttf | ||
!LiberationMono-Regular.ttf | ||
!LiberationSans-Regular.ttf | ||
!LiberationSerif-Regular.ttf |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,184 @@ | ||
Loading font using filename...done. | ||
Font height = 10 | ||
Loading font from memory...done. | ||
Font height = 20 | ||
Current font: 16 | ||
Changing font to 14 | ||
New font: 14 | ||
|
||
Built-in font 8. | ||
_FONTWIDTH = 8 | ||
_FONTHEIGHT = 8 | ||
_UFONTHEIGHT = 8 | ||
_ULINESPACING = 8 | ||
_PRINTWIDTH = 760 | ||
_UPRINTWIDTH = 760 | ||
_UCHARPOS = 95 | ||
|
||
Success, images are identical! | ||
Success, images are identical! | ||
|
||
Built-in font 14. | ||
_FONTWIDTH = 8 | ||
_FONTHEIGHT = 14 | ||
_UFONTHEIGHT = 14 | ||
_ULINESPACING = 14 | ||
_PRINTWIDTH = 760 | ||
_UPRINTWIDTH = 760 | ||
_UCHARPOS = 95 | ||
|
||
Success, images are identical! | ||
Success, images are identical! | ||
|
||
Built-in font 16. | ||
_FONTWIDTH = 8 | ||
_FONTHEIGHT = 16 | ||
_UFONTHEIGHT = 16 | ||
_ULINESPACING = 16 | ||
_PRINTWIDTH = 760 | ||
_UPRINTWIDTH = 760 | ||
_UCHARPOS = 95 | ||
|
||
Success, images are identical! | ||
Success, images are identical! | ||
|
||
Loading font from memory () ... done. | ||
_FONTWIDTH = 0 | ||
_FONTHEIGHT = 12 | ||
_UFONTHEIGHT = 15 | ||
_ULINESPACING = 15 | ||
_PRINTWIDTH = 597 | ||
_UPRINTWIDTH = 597 | ||
_UCHARPOS = 95 | ||
|
||
Success, images are identical! | ||
Success, images are identical! | ||
|
||
Loading font from memory (monospace) ... done. | ||
_FONTWIDTH = 16 | ||
_FONTHEIGHT = 16 | ||
_UFONTHEIGHT = 20 | ||
_ULINESPACING = 20 | ||
_PRINTWIDTH = 1520 | ||
_UPRINTWIDTH = 1520 | ||
_UCHARPOS = 95 | ||
|
||
Success, images are identical! | ||
Success, images are identical! | ||
|
||
Loading font from memory (automono) ... done. | ||
_FONTWIDTH = 0 | ||
_FONTHEIGHT = 22 | ||
_UFONTHEIGHT = 27 | ||
_ULINESPACING = 27 | ||
_PRINTWIDTH = 1088 | ||
_UPRINTWIDTH = 1088 | ||
_UCHARPOS = 95 | ||
|
||
Success, images are identical! | ||
Success, images are identical! | ||
|
||
Loading font LiberationSans-Regular.ttf () ... done. | ||
_FONTWIDTH = 0 | ||
_FONTHEIGHT = 12 | ||
_UFONTHEIGHT = 13 | ||
_ULINESPACING = 13 | ||
_PRINTWIDTH = 606 | ||
_UPRINTWIDTH = 606 | ||
_UCHARPOS = 95 | ||
|
||
Success, images are identical! | ||
Success, images are identical! | ||
|
||
Loading font LiberationSans-Regular.ttf (monospace) ... done. | ||
_FONTWIDTH = 15 | ||
_FONTHEIGHT = 16 | ||
_UFONTHEIGHT = 17 | ||
_ULINESPACING = 18 | ||
_PRINTWIDTH = 1425 | ||
_UPRINTWIDTH = 1425 | ||
_UCHARPOS = 95 | ||
|
||
Success, images are identical! | ||
Success, images are identical! | ||
|
||
Loading font LiberationSans-Regular.ttf (automono) ... done. | ||
_FONTWIDTH = 0 | ||
_FONTHEIGHT = 22 | ||
_UFONTHEIGHT = 24 | ||
_ULINESPACING = 25 | ||
_PRINTWIDTH = 1094 | ||
_UPRINTWIDTH = 1094 | ||
_UCHARPOS = 95 | ||
|
||
Success, images are identical! | ||
Success, images are identical! | ||
|
||
Loading font LiberationSerif-Regular.ttf () ... done. | ||
_FONTWIDTH = 0 | ||
_FONTHEIGHT = 12 | ||
_UFONTHEIGHT = 13 | ||
_ULINESPACING = 13 | ||
_PRINTWIDTH = 583 | ||
_UPRINTWIDTH = 583 | ||
_UCHARPOS = 95 | ||
|
||
Success, images are identical! | ||
Success, images are identical! | ||
|
||
Loading font LiberationSerif-Regular.ttf (monospace) ... done. | ||
_FONTWIDTH = 15 | ||
_FONTHEIGHT = 16 | ||
_UFONTHEIGHT = 17 | ||
_ULINESPACING = 18 | ||
_PRINTWIDTH = 1425 | ||
_UPRINTWIDTH = 1425 | ||
_UCHARPOS = 95 | ||
|
||
Success, images are identical! | ||
Success, images are identical! | ||
|
||
Loading font LiberationSerif-Regular.ttf (automono) ... done. | ||
_FONTWIDTH = 0 | ||
_FONTHEIGHT = 22 | ||
_UFONTHEIGHT = 24 | ||
_ULINESPACING = 25 | ||
_PRINTWIDTH = 1063 | ||
_UPRINTWIDTH = 1063 | ||
_UCHARPOS = 95 | ||
|
||
Success, images are identical! | ||
Success, images are identical! | ||
|
||
Loading font LiberationMono-Regular.ttf () ... done. | ||
_FONTWIDTH = 0 | ||
_FONTHEIGHT = 12 | ||
_UFONTHEIGHT = 13 | ||
_ULINESPACING = 13 | ||
_PRINTWIDTH = 665 | ||
_UPRINTWIDTH = 665 | ||
_UCHARPOS = 95 | ||
|
||
Success, images are identical! | ||
Success, images are identical! | ||
|
||
Loading font LiberationMono-Regular.ttf (monospace) ... done. | ||
_FONTWIDTH = 10 | ||
_FONTHEIGHT = 16 | ||
_UFONTHEIGHT = 18 | ||
_ULINESPACING = 18 | ||
_PRINTWIDTH = 950 | ||
_UPRINTWIDTH = 950 | ||
_UCHARPOS = 95 | ||
|
||
Success, images are identical! | ||
Success, images are identical! | ||
|
||
Loading font LiberationMono-Regular.ttf (automono) ... done. | ||
_FONTWIDTH = 13 | ||
_FONTHEIGHT = 22 | ||
_UFONTHEIGHT = 24 | ||
_ULINESPACING = 24 | ||
_PRINTWIDTH = 1235 | ||
_UPRINTWIDTH = 1235 | ||
_UCHARPOS = 95 | ||
|
||
Success, images are identical! | ||
Success, images are identical! | ||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,146 @@ | ||
'----------------------------------------------------------------------------------------------------------------------- | ||
' Base64 Encoder and Decoder library | ||
' a740g | ||
'----------------------------------------------------------------------------------------------------------------------- | ||
|
||
' Converts a normal string or binary data to a base64 string | ||
Function Base64_Encode$ (s As String) | ||
Const BASE64_CHARACTERS = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/" | ||
|
||
Dim srcSize As _Unsigned Long: srcSize = Len(s) | ||
Dim srcSize3rem As _Unsigned Long: srcSize3rem = srcSize Mod 3 | ||
Dim srcSize3mul As _Unsigned Long: srcSize3mul = srcSize - srcSize3rem | ||
Dim buffer As String: buffer = Space$(((srcSize + 2) \ 3) * 4) ' preallocate complete buffer | ||
Dim j As _Unsigned Long: j = 1 | ||
|
||
Dim i As _Unsigned Long: For i = 1 To srcSize3mul Step 3 | ||
Dim char1 As _Unsigned _Byte: char1 = Asc(s, i) | ||
Dim char2 As _Unsigned _Byte: char2 = Asc(s, i + 1) | ||
Dim char3 As _Unsigned _Byte: char3 = Asc(s, i + 2) | ||
|
||
Asc(buffer, j) = Asc(BASE64_CHARACTERS, 1 + (_ShR(char1, 2))) | ||
j = j + 1 | ||
Asc(buffer, j) = Asc(BASE64_CHARACTERS, 1 + (_ShL((char1 And 3), 4) Or _ShR(char2, 4))) | ||
j = j + 1 | ||
Asc(buffer, j) = Asc(BASE64_CHARACTERS, 1 + (_ShL((char2 And 15), 2) Or _ShR(char3, 6))) | ||
j = j + 1 | ||
Asc(buffer, j) = Asc(BASE64_CHARACTERS, 1 + (char3 And 63)) | ||
j = j + 1 | ||
Next i | ||
|
||
' Add padding | ||
If srcSize3rem > 0 Then | ||
char1 = Asc(s, i) | ||
|
||
Asc(buffer, j) = Asc(BASE64_CHARACTERS, 1 + (_ShR(char1, 2))) | ||
j = j + 1 | ||
|
||
If srcSize3rem = 1 Then | ||
Asc(buffer, j) = Asc(BASE64_CHARACTERS, 1 + (_ShL(char1 And 3, 4))) | ||
j = j + 1 | ||
Asc(buffer, j) = 61 ' "=" | ||
j = j + 1 | ||
Asc(buffer, j) = 61 ' "=" | ||
Else ' srcSize3rem = 2 | ||
char2 = Asc(s, i + 1) | ||
|
||
Asc(buffer, j) = Asc(BASE64_CHARACTERS, 1 + (_ShL((char1 And 3), 4) Or _ShR(char2, 4))) | ||
j = j + 1 | ||
Asc(buffer, j) = Asc(BASE64_CHARACTERS, 1 + (_ShL(char2 And 15, 2))) | ||
j = j + 1 | ||
Asc(buffer, j) = 61 ' "=" | ||
End If | ||
End If | ||
|
||
Base64_Encode = buffer | ||
End Function | ||
|
||
|
||
' Converts a base64 string to a normal string or binary data | ||
Function Base64_Decode$ (s As String) | ||
Dim srcSize As _Unsigned Long: srcSize = Len(s) | ||
Dim buffer As String: buffer = Space$((srcSize \ 4) * 3) ' preallocate complete buffer | ||
Dim j As _Unsigned Long: j = 1 | ||
Dim As _Unsigned _Byte index, char1, char2, char3, char4 | ||
|
||
Dim i As _Unsigned Long: For i = 1 To srcSize Step 4 | ||
index = Asc(s, i): GoSub find_index: char1 = index | ||
index = Asc(s, i + 1): GoSub find_index: char2 = index | ||
index = Asc(s, i + 2): GoSub find_index: char3 = index | ||
index = Asc(s, i + 3): GoSub find_index: char4 = index | ||
|
||
Asc(buffer, j) = _ShL(char1, 2) Or _ShR(char2, 4) | ||
j = j + 1 | ||
Asc(buffer, j) = _ShL(char2 And 15, 4) Or _ShR(char3, 2) | ||
j = j + 1 | ||
Asc(buffer, j) = _ShL(char3 And 3, 6) Or char4 | ||
j = j + 1 | ||
Next i | ||
|
||
' Remove padding | ||
If Right$(s, 2) = "==" Then | ||
buffer = Left$(buffer, Len(buffer) - 2) | ||
ElseIf Right$(s, 1) = "=" Then | ||
buffer = Left$(buffer, Len(buffer) - 1) | ||
End If | ||
|
||
Base64_Decode = buffer | ||
Exit Function | ||
|
||
find_index: | ||
If index >= 65 And index <= 90 Then | ||
index = index - 65 | ||
ElseIf index >= 97 And index <= 122 Then | ||
index = index - 97 + 26 | ||
ElseIf index >= 48 And index <= 57 Then | ||
index = index - 48 + 52 | ||
ElseIf index = 43 Then | ||
index = 62 | ||
ElseIf index = 47 Then | ||
index = 63 | ||
End If | ||
Return | ||
End Function | ||
|
||
|
||
' This function loads a resource directly from a string variable or constant (like the ones made by Bin2Data) | ||
Function Base64_LoadResourceString$ (src As String, ogSize As _Unsigned Long, isComp As _Byte) | ||
' Decode the data | ||
Dim buffer As String: buffer = Base64_Decode(src) | ||
|
||
' Expand the data if needed | ||
If isComp Then buffer = _Inflate$(buffer, ogSize) | ||
|
||
Base64_LoadResourceString = buffer | ||
End Function | ||
|
||
|
||
' Loads a binary file encoded with Bin2Data | ||
' Usage: | ||
' 1. Encode the binary file with Bin2Data | ||
' 2. Include the file or it's contents | ||
' 3. Load the file like so: | ||
' Restore label_generated_by_bin2data | ||
' Dim buffer As String | ||
' buffer = Base64_LoadResourceData ' buffer will now hold the contents of the file | ||
Function Base64_LoadResourceData$ | ||
Dim ogSize As _Unsigned Long, resize As _Unsigned Long, isComp As _Byte | ||
Read ogSize, resize, isComp ' read the header | ||
|
||
Dim buffer As String: buffer = Space$(resize) ' preallocate complete buffer | ||
|
||
' Read the whole resource data | ||
Dim i As _Unsigned Long: Do While i < resize | ||
Dim chunk As String: Read chunk | ||
Mid$(buffer, i + 1) = chunk | ||
i = i + Len(chunk) | ||
Loop | ||
|
||
' Decode the data | ||
buffer = Base64_Decode(buffer) | ||
|
||
' Expand the data if needed | ||
If isComp Then buffer = _Inflate$(buffer, ogSize) | ||
|
||
Base64_LoadResourceData = buffer | ||
End Function |
Oops, something went wrong.