GameView - Another howto question

basil99

Active Member
Licensed User
Longtime User
Lets say, I load several images and add them to Gameview in this way

Dim gv as GameView

and

gv.BitmapsData.Add( Picture1 )
gv.BitmapsData.Add( Picture2 )
gv.BitmapsData.Add( Picture3 )
gv.BitmapsData.Add( Picture4 )
.......
gv.BitmapsData.Add( PictureN )

Then I need to "clear" Gameview and start to draw another pack of pictures:

gv.BitmapsData.Add( anotherPicture1 )
gv.BitmapsData.Add( anotherPicture2 )
gv.BitmapsData.Add( anotherPicture3 )
.......
gv.BitmapsData.Add( anotherPictureM )

So, questions are:

1) how to "clear" GameView "in one click" ? If possible ?
2) If not, I need to make calls like that:

Picture1.Delete = True
Picture2.Delete = True
Picture3.Delete = True
................
PictureN.Delete = True

then add another group of pictures ?

I tried this but by some reason I can't add picture to the gameview again if it was deleted before - nothing is displayed

3) How to remove picture from gameview list without deleting it ?


Thank you
 
Last edited:

basil99

Active Member
Licensed User
Longtime User
1, 2)
B4X:
gv.BitmapsData.Clear
3) Setting Delete to true is equivalent to removing the picture. It doesn't "destroy" the image.

It is convenient to set Delete to true and not modify the list directly. Modifying the list directly can lead to parent For Next blocks to fail.

Ok, thanks, it works )
 
Upvote 0

Juan Luis Lopez

Member
Licensed User
Longtime User
i want to make something to blink but if i use .delete = true and then use .delete= false nothing appears
i tries to reload the bitmap with bitmapdata.loadbitmap but i doesnt work...
how can i do it?
 
Upvote 0

Juan Luis Lopez

Member
Licensed User
Longtime User
but bitmapdata hasnt an alpha property...
i found a way to do that
after deleting with bitmapdata.delete=true, i have to reload a bitmap and add it to the gameview list.
i have been reading about accelerated surface and dxlib but i found it hard.
thanks!
 
Upvote 0

Informatix

Expert
Licensed User
Longtime User
but bitmapdata hasnt an alpha property...
Your bitmapdata has a bitmap property containing the image to make blink. Use the AlterColors function of my Accelerated Surface library (or any similar function of another library) to change the alpha value.
EDIT: another way is to draw with a zero size destrect if the library allows that (untested). That's not ideal but it's better than creating/removing an object repeatedly.
 
  • Like
Reactions: eps
Upvote 0
Top