Android Question list of images with gameview is not appearing properly.

Ripley

Member
Licensed User
Longtime User
I'm doing some experimenting with gameview as I learn B4A. I'm trying to display a row of images (and prove to myself my understanding of lists and loops) and then was planning on animating them.

Instead of stacking each image in a row like I figured my loop would, it stretches them accross the total length of the images.

This is my whole program: (also zipped it along with a screen shot of the emulator showing my problem.)

If I shouldn't have copy/pasted it here let me know. I though maybe someone could spot an error with out having to take the time to load my program.

Thanks in advance.

Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.
Dim Timer1 As Timer
Dim pngList As List

Dim CircleList As List
Dim Size As Int
Size = 50dip
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)
If FirstTime Then

pngList.Initialize
For i = 0 To 12
pngList.Add(LoadBitmap(File.DirAssets, "Image" & NumberFormat(i, 2, 0) & ".png"))
Next

CircleList.Initialize

For q = 0 To 8
Dim Circle As BitmapData
Dim rndNum As Int = Rnd(0, 12)
Circle.Bitmap = pngList.Get(rndNum)
Circle.DestRect.Initialize(100dip, 0dip+(q*Size), 170dip, 430dip-(q*Size))

CircleList.Add(Circle)
Next

Timer1.Initialize("Timer1", 16)
End If

gv.Initialize("gv")
Activity.AddView(gv, 0, 0, 100%x, 100%y)
gv.BitmapsData.AddAll(CircleList)
'Do not forget to load the layout fil-e created with the visual designer. For example:
'Activity.LoadLayout("Layout1")

End Sub
 

Attachments

  • GameViewRIPLEY.zip
    15.5 KB · Views: 75
  • emulatorPIC.png
    emulatorPIC.png
    247.9 KB · Views: 108

Ripley

Member
Licensed User
Longtime User
Thank you Erel. For some reason I thought the top counted dips from the top of the screen and the bottom of the destRec counted from the bottom of the screen. Obviously all numbers for Y are relative to the top!
 
Upvote 0
Top