GameX - Game Library for FreeBASIC
GameX - Game Library for FreeBASIC
GameX is a library of functions to help people make games (or other programs) in FreeBASIC.
What is in this library you ask? The library is broken out into classes of specific game relevance.
1. Sound Class - Uses SDL to provide simple wave playback, looping, and volume control up to 255 sounds.
2. Sprite Class - Gives simple functions for loading individual sprites or sheets and displaying them.
3. Collision Class - Provides pixel-perfect collision detection
3. RotoZoom Class - As the name implies, it gives the familiar zooming and rotating of sprites.
4. Input Class - Gives simple calls for keyboard and mouse states.
5. Vector Font Class - Provides simple vector drawn fonts in several styles
6. Bitmap Font Class - Currently provides 4 different fonts (Bauhaus, Stencil, OCR-A, and Tahoma)
7. SDL Screen Class - Lets SDL handle screen, mouse, and keyboard processing
8. Animator Class - Automates processing frames at a specific rate for sprite sheets.
The library is designed so you only have to link to what you want. I am still working out some details before I provide it to the community (LGPL).
I am debating adding a screen effects class to provide screen wipes and fades. I would also be interested in any other ideas.
Here is an early beta with an example program.
Download Version 0.1
-Vince
What is in this library you ask? The library is broken out into classes of specific game relevance.
1. Sound Class - Uses SDL to provide simple wave playback, looping, and volume control up to 255 sounds.
2. Sprite Class - Gives simple functions for loading individual sprites or sheets and displaying them.
3. Collision Class - Provides pixel-perfect collision detection
3. RotoZoom Class - As the name implies, it gives the familiar zooming and rotating of sprites.
4. Input Class - Gives simple calls for keyboard and mouse states.
5. Vector Font Class - Provides simple vector drawn fonts in several styles
6. Bitmap Font Class - Currently provides 4 different fonts (Bauhaus, Stencil, OCR-A, and Tahoma)
7. SDL Screen Class - Lets SDL handle screen, mouse, and keyboard processing
8. Animator Class - Automates processing frames at a specific rate for sprite sheets.
The library is designed so you only have to link to what you want. I am still working out some details before I provide it to the community (LGPL).
I am debating adding a screen effects class to provide screen wipes and fades. I would also be interested in any other ideas.
Here is an early beta with an example program.
Download Version 0.1
-Vince
Last edited by vdecampo on May 20, 2012 2:25, edited 2 times in total.
Re: GameX - Game Library for FreeBASIC
can you give me a quick code example of what you mean by linking etc
something tangible so i can to get my head around it all and my thinking cap on straight as it were
something tangible so i can to get my head around it all and my thinking cap on straight as it were
Re: GameX - Game Library for FreeBASIC
Linking is what happens when you use a library in code. The library's code is "linked" or joined to the code you have written.TESLACOIL wrote:can you give me a quick code example of what you mean by linking etc
something tangible so i can to get my head around it all and my thinking cap on straight as it were
What he means by linking only what is used, is this: The parts of the library that you don't use will not be included in your final exe. This makes the final program smaller. If all you use is the vector fonts, then that is all that will be included in the final exe.
I hope that helps.
Re: GameX - Game Library for FreeBASIC
I sorta gathered that much, was after an code snippet so i could examine the actual format and code context he was intending to use
other wise im commenting on something i haven't actually seen, working blind if you get me ....a good sculptor needs to get a feel of the clay
thx 4 the clarification anyrate
other wise im commenting on something i haven't actually seen, working blind if you get me ....a good sculptor needs to get a feel of the clay
thx 4 the clarification anyrate
Re: GameX - Game Library for FreeBASIC
Here is a sample to play a sound loop...
-Vince
Code: Select all
#Include "gamex.bi"
Dim As clsSOUND Sound
If Sound.IsInitialized = 0 Then
Print "Sound did not initialize!"
EndIf
Var music1 = Sound.LoadSound("test2.wav")
Sound.PlaySound(music1,10) '<- 10 loops
Re: GameX - Game Library for FreeBASIC
Ang here is an example of using the input and bitmap fonts classes...
-Vince
Code: Select all
#Include "gamex.bi"
ScreenRes 640,480,32 'Set Gfx mode before any Gfx classes
Dim As clsBMPFONT Font
Dim As clsINPUT inpt
Font.SetFont(clsBMPFONT.OCRA)
Font.SetAlignment(clsBMPFONT.ALIGN_RIGHT)
Font.DrawString(0,"ABCDEFGHIJKLMNOPQRSTUVWXYZ",320,20,&hFF0000)
Do
Sleep 10,1
Loop Until inpt.GetChar()
Re: GameX - Game Library for FreeBASIC
ta
no biggie but its kind of hard not to read cls as CLS in as in clear screen
prolly down to years of scanning basic code for bugs...i can see this causing endless doh ! to the n' moments
gamex.bi = is good ( its kind of a WYSIWYG word that doesn't dump me in the basement )
minor details i know , but it all adds up especially when it comes to inevitable debug time
when humans read they tend to grab the end features of a word and guess the middle, that's why uppercase GX_ feels much more natural than using a lowercase cls shunted up tight to its bedfellow keyword
there is an entire class of visual deceptions & illusions based upon this premise. I remember staring at one particular trick sentence for 10 minutes and still couldn't spot the deliberate mistake even after manually fingering each & every letter....the compulsion to 'guess the middle' that powerful...no doubt 'de bugging blindness' is strongly related to this phenomenon
...imagines
-Vince wincing as he hastily codes up a macro to let loose on his HDD to hunt down every instance of cls***
no biggie but its kind of hard not to read cls as CLS in as in clear screen
prolly down to years of scanning basic code for bugs...i can see this causing endless doh ! to the n' moments
gamex.bi = is good ( its kind of a WYSIWYG word that doesn't dump me in the basement )
Code: Select all
' perhaps
Dim As GX_SOUND Sound
' rather than
Dim As clsSOUND Sound
' its one less case change as well
' and more importantly the underscore greatlyaidsreadability :-p
minor details i know , but it all adds up especially when it comes to inevitable debug time
when humans read they tend to grab the end features of a word and guess the middle, that's why uppercase GX_ feels much more natural than using a lowercase cls shunted up tight to its bedfellow keyword
there is an entire class of visual deceptions & illusions based upon this premise. I remember staring at one particular trick sentence for 10 minutes and still couldn't spot the deliberate mistake even after manually fingering each & every letter....the compulsion to 'guess the middle' that powerful...no doubt 'de bugging blindness' is strongly related to this phenomenon
...imagines
-Vince wincing as he hastily codes up a macro to let loose on his HDD to hunt down every instance of cls***
Re: GameX - Game Library for FreeBASIC
Don't hold your breath. :)TESLACOIL wrote: ...imagines
-Vince wincing as he hastily codes up a macro to let loose on his HDD to hunt down every instance of cls***
Re: GameX - Game Library for FreeBASIC
lol....there's always the one isn't there Vince
looks like you are brewing up some good stuff there any rate.
Sounds
I gather you know whats required soundswise for arcade games etc. By solving this you also mostly solve artificial speech and artificial singing. ( vocaloid )
I use a bank of wav sounds for speech, SAPI etc is ok but its kind of clunky and limiting.
For robo speech / robo singing you need to have phonetics effectively mixed and blended to smooth out the hiss pop and stutter. Playing up to half a dozen wavs at once does at a stroke do away with many audio issues. However new issues arise such as getting the timing synchronized and perhaps the volumes compensated.
I take it your GX Sound is an effort to handle synchronization aspect of things ?
This would be a great asset to coders.
SDL
http://en.wikipedia.org/wiki/Simple_DirectMedia_Layer
Simple DirectMedia Layer
http://www.libsdl.org/
Ill certainly be up for testing your sound code ( win xp sp 3 ) I have a dozen or so pcs so i can test it on multiple hw configurations. I have to solve the sound issue for my AI project anyway so i dont mind putting in some graft on the beta testing.
looks like you are brewing up some good stuff there any rate.
Sounds
I gather you know whats required soundswise for arcade games etc. By solving this you also mostly solve artificial speech and artificial singing. ( vocaloid )
I use a bank of wav sounds for speech, SAPI etc is ok but its kind of clunky and limiting.
For robo speech / robo singing you need to have phonetics effectively mixed and blended to smooth out the hiss pop and stutter. Playing up to half a dozen wavs at once does at a stroke do away with many audio issues. However new issues arise such as getting the timing synchronized and perhaps the volumes compensated.
I take it your GX Sound is an effort to handle synchronization aspect of things ?
This would be a great asset to coders.
SDL
http://en.wikipedia.org/wiki/Simple_DirectMedia_Layer
Simple DirectMedia Layer
http://www.libsdl.org/
Ill certainly be up for testing your sound code ( win xp sp 3 ) I have a dozen or so pcs so i can test it on multiple hw configurations. I have to solve the sound issue for my AI project anyway so i dont mind putting in some graft on the beta testing.
Last edited by TESLACOIL on May 16, 2012 15:36, edited 2 times in total.
Re: GameX - Game Library for FreeBASIC
The focus of GameX is simplicity. It is designed as a starting point for those who want to start making games.TESLACOIL wrote:I take it your GX Sound is an effort to handle synchronization aspect of things ?
-Vince
Re: GameX - Game Library for FreeBASIC
Q how many sounds can you play at once ?
Re: GameX - Game Library for FreeBASIC
From the first post...TESLACOIL wrote:Q how many sounds can you play at once ?
1. Sound Class - Uses SDL to provide simple wave playback, looping, and volume control up to 255 sounds.
-Vince
Re: GameX - Game Library for FreeBASIC
You mentioned SDL - is it multithread-proof?
Re: GameX - Game Library for FreeBASIC
Do you mean can you call the sound class from different threads? That is not advisable. You would want to use a mutex. But it is fine running on its own thread. The graphics classes suffer from the same threading issues as the FB Gfx lib. All Gfx classes should be used from the main thread.Kot wrote:You mentioned SDL - is it multithread-proof?
Again, this is a simple set of tools for beginner to intermediate programmers to put all of the resources for game development in one easy to access library.
-Vince
Re: GameX - Game Library for FreeBASIC
Early Beta version now available for download. See first post.
-Vince
-Vince