Graphics with QB64
In QB 4.5 for DOS you would simply code:
PSET (100, 100), 15
...to display a primitive kind of graphics (a dot).
SCREEN 13 is 320 * 200 with 256 color values.
This still works in QB64, however as QB64 is made for modern systems it also have modern graphics.
Instead of using SCREEN 13 we would rather use some other screenmode with a higher resolution, say 800*600, and instead of using 256 colors we would rather use millions of colors (32-bit for example).
So we would like to define our own screenmode, instead of 13.
Take a glimpse at this code:
newscreen = _NEWIMAGE(800, 600, 32) '800*600 with 32-bit color
SCREEN newscreen ' newscreen can now be seen as our new screenmode!
PSET (100, 100), _RGB32(255, 255, 255)
_NEWIMAGE is the statement that can be used to define a screenmode. So instead of SCREEN 13, we have SCREEN newscreen instead that we can define to be exactly what we want (newscreen can of course be any name you want).
With 32-bit modes we can use _RGB32 as the color value, this way we can define the color we want!
RGB stands for Red, Green, Blue, and you can define the amount of Red, Blue and Green you want mixed to produce the color.
255 is the highest value of Red, Green and Blue, so having all set to 255 will produce bright white.
See how much more freedom you get with defining your own screenmode instead of having to use predefined ones as in QB 4.5?
Well, this is not the end of your freedom, alot more can be done with QB64 by simple means!
Let's create something interesting!
newscreen = _NEWIMAGE(800, 600, 32)
Well, that's the end of this tutorial! Hope you have learned something!
Back to Index