|
QBXL Technical Articles
So you want to try out FreeBASIC, eh? By SJ Zero |
|
The
future
is upon us and you want to get started, don't you? Fear not! FreeBASIC
is easier to get into today than ever before! Most problems with
earlier versions which could have stood in the way of learning how to
use FreeBASIC have been eliminated, and today, 99% of what you need to
know to code in FreeBASIC is just old QuickBASIC material. 1. Getting started with the software As of this writing, You can grab fbIDE bundled with FreeBASIC
.12 right here.
Install it like you'd install any windows program. This part is really
easy. If you can't download a program and run an installer, you
probably should look elsewhere -- like an etch-a-sketch -- for your
programming needs. 2. Hello world! Open up fbIDE and type the following: PRINT "Hello World!" Now press F5. Congratulations, you've just seen how much like
QB
FreeBASIC really is. Now you can use most console commands for QB just
like you remember. for example: LOCATE 10,10
From there, all of the standard QB graphics
commands work as you remember, as you can see in this example: SCREEN 13 FreeBASIC also has new graphics features. For example, QB has never had a screen 14 or greater. Try running this program: SCREEN 15 After opening a graphics window via the
SCREEN command, you can also hit ALT-ENTER to change between windowed
and fullscreen modes. Another nice feature of the graphics
library in FreeBASIC is that you can do page flipping in any video
mode. The following code demonstrates this. THERE IS NO EXIT IN THIS PROGRAM SO YOU
MUST CLOSE THE CONSOLE WINDOW TO EXIT THE PROGRAM. THIS WILL WORK FOR
ANY LOCKED UP OR UNEXITABLE FreeBASIC PROGRAM! DIM page screen 12,
, 2 'This sets the screen for 2 pages This works for any mode, so you can use the
high resolution modes for your programs with page flipping, using
standard QB graphics commands! 4. Why ASM is probably
pretty dead DIM x,y,buttons WHILE NOT
MULTIKEY(escapeKey) 'this checks the escape key every frame With this knowlege, you should be able to
begin the transition to FreeBASIC, with all the perks that it entails;
Speed, power, portability -- you're the man, cool guy! |
||
|
|||