Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Roll The Dice InputBox$ and MessageBox Example
#14
ROFL Awesome guys, I'm glad you had some fun with it. 

After Steve said the boxes are easy, I've been racking my brain for hours last night and this morning just to make 3 boxes, moveable by the mouse. I made it last night, except, I think there's a sequence problem because sometimes a box, that I'm not using, will overlap onto another box. Oh sure, sounds simple... until I've tried almost everything in the book that I know how to do. lol
Here is what I have if you want to check it out. This is the simple version from last night. I'm sure I have to double the box drawings to make all 6 possibilities of 3 boxes. But the problem is, when and how... lol. I've tried arrays and 3 different variables, and 3 different variable arrays.. until my head exploded. lol

Here is your mission if you choose to accept it....

Code: (Select All)


Screen _NewImage(800, 600, 32)
x1 = 400: y1 = 300
x2 = 0: y2 = 0
x3 = 600: y3 = 400
click = 1
click2 = 1

'Box 1 Text
a1$ = "Hello"
let1 = Len(a1$)
pix1 = let1 * 8

'Box 2 Text
a2$ = "QB64 Phoenix Edition"
let2 = Len(a2$)
pix2 = let2 * 8

'Box 3 Text
a3$ = "Forum!"
let3 = Len(a3$)
pix3 = let3 * 8

_Title "Moveable Boxes Example - Use Mouse"

Do
    _Limit 30
    While _MouseInput
        If _MouseButton(1) Then
            x = _MouseX
            y = _MouseY
            If x > x1 And x < x1 + 200 And y > y1 And y < y1 + 200 And click <> 2 And click <> 3 Then
                x1 = x - 100
                y1 = y - 100
                click = 1
                click2 = 1
            End If
            If x > x2 And x < x2 + 200 And y > y2 And y < y2 + 200 And click <> 1 And click <> 3 Then
                x2 = x - 100
                y2 = y - 100
                click = 2
                click2 = 2
            End If
            If x > x3 And x < x3 + 200 And y > y3 And y < y3 + 200 And click <> 1 And click <> 2 Then
                x3 = x - 100
                y3 = y - 100
                click = 3
                click2 = 3
            End If
        Else
            click = 0
        End If
    Wend

    If click = 1 Or click2 = 1 Then
        'Box 2
        Line (x2, y2)-(x2 + 200, y2 + 200), _RGB32(100, 100, 200), BF
        Line (x2, y2)-(x2 + 200, y2 + 200), _RGB32(255, 255, 255), B
        Color _RGB32(255, 255, 255), _RGB32(100, 100, 200)
        cent2 = (x2 + 100) - (pix2 / 2)
        _PrintString (cent2, y2 + 100), a2$
        'Box 3
        Line (x3, y3)-(x3 + 200, y3 + 200), _RGB32(200, 200, 100), BF
        Line (x3, y3)-(x3 + 200, y3 + 200), _RGB32(255, 255, 255), B
        Color _RGB32(255, 255, 255), _RGB32(200, 200, 100)
        cent3 = (x3 + 100) - (pix3 / 2)
        _PrintString (cent3, y3 + 100), a3$
        'Box 1
        Line (x1, y1)-(x1 + 200, y1 + 200), _RGB32(255, 100, 100), BF
        Line (x1, y1)-(x1 + 200, y1 + 200), _RGB32(255, 255, 255), B
        Color _RGB32(255, 255, 255), _RGB32(255, 100, 100)
        cent1 = (x1 + 100) - (pix1 / 2)
        _PrintString (cent1, y1 + 100), a1$
    End If
    If click = 2 Or click2 = 2 Then
        'Box 3
        Line (x3, y3)-(x3 + 200, y3 + 200), _RGB32(200, 200, 100), BF
        Line (x3, y3)-(x3 + 200, y3 + 200), _RGB32(255, 255, 255), B
        Color _RGB32(255, 255, 255), _RGB32(200, 200, 100)
        cent3 = (x3 + 100) - (pix3 / 2)
        _PrintString (cent3, y3 + 100), a3$
        'Box 1
        Line (x1, y1)-(x1 + 200, y1 + 200), _RGB32(255, 100, 100), BF
        Line (x1, y1)-(x1 + 200, y1 + 200), _RGB32(255, 255, 255), B
        Color _RGB32(255, 255, 255), _RGB32(255, 100, 100)
        cent1 = (x1 + 100) - (pix1 / 2)
        _PrintString (cent1, y1 + 100), a1$
        'Box 2
        Line (x2, y2)-(x2 + 200, y2 + 200), _RGB32(100, 100, 200), BF
        Line (x2, y2)-(x2 + 200, y2 + 200), _RGB32(255, 255, 255), B
        Color _RGB32(255, 255, 255), _RGB32(100, 100, 200)
        cent2 = (x2 + 100) - (pix2 / 2)
        _PrintString (cent2, y2 + 100), a2$
    End If
    If click = 3 Or click2 = 3 Then
        'Box 1
        Line (x1, y1)-(x1 + 200, y1 + 200), _RGB32(255, 100, 100), BF
        Line (x1, y1)-(x1 + 200, y1 + 200), _RGB32(255, 255, 255), B
        Color _RGB32(255, 255, 255), _RGB32(255, 100, 100)
        cent1 = (x1 + 100) - (pix1 / 2)
        _PrintString (cent1, y1 + 100), a1$
        'Box 2
        Line (x2, y2)-(x2 + 200, y2 + 200), _RGB32(100, 100, 200), BF
        Line (x2, y2)-(x2 + 200, y2 + 200), _RGB32(255, 255, 255), B
        Color _RGB32(255, 255, 255), _RGB32(100, 100, 200)
        cent2 = (x2 + 100) - (pix2 / 2)
        _PrintString (cent2, y2 + 100), a2$
        'Box 3
        Line (x3, y3)-(x3 + 200, y3 + 200), _RGB32(200, 200, 100), BF
        Line (x3, y3)-(x3 + 200, y3 + 200), _RGB32(255, 255, 255), B
        Color _RGB32(255, 255, 255), _RGB32(200, 200, 100)
        cent3 = (x3 + 100) - (pix3 / 2)
        _PrintString (cent3, y3 + 100), a3$
    End If

    _Display
    Line (0, 0)-(800, 600), _RGB32(0, 0, 0), BF
    If InKey$ = Chr$(27) Then Exit Do
Loop
Reply


Messages In This Thread
RE: Roll The Dice InputBox$ and MessageBox Example - by SierraKen - 02-18-2025, 08:43 PM



Users browsing this thread: 7 Guest(s)