Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
So what's that damn Pete up to now?
#1
Glad you asked.

Well, since March is QB Coding month, I decided to at least take a shot at "pruddying" up some of my older SCREEN 0 programs. One area that I'd like to improve upon is buttons. Now I have cheated a bit in the past, by using hardware acceleration to display graphics buttons in SCREEN 0. I'm sure I'll be going to Hell for that... but how bad can Text Hell be?

There are times I have wished we could reassign bit values to ASCII characters. I'd make the border characters have the lines displayed on the outside margins of the 8 x 8 pixel blocks. Atari allowed for that feature. That would make it possible to color inside the border. The next best thing is probably this...

[Latest Update Here: https://qb64phoenix.com/forum/showthread...8#pid23598] Includes 3 different types of buttons: Text-Hybrid, Graphics, and HTML.

Code: (Select All)
Palette 5, 63
Palette 6, 56
Color 7, 5: Cls

Const FALSE = 0, TRUE = Not FALSE

Type MouseType
    EndX As Integer
    EndY As Integer
    StartX As Integer
    StartY As Integer
    LButDown As Integer
    LtClick As Integer
End Type

Dim As MouseType Mouse
Dim As _Bit Active

Active = FALSE

Dim b(13) As String * 1
b(0) = " "
b(1) = "Ú"
b(2) = "Ä"
b(3) = "¿"
b(4) = "³"
b(5) = "À"
b(6) = "Ù"
b(7) = "Ã"
b(8) = "´"
b(9) = "Ä"
b(10) = "Â"
b(11) = "Á"
b(12) = "Þ"
b(13) = "Ý"

y = 10: x = 35

Do
    Locate y, x: Color 5, 6: Print b(13);: Color 0, 6: Print b(1); String$(10, b(2)); b(3);: Color 5, 6: Print b(12)
    Locate , x: Color 5, 6: Print b(13);: Color 0, 6: Print b(4); String$(10, b(0)); b(4);: Color 5, 6: Print b(12)
    Locate , x: Color 5, 6: Print b(13);: Color 0, 6: Print b(5); String$(10, b(2)); b(6);: Color 5, 6: Print b(12);
    Locate y + 1, x + 2: Color 7, 6: Print b(12);: Color 6, 7: Print "Activate";: Color 7, 6: Print b(13);
    'Locate y + 1, x + 2: Color 0, 6: Print b(12);: Color 5, 0: Print "Activate";: Color 0, 6: Print b(13);

    Do
        _Limit 30

        While _MouseInput: Wend

        Mouse.StartX = _MouseX
        Mouse.StartY = _MouseY
        Mouse.LButDown = _MouseButton(1)

        If Not Mouse.LButDown And Mouse.LtClick Then Mouse.LtClick = 0

        Rem Locate 5, 1: Print Mouse.StartX; Mouse.StartY; Active

        If Mouse.StartX >= x And Mouse.StartX <= x + 13 And Mouse.StartY >= 10 And Mouse.StartY <= 12 And Not Active Then
            If Not Active Then _MouseShow "LINK"
            Active = TRUE
        ElseIf Active Eqv Mouse.StartX < x Or Mouse.StartX > x + 13 Or Mouse.StartY < 10 Or Mouse.StartY > 12 Then
            If Active Then _MouseShow "DEFAULT"
            Active = FALSE
        End If

        b$ = InKey$
        If Len(b$) Or Active And Mouse.LButDown And Mouse.LtClick = 0 Then
            Mouse.LtClick = -1
            If b$ = Chr$(27) Then System
            Color 0, 7
            Locate y, x: Color 5, 7: Print b(13);: Color 0, 7: Print b(1); String$(10, b(2)); b(3);: Color 5, 7: Print b(12)
            Locate , x: Color 5, 7: Print b(13);: Color 0, 7: Print b(4); String$(10, b(0)); b(4);: Color 5, 7: Print b(12)
            Locate , x: Color 5, 7: Print b(13);: Color 0, 7: Print b(5); String$(10, b(2)); b(6);: Color 5, 7: Print b(12);
            ' Locate y + 1, x + 2: Color 7, 7: Print b(12);: Color 0, 7: Print "Activate";: Color 7, 7: Print b(13);
            _Delay .1
            Exit Do
        End If
    Loop
Loop

If I tweak it more it will be by using the QB64 RGB color statements to improve on the shades of grey.

Use the mouse to hover and left click.

If anyone else has some nifty button stuff to share, please post 'em.

Happy QB Coding Month!

Pete
Reply


Messages In This Thread
So what's that damn Pete up to now? - by Pete - 03-05-2024, 12:34 AM
RE: So what's that damn Pete up to now? - by Pete - 03-05-2024, 07:53 AM
RE: So what's that damn Pete up to now? - by Pete - 03-05-2024, 02:49 PM
RE: So what's that damn Pete up to now? - by Pete - 03-05-2024, 10:15 PM
RE: So what's that damn Pete up to now? - by Pete - 03-06-2024, 08:39 AM
RE: So what's that damn Pete up to now? - by Jack - 03-06-2024, 10:21 AM
RE: So what's that damn Pete up to now? - by Pete - 03-06-2024, 02:22 PM
RE: So what's that damn Pete up to now? - by Pete - 03-06-2024, 11:20 PM
RE: So what's that damn Pete up to now? - by Pete - 03-07-2024, 03:18 AM
RE: So what's that damn Pete up to now? - by Pete - 03-07-2024, 10:31 AM
RE: So what's that damn Pete up to now? - by Pete - 03-08-2024, 10:46 PM
RE: So what's that damn Pete up to now? - by Pete - 03-08-2024, 11:31 PM



Users browsing this thread: 6 Guest(s)