Qbasicnews.com

Full Version: Bitmaps (loading image)
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
ok i have a number of sprite and tiles. I was wondering is there a way to have qbasic load the image and do the bitmap it self. Like the

0,0,0,0,0,0,0,0,0,0,0,
etc

or is there a way to turn it into a bitmap outside of qbasic. cause i dont know how to do it manually.
ello,

I'm no Gfx expert, bu there is Bload and Bsave commands.
bsave let's you to save an bitmap array and bload to load bitmap array.
Example:
Code:
DIM Cube(1 TO 675)
SCREEN 1
'Draw a white box.
LINE (140, 25)-(140 + 100, 125), 3, B
'Draw the outline of a magenta cube inside the box.
DRAW "C2 BM140,50 M+50,-25 M+50,25 M-50,25"
DRAW "M-50,-25 M+0,50 M+50,25 M+50,-25 M+0,-50 BM190,75 M+0,50"
'Save the drawing in the array Cube.
GET (140, 25)-(240, 125), Cube
'Set segment to the array Cube's segment and store the drawing
'in the file MAGCUBE.GRH. Note: 2700 is the number of bytes
'in Cube (4 bytes per array element * 675).
DEF SEG = VARSEG(Cube(1))
BSAVE "MAGCUBE.GRH", VARPTR(Cube(1)), 2700
DEF SEG                 'Restore default BASIC segment.
and to load it:
Code:
DIM Cube(1 TO 675)
'Set the screen mode. The mode should be the same as the
'mode used to create the original drawing.
SCREEN 1
'Set segment to the array Cube's segment and load
'the graphic file into Cube.
DEF SEG = VARSEG(Cube(1))
BLOAD "MAGCUBE.GRH", VARPTR(Cube(1))
DEF SEG               'Restore default BASIC segment.
'Put the drawing on the screen.
PUT (80, 10), Cube
Hope It'll be of some help.
thank youf or your reply i can use that too but i mean. I drew some sprites in MS paint how can i convert them to bitmap format 0,3,0,9,8,0,7 etc.

i dotn want to have to figure out each color and do it by hand im sure there some way to do this? Anyone?
There are routines for loading bitmaps coded in QB.
Example: http://qbnz.com/dav/ click programs
Most bmp convertors are saving the file with BSAVE, so you can load them with BLOAD and use the sprites for your QB program.

I never saw a program that convers a .bmp file in DATA statements maybe possible but then if your getting to more advanced programming in QB you realize its useless.
so will this bmp converters turn it into a data statment?
no, it will just save it in the BSAVE format which you can later load by using BLOAD command.