Background Image

BlitzMax Forums/BlitzMax Beginners Area/Background Image

foosh(Posted 2008) [#1]
The background image for my game shows up as just a white slate when it's drawn using the DrawImage command. Do I need to set some sort of mask, or somehow prep the background before I draw it?

- foosh


Brucey(Posted 2008) [#2]
How big is it (x,y) ?

Do all the other images show up okay?

Perhaps you are short on VRAM?


foosh(Posted 2008) [#3]
I have a character image that shows up fine without the map, but when the map is enabled, it covers the character. It is 2156x2157...

- foosh


Brucey(Posted 2008) [#4]
Hmm, worst case, isn't that 148,815,744 bytes? (2156x2157x32)

You may find you need to cut it up into smaller chunks for your graphics card to be able to handle it.

Tiling is a good way to draw large maps.


foosh(Posted 2008) [#5]
Thanks that was the problem. Going into theory here, what is the best way to initialize and maintain a tile map? Does BlitzMax support two-dimensional arrays like in C? I would think the best way would be to have several tiles, map out the tiles in a two-dimensional array, and then have a for loop process and place them all. However, that's what I'd do in C-- I'm not familiar with BlitzMax.

Thanks!
Tim


tonyg(Posted 2008) [#6]
Yes, that is how you would do it in Bmax as well.


foosh(Posted 2008) [#7]
How do I access the a letter within a string?

Global array:String[][] = [["game"]]
Print array[0][0][0]


That gives me 103, which is the ASCII code for g. Is there some conversion function?

- foosh


tonyg(Posted 2008) [#8]
Not sure how the new question fits this post or why you're using arrays for it.
Short answer is :
Local MyString:String = "Hello World!"

 Print Chr(MyString[3])

Longer answer can be found here discusses it and provides a workaround plus an answer from Mark.
Here are some useful string functions.


ImaginaryHuman(Posted 2008) [#9]
A white rectangle usually means either some of your mipmap levels have not been generated but mipmapping is switched on, or there is not enough video ram for the texture, or texturing is switched off.


foosh(Posted 2008) [#10]
I fixed the white background problem. Thanks for all the help. The array relates to the problem, because I'm going to be using arrays for tiling, so I'm going to be doing something like

Local Array:String[][] = [ ["MXXXXXXXXXWMMX"] ]


Brucey's suggestion was tiling, so I'm going to be processing each sub-array one character at a time, and placing the tile on the map.

foosh


Brucey(Posted 2008) [#11]
For the ASCII code of a character from a string : myString[index]

For the the character value at a given position : myString[index..index+1]

It's probably more efficient to use the ASCII codes, rather than slicing a string and comparing single character length strings.


TaskMaster(Posted 2008) [#12]
Brucey, your calculation was bits, divide by 8 to get the bytes, which is about 18.6 MB. Still quite large, but not impossible.


Gabriel(Posted 2008) [#13]
Brucey, your calculation was bits, divide by 8 to get the bytes, which is about 18.6 MB. Still quite large, but not impossible.

Possibly, but he also underestimated the size, because the original poster is not considering powers of two. An image of that size would be resized to 4096x4096. Assuming the videocard in question even supports textures of that size, it would use up 64MB.

My guess is the videocard in question is either a 64MB card and didn't have enough ram for it or doesn't support textures of 4096x4096 regardless of ram.


Brucey(Posted 2008) [#14]
our calculation was bits

Oops... :-)

Never did understand computers properly...