Posts: 6,419
Threads: 74
Joined: Mar 2002
CHR$ (0) is the null character and the string terminator in C and many other languages. This is done for expandability.
CHR$ (0) + "K" is somewhat like an empty string 'cause most functions will stop working at the first char.
WB, Zack. Nice to see you around again.
Posts: 3,616
Threads: 287
Joined: Jan 2003
Quote:Zack Wrote:Next project: add line, box and circle capability. I might do a total rewrite and work it around lib with bitmap loading/saving, etc.
A lib.. kind of like.. the standard FB lib?
Bload "mybmpfile.bmp"
Bsave "mybmpfile.bmp"
Just make sure to use the .bmp extension, and to bload into a properly dimensioned surface (array) I just discovered that. Wicked. :o
Hey Nath, how you doing?
I have a question. Suppose I have a 10x10 bmp that I load. Suppose it's a picture of a little game character (Mario or such), and I want to put it against a green grass background. So I draw the background, and put the bmp in the middle...but then you see that all around the character, the grass has been blanked out by the white character background, so now it's just ugly.
Any suggestions?
f only life let you press CTRL-Z.
--------------------------------------
Freebasic is like QB, except it doesn't suck.
Posts: 6,419
Threads: 74
Joined: Mar 2002
Use the TRANS mode in PUT, It's been added and bypasses black (0) pixels in paletted modes and pink (RGB = 255, 0, 255) pixels in true/hi-colour modes.
Code: PUT (100,100), sprite%(0), TRANS
Read more: http://www.freebasic.net/wiki/wikka.php?...utgraphics
this post is like... so symbolic of fb defeating qb... it amazes me.
Posts: 6,419
Threads: 74
Joined: Mar 2002
hahaha It's so epic.
All the common problems of coding in QB being solved in 1 line of fB code.
On the next QB vs. fB war we can just link to this thread.
Posts: 3,616
Threads: 287
Joined: Jan 2003
Thanks Nath.
Yep, I'm converted. FB r0xx0rz over QB, hands-down, flat out, no questions asked.
None of this was impossible in QB...just so much harder...
f only life let you press CTRL-Z.
--------------------------------------
Freebasic is like QB, except it doesn't suck.
Posts: 3,616
Threads: 287
Joined: Jan 2003
Next question...
Code: dim pic(26*36*4) as byte
screen 19,24
paint (10,10),200
bload "c:\man.bmp",@pic(0)
put (100,100),@pic(0),trans
sleep
man.bmp is just a little 25*35 24-bit bmp with an rgb(255,0,255) background.
Why does it only do what I want when it has the "@" symbol before any reference to the pic array? If I leave it out, it loads the bitmap straight to the screen at (0,0) and the pink background is shown, instead of making it invisible.
f only life let you press CTRL-Z.
--------------------------------------
Freebasic is like QB, except it doesn't suck.
Posts: 3,522
Threads: 189
Joined: Dec 2003
Quote:Next question...
Code: dim pic(26*36*4) as byte
screen 19,24
paint (10,10),200
bload "c:\man.bmp",@pic(0)
put (100,100),@pic(0),trans
sleep
man.bmp is just a little 25*35 24-bit bmp with an rgb(255,0,255) background.
Why does it only do what I want when it has the "@" symbol before any reference to the pic array? If I leave it out, it loads the bitmap straight to the screen at (0,0) and the pink background is shown, instead of making it invisible.
Because FB now use pointers instead of pure arrays.
When you pass the array, FB interpret it as 0, if you bload without adding a pointer, or when adding a 0, the bitmap is loaded to screen, top left.
bload "c:\man.bmp"
Also, get rid of the fixed paths. Now.
Fixed path: "c:\man.bmp"
Relative path: "man.bmp"
|