Weekly Qbasic and Qb64 Lesson Topics
June 23, 2017, 05:22:43 am
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News: Want to see a specific Tutorial? ASK!
 
  Home Help Search Arcade Links Staff List Login Register  

QBasic verse QB64 SCREENs


Pages: [1]
  Print  
Author Topic: QBasic verse QB64 SCREENs  (Read 2595 times)
GarrisonRicketson
Admin
Administrator
Hero Member
*****
Posts: 583



WWW
« on: February 04, 2011, 11:03:43 pm »

Depending how much you know, this may or may not make much sense to you, back when I first recieved this, it did not make much sense to me, now it dose make more sense.
Quote
         QBasic verse QB64 SCREENs
   In QBasic the user has to define the output screen use through the SCREEN MODE command.

The graphical output screens that QBasic can access are 7,9,12 and 13. Screen 7,9,12 use 16 color
palettes and Screen 13 uses 256 color palette.
   QB64 allows compatablty by using those same screen resolutions. However in QB64 there are
broadly 2 different ways to use those screens.
1] Method 1 .Uses the same screen mode commands as in QBasic.
2] Method 2 .Uses the _newscreen command. This command allows you to nominate the pixels wide by
pixels high with the color depth.
To use _newscreen and recreate a standard QBasic screen 12 we would do this
_newscreen (640,480,12)
to show this new screen we do this SCREEN _newscreen(640,480,12).

   One of the limitations of QBasic with screens is that you are limited to one. In QB64 you
can have multiple screens but only one can show at a time. In QB64 you use "handles" to identify
a screen "page". Any screen can be made "visable" at any time and any other pages still exist but
are not "visable".
   A quirk is that you can create a QB64 screen that half the size of the equivalent QBasic
screen. In QBasic Screen 12 is 640 pixels wide by 480 pixels high. To make a screen half this size
HalfScreen&= _newimage (320,240,12)  (note the handle "HalfScreen&", the 12 indicates screen 12 palette)
To display this screen we do this
SCREEN HalfScreen&
   Another QB64 feature is you can have multiple SCREEN 12 "pages" each one with a different
palette. By making a specific "page" visable we use its palette in dispalying that "page". Its not
possible to use 2 images from different "pages" that are "mixed" using 2 different palettes ,displayed
on a single "page" without reassigning (rebuild) the pages palette.
   When you create a new image with the _newimage command the screen page is created with a
standard palette. If we created a new screen page by using the _loadimage command ,that page will
use the palette of the saved image. To copy the image to the other page and preserve the palette we
need to use the _copypalette command before the copy command. If we didnt we would see the loaded
image in a different palette.
   When you use two pages we need to use 2 new commands to indicate which page we wish to work
with. Thats why we use _SOURCE and _DEST commands. The big disadvantage in QBasic of using only one
screen is that any drawing occurs in real time and we see the screen change before our eyes. If we
drew slowly enough we would see the new image unvail as its drawn. This is cured by using two screens,
one that is displayed and the other having its contents drawn on. At regular intevals we flip the 2
screens so the newer drawn page is shown. To achieve this we would need to tell QB64 which page we
wish the drawing to occur on with the _dest command.
   Another advantage of QB64 is that we can display any image scaled up or down on the "fly".If
we create 2 pages and assign one to be shown, then anything copied from the non visable page can be
scaled onto the visable page. We copy by using put image.
_putimage (destination co-ordinates),SourecHandle&,DestinationHandle&,(source co-ordinates)
   If we used the same (destination co-ordinates) as the (source co-ordinates) we see the same
image at the same size. If we halved the (destination co-ordinates) we would see a picture that is
only half the size of the image referenced by the (source co-ordinates).
   This process is only complicated if you use two different screen sizes to begin with. The "size"
is described in "pixels" by the co-ordinates used. So this means that a number of pixels are read and
applied with (source co-ordinates) ,to an amount of "space" referenced by (destination co-ordinates).
 
« Last Edit: September 09, 2011, 12:05:12 am by GarrisonRicketson » Report Spam   Logged

Social Buttons


Pages: [1]
  Print  
 
Jump to:  

Powered by EzPortal
Bookmark this site! | Upgrade This Forum
SMF For Free - Create your own Forum

Buy traffic for your forum/website
traffic-masters
Powered by SMF | SMF © 2016, Simple Machines