MiniB3d for FreeBasic

Headers, Bindings, Libraries for use with FreeBASIC, Please include example of use to help ensure they are tested and usable.
Post Reply
angros47
Posts: 2409
Joined: Jun 21, 2005 19:04

Re: MiniB3d for FreeBasic

Post by angros47 »

Pretty simple: with the line:

Code: Select all

imagetohud=imagecreate(128,16,32)
you create a picture that has a width of 128 and a height of 16 pixels, and I guess it was your intention, since you have the line:

Code: Select all

    Line imagetohud,(0,0)-(511,15),RGB(150,10,0),BF
to fill it.

But when you create the sprite texture, you use:

Code: Select all

hudstringtex=CreateTexture(128,32)
that means, the texture expects a picture that has a width of 128 pixels and a height of 32 pixels, not 16. So, since the picture you created can fill only half of the texture, the other half of the texture will contain garbage, hence you see the pixels of different colors.

So, either you use "imagetohud=imagecreate(128,32)" (and also modify the LINE command), or you use "hudstringtex=CreateTexture(128,16)" (that will stretch the text vertically, I warn you)
ITomi
Posts: 189
Joined: Jul 31, 2015 11:23
Location: Hungary

Re: MiniB3d for FreeBasic

Post by ITomi »

Thanks, Angros47!
So, is it not possible to make a background of exact size? Just because the text size in the command hudstringtex=CreateTexture(128,32) stretch the text in the opposite way. That is while I would reduce the values in other commands to get smaller background, in the hudstringtex higher value results smaller text.
angros47
Posts: 2409
Joined: Jun 21, 2005 19:04

Re: MiniB3d for FreeBasic

Post by angros47 »

What are you doing with the sprite is not a background, it's more of a HUD

And the stretching happens because, while the texture has the size you specified, the sprite, unless scaled, is always square, so the texture is stretched to fit. So, either you scale the sprite, or you use a square texture and image
Post Reply