B4i Library [B4X] [XUI] iSD_Dice

Star-Dust

Expert
Licensed User
dado.gifezgif.com-crop.gif

iSD_Dice

Author:
Star-Dust
Version: 1.04
  • DiceView
    • Events:
      • Click
      • CompleteRoll
    • Fields:
      • mBase As B4XView
      • Tag As Object
      • TimeMovment As Int
    • Functions:
      • Class_Globals As String
      • DesignerCreateView (Base As Object, Lbl As Label, PropS As Map) As String
        Base type must be Object
      • Initialize (Callback As Object, EventName As String) As String
      • IsInitialized As Boolean
        Verifica se l'oggetto sia stato inizializzato.
      • Move (X As Int, Y As Int, Z As Int) As String
      • RollTo (FaceNumber As Int)
      • Rotate (DegreeX As Int, DegreeY As Int, DegreeZ As Int) As String

Here for B4A
Here for B4J
 

Attachments

Last edited:

Star-Dust

Expert
Licensed User
Update rel 1.01
  • Add RollTo(FaceNumber)

Allows you to roll the data until it reaches a face
B4X:
DiceView1.RollTo(RND(1,7))
Video 2.gif
 

Star-Dust

Expert
Licensed User
Update rel 1.02
  • Improved rotation. Ability to change the timing of the animation

Trick to turn the nut to the desired face
Code:
Sub ChangeFace(FaceNumber As B4XFont)
    Select FaceNumber
        Case 1
            DiceView1.Rotate(0,10,0)
        Case 2
            DiceView1.Rotate(0,280,0)
        Case 3
            DiceView1.Rotate(90,10,0)
        Case 4
            DiceView1.Rotate(270,10,0)
        Case 5
            DiceView1.Rotate(0,100,0)
        Case 6
            DiceView1.Rotate(0,190,0)
    End Select
End Sub
NB. For some reason unknown to me the B4i version is slower.
 
Last edited:

Filippo

Expert
Licensed User
NB. For some reason unknown to me the B4i version is slower.
Did you also try in release mode?
 

Star-Dust

Expert
Licensed User

Filippo

Expert
Licensed User
Yes. In release mode it is slow but acceptable. I tried it on iphone6
then your program is not slow, but your iphone6 is no longer the fastest.
 

Star-Dust

Expert
Licensed User
then your program is not slow, but your iphone6 is no longer the fastest.
All I have is this, I'm not so keen on Apple that I buy a new device just to test 😜
 
Top