Hi everyone,
I really need some advice regarding my code on livewallpaper created using basic4android here. Actually this code is working quite fine on medium-smaller device, but when this livewallpaper is running on New HD device such as Galaxy S3, it tend to crash and show out of memory from bitmap.
I know it must be my code that produce this issue due my code is not efficient enough.
Sorry, forgot to attached the complete project. Here are the complete project files
Link for attachment :
Download mycrashwallpaper.rar (complete project)
Download crash.rar (crash log and video)
continued on next post ...
I really need some advice regarding my code on livewallpaper created using basic4android here. Actually this code is working quite fine on medium-smaller device, but when this livewallpaper is running on New HD device such as Galaxy S3, it tend to crash and show out of memory from bitmap.
I know it must be my code that produce this issue due my code is not efficient enough.
B4X:
Sub Process_Globals
Dim lwm As LWManager
Dim lwe As LWEngine
Dim airpushads As MESAirpushV5
Dim width As Int
Dim height As Int
Dim x, y, vx, vy As Int
Dim initialized As Boolean: initialized = False
Dim boxSize As Int
Dim bgmedium As Bitmap
Dim bgsmall As Bitmap
Dim bgbig As Bitmap
Dim backgroundColor As Int
Dim starbig As Bitmap
Dim starbig2 As Bitmap
Dim starbig3 As Bitmap
Dim starbig4 As Bitmap
Dim starbig5 As Bitmap
Dim starbig6 As Bitmap
Dim starbig7 As Bitmap
Dim starbig8 As Bitmap
Dim starbig9 As Bitmap
Dim starbig10 As Bitmap
Dim reccls As Rect ' Screen Clear Rectangle
Dim bubblesrnd(7) As Bitmap
Dim rectbubblernd(7) As Rect
Dim bubbledynamic(7) As Bitmap
Dim bubbledynamicx(7) As Double
Dim bubbledynamicy(7) As Double
Dim bubbledynamicrect(7) As Rect
Dim AngleStep As Float
getrotatespeed
' AngleStep = 0.05
Dim xyinit As Boolean: initialized = False
Dim getdir As String
Dim getspd As String
Dim getitrc As String
Dim getpat As String
Dim getvisible As String
Dim getrotspd As String
Dim Angle As Float : Angle = -AngleStep
'Initialize awal sebelum ada perubahan di seting jumlah item
Dim getnum As Int
getnumber
Dim bubblesrndshow(getnum) As Bitmap
Dim rectbubblerndshow(getnum) As Rect
Dim bubblexrnd(getnum) As Double
Dim bubbleyrnd(getnum) As Double
Dim MP As MediaPlayer
'Ok lets store animated sparkles the list
Dim bmpbs As Bitmap ' ground
Dim anim As List
Dim animindex As Int
animindex=0
End Sub
Sub Service_Create
InitializeEngine
' airpushads.initialise
' airpushads.startPush("false")
End Sub
Sub Service_Start (StartingIntent As Intent)
' airpushads.startSmartWall
End Sub
Sub Service_Destroy
Dim Obj1 As Reflector
Dim Obj2 As Reflector
Dim Obj3 As Reflector
Dim Obj4 As Reflector
Dim Obj5 As Reflector
Dim Obj6 As Reflector
Dim Obj7 As Reflector
' Dim Obj8(getnum) As Reflector
Dim Obj9(7) As Reflector
Dim Obj10(7) As Reflector
Dim Obj11 As Reflector
Dim Obj12 As Reflector
Dim Obj13 As Reflector
Dim Obj14 As Reflector
Dim Obj15 As Reflector
Dim Obj16 As Reflector
Dim Obj17 As Reflector
Obj1.Target = bgsmall ' bmp is the unwanted Bitmap
Obj1.RunMethod("recycle")
Obj2.Target = bgmedium ' bmp is the unwanted Bitmap
Obj2.RunMethod("recycle")
Obj3.Target = bgbig ' bmp is the unwanted Bitmap
Obj3.RunMethod("recycle")
Obj4.Target = starbig ' bmp is the unwanted Bitmap
Obj4.RunMethod("recycle")
Obj5.Target = starbig2 ' bmp is the unwanted Bitmap
Obj5.RunMethod("recycle")
Obj6.Target = starbig3 ' bmp is the unwanted Bitmap
Obj6.RunMethod("recycle")
Obj11.Target = starbig4 ' bmp is the unwanted Bitmap
Obj11.RunMethod("recycle")
Obj12.Target = starbig5 ' bmp is the unwanted Bitmap
Obj12.RunMethod("recycle")
Obj13.Target = starbig6 ' bmp is the unwanted Bitmap
Obj13.RunMethod("recycle")
Obj14.Target = starbig7 ' bmp is the unwanted Bitmap
Obj14.RunMethod("recycle")
Obj15.Target = starbig8 ' bmp is the unwanted Bitmap
Obj15.RunMethod("recycle")
Obj16.Target = starbig9 ' bmp is the unwanted Bitmap
Obj16.RunMethod("recycle")
Obj17.Target = starbig10 ' bmp is the unwanted Bitmap
Obj17.RunMethod("recycle")
Obj7.Target = bmpbs ' bmp is the unwanted Bitmap
Obj7.RunMethod("recycle")
' For i=0 To getnum-1
' Obj8(i).Target = bubblesrndshow(i)' bmp is the unwanted Bitmap
' Obj8(i).RunMethod("recycle")
' Next
'
For i=0 To 6
Obj9(i).Target = bubblesrnd(i)' bmp is the unwanted Bitmap
Obj10(i).Target = bubbledynamic(i)' bmp is the unwanted Bitmap
Obj9(i).RunMethod("recycle")
Obj10(i).RunMethod("recycle")
Next
' Log("i:"&i)
End Sub
Sub lwm_SizeChanged (Engine As LWEngine)
DrawBackground(Engine)
End Sub
Sub lwm_OffsetChanged (Engine As LWEngine)
End Sub
Sub DrawBackground (Engine As LWEngine)
getnumber
getheartvisible
If Engine.ScreenWidth>Engine.ScreenHeight Then
FullRefreshLandscape(Engine)
Else
FullRefreshPortrait(Engine)
End If
If getvisible ="False" Then
'set direction in drawing
If getdir == 0 Then 'move bubble to left
MoveLeft(Engine)
Else If getdir == 1 Then 'move bubble to up
MoveUp(Engine)
Else If getdir == 2 Then 'move bubble to right
MoveRight(Engine)
Else If getdir == 3 Then 'move bubble to down
MoveDown(Engine)
End If
End If
reccls.Initialize(0,0,Engine.ScreenWidth,Engine.ScreenHeight)
Engine.Refresh(reccls)
End Sub
Sub lwm_VisibilityChanged (Engine As LWEngine, Visible As Boolean)
If Visible Then
DrawBackground(Engine)
End If
End Sub
Sub lwm_Tick(Engine As LWEngine)
DrawBackground(Engine)
End Sub
'Fungsi untuk menginisiasi engine lwp awal termasuk itemnya
Sub InitializeEngine
lwm.Initialize("lwm", True)
'Initialize berikutnya looping setelah ada perubahan di seting jumlah item
Dim getnum As Int
getnumber
getspeed
getdirection
getdisableinteraction
getrotatespeed
boxSize=50
MP.Initialize
MP.Load(File.DirAssets, "bubble.wav")
MP.SetVolume(0.5,0.5)
Dim bubblesrndshow(getnum) As Bitmap
Dim rectbubblerndshow(getnum) As Rect
Dim bubblexrnd(getnum) As Double
Dim bubbleyrnd(getnum) As Double
bgsmall.Initialize(File.DirAssets, "small.jpg")
bgmedium.Initialize(File.DirAssets, "medium.jpg")
bgbig.Initialize(File.DirAssets, "big.jpg")
starbig.Initialize(File.DirAssets, "bigstar.png")
starbig2.Initialize(File.DirAssets, "bigstar2.png")
starbig3.Initialize(File.DirAssets, "bigstar3.png")
starbig4.Initialize(File.DirAssets, "bigstar4.png")
starbig5.Initialize(File.DirAssets, "bigstar5.png")
starbig6.Initialize(File.DirAssets, "bigstar6.png")
starbig7.Initialize(File.DirAssets, "bigstar7.png")
starbig8.Initialize(File.DirAssets, "bigstar8.png")
starbig9.Initialize(File.DirAssets, "bigstar9.png")
starbig10.Initialize(File.DirAssets, "bigstar10.png")
lwm.StartTicking(33) 'Start the wallpaper timer (refresh every 5 milliseconds).
'======================================================
bmpbs.Initialize(File.DirAssets,"spark_0.png") 'BAmiga sector 1 animated ground..
' And initialize anim list emty
anim.Initialize
' store boring 51 pics to the list .... all work to show how to anim gifs :)
anim.AddAll(Array As String("spark_0.png", "spark_1.png", "spark_2.png", "spark_3.png", "spark_4.png", "spark_5.png", _
"spark_6.png", "spark_7.png", "spark_8.png", "spark_9.png", "spark_10.png", "spark_11.png", "spark_12.png", "spark_13.png", _
"spark_14.png", "spark_15.png", "spark_16.png", "spark_17.png", "spark_18.png", "spark_19.png", "spark_20.png", "spark_21.png", _
"spark_22.png", "spark_23.png", "spark_24.png", "spark_25.png", "spark_26.png", "spark_27.png", "spark_28.png", "spark_29.png"))
'Initialize all used item bubbles
bubblesrnd(0).Initialize(File.DirAssets, "10.png")
bubblesrnd(1).Initialize(File.DirAssets, "20.png")
bubblesrnd(2).Initialize(File.DirAssets, "30.png")
bubblesrnd(3).Initialize(File.DirAssets, "40.png")
bubblesrnd(4).Initialize(File.DirAssets, "402.png")
bubblesrnd(5).Initialize(File.DirAssets, "50.png")
bubblesrnd(6).Initialize(File.DirAssets, "100.png")
bubbledynamic(0)=bubblesrnd(0)
bubbledynamic(1)=bubblesrnd(1)
bubbledynamic(2)=bubblesrnd(2)
bubbledynamic(3)=bubblesrnd(3)
bubbledynamic(4)=bubblesrnd(4)
bubbledynamic(5)=bubblesrnd(5)
bubbledynamic(6)=bubblesrnd(6)
rectbubblernd(0).Initialize(bubblexrnd(0), bubbleyrnd(0), bubblexrnd(0)+10, bubbleyrnd(0)+10)
rectbubblernd(1).Initialize(bubblexrnd(1), bubbleyrnd(1), bubblexrnd(1)+20, bubbleyrnd(1)+20)
rectbubblernd(2).Initialize(bubblexrnd(2), bubbleyrnd(2), bubblexrnd(2)+30, bubbleyrnd(2)+30)
rectbubblernd(3).Initialize(bubblexrnd(3), bubbleyrnd(3), bubblexrnd(3)+40, bubbleyrnd(3)+40)
rectbubblernd(4).Initialize(bubblexrnd(4), bubbleyrnd(4), bubblexrnd(4)+40, bubbleyrnd(4)+40)
rectbubblernd(5).Initialize(bubblexrnd(5), bubbleyrnd(5), bubblexrnd(5)+50, bubbleyrnd(5)+50)
rectbubblernd(6).Initialize(bubblexrnd(6), bubbleyrnd(6), bubblexrnd(6)+100, bubbleyrnd(6)+100)
bubbledynamicrect(0) = rectbubblernd(0)
bubbledynamicrect(1) = rectbubblernd(1)
bubbledynamicrect(2) = rectbubblernd(2)
bubbledynamicrect(3) = rectbubblernd(3)
bubbledynamicrect(4) = rectbubblernd(4)
bubbledynamicrect(5) = rectbubblernd(5)
bubbledynamicrect(6) = rectbubblernd(6)
For i=0 To getnum-1
bubblesrndshow(i)=bubblesrnd(Rnd(0,7)) 'random dari 1-7
'rectbubblerndshow(i)=rectbubblernd(Rnd(0,6))
If bubblesrndshow(i) = bubblesrnd(0) Then
rectbubblerndshow(i) = rectbubblernd(0)
Else If bubblesrndshow(i) = bubblesrnd(1) Then
rectbubblerndshow(i) = rectbubblernd(1)
Else If bubblesrndshow(i) = bubblesrnd(2) Then
rectbubblerndshow(i) = rectbubblernd(2)
Else If bubblesrndshow(i) = bubblesrnd(3) Then
rectbubblerndshow(i) = rectbubblernd(3)
Else If bubblesrndshow(i) = bubblesrnd(4) Then
rectbubblerndshow(i) = rectbubblernd(4)
Else If bubblesrndshow(i) = bubblesrnd(5) Then
rectbubblerndshow(i) = rectbubblernd(5)
Else If bubblesrndshow(i) = bubblesrnd(6) Then
rectbubblerndshow(i) = rectbubblernd(6)
End If
Next
End Sub
Sub lwm_Touch (Engine As LWEngine, Action As Int, tx As Float, ty As Float)
If getitrc =="False" Then
For i=0 To getnum-1
If Action <> 0 Then Return '0 is the value of Activity.ACTION_DOWN
If tx > bubblexrnd(i) - boxSize AND tx < bubblexrnd(i) + boxSize AND _
ty > bubbleyrnd(i) - boxSize AND ty < bubbleyrnd(i) + boxSize Then
bubblexrnd(i) = -bubblexrnd(i) 'change the smiley direction if the user pressed on it
bubbleyrnd(i) = -bubbleyrnd(i)
MP.Play
End If
Next
For i=0 To bubbledynamic.Length-1
If Action <> 0 Then Return '0 is the value of Activity.ACTION_DOWN
If tx > bubbledynamicx(i) - boxSize AND tx < bubbledynamicx(i) + boxSize AND _
ty > bubbledynamicy(i) - boxSize AND ty < bubbledynamicy(i) + boxSize Then
bubbledynamicx(i) = -bubbledynamicx(i) 'change the smiley direction if the user pressed on it
bubbledynamicy(i) = -bubbledynamicy(i)
MP.Play
End If
Next
End If
End Sub
Sub FullRefreshPortrait(Engine As LWEngine)
'Refresh background at start
Dim aRectOffSet_small As Rect
Dim aRectOffSet_medium As Rect
Dim aRectOffSet_big As Rect
Dim aRect As Rect
Dim starsmallrect As Rect
Dim starsmallrect_offset As Rect
Dim starmediumrect As Rect
Dim starmediumrect_offset As Rect
Dim starbigrect As Rect
Dim starbigrect_offset As Rect
'set sparkles
Dim sparkleRect As Rect
Dim sparkleRectOffset_small1 As Rect
Dim sparkleRectOffset_small2 As Rect
Dim sparkleRectOffset_small3 As Rect
Dim sparkleRectOffset_small4 As Rect
Dim sparkleRectOffset_small5 As Rect
Dim sparkleRectOffset_small6 As Rect
Dim sparkleRectOffset_small7 As Rect
Dim sparkleRectOffset_small8 As Rect
Dim sparkleRectOffset_medium1 As Rect
Dim sparkleRectOffset_medium2 As Rect
Dim sparkleRectOffset_medium3 As Rect
Dim sparkleRectOffset_medium4 As Rect
Dim sparkleRectOffset_medium5 As Rect
Dim sparkleRectOffset_medium6 As Rect
Dim sparkleRectOffset_medium7 As Rect
Dim sparkleRectOffset_medium8 As Rect
Dim sparkleRectOffset_big1 As Rect
Dim sparkleRectOffset_big2 As Rect
Dim sparkleRectOffset_big3 As Rect
Dim sparkleRectOffset_big4 As Rect
Dim sparkleRectOffset_big5 As Rect
Dim sparkleRectOffset_big6 As Rect
Dim sparkleRectOffset_big7 As Rect
Dim sparkleRectOffset_big8 As Rect
getrotatespeed
If getrotspd = 0 Then AngleStep = 0.05
If getrotspd = 1 Then AngleStep = 0.30
If getrotspd = 2 Then AngleStep = 1.00
If getrotspd = 3 Then AngleStep = 2.00
If getrotspd = 4 Then AngleStep = 3.00
If getrotspd = 5 Then AngleStep = 5.00
Angle = (Angle+AngleStep) Mod 360
aRectOffSet_small.Initialize(0 + Engine.CurrentOffsetX, 0 , Engine.ScreenWidth + Engine.CurrentOffsetX, bgsmall.height-(bgsmall.height-Engine.ScreenHeight))
aRectOffSet_medium.Initialize(0 + Engine.CurrentOffsetX, 0 , Engine.ScreenWidth + Engine.CurrentOffsetX, bgmedium.height-(bgmedium.height-Engine.ScreenHeight))
aRectOffSet_big.Initialize(0 + Engine.CurrentOffsetX, 0 , Engine.ScreenWidth + Engine.CurrentOffsetX, bgbig.height-(bgbig.height-Engine.ScreenHeight))
'DrawBackground (Engine)
sparkleRect.Initialize(0,0,200,200)
starsmallrect.Initialize(0,0,250,250)
starmediumrect.Initialize(0,0,500,500)
starbigrect.Initialize(0,0,800,800)
aRect.Initialize(0,0,Engine.ScreenWidth,Engine.ScreenHeight)
'set the sparkles small
sparkleRectOffset_small1.Initialize((0.1*bgsmall.width)-Engine.CurrentOffsetX, 100 ,((0.1*bgsmall.width)-Engine.CurrentOffsetX)+200, bmpbs.height+100)
sparkleRectOffset_small2.Initialize((0.3*bgsmall.width)-Engine.CurrentOffsetX, 500 ,((0.3*bgsmall.width)-Engine.CurrentOffsetX)+200, bmpbs.height+500)
sparkleRectOffset_small3.Initialize((0.4*bgsmall.width)-Engine.CurrentOffsetX, 100 ,((0.4*bgsmall.width)-Engine.CurrentOffsetX)+200, bmpbs.height+100)
sparkleRectOffset_small4.Initialize((0.5*bgsmall.width)-Engine.CurrentOffsetX, 400 ,((0.5*bgsmall.width)-Engine.CurrentOffsetX)+200, bmpbs.height+400)
sparkleRectOffset_small5.Initialize((0.7*bgsmall.width)-Engine.CurrentOffsetX, 100 ,((0.7*bgsmall.width)-Engine.CurrentOffsetX)+200, bmpbs.height+100)
sparkleRectOffset_small6.Initialize((0.7*bgsmall.width)-Engine.CurrentOffsetX, 300 ,((0.7*bgsmall.width)-Engine.CurrentOffsetX)+200, bmpbs.height+300)
sparkleRectOffset_small7.Initialize((0.1*bgsmall.width)-Engine.CurrentOffsetX, 300 ,((0.1*bgsmall.width)-Engine.CurrentOffsetX)+200, bmpbs.height+300)
sparkleRectOffset_small8.Initialize((0.7*bgsmall.width)-Engine.CurrentOffsetX, 300 ,((0.7*bgsmall.width)-Engine.CurrentOffsetX)+200, bmpbs.height+300)
'set the sparkles medium
sparkleRectOffset_medium1.Initialize((0.1*bgmedium.width)-Engine.CurrentOffsetX, 100 ,((0.1*bgmedium.width)-Engine.CurrentOffsetX)+200, bmpbs.height+100)
sparkleRectOffset_medium2.Initialize((0.3*bgmedium.width)-Engine.CurrentOffsetX, 500 ,((0.3*bgmedium.width)-Engine.CurrentOffsetX)+200, bmpbs.height+500)
sparkleRectOffset_medium3.Initialize((0.4*bgmedium.width)-Engine.CurrentOffsetX, 100 ,((0.4*bgmedium.width)-Engine.CurrentOffsetX)+200, bmpbs.height+100)
sparkleRectOffset_medium4.Initialize((0.5*bgmedium.width)-Engine.CurrentOffsetX, 400 ,((0.5*bgmedium.width)-Engine.CurrentOffsetX)+200, bmpbs.height+400)
sparkleRectOffset_medium5.Initialize((0.7*bgmedium.width)-Engine.CurrentOffsetX, 100 ,((0.7*bgmedium.width)-Engine.CurrentOffsetX)+200, bmpbs.height+100)
sparkleRectOffset_medium6.Initialize((0.7*bgmedium.width)-Engine.CurrentOffsetX, 600 ,((0.7*bgmedium.width)-Engine.CurrentOffsetX)+200, bmpbs.height+600)
sparkleRectOffset_medium7.Initialize((0.1*bgmedium.width)-Engine.CurrentOffsetX, 650 ,((0.1*bgmedium.width)-Engine.CurrentOffsetX)+200, bmpbs.height+650)
sparkleRectOffset_medium8.Initialize((0.7*bgmedium.width)-Engine.CurrentOffsetX, 650 ,((0.7*bgmedium.width)-Engine.CurrentOffsetX)+200, bmpbs.height+650)
'set the sparkles big
sparkleRectOffset_big1.Initialize((0.1*bgbig.width)-Engine.CurrentOffsetX, 100 ,((0.1*bgbig.width)-Engine.CurrentOffsetX)+200, bmpbs.height+100)
sparkleRectOffset_big2.Initialize((0.3*bgbig.width)-Engine.CurrentOffsetX, 500 ,((0.3*bgbig.width)-Engine.CurrentOffsetX)+200, bmpbs.height+500)
sparkleRectOffset_big3.Initialize((0.4*bgbig.width)-Engine.CurrentOffsetX, 100 ,((0.4*bgbig.width)-Engine.CurrentOffsetX)+200, bmpbs.height+100)
sparkleRectOffset_big4.Initialize((0.5*bgbig.width)-Engine.CurrentOffsetX, 400 ,((0.5*bgbig.width)-Engine.CurrentOffsetX)+200, bmpbs.height+400)
sparkleRectOffset_big5.Initialize((0.7*bgbig.width)-Engine.CurrentOffsetX, 100 ,((0.7*bgbig.width)-Engine.CurrentOffsetX)+200, bmpbs.height+100)
sparkleRectOffset_big6.Initialize((0.7*bgbig.width)-Engine.CurrentOffsetX, 600 ,((0.7*bgbig.width)-Engine.CurrentOffsetX)+200, bmpbs.height+600)
sparkleRectOffset_big7.Initialize((0.03*bgbig.width)-Engine.CurrentOffsetX, 800 ,((0.03*bgbig.width)-Engine.CurrentOffsetX)+200, bmpbs.height+800)
sparkleRectOffset_big8.Initialize((0.8*bgbig.width)-Engine.CurrentOffsetX, 800 ,((0.8*bgbig.width)-Engine.CurrentOffsetX)+200, bmpbs.height+800)
'set the star rotation
starsmallrect_offset.Initialize((0.30*bgsmall.width)-Engine.CurrentOffsetX,DipToCurrent(0.2*Engine.ScreenHeight),(((0.30*bgsmall.width))-Engine.CurrentOffsetX)+250, 250+DipToCurrent((0.2*Engine.ScreenHeight)))
starmediumrect_offset.Initialize((0.26*bgmedium.width)-Engine.CurrentOffsetX,DipToCurrent(0.15*Engine.ScreenHeight),(((0.26*bgmedium.width))-Engine.CurrentOffsetX)+500, 500+DipToCurrent((0.15*Engine.ScreenHeight)))
starbigrect_offset.Initialize((0.25*bgbig.width)-Engine.CurrentOffsetX,DipToCurrent(0.1*Engine.ScreenHeight),(((0.25*bgbig.width))-Engine.CurrentOffsetX)+800, 800+DipToCurrent((0.1*Engine.ScreenHeight)))
'starmediumrect_offset.Initialize((0.2*bgmedium.width)-Engine.CurrentOffsetX, (0.1*bgmedium.height) ,((0.2*bgmedium.width)-Engine.CurrentOffsetX)+700, 700+(0.1*bgmedium.height))
'starbigrect_offset.Initialize((0.2*bgbig.width)-Engine.CurrentOffsetX,(0.2*bgbig.height) ,((0.2*bgbig.width)-Engine.CurrentOffsetX)+800, 800+(0.2*bgbig.height))
' Log("arecoffset_small : " &aRectOffSet_small)
' Log("arecoffset_medium : " &starmediumrect_offset)
' Log("arecoffset_big : " &aRectOffSet_big)
' Log("arect : " &aRect)
'Portrait
If Engine.ScreenWidth <= 320 Then
Engine.Canvas.DrawBitmap(bgsmall,aRectOffSet_small,aRect)
getpattern
If getpat="0" Then Engine.Canvas.DrawBitmapRotated(starbig,Null,starsmallrect_offset,Angle)
If getpat="1" Then Engine.Canvas.DrawBitmapRotated(starbig2,Null,starsmallrect_offset,Angle)
If getpat="2" Then Engine.Canvas.DrawBitmapRotated(starbig3,Null,starsmallrect_offset,Angle)
If getpat="3" Then Engine.Canvas.DrawBitmapRotated(starbig4,Null,starsmallrect_offset,Angle)
If getpat="4" Then Engine.Canvas.DrawBitmapRotated(starbig5,Null,starsmallrect_offset,Angle)
If getpat="5" Then Engine.Canvas.DrawBitmapRotated(starbig6,Null,starsmallrect_offset,Angle)
If getpat="6" Then Engine.Canvas.DrawBitmapRotated(starbig7,Null,starsmallrect_offset,Angle)
If getpat="7" Then Engine.Canvas.DrawBitmapRotated(starbig8,Null,starsmallrect_offset,Angle)
If getpat="8" Then Engine.Canvas.DrawBitmapRotated(starbig9,Null,starsmallrect_offset,Angle)
If getpat="9" Then Engine.Canvas.DrawBitmapRotated(starbig10,Null,starsmallrect_offset,Angle)
bmpbs.Initialize(File.DirAssets,anim.get(animindex))
Engine.Canvas.DrawBitmap(bmpbs,sparkleRect,sparkleRectOffset_small1) ' ground...
Engine.Canvas.DrawBitmap(bmpbs,sparkleRect,sparkleRectOffset_small2)
Engine.Canvas.DrawBitmap(bmpbs,sparkleRect,sparkleRectOffset_small3)
Engine.Canvas.DrawBitmap(bmpbs,sparkleRect,sparkleRectOffset_small4)
Engine.Canvas.DrawBitmap(bmpbs,sparkleRect,sparkleRectOffset_small5)
Engine.Canvas.DrawBitmap(bmpbs,sparkleRect,sparkleRectOffset_small6)
Engine.Canvas.DrawBitmap(bmpbs,sparkleRect,sparkleRectOffset_small7)
Engine.Canvas.DrawBitmap(bmpbs,sparkleRect,sparkleRectOffset_small8)
Else If Engine.ScreenWidth <= 540 Then
Engine.Canvas.DrawBitmap(bgmedium,aRectOffSet_medium,aRect)
getpattern
If getpat="0" Then Engine.Canvas.DrawBitmapRotated(starbig,Null,starmediumrect_offset,Angle)
If getpat="1" Then Engine.Canvas.DrawBitmapRotated(starbig2,Null,starmediumrect_offset,Angle)
If getpat="2" Then Engine.Canvas.DrawBitmapRotated(starbig3,Null,starmediumrect_offset,Angle)
If getpat="3" Then Engine.Canvas.DrawBitmapRotated(starbig4,Null,starmediumrect_offset,Angle)
If getpat="4" Then Engine.Canvas.DrawBitmapRotated(starbig5,Null,starmediumrect_offset,Angle)
If getpat="5" Then Engine.Canvas.DrawBitmapRotated(starbig6,Null,starmediumrect_offset,Angle)
If getpat="6" Then Engine.Canvas.DrawBitmapRotated(starbig7,Null,starmediumrect_offset,Angle)
If getpat="7" Then Engine.Canvas.DrawBitmapRotated(starbig8,Null,starmediumrect_offset,Angle)
If getpat="8" Then Engine.Canvas.DrawBitmapRotated(starbig9,Null,starmediumrect_offset,Angle)
If getpat="9" Then Engine.Canvas.DrawBitmapRotated(starbig10,Null,starmediumrect_offset,Angle)
bmpbs.Initialize(File.DirAssets,anim.get(animindex))
Engine.Canvas.DrawBitmap(bmpbs,sparkleRect,sparkleRectOffset_medium1) ' ground...
Engine.Canvas.DrawBitmap(bmpbs,sparkleRect,sparkleRectOffset_medium2)
Engine.Canvas.DrawBitmap(bmpbs,sparkleRect,sparkleRectOffset_medium3)
Engine.Canvas.DrawBitmap(bmpbs,sparkleRect,sparkleRectOffset_medium4)
Engine.Canvas.DrawBitmap(bmpbs,sparkleRect,sparkleRectOffset_medium5)
Engine.Canvas.DrawBitmap(bmpbs,sparkleRect,sparkleRectOffset_medium6)
Engine.Canvas.DrawBitmap(bmpbs,sparkleRect,sparkleRectOffset_medium7)
Engine.Canvas.DrawBitmap(bmpbs,sparkleRect,sparkleRectOffset_medium8)
Else If Engine.ScreenWidth <= 800 Then
Engine.Canvas.DrawBitmap(bgbig,aRectOffSet_big,aRect)
getpattern
If getpat="0" Then Engine.Canvas.DrawBitmapRotated(starbig,Null,starbigrect_offset,Angle)
If getpat="1" Then Engine.Canvas.DrawBitmapRotated(starbig2,Null,starbigrect_offset,Angle)
If getpat="2" Then Engine.Canvas.DrawBitmapRotated(starbig3,Null,starbigrect_offset,Angle)
If getpat="3" Then Engine.Canvas.DrawBitmapRotated(starbig4,Null,starbigrect_offset,Angle)
If getpat="4" Then Engine.Canvas.DrawBitmapRotated(starbig5,Null,starbigrect_offset,Angle)
If getpat="5" Then Engine.Canvas.DrawBitmapRotated(starbig6,Null,starbigrect_offset,Angle)
If getpat="6" Then Engine.Canvas.DrawBitmapRotated(starbig7,Null,starbigrect_offset,Angle)
If getpat="7" Then Engine.Canvas.DrawBitmapRotated(starbig8,Null,starbigrect_offset,Angle)
If getpat="8" Then Engine.Canvas.DrawBitmapRotated(starbig9,Null,starbigrect_offset,Angle)
If getpat="9" Then Engine.Canvas.DrawBitmapRotated(starbig10,Null,starbigrect_offset,Angle)
bmpbs.Initialize(File.DirAssets,anim.get(animindex))
Engine.Canvas.DrawBitmap(bmpbs,sparkleRect,sparkleRectOffset_big1) ' ground...
Engine.Canvas.DrawBitmap(bmpbs,sparkleRect,sparkleRectOffset_big2)
Engine.Canvas.DrawBitmap(bmpbs,sparkleRect,sparkleRectOffset_big3)
Engine.Canvas.DrawBitmap(bmpbs,sparkleRect,sparkleRectOffset_big4)
Engine.Canvas.DrawBitmap(bmpbs,sparkleRect,sparkleRectOffset_big5)
Engine.Canvas.DrawBitmap(bmpbs,sparkleRect,sparkleRectOffset_big6)
Engine.Canvas.DrawBitmap(bmpbs,sparkleRect,sparkleRectOffset_big7)
Engine.Canvas.DrawBitmap(bmpbs,sparkleRect,sparkleRectOffset_big8)
End If
animindex=animindex+1 ' increase anim index to show picname+1
If animindex>29 Then animindex=0 ' block animindex at 51 coze we have 0+51=52 pics
End Sub
Sorry, forgot to attached the complete project. Here are the complete project files
Link for attachment :
Download mycrashwallpaper.rar (complete project)
Download crash.rar (crash log and video)
continued on next post ...
Last edited: