Welcome to my newest 2D Truecolor Game Lib in FB: AFlib III.

User projects written in or related to FreeBASIC.
Adigun A. Polack
Posts: 231
Joined: May 27, 2005 15:14
Contact:

Re: Welcome to my newest 2D Truecolor Game Lib in FB: AFlib III.

Post by Adigun A. Polack »

Alright... in honor of my very, very special birthday coming up this Saturday, May 28, 2016 where I will officially turn 39 years old (wow, I am REALLY getting up there now, aren’t I? Older but a whole lot wiser, as they say!!! (^-^)v !! ), I have just now brought out today a major, major update to AFlib III for you guys and gals where this very FB game-creation library indeed now has full-on sound and music support for both the 32- and 64-bit editions of FreeBASIC!!! Feel free to download this newest version at once, thoroughly tested and certified *completely* virus-free right here:
Image

You see, thanks to the built-in SDL sound mixers that originally first came with FreeBASIC v1.02 or higher (32- and 64-bit editions), I have fully created my own rather special easier-to-use custom AFlib III PCM Music/Sound Driver that definitely supports as many as a WHOPPING 32 channels simultaneously with which for you to play your .ogg/.mp3/.aiff/.wav sound effects quite effortlessly, as well as an additional separate channel of full digital background music that supports quite around any .ogg/.mp3/.aiff/.wav music piece you want, as well as extra MOD-music support in so many ways, also!! Meaning, that all these types of MOD-based music files are fully available right out of the gate:
  • .MOD (Amiga/ProTracker Module File)
    .S3M (ScreamTracker 3 Module File)
    .XM (FastTracker 2 Extended Module File)
    .IT (Impulse Tracker Music Module File)
    .669 (669 Tracker Module File)
    .MED (Amiga MED/OctaMed Tracker Module Sound File)
    .MTM (MultiTracker Music Module File)
    .OKT (Oktalyzer Tracker Module)
    .MPTM (OpenMPT Modules)
...and for more on how to get it all to work nice and easily, please be sure to immediately check out both “AF3_welcome_BGMver.bas” and “AF3_SFXchannel_test.bas” (which are found in this current newest update of AFlib III, by the way!) where they first open up with some clear, simple instructions for you in how to do this before the rest of those two new programs themselves are shown. As for all the music, sound-fx, and voice examples that are featured in those two examples there for this very update... I, Adigun Azikiwe Polack, created it all myself in less than two weeks’ time... including all the intro/demo music here, too!!! You are gonna love ‘em, I hugely promise!!

To help get you off and running on my new sound driver here with this new version of AFlib III, here is a BRAND-NEW source code snippet that illustrates this for you right now!!! ;)

Code: Select all

'-------------------------------------------------------------------------------
' NOTE: This FB code snippet requires AFlib III v0.91 or higher to run!!  ;)
'-------------------------------------------------------------------------------

#ifdef __FB_64BIT__
  #include "AFlib3_64bit_MusicSound.bi"
  #include "AFlib3_64bit_Palette.bi"
  #include "AFlib3_64bit_Miscellaneous.bi"
#else
  #include "AFlib3_MusicSound.bi"
  #include "AFlib3_Palette.bi"
  #include "AFlib3_Miscellaneous.bi"
#endif


ScreenRes 640, 400, 24, , 0


' First, we initialize our AFlib III PCM Music/Sound System, with an
' average audio bit-rate quality of 22050, Stereo sound.
'----------------------------------------------------------------------
AFlibIII_Initialize_PCM 22050   '<------ You may raise up the bit-rate to a maximum top quality
                                '        of 44100, if your computer is capable of supporting this.

AFlibIII_PCM_AdjustVolumeBGM 64 '<------ Set the global music volume level to any number you want,
                                '        up to a maximum of 128.  The higher the number, the louder.


' Next, we play a .MOD-based music piece through the use of this
' simple command "AFlibIII_MOD_PlayBGM":
'----------------------------------------------------------------------
AFlibIII_MOD_PlayBGM "sample.mod" '<------ Place any .MOD, .669, .S3M, .XM, .IT, .MTM, .OKT, .MED,
                                  '        or .MPTM music filename here.

Color EGAcol(15): ? "Now playing .MOD music."
Color EGAcol(7): ? "Press any key to play some .OGG music..."
Sleep
Cls


' Then, we give an .OGG-based music piece a shot with the command
' "AFlibIII_OGG_PlayBGM":
'----------------------------------------------------------------------
AFlibIII_OGG_PlayBGM "sample.ogg" '<------ Place any .OGG music filename here.

Color EGAcol(15): ? "Now playing .OGG music."
Color EGAcol(7): ? "Press any key to play some .MP3 music..."
Sleep
Cls


' And then, let's play an .MP3-music piece with the command called
' "AFlibIII_MP3_PlayBGM":
'----------------------------------------------------------------------
AFlibIII_MP3_PlayBGM "sample.mp3" '<------ Place any .MP3 music filename here.

Color EGAcol(15): ? "Now playing .MP3 music."
Color EGAcol(7): ? "Press any key to play some .WAV music..."
Sleep
Cls


' Now, with the command called "AFlibIII_PCM_PlayBGM", a .WAV-music or
' .AIFF-music piece will be be played right here:
'----------------------------------------------------------------------
AFlibIII_PCM_PlayBGM "sample.wav" '<------ Place any .WAV or .AIFF music filename here.

Color EGAcol(15): ? "Now playing .WAV music."
Color EGAcol(7): ? "Press any key to end, please."
Sleep


' Finally, we safely remove our AFlib III PCM Music/Sound driver from
' our program so that we can avoid any memory leaks when the run-time
' of it ends.  And the way to do exactly that is by simply using this
' easy one command known as "AFlibIII_DeInit_PCM".  ;)
'----------------------------------------------------------------------
AFlibIII_DeInit_PCM


' A wonderful good night, everyone, as we close this program here!!!
'----------------------------------------------------------------------
AFlibIII_EndProgram


And please be sure to grab quite some excellent MOD-musics at The MOD Archive website right here so that you can try this new custom-made driver out, too!!

Remember now, in order for the new AFlib III PCM Music/Sound Driver to work here, FreeBASIC v1.02 or higher is required. Outside of the full music/sound support though, all other aspects of this entire game-creation library of AFlib III (graphics, fonts, sprites, palettes, score rankings, high-score saves, memory-based screen storages, etc.) run natively in FreeBASIC v0.20 or higher without even requiring any .DLL-file dependencies like that whatsoever. ;*) !!

In the “AFlib3_Palette.bi” and “AFlib3_64bit_Palette.bi” modules, I changed the names of the following:
  • AFlibIII_FadeEGA
    AFlibIII_FadeNES
    AFlibIII_FadeSMS
    AFlibIII_FadeGB
    AFlibIII_FadeC64
    AFlibIII_FadeCPC
...to these:
  • AFlibIII_MachineFade_EGA
    AFlibIII_MachineFade_NES
    AFlibIII_MachineFade_SMS
    AFlibIII_MachineFade_GB
    AFlibIII_MachineFade_C64
    AFlibIII_MachineFade_CPC
...since they do sound a whole lot better and more natural in name now, considering that I DO remember quite a ton about the ins and outs of classic retro home computers quite very seriously as I grew up from during the 1980s era, of course!!! ^^=b !

And — inspired by MrSwiss himself who originally first started this QUITE excellent recent topic about different proper global Date-adjustment setups in the “Tips and Tricks” section of this very forumboard of ours here — in the “AFlib3_Miscellaneous.bi” and “AFlib3_64bit_Miscellaneous.bi” modules, I added in these two new commands:
  • AFlibIII_TinyDate_Dash
    AFlibIII_TinyDate_European
...and updated this command:
  • AFlibIII_TinyDate
...to top things off nicely. Thank you so much for showing me that great little inspiration there, MrSwiss!!! ;) !!

Finally, as promised to MrSwiss and to every one of you as well now, I made very *slight* little adjustments to the included source codes of “AF3_ANSIviewer.bas”, “AF3_BMPload_to_ASCii.bas”, “AF3_BMPload_to_ASCii_DB32.bas”, “AF3_BMPload_to_Truecolor_ASCii.bas”, “AF3_img_colorconversion.bas”, and “AF3_img_ditheredBMPload.bas” to where they become even more user-friendly in showing you the palette/ASCii conversions and more that they can all give you in the so many things that AFlib III has to offer. So now, for example, when no ANSI-picture (.ANS) file has been loaded at all into the run-time of “AF3_ANSIviewer.bas”, it should simply take you to my ALL-NEW and original ANSI-based design welcoming you to AFlib III (I made that design in only just a few days since this past weekend, really!!).

And with all of that said and done, everybody, do wish me quite a TRULY happy birthday for 2016 as I personally invite you to check out and thoroughly enjoy this overall dramatically big update to AFlib III for both the 32- and 64-bit editions of FreeBASIC. THANK YOU all ever so much once again, ladies and gentlemen of our FB entire community, and I hugely appreciate your tremendous continued support of this original FB game-creation lib here!!! (^_~)=b !!!
srvaldez
Posts: 3373
Joined: Sep 25, 2005 21:54

Re: Welcome to my newest 2D Truecolor Game Lib in FB: AFlib III.

Post by srvaldez »

Happy birthday Adigun :)

wow, this is simply awesome, thank you. :)
MrSwiss
Posts: 3910
Joined: Jun 02, 2013 9:27
Location: Switzerland

Re: Welcome to my newest 2D Truecolor Game Lib in FB: AFlib III.

Post by MrSwiss »

Hi Aldigun, happy Birthday,

I'm of course the one, that has to find the 'Hair in the Soup'.
In your Date Function: AFlibIII_TinyDate there is a problem:

Code: Select all

Format(Now, "yyyy/mm/dd")    ' returns nonsense!
Apparently a 'Format' issue.

I'd use ExDate() (internally defined as 'private') and then let AFlibIII_TinyDate just
call ExDate(correct param.) to deliver the correctly formatted String ...
All your Date related Fuctions could be changed to (internally) simply call ExDate.
See my description of doing that with: AFlibIII_CurrentYear ... in Code!

Example:

Code: Select all

Function ExDate (ByVal p As UByte = 0) As String
	Dim As String	tmp = Date, sDD, sMM, sYY

	sMM = Left(tmp, 2) : sYY = Right(tmp, 4)
	sDD = Mid(tmp, 4, 2)

	Select Case As Const p	' faster than 'Select Case p' (no 'Is' alowed!)
		Case 0		:	Return tmp							' US
		Case 1		:	Return sYY + "-" + sMM + "-" + sDD	' ISO
		Case 2		:	Return sDD + "." + sMM + "." + sYY	' germanic
		Case 3		:	Return sDD + "/" + sMM + "/" + sYY	' latinic
		Case 4		:	Return sMM + "-" + sYY				' US-short
		Case 5		:	Return sYY + "-" + sMM				' ISO short (legal ???)
		Case 6		:	Return sMM + "." + sYY				' ger-short
		Case 7		:	Return sMM + "/" + sYY				' lat-short
		Case 8		:	Return sYY							' Year only
		Case 9		:	Return sMM							' Month only
		Case 10		:	Return sDD							' Day only
		Case 11		:	Return sDD + "*" + sMM + "*" + sYY	' custom1
		Case 12		:	Return sDD + "#" + sMM + "#" + sYY	' custom2
		Case 13		:	Return sMM + "*" + sDD + "*" + sYY	' custom3
		Case 14		:	Return sMM + "#" + sDD + "#" + sYY	' custom4
		Case 15		:	Return sYY + " ^o-o^ " + sMM + " V+|+V " + sDD + " ;-)"	' aldigun special
		Case Else	:	Return "ERROR: 'p' out of Range!"
	End Select
End Function

/'
'==============================================================
' from AF3lib as currently defined (goes for Month & Day also!)
'--------------------------------------------------------------
Declare Function AFlibIII_CurrentYear() as Double
'--------------------------------------------------------------
' instead use:
'--------------------------------------------------------------
Declare AFlibIII_CurrentYear() as String
'--------------------------------------------------------------
' implement as:
'--------------------------------------------------------------
Function AFlibIII_CurrentYear() as String
	return ExDate(8)	' ExDate() declared as PRIVATE (inside LIB only accessible)
End Function
'==============================================================
' to simplify internal Structures (a little Birthday Present from me!)
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
' similarly you could modify all your other Date Functions ...
' the idea is: only ONE (internal) Function, that does it all.
' the other Functions are just using it (in your pre-defined way).
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
' Side-Benefit: you don't need to include "vbcompat.bi" if there
' are no other routines (of you) present, that are using it!
'==============================================================
'/

For i As Long = -1 To 16
	If i = 15 Then
		Print ExDate(i), "p = " & i & "  Aldigun-Special! ... by MrSwiss"
	Else
		Print ExDate(i), "p = " & i
	End If
Next
Print : Print "press a key to quit!"
sleep
Parameter 15 = very specially for your Birthday = totally NEW defined 'Aldigun-Special' Date-String ...
Just compile and run to see, - lol -, enjoy ...

BTW: tested your example code and got "no sound at all" (I've of course modified the "filename" to load.) ???
Tested FBC WIN 64 ... : compile OK (no error/no warning), prog. runns just ... silent !!
Adigun A. Polack
Posts: 231
Joined: May 27, 2005 15:14
Contact:

Re: Welcome to my newest 2D Truecolor Game Lib in FB: AFlib III.

Post by Adigun A. Polack »

MrSwiss, you wrote:Hi Aldigun, happy Birthday,

I'm of course the one, that has to find the 'Hair in the Soup'.
In your Date Function: AFlibIII_TinyDate there is a problem:

Code: Select all

Format(Now, "yyyy/mm/dd")    ' returns nonsense!
Apparently a 'Format' issue.

I'd use ExDate() (internally defined as 'private') and then let AFlibIII_TinyDate just
call ExDate(correct param.) to deliver the correctly formatted String ...
All your Date related Fuctions could be changed to (internally) simply call ExDate.
See my description of doing that with: AFlibIII_CurrentYear ... in Code!

Example:

Code: Select all

Function ExDate (ByVal p As UByte = 0) As String
	Dim As String	tmp = Date, sDD, sMM, sYY

	sMM = Left(tmp, 2) : sYY = Right(tmp, 4)
	sDD = Mid(tmp, 4, 2)

	Select Case As Const p	' faster than 'Select Case p' (no 'Is' alowed!)
		Case 0		:	Return tmp							' US
		Case 1		:	Return sYY + "-" + sMM + "-" + sDD	' ISO
		Case 2		:	Return sDD + "." + sMM + "." + sYY	' germanic
		Case 3		:	Return sDD + "/" + sMM + "/" + sYY	' latinic
		Case 4		:	Return sMM + "-" + sYY				' US-short
		Case 5		:	Return sYY + "-" + sMM				' ISO short (legal ???)
		Case 6		:	Return sMM + "." + sYY				' ger-short
		Case 7		:	Return sMM + "/" + sYY				' lat-short
		Case 8		:	Return sYY							' Year only
		Case 9		:	Return sMM							' Month only
		Case 10		:	Return sDD							' Day only
		Case 11		:	Return sDD + "*" + sMM + "*" + sYY	' custom1
		Case 12		:	Return sDD + "#" + sMM + "#" + sYY	' custom2
		Case 13		:	Return sMM + "*" + sDD + "*" + sYY	' custom3
		Case 14		:	Return sMM + "#" + sDD + "#" + sYY	' custom4
		Case 15		:	Return sYY + " ^o-o^ " + sMM + " V+|+V " + sDD + " ;-)"	' aldigun special
		Case Else	:	Return "ERROR: 'p' out of Range!"
	End Select
End Function

/'
'==============================================================
' from AF3lib as currently defined (goes for Month & Day also!)
'--------------------------------------------------------------
Declare Function AFlibIII_CurrentYear() as Double
'--------------------------------------------------------------
' instead use:
'--------------------------------------------------------------
Declare AFlibIII_CurrentYear() as String
'--------------------------------------------------------------
' implement as:
'--------------------------------------------------------------
Function AFlibIII_CurrentYear() as String
	return ExDate(8)	' ExDate() declared as PRIVATE (inside LIB only accessible)
End Function
'==============================================================
' to simplify internal Structures (a little Birthday Present from me!)
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
' similarly you could modify all your other Date Functions ...
' the idea is: only ONE (internal) Function, that does it all.
' the other Functions are just using it (in your pre-defined way).
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
' Side-Benefit: you don't need to include "vbcompat.bi" if there
' are no other routines (of you) present, that are using it!
'==============================================================
'/

For i As Long = -1 To 16
	If i = 15 Then
		Print ExDate(i), "p = " & i & "  Aldigun-Special! ... by MrSwiss"
	Else
		Print ExDate(i), "p = " & i
	End If
Next
Print : Print "press a key to quit!"
sleep
Parameter 15 = very specially for your Birthday = totally NEW defined 'Aldigun-Special' Date-String ...
Just compile and run to see, - lol -, enjoy ...
Well first of all, MrSwiss, your code that you just presented to me makes such perfectly awesome sense, as it truly and genuinely works 100% without even having to rely on “vbcompat.bi” whatsoever, so wisely well spotted... optimizations and all!! :D I did not even know about that one, either!

Image

Thank you quite so very much for pointing this out to me... well appreciated to you for the fine gift!!! ;)

And about my sample code for my newly custom AFlib III PCM Music/Sound Driver that was shown to you in my previous post, you replied:
BTW: tested your example code and got "no sound at all" (I've of course modified the "filename" to load.) ???
Tested FBC WIN 64 ... : compile OK (no error/no warning), prog. runns just ... silent !!
In the case of the current version (v1.05) of FreeBASIC 64-bit edition that you are using, MrSwiss, have you tried the following in this order:
  • _______________________________________________________________________________
    1 • In the AFlib III v0.91 beta test .ZIP distribution, be sure to look for and access the following folder entitled...
    All the proper SDL_mixer DLLs for AFlib III's Custom PCM Music and Sound Driver in FreeBASIC!!!
    ...where you will then see two folders in there: “32-bit” and “64-bit”.

    2 • Next, access the “64-bit” folder.

    3 • Once there, please be sure to copy and place the following seven (7) necessary included .DLLs...


    [list]• libmodplug-1.dll
    • libogg-0.dll
    • libvorbis-0.dll
    • libvorbisfile-3.dll
    • SDL2.dll
    • SDL2_mixer.dll
    • smpeg2.dll

...into the *exact* target directory where your just-compiled AFlib III example Sound Driver code snippet is located under. If you do all this right, the sound should come up with no problems the next time you run your program. ;)
_______________________________________________________________________________[/list]

I have tested and followed all these steps myself closely and thoroughly on my current computer running Windows 10 (64-bit), and all the sound came out A-OK on mine when I ran the code. SDL can be rather tricky and a pain to use sometimes for successfully implementing and producing sound/music in FreeBASIC, but, I only want to make sure the sound and music finally works on your computer here on the run-time of that newest AFlib III code snippet of mine from my previous post, too. So MrSwiss, if you have not yet tried these steps that I have just now shown you here in this post, do give them a shot and please let me know as soon as you can, ok now? Thank you so much once again and fingers crossed!!! ^^=b !
MrSwiss
Posts: 3910
Joined: Jun 02, 2013 9:27
Location: Switzerland

Re: Welcome to my newest 2D Truecolor Game Lib in FB: AFlib III.

Post by MrSwiss »

Adigun A. Polack wrote:3 • Once there, please be sure to copy and place the following seven (7) necessary included .DLLs...
• libmodplug-1.dll
• libogg-0.dll
• libvorbis-0.dll
• libvorbisfile-3.dll
• SDL2.dll
• SDL2_mixer.dll
• smpeg2.dll
You're completely right, some of the *7* where missing. Actually I've just had the 2 SDL*.dll's there.
What I find disturbing is: every one of the "missing" Lib's should have kicked an ERROR on compile?!?

Do you have any idea, why this wasn't the case?

My slightly modified AFIIILIB_Test1.bas:

Code: Select all

'-------------------------------------------------------------------------------
' NOTE: This FB code snippet requires AFlib III v0.91 or higher to run!!  ;)
'-------------------------------------------------------------------------------

#ifdef __FB_64BIT__
  #Include "AFlib3_64bit_MusicSound.bi"
  '#include "AF3_sound64_T.bi"
  #include "AFlib3_64bit_Palette.bi"
  #include "AFlib3_64bit_Miscellaneous.bi"
#else
  #include "AFlib3_MusicSound.bi"
  #include "AFlib3_Palette.bi"
  #include "AFlib3_Miscellaneous.bi"
#endif


ScreenRes 640, 400, 24, , 0


' First, we initialize our AFlib III PCM Music/Sound System, with an
' average audio bit-rate quality of 22050, Stereo sound.
'----------------------------------------------------------------------
AFlibIII_Initialize_PCM 44100   '<------ You may raise up the bit-rate to a maximum top quality
                                '        of 44100, if your computer is capable of supporting this.

AFlibIII_PCM_AdjustVolumeBGM 128 '<------ Set the global music volume level to any number you want,
                                '        up to a maximum of 128.  The higher the number, the louder.


' Next, we play a .MOD-based music piece through the use of this
' simple command "AFlibIII_MOD_PlayBGM":
'----------------------------------------------------------------------
AFlibIII_MOD_PlayBGM "sound/tjc-mars-invasion.mod" '<------ Place any .MOD, .669, .S3M, .XM, .IT, .MTM, .OKT, .MED,
                                  '        or .MPTM music filename here.

Color EGAcol(14): ? AFlibIII_TinyDate_European(2), AFlibIII_TinyDate_Dash(), AFlibIII_TinyDate()
Color EGAcol(15): ? "Now playing .MOD music."
Color EGAcol(7): ? "Press any key to play some .OGG music..."
Sleep
Cls


' Then, we give an .OGG-based music piece a shot with the command
' "AFlibIII_OGG_PlayBGM":
'----------------------------------------------------------------------
AFlibIII_OGG_PlayBGM "sound/AF3_OGG_Demo-BGM1.ogg" '<------ Place any .OGG music filename here.

Color EGAcol(13): ? AFlibIII_TinyDate_European(2), AFlibIII_TinyDate_Dash(), AFlibIII_TinyDate(1)
Color EGAcol(15): ? "Now playing .OGG music."
Color EGAcol(7): ? "Press any key to play some .MP3 music..."
Sleep
Cls


' And then, let's play an .MP3-music piece with the command called
' "AFlibIII_MP3_PlayBGM":
'----------------------------------------------------------------------
AFlibIII_MP3_PlayBGM "sound/AF3_note-C1.mp3" '<------ Place any .MP3 music filename here.

Color EGAcol(12): ? AFlibIII_TinyDate_European(2), AFlibIII_TinyDate_Dash(), AFlibIII_TinyDate(1)
Color EGAcol(15): ? "Now playing .MP3 music."
Color EGAcol(7): ? "Press any key to play some .WAV music..."
Sleep
Cls


' Now, with the command called "AFlibIII_PCM_PlayBGM", a .WAV-music or
' .AIFF-music piece will be be played right here:
'----------------------------------------------------------------------
AFlibIII_PCM_PlayBGM "sound/applause.wav" '<------ Place any .WAV or .AIFF music filename here.

Color EGAcol(11): ? AFlibIII_TinyDate_European(2), AFlibIII_TinyDate_Dash(), AFlibIII_TinyDate(1)
Color EGAcol(15): ? "Now playing .WAV music."
Color EGAcol(7): ? "Press any key to end, please."
Sleep


' Finally, we safely remove our AFlib III PCM Music/Sound driver from
' our program so that we can avoid any memory leaks when the run-time
' of it ends.  And the way to do exactly that is by simply using this
' easy one command known as "AFlibIII_DeInit_PCM".  ;)
'----------------------------------------------------------------------
AFlibIII_DeInit_PCM


' A wonderful good night, everyone, as we close this program here!!!
'----------------------------------------------------------------------
AFlibIII_EndProgram
See the tests with "DATE" stuff ...

In the "includes" for __FB_64BIT__ you might note: commented out a.t.m. #include "AF3_sound64_T.bi"
this is a modified version of the original, where I've replaced all your "Integer<32>" definitions with "Long".
Both of them work equally well ... (another possible optimization perhaps?).
Adigun A. Polack
Posts: 231
Joined: May 27, 2005 15:14
Contact:

Re: Welcome to my newest 2D Truecolor Game Lib in FB: AFlib III.

Post by Adigun A. Polack »

MrSwiss just replied once more to me and wrote:
Adigun A. Polack wrote:3 • Once there, please be sure to copy and place the following seven (7) necessary included .DLLs...
• libmodplug-1.dll
• libogg-0.dll
• libvorbis-0.dll
• libvorbisfile-3.dll
• SDL2.dll
• SDL2_mixer.dll
• smpeg2.dll
You're completely right, some of the *7* where missing. Actually I've just had the 2 SDL*.dll's there.
What I find disturbing is: every one of the "missing" Lib's should have kicked an ERROR on compile?!?

Do you have any idea, why this wasn't the case?
That is QUITE a rather great question, MrSwiss. ^-^ !! You know something, I was wondering truly the exact, *exact* same way myself regarding why those missing lib .DLLs should clearly have indeed given the user an error message showing that they were all required as well in order to make sure all the sounds and music are working perfectly on that sample AFlib III sound driver code snippet. While I have currently no direct clear answers yet to this extremely perplexing dilemma myself, all I do know — from what I can honestly remember — is that when the run-time binaries to SDL2_mixer-2.0.1 (which can be found in 32- and 64-bit varieties for Windows here) were first officially released just this year on v2.0.1 as that particular specific version of this I am taking about now, and when I first downloaded them and tried them all out in FreeBASIC v1.02 or higher, during the compile of any program that uses these SDL mixers, there was simply *no* error checking to let us know that the remaining .DLLs that you and I are talking about were required (apart from “SDL2.dll” and “SDL2_mixer.dll” as the only two alone; they do not check the other libs on compile, for some inexplicably bizarre reason!). I was so definitely baffled like “What!?”, because that was the very part that truly bewildered me and actually frustrated me the most, in overall terms of me first figuring out how to get all the music and sound FX to work in so many different digital sound file formats, you know what I am saying? Hence, the SDL sound mixers (SDL2_mixers) can be quite rather temperamental and a real pain in the you-know-what indeed to use sometimes. Heck, even I had a truly rather plain difficult time at one point in trying to even get the sound system to work amazingly well. :( And believe me, when it comes to my SDL-based AFlib III custom Music/Sound Driver in FreeBASIC, it was quite a true and arduous uphill climb to the glorious top, let me tell you for sure... but I am glad it all eventually worked out seriously well in the end!!! :D

And as for your overall comment furthermore just now, MrSwiss, I found it all rather interesting and well-insightfully worth it. Deeply noted, and I thank you once again for your wonderful time today!!! ^-^=b !!
MrSwiss
Posts: 3910
Joined: Jun 02, 2013 9:27
Location: Switzerland

Re: Welcome to my newest 2D Truecolor Game Lib in FB: AFlib III.

Post by MrSwiss »

@Adigun,

just in case you are interested, there are quite a few routines in, e.g. "misc." that could be improved ...
Problem is, your restrictive Licensing terms (in short): no change allowed *at all* !

Just to give you an Idea of what I'd change in future versions:

Code: Select all

' changed declarations ...
Declare Function AFlibIII_LongMonthName ( ByVal Mth_Format As UByte = 0 ) As String
Declare Function AFlibIII_LongMonthName_UC () As String
Declare Function AFlibIII_LongMonthName_LC () As String

' changed implementations ...
Function AFlibIII_LongMonthName ( ByVal Mth_Format As UByte = 0 ) As String
  
  Dim WholeMonth as String
  Select Case as Const Month(Now)
    Case  1: WholeMonth = "January"
    Case  2: WholeMonth = "February"
    Case  3: WholeMonth = "March"
    Case  4: WholeMonth = "April"
    Case  5: WholeMonth = "May"
    Case  6: WholeMonth = "June"
    Case  7: WholeMonth = "July"
    Case  8: WholeMonth = "August"
    Case  9: WholeMonth = "September"
    Case 10: WholeMonth = "October"
    Case 11: WholeMonth = "November"
    Case 12: WholeMonth = "December"
  End Select
  ' above: original (except added parameter: Mth_Format), below: MrSwiss addition ...  
  Select Case As Const Mth_Format
  	Case 0		:	Return WholeMonth
  	Case 1		:	Return UCase(WholeMonth)
  	Case 2		:	Return LCase(WholeMonth)
  	Case Else	:	Return "ERROR: Mth_Format out of range!"
  End Select

End Function

' the following 2 Functions newly coded to completely replace the complex older routines ...
Function AFlibIII_LongMonthName_UC () As String
	Return AFlibIII_LongMonthName ( 1 )
End Function

Function AFlibIII_LongMonthName_LC () As String
	Return AFlibIII_LongMonthName ( 2 )
End Function
Little changes, that have a rather large impact on Code-Length,
Code-Maintainability and Code-Readability ... and *last, but not least*: SPEED !!!

Above is just an Example, your SCORE Routines look far more promising, to gain largely, by improving
however, I've jet to understand the reason to *need to know* every single digit ??? Why *Double* ???

As you might have guessed: I'm a lazy *typer* (I can't do 10 finger typing), not to be confused with:
lazy programmer.
Adigun A. Polack
Posts: 231
Joined: May 27, 2005 15:14
Contact:

Re: Welcome to my newest 2D Truecolor Game Lib in FB: AFlib III.

Post by Adigun A. Polack »

Okay now. It has gotta be quite time for a brand-new update to AFlib III, and what an update it is as according to what I have got in store for all of you now, as it has been exactly a couple of months since the previous one. Go and download this very latest v0.92 beta test version of this original FB game-creation library right here, as it is thoroughly tested virus-free as always:
Image

First off, since the previous license terms of mine were indeed too restrictive here as MrSwiss wisely pointed out to me in his previous post in this very thread, I went ahead and decided to change the license for AFlib III to the GNU General Public License, which I think should be quite a perfect fit for this type of game library in FreeBASIC truly, since AFlib III is *indeed* free software, after all, as the screen above this paragraph simply indicates. ;)

By the way, in case anyone is wondering about my Score Routines in AFlib III, the score can be up to a absolute maximum of 15 digits long, if you wish to. For this newest v0.92 beta indeed, since the “Double” data type is as way slow as molasses when it comes to speed itself (since it is most largely measured by huge floating-point decimals, as far as I can clearly remember now), I have changed all of the AFlib III Score Routines to “ULongInt” as my newest sure data type here, since it measures itself now by whole numbers, which likely optimizes itself to be a lot faster than “Double” (if my memory serves me correctly here) while actually maintaining support for up to a maximum 15 digits indeed for any one score!! ^^

Now additionally here, I have carefully reworked the entire AFlib III Sprite Blitters to better fit with the proper translucency effects rather smoothly for both the ASCii and Graphical versions. And, in the “AFlib3_Font.bi” and “AFlib3_64bit_Font.bi” modules, I removed the following commands:
  • • AFlibIII_OptimizedPrintSPECIAL
    • AFlibIII_OptimizedPrintSPECIAL_alpha
    • AFlibIII_OptimizedPrintSPECIAL_add
    • AFlibIII_OptimizedPrintSPECIAL_firefly
    • AFlibIII_OptimizedPrintSPECIAL_color
    • AFlibIII_OptimizedPrintSPECIAL_tint
    • AFlibIII_OptimizedPrintSPECIAL_greyscale
    • AFlibIII_OptimizedPrintSPECIAL_greytint
    • AFlibIII_OptimizedPrintSPECIAL_inverse
    • AFlibIII_OptimizedPrintSPECIAL_invtint
    • AFlibIII_OptimizedPrintSPECIAL_inversegrey
    • AFlibIII_OptimizedPrintSPECIAL_invgreytint
    • AFlibIII_OptimizedPrintSPECIAL_overlay
...since not only were they too derivative for their own good, but they also messed up the centering rather plain horribly, as well! :*( However, in the “AFlib3_Sprite.bi” and “AFlib3_64bit_Sprite.bi” modules, I added these brand-new commands:
  • • AFlibIII_SprBlitPeek
    • AFlibIII_SprBlitPeek_alpha
    • AFlibIII_SprBlitPeek_add
    • AFlibIII_SprBlitPeek_firefly
    • AFlibIII_SprBlitPeek_color
    • AFlibIII_SprBlitPeek_tint
    • AFlibIII_SprBlitPeek_greyscale
    • AFlibIII_SprBlitPeek_greytint
    • AFlibIII_SprBlitPeek_inverse
    • AFlibIII_SprBlitPeek_invtint
    • AFlibIII_SprBlitPeek_inversegrey
    • AFlibIII_SprBlitPeek_invgreytint
    • AFlibIII_SprBlitPeek_overlay
    • AFlibIII_PP256_SprBlitPeek
    • AFlibIII_PP256_SprBlitPeek_alpha
    • AFlibIII_PP256_SprBlitPeek_add
    • AFlibIII_PP256_SprBlitPeek_firefly
    • AFlibIII_PP256_SprBlitPeek_color
    • AFlibIII_PP256_SprBlitPeek_tint
    • AFlibIII_PP256_SprBlitPeek_greyscale
    • AFlibIII_PP256_SprBlitPeek_greytint
    • AFlibIII_PP256_SprBlitPeek_inverse
    • AFlibIII_PP256_SprBlitPeek_invtint
    • AFlibIII_PP256_SprBlitPeek_inversegrey
    • AFlibIII_PP256_SprBlitPeek_invgreytint
    • AFlibIII_PP256_SprBlitPeek_overlay
    • AFlibIII_SprBlit_dissolve
    • AFlibIII_SprBlitPeek_dissolve
    • AFlibIII_PP256_SprBlit_dissolve
    • AFlibIII_PP256_SprBlitPeek_dissolve
    • AFlibIII_DissolveDisplay
...and in the “AFlib3_Screen.bi” and “AFlib3_64bit_Screen.bi” modules, I additionally created this brand-new command entitled:
  • • AFlibIII_BlitScreen_dissolve
...and furthermore, in both the “AFlib3_ScoreRanking.bi” and “AFlib3_64bit_ScoreRanking.bi” modules, I have just added these special all-new Game Clock commands right here with automatic built-in support for an astounding 2,000 slots:
  • • AFlibIII_GameClock_Start
    • AFlibIII_GameClock_Start_ranged
    • AFlibIII_GameClock_Stop
    • AFlibIII_GameClock_Stop_ranged
    • AFlibIII_GameClock_Toggle
    • AFlibIII_GameClock_Toggle_ranged
    • AFlibIII_GameClock_Update
    • AFlibIII_GameClock_Update_ranged
    • AFlibIII_GameClock_AddTime
    • AFlibIII_GameClock_AddTime_ranged
    • AFlibIII_GameClock_SubtractTime
    • AFlibIII_GameClock_SubtractTime_ranged
    • AFlibIII_GameClock_SetCustomTime
    • AFlibIII_GameClock_SetCustomTime_ranged
    • AFlibIII_GameClock_Reset
    • AFlibIII_GameClock_Reset_ranged
    • AFlibIII_GameClock_Reset_all
    • AFlibIII_CheckGameClock
    • AFlibIII_ShowGameClock
    • AFlibIII_ShowGameClock_RawData
    • AFlibIII_ShowGameClock_RawData_ReverseToNormal
    • AFlibIII_ShowGameClock_LoadVariableToData
...and please be sure to check out “AF3_gameclock-test.bas” for a sample in how to easily implement these custom-made game timers to help you out a lot on your next game project in FreeBASIC... especially for a time-attack based one, too, which can really come in quite handy for you now!!! ;) Take a look at this screen right here:

Image

...and in the “AFlib3_ASCii.bi” and “AFlib3_64bit_ASCii.bi” modules, I also thrown in these additional new commands, too:
  • • AFlibIII_ASCii_SprBlitPeek
    • AFlibIII_ASCii_SprBlitPeek_blink
    • AFlibIII_ASCii_SprBlitPeek_alpha
    • AFlibIII_ASCii_SprBlitPeek_add
    • AFlibIII_ASCii_SprBlitPeek_firefly
    • AFlibIII_ASCii_SprBlitPeek_color
    • AFlibIII_ASCii_SprBlitPeek_tint
    • AFlibIII_ASCii_SprBlitPeek_greyscale
    • AFlibIII_ASCii_SprBlitPeek_greytint
    • AFlibIII_ASCii_SprBlitPeek_inverse
    • AFlibIII_ASCii_SprBlitPeek_invtint
    • AFlibIII_ASCii_SprBlitPeek_inversegrey
    • AFlibIII_ASCii_SprBlitPeek_invgreytint
    • AFlibIII_ASCii_SprBlitPeek_overlay
    • AFlibIII_ASCii_Print_blinkcolor
    • AFlibIII_ASCii_PrintTY_blinkcolor
    • AFlibIII_ASCii_PrintScore_blinkcolor
    • AFlibIII_ASCii_PrintScoreR_blinkcolor
    • AFlibIII_ASCii_PrintScoreRCH_blinkcolor
    • AFlibIII_ASCii_Pixel_blinkcolor
    • AFlibIII_ASCii_Line_blinkcolor
    • AFlibIII_ASCii_Box_blinkcolor
    • AFlibIII_ASCii_Circle_blinkcolor
    • AFlibIII_ASCii_Triangle_blinkcolor
    • AFlibIII_ASCii_Lightning_blinkcolor
...and also, I made an important bugfix to this command:
  • • AFlibIII_ASCii_Circle_blink
...which originally had a bug where as soon as you passed “0” in either the “Xradius” or “Yradius” parameters, the circle did not flash at all. Now, the flashing on the circle works like it is supposed to on this command... even if you do pass “0” on either the “Xradius” or “Yradius” parameters indeed, too!! ;)

Furthermore for you wonderful ladies and gents, the ALL-NEW graphical mouse routines have officially been added for AFlib III, with 64 custom built-in mouse cursors automatically available for you on this lib right here:

Image

...and be sure please to check out “AF3_mouse.bas” right now to test-drive these graphical mouse routines for AFlib III v0.92 beta indeed.

Image

As well, I now corrected an accidental error in the “Launch_AFlib3.bi” module, where I have changed the following:

Code: Select all

  #ifdef __FB_64BIT__
    #include "AFlib3_64bit_MusicSound.bi"
  #else
    #include "AFlib3_ASCii.bi"
  #endif
...to this:

Code: Select all

  #ifdef __FB_64BIT__
    #include "AFlib3_64bit_MusicSound.bi"
  #else
    #include "AFlib3_MusicSound.bi"
  #endif
...just to clear away any confusion and to make sure my custom-built AFlib III PCM Sound Driver works proper when using this module.

And finally, there is a major update in the “AFlib3_Miscellaneous.bi” and the “AFlib3_64bit_Miscellaneous.bi” modules, I have undergone some serious optimizations such that the Time/Date commands, for example, no longer require “vbcompat.bi”, ever. They just work natively now on their own in FreeBASIC, without any extra external .BI module files whatsoever. ENORMOUSLY huge thanks to MrSwiss once again for showing me how it’s really done right here in such a phenomenally quite awesome way indeed!!! (^-^)v !!

Here are some very easy ways that you can create your own custom time/date stamps in AFlib III, using this BRAND-NEW source code snippet that illustrates to you how to do it!!! ;)

Code: Select all

'-------------------------------------------------------------------------------
' NOTE: This FB code snippet requires AFlib III v0.92 or higher to run!!  ;)
'-------------------------------------------------------------------------------

#ifdef __FB_64BIT__
  #include "AFlib3_64bit_Miscellaneous.bi"
  #include "AFlib3_64bit_Primitives.bi"
  #include "AFlib3_64bit_Screen.bi"
  #include "AFlib3_64bit_Sprite.bi"
  #include "AFlib3_64bit_Font.bi"
  #include "AFlib3_64bit_Constants.bi"
#else
  #include "AFlib3_Miscellaneous.bi"
  #include "AFlib3_Primitives.bi"
  #include "AFlib3_Screen.bi"
  #include "AFlib3_Sprite.bi"
  #include "AFlib3_Font.bi"
  #include "AFlib3_Constants.bi"
#endif 

WindowTitle "My AWESOME little first AFlib III time/date stamp test in FreeBASIC!!!  ;*)"

Dim as Ubyte FontSelect = 9 '<------ Select your built-in 8x8 AFlib III fontface by number,
                            '        from 1 to 40.

Dim as Ushort ColumnLine

Screenres 800, 600, 24

'---------------------------------------------------------------
ScreenLock
AFlibIII_PrepareScreenTrans
AFlibIII_DisplayAllChars 0, 0, rgb(255, 255, 255), rgb(255, 255, 255), 0, FontSelect
AFlibIII_OptimizeFontSet 0, 0, 1
ScreenUnlock
'---------------------------------------------------------------

AFlibIII_ClearDisplay
Do
  ScreenLock
  AFlibIII_ClearDisplay

  AFlibIII_OptimizedPrint_color "Look at all the types of time/date stamps that you and I can create in FB with AFlib III!!!", 8, 8, 1, 1, RGB(255, 255, 0)
  AFlibIII_Line 0, 17, 799, 17, RGB(255, 63, 0)

  AFlibIII_OptimizedPrint_color AFlibIII_CurrentYear, 8, 24, 1, 0, RGB(255, 255, 255)
  AFlibIII_OptimizedPrint_color AFlibIII_CurrentMonth, 88, 24, 1, 0, RGB(255, 255, 255)
  AFlibIII_OptimizedPrint_color AFlibIII_CurrentDay, 168, 24, 1, 0, RGB(255, 255, 255)
  
  AFlibIII_OptimizedPrint_color AFlibIII_CurrentHour, 8, 32, 1, 0, RGB(255, 255, 255)
  AFlibIII_OptimizedPrint_color AFlibIII_CurrentMinute, 88, 32, 1, 0, RGB(255, 255, 255)
  AFlibIII_OptimizedPrint_color AFlibIII_CurrentSecond, 168, 32, 1, 0, RGB(255, 255, 255)
  
  For ColumnLine = 0 to 2
    AFlibIII_OptimizedPrint_color AFlibIII_LongMonthName(ColumnLine), 8, 48 + (ColumnLine * 8), 1, 0, RGB(255, 255, 255)
    AFlibIII_OptimizedPrint_color AFlibIII_ShortMonthName(ColumnLine), 200, 48 + (ColumnLine * 8), 1, 0, RGB(255, 255, 255)
  Next

  For ColumnLine = 0 to 2
    AFlibIII_OptimizedPrint_color AFlibIII_LongDate(ColumnLine), 8, 80 + (ColumnLine * 8), 1, 0, RGB(255, 255, 255)
    AFlibIII_OptimizedPrint_color AFlibIII_ShortDate(ColumnLine), 200, 80 + (ColumnLine * 8), 1, 0, RGB(255, 255, 255)
  Next

  For ColumnLine = 0 to 11
    AFlibIII_OptimizedPrint_color AFlibIII_TinyDate(AF3_Date_Latinic + ColumnLine), 8, 112 + (ColumnLine * 8), 1, 0, RGB(255, 255, 255)
    AFlibIII_OptimizedPrint_color AFlibIII_TinyDate(AF3_Date_US + ColumnLine), 120, 112 + (ColumnLine * 8), 1, 0, RGB(255, 255, 255)
    AFlibIII_OptimizedPrint_color AFlibIII_TinyDate(AF3_Date_Germanic + ColumnLine), 232, 112 + (ColumnLine * 8), 1, 0, RGB(255, 255, 255)
    AFlibIII_OptimizedPrint_color AFlibIII_TinyDate(AF3_Date_CustomTypeA + ColumnLine), 344, 112 + (ColumnLine * 8), 1, 0, RGB(255, 255, 255)
    AFlibIII_OptimizedPrint_color AFlibIII_TinyDate(AF3_Date_CustomTypeB + ColumnLine), 456, 112 + (ColumnLine * 8), 1, 0, RGB(255, 255, 255)
    AFlibIII_OptimizedPrint_color AFlibIII_TinyDate(AF3_Date_CustomTypeC + ColumnLine), 568, 112 + (ColumnLine * 8), 1, 0, RGB(255, 255, 255)
    AFlibIII_OptimizedPrint_color AFlibIII_TinyDate(AF3_Date_CustomTypeD + ColumnLine), 680, 112 + (ColumnLine * 8), 1, 0, RGB(255, 255, 255)
  Next

  For ColumnLine = 0 to 2
    AFlibIII_OptimizedPrint_color AFlibIII_CurrentTime(ColumnLine), 8, 216 + (ColumnLine * 8), 1, 0, RGB(255, 255, 255)
  Next

  AFlibIII_LowRes_Vert
  ScreenUnlock
  AFlibIII_CustomSync fps_OPTIMAL
Loop until MultiKey(&h01) or AFlibIII_Detect_CloseWindow

AFlibIII_RemoveFontSet 1
AFlibIII_EndProgram
Image

So with all these updates and fixes for this newest version of AFlib III for FreeBASIC 32-bit and 64-bit editions, please so richly enjoy it as we head much closer and closer towards its fullest completion!!! Thank you all so much once again for your awesome time and patience, ladies and gentlemen!! ^^=b !!
Adigun A. Polack
Posts: 231
Joined: May 27, 2005 15:14
Contact:

Re: Welcome to my newest 2D Truecolor Game Lib in FB: AFlib III.

Post by Adigun A. Polack »

Alright, ladies and gentlemen. The season of Summer may already be over for this year now, but that does not even halfway mean that AFlib III hasn’t turned up the heat in any way, shape, or form in terms of the optimizations and fantastic NEVER-BEFORE-SEEN new features that I have just now added once again. In quite actual fact, I really kicked it up quite several notches and more, just in order to form a brand-newest update to this original FreeBASIC game-creation library, as it is thoroughly tested once again *completely* virus-free and ready for you to download as Autumn 2016 begins:
Get splendidly excited like never before, everybody!!! (^-^)v !!

First of all now, on AFlib III’s built-in font #6 (which happens to be titled “1980s Gamer Classic” as this particular fontface here), I did a minor character edit on the lowercase “a” so that it makes it a little more readable and much easier to distinguish between the lowercase “a” and the lowercase “o” indeed. Take a quick look:

Image

There, much legible now. And that is only barely scratching the surface in this important new AFlib III update! Read on!! ;)

Secondly, I have just improved and strengthened the security of the AFlib III Score Ranking File Saving/Loading System to make it even better than ever, and that is most noticeably true now in both the "AFlib3_ScoreRanking.bi" and "AFlib3_64bit_ScoreRanking.bi" modules, too!

Next, in the “AFlib3_Font.bi” and “AFlib3_64bit_Font.bi” modules, I added in a VERY special all-new command:
  • AFlibIII_OptimizedFont_ShakyTextSetup

    Code: Select all

    Declare Sub AFlibIII_OptimizedFont_ShakyTextSetup ( Byref x_quake as Ubyte, _
                                                        Byref y_quake as Ubyte )
...which enables you to literally shake up the text that you print in your optimized font(s) as if it had been in an earthquake, or, if you want, disables this “quaking” text effect completely. These modern days now, quite a number of indie-game developers have been using this kind of rather unique effect indeed in the original development of games like Manos: The Hands of Fate (2d platformer video-game version on PC) by FreakZone Games and Shovel Knight by Yacht Club Games, for example. I am sure there are many more examples of that ShakyText stuff being already implemented in other 2d indie games of this type or something like that, and so I thought it would be rather amazing for me to add this kind of effect indeed for you to finally use exclusively in AFlib III for FreeBASIC, you know that? :D !!


To test out my brand-new ShakyText effect in AFlib III for your optimized fonts, here is this fast and really simple source-code example on this to truly help you out!! ;)

Code: Select all

'-------------------------------------------------------------------------------
' NOTE: This FB code snippet requires AFlib III v0.93 or higher to run!!  ;)
'-------------------------------------------------------------------------------

#ifdef __FB_64BIT__
  #include "AFlib3_64bit_Font.bi"
  #include "AFlib3_64bit_Screen.bi"
  #include "AFlib3_64bit_Sprite.bi"
  #include "AFlib3_64bit_Miscellaneous.bi"
#else
  #include "AFlib3_Font.bi"
  #include "AFlib3_Screen.bi"
  #include "AFlib3_Sprite.bi"
  #include "AFlib3_Miscellaneous.bi"
#endif


Dim FontSelect as Integer = 6 '<----- Please select any one of AFlib III's built-in fonts, from 1 to 40.

ScreenRes 640, 400, 24, , 0

'---------------------------------------------------------------
ScreenLock
AFlibIII_PrepareScreenTrans
AFlibIII_DisplayAllChars 1, 1, rgb(64, 64, 64), rgb(64, 64, 64), 0, FontSelect
AFlibIII_DisplayAllChars 1, 0, rgb(64, 64, 64), rgb(64, 64, 64), 0, FontSelect
AFlibIII_DisplayAllChars 0, 1, rgb(64, 64, 64), rgb(64, 64, 64), 0, FontSelect
AFlibIII_DisplayAllChars 0, 0, rgb(255, 255, 255), rgb(180, 180, 180), 0, FontSelect
AFlibIII_OptimizeFontSet 0, 0, 1
ScreenUnlock
'---------------------------------------------------------------

AFlibIII_ClearDisplay

Do
  ScreenLock
    AFlibIII_ClearDisplay
   
    AFlibIII_OptimizedFont_ShakyTextSetup 1, 2 '<----- This turns on the ShakyText with a light setting shown here.
    AFlibIII_OptimizedPrint "ShakyText is now in effect for AFlib III in FreeBASIC...", 16, 48, 1, 0

    AFlibIII_OptimizedFont_ShakyTextSetup 0, 0 '<----- This turns the ShakyText off.
    AFlibIII_OptimizedPrint "...and now, this piece of text is still and peaceful with the ShakyText off.", 16, 64, 1, 0

    AFlibIII_OptimizedPrint "THANK YOU KINDLY FOR WATCHING THIS EXAMPLE.", 0, 88, 1, 1

  ScreenUnlock
  AFlibIII_CustomSync 70

Loop until Inkey = Chr(27) '<----- Press [ESC] to exit.

AFlibIII_RemoveFontSet 1
AFlibIII_EndProgram
Image


And even vitally in the “AFlib3_Palette.bi” and “AFlib3_64bit_Palette.bi” modules, I have updated and optimized the following commands:
  • • AFlibIII_MachineFade_EGA
    • AFlibIII_MachineFade_NES
    • AFlibIII_MachineFade_SMS
    • AFlibIII_MachineFade_C64
    • AFlibIII_MachineFade_CPC
    • AFlibIII_MachineFade_GB
...and added in quite several brand-new and simple-to-use commands:
  • • AFlibIII_MachineFade_FCUBE
    • AFlibIII_MachineFade_DB32
    • AFlibIII_MachineFade_VB
    • AFlibIII_MachineFade_WS
    • AFlibIII_MachineFade_RGB8
    • AFlibIII_MachineFade_ARNE
    • AFlibIII_MachineFade_FUN16
    • AFlibIII_MachineFade_INTV
    • AFlibIII_MachineFade_PC6001
    • AFlibIII_MachineFade_VIC20_NTSC
    • AFlibIII_MachineFade_VIC20_PAL
    • AFlibIII_MachineFade_MSX
    • AFlibIII_MachineFade_ZXSpectrum
    • AFlibIII_MachineFade_APPLEII
    • AFlibIII_MachineFade_AQUAR
...all to support even purer palette fading effects based on each of their own respective classic computers/consoles indeed and such!!! ;) Please check out the 32- and 64-bit versions of the AFlib III Machine-Palette Fade Test program included in this download package for the latest version of AFlib III, as well as the .BAS source-code file of “AF3_machinefade-test.bas” for how all this custom palette fading magic is done for 24- and 32-bit color graphics modes only on these kinds of fading effects indeed.

And then, in the “AFlib3_ASCii.bi” and “AFlib3_64bit_ASCii.bi” modules, I have thrown in this brand-new command, too:
  • • AFlibIII_ASCii_CaptureSprite_BMP_to_Text
...while at the same time now for this very version, I’ve also added in the ability for you to most easily create custom dialogue boxes in AFlib III, using these additional all-new commands:
  • • AFlibIII_ASCii_DialogueBox
    • AFlibIII_ASCii_DialogueBox_alpha
    • AFlibIII_ASCii_DialogueBox_add
    • AFlibIII_ASCii_FilledDialogueBox
    • AFlibIII_ASCii_FilledDialogueBox_alpha
    • AFlibIII_ASCii_FilledDialogueBox_add
...and here is what you get coming from this next screenshot, just to whet your appetite:

Image


To inspire all of you to quite easily create those ASCii-based custom dialogue boxes in FreeBASIC without any frustrating fancy-shmancy programming involved, here is a simple new source-code example to help you get the job done nice and quick!!! ^-^

Code: Select all

'-------------------------------------------------------------------------------
' NOTE: This FB code snippet requires AFlib III v0.93 or higher to run!!  ;)
'-------------------------------------------------------------------------------

#ifdef __FB_64BIT__
  #include "AFlib3_64bit_ASCii.bi"
  #include "AFlib3_64bit_Miscellaneous.bi"
#else
  #include "AFlib3_ASCii.bi"
  #include "AFlib3_Miscellaneous.bi"
#endif


' First, let's set our 24-bit color ASCii-graphics mode to
' 80x60, based only on an 8x8 ASCii-character grid which
' directly equates itself to a standard 640x480x24 graphics
' mode in single pixels alone.
'----------------------------------------------------------
AFlibIII_SetTextGFX 80, 60, 24, , 0


' Secondly, we initialize our AFlib III ASCii-graphics
' system with its 40 built-in fonts, using this command:
'----------------------------------------------------------
AFlibIII_Initialize_ASCii


' Next, we build our simple text-based background.
'----------------------------------------------------------
AFlibIII_ASCii_FilledBox chr(197), 0, 0, 79, 59, RGB(64, 0, 0), RGB(0, 0, 0), 1


' Now, the REAL fun begins!!!  We start here by making our
' very first ASCii-based dialogue box for AFlib III, using
' a filled one so we can then put our text in it.  ;) !!
'----------------------------------------------------------
AFlibIII_ASCii_FilledDialogueBox 8, 5, 4, 50, 9, RGB(255, 235, 185), RGB(236, 236, 0), _
                                                 RGB(145, 125, 65), RGB(80, 80, 0), _
                                                 RGB(165, 125, 20), RGB(21, 0, 0), _
                                                 255, 12

AFlibIII_ASCii_Print "This is my first ASCII-based dialogue box,", 7, 6, RGB(255, 255, 255), RGB(255, 0, 255), 12
AFlibIII_ASCii_Print "created using AFlib III in FreeBASIC!!!", 7, 7, RGB(255, 255, 255), RGB(255, 0, 255), 12


' Let's add another dialogue box... this time, with just a
' non-filled, alpha-blended one to make it more frame-like
' in style!!  And then, we add even a bit more text to it
' that we just built.  ^^
'----------------------------------------------------------
AFlibIII_ASCii_DialogueBox_alpha 7, 18, 13, 76, 17, RGB(215, 255, 235), RGB(0, 236, 236), RGB(65, 145, 125), RGB(0, 120, 120), 128, 21
AFlibIII_ASCii_Print "I can also create another dialogue box alpha-blended...", 20, 15, RGB(255, 255, 255), RGB(255, 0, 255), 21


' And then we add yet one more dialogue box... this time,
' a filled one, with another different style of the way 
' this new one executes in terms of giving the ASCii-based
' dialogue boxes themselves a great variety here... most
' considering that there are 11 custom built-in styles to
' choose from in AFlib III, of course!!!  (^-^)v !!!
'----------------------------------------------------------
AFlibIII_ASCii_FilledDialogueBox_add 9, 41, 21, 76, 26, RGB(255, 205, 245), RGB(236, 106, 236), _
                                                        RGB(185, 65, 165), RGB(120, 0, 120), _
                                                        RGB(0, 0, 0), RGB(120, 120, 120), _
                                                        255, 210, 18

AFlibIII_ASCii_Print "...as well as create yet another", 43, 23, RGB(255, 255, 255), RGB(255, 0, 255), 18
AFlibIII_ASCii_Print "one additive-blended, too!!", 43, 24, RGB(255, 255, 255), RGB(255, 0, 255), 18


' Now, these final bits of text for us to print, before
' asking the user for a key-press to end the program.
'----------------------------------------------------------
AFlibIII_ASCii_Print "Now, I am ready to create some truly awesome", 5, 31, RGB(255, 255, 255), RGB(255, 0, 255), 4
AFlibIII_ASCii_Print "events of dialogue in an ASCii-based RPG or even", 5, 33, RGB(255, 255, 255), RGB(255, 0, 255), 4
AFlibIII_ASCii_Print "my own custom text-based GUI system, and quite", 5, 35, RGB(255, 255, 255), RGB(255, 0, 255), 4
AFlibIII_ASCii_Print "perhaps more... all on AFlib III in FreeBASIC!!!", 5, 37, RGB(255, 255, 255), RGB(255, 0, 255), 4
AFlibIII_ASCii_Print "LET'S ROCK!!!", 5, 41, RGB(170, 200, 255), RGB(255, 0, 255), 4
AFlibIII_ASCii_Print "(^-^)=b !!", 20, 41, RGB(56, 255, 56), RGB(255, 0, 255), 4

Sleep


' Finally, we wrap up the entire program indeed by simply
' and safely removing our AFlib III ASCii-graphics system
' with the "AFlibIII_DeInit_ASCii" command, before we call
' "AFlibIII_EndProgram" to make clearly sure we end the
' program with absolutely no conflicts.  ;)
'----------------------------------------------------------
AFlibIII_DeInit_ASCii
AFlibIII_EndProgram


' A MOST splendid good night to you, everybody!!!  ^-^=b !!
Image


And best of all, MUCH more importantly, I have added in a custom recordable live ASCii-tilemap system for AFlib III (yep, you heard me!!! d=^-^=b !! ), plus its own saving and loading features!! And best of all, this system even has its own drawing primitive commands that are exclusive directly to this newest tile-mapping system indeed as well, including:
  • • AFlibIII_ASCiiMap_Print
    • AFlibIII_ASCiiMap_PrintScore
    • AFlibIII_ASCiiMap_PrintScoreR
    • AFlibIII_ASCiiMap_PrintScoreRCH
    • AFlibIII_ASCiiMap_Pixel
    • AFlibIII_ASCiiMap_Line
    • AFlibIII_ASCiiMap_Box
    • AFlibIII_ASCiiMap_FilledBox
    • AFlibIII_ASCiiMap_Circle
    • AFlibIII_ASCiiMap_FilledCircle
    • AFlibIII_ASCiiMap_Triangle
    • AFlibIII_ASCiiMap_FilledTriangle
    • AFlibIII_ASCiiMap_Globe
    • AFlibIII_ASCiiMap_Lightning
    • AFlibIII_ASCiiMap_DialogueBox
    • AFlibIII_ASCiiMap_FilledDialogueBox
    • AFlibIII_ASCiiMap_BlitBMP
    • AFlibIII_ASCiiMap_TransBlitBMP
    • AFlibIII_ASCiiMap_PatternBlitBMP
    • AFlibIII_ASCiiMap_ClearDisplay
...and so much more, which is absolutely damn brilliant stuff for also creating your own ASCii-based loading screens, ASCii-based RPG game maps, and whatever best suits your fancy in a fantastic way!!! And all in any 15- to 32-bit color graphics mode you desire, too!! :D

By default, your ASCii-tiled map is set to 80x60 text-based mode (as measured in 8x8 ASCii characters, exactly)... best suited for a normal 640x480 graphics mode. But, with this additional command:
  • AFlibIII_ASCiiMap_SwitchType

    Code: Select all

    Sub AFlibIII_ASCiiMap_SwitchType ( Byval tilesize_type as Ubyte )
...you can efficiently switch between different types of these maps based on size, while certainly keeping close track of your progress between them all... all during the run-time of your program. You can choose between the following in the “tilesize_type” parameter of this command:

[list]0 = AFlib III 40x30 ASCii-tiled Map
1 = AFlib III 80x60 ASCii-tiled Map
2 = AFlib III 100x75 ASCii-tiled Map
3 = AFlib III 128x96 ASCii-tiled Map
4 = AFlib III 160x90 ASCii-tiled Map
5 = AFlib III 240x135 ASCii-tiled Map
6 = AFlib III 256x256 ASCii-tiled Map
7 = AFlib III 512x512 ASCii-tiled Map
8 = AFlib III 768x768 ASCii-tiled Map
9 = AFlib III 1024x1024 ASCii-tiled Map
[/list]

...and when you save a custom ASCii-tiled map using this command:
  • AFlibIII_ASCiiMap_Save

    Code: Select all

    Sub AFlibIII_ASCiiMap_Save ( Byref File as String, _
                                 Byref Password_1_of_3 as String = "", _
                                 Byref Password_2_of_3 as String = "", _
                                 Byref Password_3_of_3 as String = "" )
...a file extension will be given automatically to you as attached to the end of any filename you wish, as follows depending on the currently selected ASCii-tiled map type that you are using:

[list].AA0 = AFlib III 40x30 ASCii-tiled Mapper File
.AA1 = AFlib III 80x60 ASCii-tiled Mapper File
.AA2 = AFlib III 100x75 ASCii-tiled Mapper File
.AA3 = AFlib III 128x96 ASCii-tiled Mapper File
.AA4 = AFlib III 160x90 ASCii-tiled Mapper File
.AA5 = AFlib III 240x135 ASCii-tiled Mapper File
.AA6 = AFlib III 256x256 ASCii-tiled Mapper File
.AA7 = AFlib III 512x512 ASCii-tiled Mapper File
.AA8 = AFlib III 768x768 ASCii-tiled Mapper File
.AA9 = AFlib III 1024x1024 ASCii-tiled Mapper File
[/list]

...and as for the optional “Password_1_of_3”, “Password_2_of_3”, “Password_3_of_3” parameters here, feel free to add them in if you wish to give your maps some added extra security features, with the passwords themselves being up to 24 characters long each. Just be sure to remember them all yourself on your own when you load these custom maps back up using this command:
  • AFlibIII_ASCiiMap_Load

    Code: Select all

    Sub AFlibIII_ASCiiMap_Load ( Byref File as String, _
                                 Byref Password_1_of_3 as String = "", _
                                 Byref Password_2_of_3 as String = "", _
                                 Byref Password_3_of_3 as String = "" )
To display your currently selected type of ASCii-tiled map anywhere you wish, just simply add this command:
  • AFlibIII_ASCiiMap_DisplayRaw

    Code: Select all

    Sub AFlibIII_ASCiiMap_DisplayRaw ( Byval tile_x as Integer<32>, _ 
                                       Byval tile_y as Integer<32>, _
                                       Byval fontface as Integer<32>, _
                                       Byval buffer as any Ptr = 0 )
...and you are pretty much good to go so far.

You got me on all of that, everybody? Good. Now let’s put our ASCii map creation to some spectacularly good use, shall we!? ;*)


To get you started on using this phenomenal new custom ASCii-tilemap system that is exclusive to AFlib III for the 32- and 64-bit editions of FreeBASIC, here now are the next two awesome little source-code examples that shows you how you can easily create ASCii-based game maps live, as well as you saving and loading them quite simply without a hitch!!! ;)

Code: Select all

'-------------------------------------------------------------------------------
' NOTE: This FB code snippet requires AFlib III v0.93 or higher to run!!  ;)
'-------------------------------------------------------------------------------

#ifdef __FB_64BIT__
  #include "AFlib3_64bit_ASCii.bi"
  #include "AFlib3_64bit_Miscellaneous.bi"
#else
  #include "AFlib3_ASCii.bi"
  #include "AFlib3_Miscellaneous.bi"
#endif


' First, we set our 24-bit color ASCii-graphics mode to
' 80x60, based only on an 8x8 ASCii-character grid which
' directly equates itself to a standard 640x480x24 graphics
' mode in single pixels alone.
'----------------------------------------------------------
AFlibIII_SetTextGFX 80, 60, 24, , 0


' Second now, we initialize our AFlib III ASCii-graphics
' system with its 40 built-in fonts, using this command:
'----------------------------------------------------------
AFlibIII_Initialize_ASCii


' Next, let's build our first custom 80x60 ASCii tilemap
' as our test!!  ;)
'----------------------------------------------------------
AFlibIII_ASCiiMap_ClearDisplay RGB(0, 0, 0)
AFlibIII_ASCiiMap_FilledBox Chr(4), 0, 0, 68, 59, RGB(33, 0, 35), RGB(10, 0, 15)

For Wall_y as Integer = 0 to 5
  For Wall_x as Integer = 0 to 6
    If Wall_x = 1 and Wall_y = 1 or Wall_x = 5 and Wall_y = 1 or Wall_x = 1 and Wall_y = 4 or Wall_x = 5 and Wall_y = 4 then
      AFlibIII_ASCiiMap_FilledDialogueBox 3, (Wall_x * 9) + 5, (Wall_y * 9) + 5, (Wall_x * 9) + 9, (Wall_y * 9) + 9, _
                                             RGB(250, 255, 250), RGB(40, 255, 40), _
                                             RGB(10, 255, 10), RGB(0, 155, 0), _
                                             RGB(10, 240, 10), RGB(0, 135, 0)
    elseif Wall_x = 3 and Wall_y = 0 or Wall_x = 3 and Wall_y = 5 then
      AFlibIII_ASCiiMap_FilledDialogueBox 8, (Wall_x * 9) + 6, (Wall_y * 9) + 6, (Wall_x * 9) + 8, (Wall_y * 9) + 8, _
                                             RGB(240, 240, 255), RGB(180, 185, 255), _
                                             RGB(180, 180, 255), RGB(120, 120, 255), _
                                             RGB(255, 255, 255), RGB(255, 255, 255)
    elseif Wall_x = 0 and Wall_y = 0 or Wall_x = 6 and Wall_y = 5 or Wall_x = 3 and Wall_y = 2 or Wall_x = 3 and Wall_y = 3 then
      ' no maze wall piece
    else    
      AFlibIII_ASCiiMap_DialogueBox 8, (Wall_x * 9) + 5, (Wall_y * 9) + 5, (Wall_x * 9) + 9, (Wall_y * 9) + 9, _
                                             RGB(255, 255, 40), RGB(255, 168, 60), _
                                             RGB(230, 146, 10), RGB(155, 66, 0)
    End if
  Next
Next

AFlibIII_ASCiiMap_Print "TOP-SCORE", 70, 2, RGB(0, 255, 0)
AFlibIII_ASCiiMap_PrintScoreR 1245830, 64, 3, RGB(255, 255, 0)

AFlibIII_ASCiiMap_Print "1UP", 73, 8, RGB(255, 0, 0)
AFlibIII_ASCiiMap_PrintScoreR 1156800, 64, 9, RGB(255, 255, 255)
AFlibIII_ASCiiMap_Print Chr(5, 5, 5, 5), 71, 11, RGB(255, 0, 0)
AFlibIII_ASCiiMap_Print "POW ", 70, 13, RGB(255, 0, 0)
AFlibIII_ASCiiMap_Print Chr(16, 16, 16, 16, 16), 74, 13, RGB(255, 255, 255)

AFlibIII_ASCiiMap_Print "2UP", 73, 18, RGB(255, 168, 0)
AFlibIII_ASCiiMap_PrintScoreR 743920, 64, 19, RGB(255, 255, 255)
AFlibIII_ASCiiMap_Print Chr(5, 5, 5), 71, 21, RGB(255, 168, 0)
AFlibIII_ASCiiMap_Print "POW ", 70, 23, RGB(255, 168, 0)
AFlibIII_ASCiiMap_Print Chr(16, 16, 16, 16, 16), 74, 23, RGB(255, 255, 255)

AFlibIII_ASCiiMap_Print "3UP", 73, 28, RGB(0, 255, 255)
AFlibIII_ASCiiMap_PrintScoreR 1085690, 64, 29, RGB(255, 255, 255)
AFlibIII_ASCiiMap_Print "INSERT", 70, 31, RGB(0, 255, 255) 
AFlibIII_ASCiiMap_Print "COIN!", 74, 32, RGB(0, 255, 255)

AFlibIII_ASCiiMap_Print "4UP", 73, 38, RGB(124, 118, 255)
AFlibIII_ASCiiMap_PrintScoreR 255040, 64, 39, RGB(255, 255, 255)
AFlibIII_ASCiiMap_Print Chr(5), 71, 41, RGB(124, 118, 255)
AFlibIII_ASCiiMap_Print "POW ", 70, 43, RGB(124, 118, 255)
AFlibIII_ASCiiMap_Print Chr(16, 16, 16, 16, 16), 74, 43, RGB(255, 255, 255)

AFlibIII_ASCiiMap_Print "CREDIT 00", 70, 57, RGB(255, 255, 255)

AFlibIII_ASCiiMap_DisplayRaw 0, 0, 15

Sleep 2000, 1
AFlibIII_ClearKeyBuffer


' Now, press any key so we can save it as "ASCii_TestMap"
' (an ".aa1" file extension will *automatically* be added
' as a result, since the AFlib III ASCii-based tilemap
' system starts you out with an 80x60 custom text tilemap
' setting instantly when you first run your program).  ;)
'----------------------------------------------------------
AFlibIII_ASCii_FilledBox " ", 0, 59, 79, 59, RGB(0, 0, 255), RGB(0, 0, 255), 1
AFlibIII_ASCii_Print "Press any key to save this 80x60 ASCii Map to file...", 0, 59, RGB(255, 255, 255), RGB(255, 0, 255), 6
Sleep

AFlibIII_ASCiiMap_DisplayRaw 0, 0, 15
AFlibIII_ASCiiMap_Save "ASCii_TestMap"
AFlibIII_ASCii_FilledBox " ", 0, 59, 79, 59, RGB(0, 0, 255), RGB(0, 0, 255), 1
AFlibIII_ASCii_Print "80x60 ASCii Map File Saved.  Press any key to end, please.", 0, 59, RGB(255, 255, 255), RGB(255, 0, 255), 6
AFlibIII_ClearKeyBuffer
Sleep




' Finally, we close this entire program by safely removing
' our own AFlib III ASCii-graphics system with the
' "AFlibIII_DeInit_ASCii" command, before we call
' "AFlibIII_EndProgram" to make clearly sure we do so here
' with absolutely no conflicts whatsoever.  ;)
'----------------------------------------------------------
AFlibIII_DeInit_ASCii
AFlibIII_EndProgram


' See you all again soon!!!  ^-^=b !!

Code: Select all

'-------------------------------------------------------------------------------
' NOTE: This FB code snippet requires AFlib III v0.93 or higher to run!!  ;)
'-------------------------------------------------------------------------------

#ifdef __FB_64BIT__
  #include "AFlib3_64bit_ASCii.bi"
  #include "AFlib3_64bit_Miscellaneous.bi"
#else
  #include "AFlib3_ASCii.bi"
  #include "AFlib3_Miscellaneous.bi"
#endif


AFlibIII_SetTextGFX 80, 60, 24, , 0
AFlibIII_Initialize_ASCii

AFlibIII_ASCii_FilledBox " ", 0, 59, 79, 59, RGB(0, 0, 255), RGB(0, 0, 255), 1
AFlibIII_ASCii_Print "Press any key to instantly load our 80x60 ASCii Map that we just created...", 0, 59, RGB(255, 255, 255), RGB(255, 0, 255), 6
Sleep

AFlibIII_ASCiiMap_Load "ASCii_TestMap.aa1"
AFlibIII_ASCiiMap_DisplayRaw 0, 0, 15
AFlibIII_ClearKeyBuffer
Sleep

AFlibIII_DeInit_ASCii
AFlibIII_EndProgram
And here is even more great news for you: from this resulting example file called “ASCii_TestMap.aa1”, since this is saved in an AFlib III 80x60 ASCii-tiled Mapper File format, its precise file size is around nothing more than a VERY low 119kbjust around 118,784 bytes, to be exact! Perfect for creating your own custom ASCii-based Truecolor loading screens for your game that you are creating in AFlib III, especially, so let’s see what kind of ASCii-tiled maps or something wildly creative you can come up with using this!!! ;*)

And speaking about the sample map that was just created using those two ASCii-tiled map-creation source codes in AFlib III just now, they should give you a good indication of the possible map layouts for the following classic ‘80s computer games: Oh Mummy! on the Amstrad CPC and Crossfire on the IBM PCjr. Let them inspire you further.

All these and more should give all of you a finely excellent leading edge towards such outstanding new game programming in FreeBASIC made much, MUCH easier than ever before!!! (^-^)v !!

And finally, check out the newly updated “AF3_BMPload_to_Truecolor_ASCii.bas” in this new version of AFlib III, as I have now made my own custom algorithm for converting the .BMPs into actual truecolor ASCii-art all its own containing multiple ASCii characters simultaneously, all supporting any 24- to 32-bit color graphics mode of your choice!!! Please do not miss these next examples of this that will I show you right here, just to get you started:
  • • Normal Picture:
    Image

    • Conversion to Single-character ASCii-art Truecolor format:
    Image Image

    • Conversion to Multi-character ASCii-art Truecolor format:
    Image Image
With that now, that sums up a ton of amazing updates for this latest beta test version 0.93 of AFlib III. And with all that info and all these fresh new source-code examples to try out in this post for this new AFlib III version, you will definitely be blown away speechless by the astounding quality and absolute care that I have put into this original FB game-creation lib, and the big improvements that I have made time after time since the 2016 year first began. Please richly enjoy them all big-time to your absolute heart’s content in this big update to this very library in FreeBASIC 32- and 64-bit especially, and an enormous thank-you once again to all of you entire FreeBASIC community so far for your continued support indeed!!! (^-^)v !!!
Last edited by Adigun A. Polack on Sep 07, 2016 2:22, edited 1 time in total.
Tourist Trap
Posts: 2958
Joined: Jun 02, 2015 16:24

Re: Welcome to my newest 2D Truecolor Game Lib in FB: AFlib III.

Post by Tourist Trap »

It's just tremendous. What is supposed to be the documentation, this page or some other website?

About the dialog boxes, do they resize according to the amount of text involved or what happens in case of text overflow?
Adigun A. Polack
Posts: 231
Joined: May 27, 2005 15:14
Contact:

Re: Welcome to my newest 2D Truecolor Game Lib in FB: AFlib III.

Post by Adigun A. Polack »

Tourist Trap, you wrote:It's just tremendous. What is supposed to be the documentation, this page or some other website?

About the dialog boxes, do they resize according to the amount of text involved or what happens in case of text overflow?
Well, Tourist Trap, seeing as AFlib III is getting a whole lot closer and closer to a v1.0 completion status already, there will definitely be an all-new full-color documentation on AFlib III that gives full, clear details on every single command there is that is in this entire FB game-creation lib itself, as well as how best to use each of them and what proper operations they produce to help you create your more robustly much richer games much, much easily in both FB 32-bit and FB 64-bit. As well, there will be quite some source-code examples that absolutely will be included in the doc itself to help even aspiring FreeBASIC users get started on making the most out of AFlib III without any hassle or fuss, just like in the ‘ye olde ‘80s classic computer manuals like the ones that originally first came with your Amstrad CPC, your Commodore 64, or even your VIC-20 itself (remember those ones? ^^ ). And you can truly betcha that every one of the AFlib III source-code examples that were featured throughout this entire thread will be added and updated in this entire new AFlib III documentation itself, to the point where all those examples there themselves will surely run in both the 32- and 64-bit editions of FreeBASIC indeed. Also, the doc will be available in .PDF format, just so you know. ;)

As for the dialogue boxes, no, they do not automatically resize themselves according to the amount of text involved. As far as I can remember and tell, the sizes of these types of boxes here are manually operated by you, to which you would then have to custom-print your own text to make it fit inside their boundaries. Let me show you a quick new AFlib III source-code example on how it is done, my man:

Code: Select all

#ifdef __FB_64BIT__
  #include "AFlib3_64bit_ASCii.bi"
  #include "AFlib3_64bit_Miscellaneous.bi"
#else
  #include "AFlib3_ASCii.bi"
  #include "AFlib3_Miscellaneous.bi"
#endif


' First, we set our 24-bit color ASCii-graphics mode to
' 80x50, based only on an 8x8 ASCii-character grid which
' directly equates itself to a standard 640x400x24 graphics
' mode in single pixels alone.
'----------------------------------------------------------
AFlibIII_SetTextGFX 80, 50, 24, , 0


' Secondly, we initialize our AFlib III ASCii-graphics
' system with its 40 built-in fonts, using this command:
'----------------------------------------------------------
AFlibIII_Initialize_ASCii


' Now, let's create a wide, horizontal filled ASCii-based
' dialogue box to be placed inside the bottom of our own
' color-graphics window...
'----------------------------------------------------------
AFlibIII_ASCii_FilledDialogueBox 8, 2, 36, 77, 47, RGB(255, 255, 255), RGB(0, 236, 236), _
                                                   RGB(0, 125, 65), RGB(0, 40, 80), _
                                                   RGB(0, 125, 125), RGB(0, 0, 36), _
                                                   255, 12


' ...then, we manually add some text, making sure we stay
' within the boundaries of our own dialogue box that we
' just built.
'----------------------------------------------------------
AFlibIII_ASCii_Print "Greetings, Tourist Trap and all the rest of our VERY AWESOME FreeBASIC", 4, 38, RGB(255, 255, 255), RGB(255, 0, 255), 12
AFlibIII_ASCii_Print "community!!!  I am some text that you can easily custom-print inside an", 4, 39, RGB(255, 255, 255), RGB(255, 0, 255), 12
AFlibIII_ASCii_Print "already-created ASCii-based dialogue box in AFlib III.", 4, 40, RGB(255, 255, 255), RGB(255, 0, 255), 12
AFlibIII_ASCii_Print "And you can program all of this in just quite only a FEW lines of code.", 4, 42, RGB(255, 255, 255), RGB(255, 0, 255), 12
AFlibIII_ASCii_Print "Let's make some spectacular-quality games in FreeBASIC together!!!", 4, 44, RGB(255, 255, 255), RGB(255, 0, 255), 12

Sleep '<----- Press any key to exit.


' Finally now, we simply and safely remove our AFlib III
' ASCii-graphics system by calling the command
' "AFlibIII_DeInit_ASCii", right before we call
' "AFlibIII_EndProgram"... all to make clearly sure we
' end the program with no conflicts whatsoever.  ;)
'----------------------------------------------------------
AFlibIII_DeInit_ASCii
AFlibIII_EndProgram


' Thank you ever so much and take excellent care!!!  ^-^=b !!
And most fortunately, FreeBASIC will NOT throw any errors at you for having the text go past the boundaries of any dialogue boxe(s) that you create in AFlib III, so quite definitely no ‘Text Overflow’ errors there on that!! And thank goodness indeed, too, as I want such awesome users like you to have such resplendent peace of mind, in that wonderful respect here. ^-^=b !!

And to everybody watching this thread, I have accidentally misquoted in my previous post that my own custom algorithm for converting the .BMPs into actual truecolor ASCii-art all its own containing multiple ASCii characters simultaneously supported any 15- to 32-bit color graphics mode... well after I tested my algorithm again just now, it turned out that it actually supports any 24- to 32-bit color graphics mode of your choice only. Pardon me for that accidental little error there; that has just now been corrected in my prior post indeed before this one.

In the meantime, Tourist Trap, thank you so much for the fine couple of questions. I TRULY appreciate your time tonight, and quite a rather pleasure meeting you indeed!!! ;)
Tourist Trap
Posts: 2958
Joined: Jun 02, 2015 16:24

Re: Welcome to my newest 2D Truecolor Game Lib in FB: AFlib III.

Post by Tourist Trap »

Adigun A. Polack wrote: And most fortunately, FreeBASIC will NOT throw any errors at you for having the text go past the boundaries of any dialogue boxe(s) that you create in AFlib III, so quite definitely no ‘Text Overflow’ errors there on that!!
Thanks for the so extensive answer. I can only thank you for the great work. It's really nice, I hope you'll soon release the version 1. This would probably be one of the best Basic project ever because you are providing a top-quality tool to revive old games, and not only games indeed.
cfriedel123
Posts: 4
Joined: Sep 08, 2016 5:40

Re: Welcome to my newest 2D Truecolor Game Lib in FB: AFlib III.

Post by cfriedel123 »

Hi Adigun,

I just wanted to thank you for creating such a great library. It looks amazing and I can't wait to try it out!

Cliff
Adigun A. Polack
Posts: 231
Joined: May 27, 2005 15:14
Contact:

Re: Welcome to my newest 2D Truecolor Game Lib in FB: AFlib III.

Post by Adigun A. Polack »

cfriedel123, you quite splendidly wrote:Hi Adigun,

I just wanted to thank you for creating such a great library. It looks amazing and I can't wait to try it out!

Cliff
Well it is my most absolute sure pleasure indeed, cfriedel123 ( ^-^=b !! ), as I so truly, genuinely wanted to make AFlib III as robust and quite easiest-to-use for you as ever where the main focus is on wholly reviving FreeBASIC-created gaming to its fullest, grand potential once again... if anything, if AFlib III finally reaches v1.00 as its full official public release, I am sure it will be the main rather catalyst for actually bringing back our very own FreeBASIC Gaming community within us all, thriving like a phenomenally creative ever-living pulse indeed!! Because believe me, we have not even seen nearly half as much of the newest FB-created games released today in very recent years as we have once quite had from back in 2004-2012 where there were so many such games released of this kind, if I remember rightly. So I will most DEFINITELY change that for the much, much better with AFlib III to help us make FreeBASIC-created gaming even more powerfully plain fun and exciting than ever, ever before! I mean, who would forget such major-hitting greats as The Griffon Legend, Lynn's Legacy, and even Y.A.G.A.C. (Yet Another Game About Colors) that were all created in FB, huh, remember those games!? ;*) We are heading straight into 2017 in a few months, after all, so let’s rejuvenate the fiery spirit of FreeBASIC gaming into something a ton more grandly, grandly awesome as we extend ourselves into the world of both 32- and 64-bit together as well, ladies and gentlemen!!!

What is in the works right now in my continued further programming of AFlib III at once is a special built-in ASCii-character Font Editor for creating custom new AFlib III fonts (supporting all 256 characters in the ASCii spectrum, of course!)... in which I will start out with the 8x8 pixel-based ones first of all. If all goes well on this, I might even go all the way up to having full support for up to 128x128 pixel-based fonts, so we will have to see how it all develops, so keep a rather close eye on this thread, everybody!! And I might even have quite a few hidden wonderful easter eggs buried within the programming of this original FB game-creation lib for all of you as development indeed continues, too. ^^

That and even more awesome *new* surprises so exciting are all coming up by the time AFlib III reaches the BIG version 1.00, cfriedel123, so do stay quite tuned here as well!!! :D
mrToad
Posts: 430
Joined: Jun 07, 2005 23:03
Location: USA
Contact:

Re: Welcome to my newest 2D Truecolor Game Lib in FB: AFlib III.

Post by mrToad »

Hi Adigun, also wanted to sign on (it's been years) and say thanks for this amazing lib. I'm currently using Easy GL2D made by Rel for my project. It's been wonderful, but I'm trying to decide if I should switch over. You've provided a wonderful option, so I will be considering it.

Very inspiring craftsmanship is Aflib III, thank you!
Post Reply