Hi,
I've got the following problem, I use gameview and I preload all used bitmaps in Lists. The Problem is, when I wanted to change one bitmap in the gamview, it's changing all. It's difficult to describe, following the code:
I hope you understand my problem, when I don't change a BitmapData the results on the Screen looks like:
00000
When I change the BitmapData with Bitmap1 it looks like:
00010
When I change it with the BitmapList it is:
11111
So, does anybody has an idea where my mistake is? :/
Is it not possible to read bitmaps out of an list and insert them into GameView?
I've got the following problem, I use gameview and I preload all used bitmaps in Lists. The Problem is, when I wanted to change one bitmap in the gamview, it's changing all. It's difficult to describe, following the code:
B4X:
Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.
Dim BitmapList As List 'List of Bitmaps, maybe thats the problem? Can't gameview handle this?
BitmapList.Initialize
Dim BitmapDataList As List 'List in which the Data for Gameview is in
BitmapDataList.Initialize
Dim Bitmap0 As Bitmap 'Single Picture, used for initialize the BitmapData for Gameview
bitmap0.Initialize(File.DirAssets,"0.png")
Dim bitmap1 As Bitmap 'Single Picture, for test
bitmap1.Initialize(File.DirAssets,"1.png")
End Sub
Sub Globals
'These global variables will be redeclared each time the activity is created.
'These variables can only be accessed from this module.
Dim GV As GameView
End Sub
Sub Activity_Create(FirstTime As Boolean)
'Do not forget to load the layout file created with the visual designer. For example:
'Activity.LoadLayout("Layout1")
For x = 0 To 9
Dim HelpBitmap As Bitmap
HelpBitmap.Initialize(File.DirAssets,x&".png")
BitmapList.Add(HelpBitmap)
Next
GV.Initialize("GV")
Activity.AddView(GV,0,0,100%x,100%y)
Dim HelpWidth = 100%x/5 As Int
For x = 0 To 4
Dim HelpBitmapData As BitmapData
HelpBitmapData.Bitmap = Bitmap0
HelpBitmapData.DestRect.Initialize(x*HelpWidth,0,(x*HelpWidth)+HelpWidth,100%y)
BitmapDataList.Add(HelpBitmapData)
Next
GV.BitmapsData.AddAll(BitmapDataList)
Dim HelpBitmapData As BitmapData
HelpBitmapData = BitmapDataList.Get(3)
HelpBitmapData.Bitmap = BitmapList.Get(1) '<--- When I do this, every bitmap is changed
'HelpBitmapData.Bitmap = bitmap1 '<--- When I do this, only the targetbitmap is changed, all other bitmaps stay normal
GV.Invalidate
End Sub
I hope you understand my problem, when I don't change a BitmapData the results on the Screen looks like:
00000
When I change the BitmapData with Bitmap1 it looks like:
00010
When I change it with the BitmapList it is:
11111
So, does anybody has an idea where my mistake is? :/
Is it not possible to read bitmaps out of an list and insert them into GameView?