Welcome, Guest |
You have to register before you can post on our site.
|
|
|
Keybone's GUI (04/2022 - Widget toolkit) |
Posted by: Keybone - 04-19-2022, 04:38 PM - Forum: Keybone
- No Replies
|
|
I wrote this shortly before my latest update (04/07/2022).
Unlike that update this is a widget toolkit and not a windowing system.
It can use some work, it has some glitches, and is not pretty.
You can't do anything advanced with this but it's worth a look.
Obligatory screenshots:
Installation:
1) Copy blank.png and k3.bas into your qb64 folder
2) Compile and run k3.bas
blank.png:
k3.bas:
Code: (Select All) Screen _NewImage(640, 480, 32)
_PrintMode _KeepBackground
Type aWindow
positionX As Integer
positionY As Integer
sizeX As _Unsigned Integer
sizeY As _Unsigned Integer
Text As String
imageHandle As _Unsigned Long
End Type
Type anIcon
positionX As Integer
positionY As Integer
sizeX As _Unsigned Integer
sizeY As _Unsigned Integer
Text As String
imageHandle As _Unsigned Long
End Type
Type aButton
positionX As Integer
positionY As Integer
sizeX As _Unsigned Integer
sizeY As _Unsigned Integer
Text As String
imageHandle As _Unsigned Long
End Type
Type aCheckbox
positionX As Integer
positionY As Integer
sizeX As _Unsigned Integer
sizeY As _Unsigned Integer
isChecked As _Byte
Text As String
imageHandle1 As _Unsigned Long
imageHandle2 As _Unsigned Long
End Type
Type aSwitch
positionX As Integer
positionY As Integer
sizeX As _Unsigned Integer
sizeY As _Unsigned Integer
isEnabled As _Byte
Text As String
imageHandle1 As _Unsigned Long
imageHandle2 As _Unsigned Long
End Type
Type aRadiobutton
positionX As Integer
positionY As Integer
sizeX As _Unsigned Integer
sizeY As _Unsigned Integer
groupID As _Unsigned Integer
isSelected As _Byte
Text As String
imageHandle1 As _Unsigned Long
imageHandle2 As _Unsigned Long
End Type
Type aMouse
positionX As Integer
positionY As Integer
buttonLeft As _Byte
buttonMiddle As _Byte
buttonRight As _Byte
End Type
Type aLimit
Minimum As _Unsigned Integer
Current As _Unsigned Integer
Maximum As _Unsigned Integer
End Type
Dim Shared theLimitWindows As aLimit
theLimitWindows.Minimum = 0
theLimitWindows.Current = theLimit.Minimum
theLimitWindows.Maximum = 0 - 1
Dim Shared theLimitIcons As aLimit
theLimitIcons.Minimum = 0
theLimitIcons.Current = theLimit.Minimum
theLimitIcons.Maximum = 0 - 1
Dim Shared theLimitButtons As aLimit
theLimitButtons.Minimum = 0
theLimitButtons.Current = theLimitButtons.Minimum
theLimitButtons.Maximum = 0 - 1
Dim Shared theLimitCheckboxes As aLimit
theLimitCheckboxes.Minimum = 0
theLimitCheckboxes.Current = theLimitCheckboxes.Minimum
theLimitCheckboxes.Maximum = 0 - 1
Dim Shared theLimitSwitches As aLimit
theLimitSwitches.Minimum = 0
theLimitSwitches.Current = theLimitSwitches.Minimum
theLimitSwitches.Maximum = 0 - 1
Dim Shared theLimitRadiobuttons As aLimit
theLimitRadiobuttons.Minimum = 0
theLimitRadiobuttons.Current = theLimitRadiobuttons.Minimum
theLimitRadiobuttons.Maximum = 0 - 1
ReDim Shared theWindows(theLimitWindows.Current) As aWindow
ReDim Shared theIcons(theLimitIcons.Current) As anIcon
ReDim Shared theButtons(theLimitButtons.Current) As aButton
ReDim Shared theCheckboxes(theLimitCheckboxes.Current) As aCheckbox
ReDim Shared theSwitches(theLimitSwitches.Current) As aSwitch
ReDim Shared theRadiobuttons(theLimitRadiobuttons.Current) As aRadiobutton
Dim Shared theMouse As aMouse
'initWindow 300, 200, 320, 240, "Window"
initIcon 100, 100, "blank.png", "Icon 1"
initIcon 200, 100, "blank.png", "Icon 2"
initButton 100, 200, 100, 40, "Button"
initCheckbox 100, 400, 50, -1, "Checkbox"
initSwitch 200, 150, 25, 0, "Switch"
initRadiobutton 550, 100, 50, 1, -1, "Radiobutton 1"
initRadiobutton 550, 175, 50, 1, 0, "Radiobutton 2"
initRadiobutton 550, 250, 50, 1, 0, "Radiobutton 3"
Dim Shared zoneTypeClicked As String
Do
Line (0, 0)-(_Width, _Height), _RGBA32(127, 127, 127, 255), BF
For i1 = 0 To theLimitButtons.Current
_PutImage (theButtons(i1).positionX, theButtons(i1).positionY), theButtons(i1).imageHandle
Next i1
For i2 = 0 To theLimitIcons.Current
_PutImage (theIcons(i2).positionX, theIcons(i2).positionY), theIcons(i2).imageHandle
Next i2
For i3 = 0 To theLimitWindows.Current
_PutImage (theWindows(i3).positionX, theWindows(i3).positionY), theWindows(i3).imageHandle
Next i3
For i4 = 0 To theLimitCheckboxes.Current
If theCheckboxes(i4).isChecked Then
_PutImage (theCheckboxes(i4).positionX, theCheckboxes(i4).positionY), theCheckboxes(i4).imageHandle2
Else
_PutImage (theCheckboxes(i4).positionX, theCheckboxes(i4).positionY), theCheckboxes(i4).imageHandle1
End If
Next i4
For i5 = 0 To theLimitSwitches.Current
If theSwitches(i5).isEnabled Then
_PutImage (theSwitches(i5).positionX, theSwitches(i5).positionY), theSwitches(i5).imageHandle2
Else
_PutImage (theSwitches(i5).positionX, theSwitches(i5).positionY), theSwitches(i5).imageHandle1
End If
Next i5
For i6 = 0 To theLimitRadiobuttons.Current
If theRadiobuttons(i6).isSelected Then
_PutImage (theRadiobuttons(i6).positionX, theRadiobuttons(i6).positionY), theRadiobuttons(i6).imageHandle2
Else
_PutImage (theRadiobuttons(i6).positionX, theRadiobuttons(i6).positionY), theRadiobuttons(i6).imageHandle1
End If
Next i6
probeMouse
If theMouse.buttonLeft Then
For i = 0 To theLimitWindows.Current
Status1 = isZone~&(i, "window")
If Status1 <> 0 Then
status2 = Status1
zoneTypeClicked = "window"
GoTo skip
End If
Next i
For i = 0 To theLimitIcons.Current
Status1 = isZone~&(i, "icon")
If Status1 <> 0 Then
status2 = Status1
zoneTypeClicked = "icon"
GoTo skip
End If
Next i
For i = 0 To theLimitButtons.Current
Status1 = isZone~&(i, "button")
If Status1 <> 0 Then
status2 = Status1
zoneTypeClicked = "button"
GoTo skip
End If
Next i
For i = 0 To theLimitCheckboxes.Current
Status1 = isZone~&(i, "checkbox")
If Status1 <> 0 Then
status2 = Status1
zoneTypeClicked = "checkbox"
GoTo skip
End If
Next i
For i = 0 To theLimitSwitches.Current
Status1 = isZone~&(i, "switch")
If Status1 <> 0 Then
status2 = Status1
zoneTypeClicked = "switch"
GoTo skip
End If
Next i
For i = 0 To theLimitRadiobuttons.Current
Status1 = isZone~&(i, "radiobutton")
If Status1 <> 0 Then
status2 = Status1
zoneTypeClicked = "radiobutton"
End If
Next i
skip:
zoneTypeClicked = LCase$(LTrim$(RTrim$(zoneTypeClicked)))
Select Case zoneTypeClicked
Case "window"
Case "icon"
Case "button"
Case "checkbox"
If theCheckboxes(status2).isChecked = -1 Then
theCheckboxes(status2).isChecked = 0
Else
theCheckboxes(status2).isChecked = -1
End If
Case "switch"
If theSwitches(status2).isEnabled = -1 Then
theSwitches(status2).isEnabled = 0
Else
theSwitches(status2).isEnabled = -1
End If
Case "radiobutton"
For i = 0 To theLimitRadiobuttons.Current
If theRadiobuttons(i).groupID = theRadiobuttons(status2).groupID Then
theRadiobuttons(i).isSelected = 0
End If
Next i
theRadiobuttons(status2).isSelected = -1
End Select
End If
_Display
Loop Until Len(InKey$)
Sub initWindow (inPositionX As Integer, inPositionY As Integer, inSizeX As _Unsigned Integer, inSizeY As _Unsigned Integer, inTitle As String)
theLimitWindows.Current = theLimitWindows.Current + 1
ReDim _Preserve theWindows(theLimitWindows.Current) As aWindow
theWindows(theLimitWindows.Current).positionX = inPositionX
theWindows(theLimitWindows.Current).positionY = inPositionY
theWindows(theLimitWindows.Current).sizeX = inSizeX
theWindows(theLimitWindows.Current).sizeY = inSizeY
theWindows(theLimitWindows.Current).Text = inTitle
theWindows(theLimitWindows.Current).imageHandle = _NewImage(theWindows(theLimitWindows.Current).sizeX, theWindows(theLimitWindows.Current).sizeY, 32)
_Dest theWindows(theLimitWindows.Current).imageHandle
_PrintMode _KeepBackground
Line (0, 0)-(_Width - 1, _Height - 1), _RGBA32(191, 191, 191, 255), BF
_PrintString (10, 10), theWindows(theLimitWindows.Current).Text
_Dest 0
End Sub
Sub initIcon (inPositionX As Integer, inPositionY As Integer, inIconFilename As String, inIconText As String)
theLimitIcons.Current = theLimitIcons.Current + 1
ReDim _Preserve theIcons(theLimitIcons.Current) As anIcon
theIcons(theLimitIcons.Current).imageHandle = _LoadImage(inIconFilename)
theIcons(theLimitIcons.Current).positionX = inPositionX
theIcons(theLimitIcons.Current).positionY = inPositionY
theIcons(theLimitIcons.Current).sizeX = _Width(theIcons(theLimitIcons.Current).imageHandle)
theIcons(theLimitIcons.Current).sizeY = _Height(theIcons(theLimitIcons.Current).imageHandle)
theIcons(theLimitIcons.Current).Text = inIconText
End Sub
Sub initButton (inPositionX As Integer, inPositionY As Integer, inSizeX As _Unsigned Integer, inSizeY As _Unsigned Integer, inText As String)
theLimitButtons.Current = theLimitButtons.Current + 1
ReDim _Preserve theButtons(theLimitButtons.Current) As aButton
theButtons(theLimitButtons.Current).positionX = inPositionX
theButtons(theLimitButtons.Current).positionY = inPositionY
theButtons(theLimitButtons.Current).sizeX = inSizeX
theButtons(theLimitButtons.Current).sizeY = inSizeY
theButtons(theLimitButtons.Current).Text = inText
theButtons(theLimitButtons.Current).imageHandle = _NewImage(theButtons(theLimitButtons.Current).sizeX, theButtons(theLimitButtons.Current).sizeY, 32)
_Dest theButtons(theLimitButtons.Current).imageHandle
_PrintMode _KeepBackground
Line (0, 0)-(_Width - 1, _Height - 1), _RGBA32(0, 0, 255, 255), BF
Line (0, 0)-(_Width - 1, _Height - 1), _RGBA32(255, 255, 255, 255), B
_PrintString (5, 5), theButtons(theLimitButtons.Current).Text
_Dest 0
End Sub
Sub initCheckbox (inPositionX As Integer, inPositionY As Integer, inSize As _Unsigned Integer, inIsChecked As _Byte, inText As String)
theLimitCheckboxes.Current = theLimitCheckboxes.Current + 1
ReDim _Preserve theCheckboxes(theLimitCheckboxes.Current) As aCheckbox
theCheckboxes(theLimitCheckboxes.Current).positionX = inPositionX
theCheckboxes(theLimitCheckboxes.Current).positionY = inPositionY
theCheckboxes(theLimitCheckboxes.Current).sizeX = inSize
theCheckboxes(theLimitCheckboxes.Current).sizeY = inSize
theCheckboxes(theLimitCheckboxes.Current).isChecked = inIsChecked
theCheckboxes(theLimitCheckboxes.Current).Text = inText
theCheckboxes(theLimitCheckboxes.Current).imageHandle1 = _NewImage(theCheckboxes(theLimitCheckboxes.Current).sizeX, theCheckboxes(theLimitCheckboxes.Current).sizeY, 32)
theCheckboxes(theLimitCheckboxes.Current).imageHandle2 = _NewImage(theCheckboxes(theLimitCheckboxes.Current).sizeX, theCheckboxes(theLimitCheckboxes.Current).sizeY, 32)
_Dest theCheckboxes(theLimitCheckboxes.Current).imageHandle2
Line (0, 0)-(_Width - 1, _Height - 1), _RGBA32(0, 127, 0, 255), BF
Line (0, 0)-(_Width - 1, _Height - 1), _RGBA32(255, 255, 255, 255), B
Line (2, 2)-(_Width - 3, _Height - 3), _RGBA32(255, 255, 255, 255)
Line (2, _Height - 3)-(_Width - 3, 2), _RGBA32(255, 255, 255, 255)
_Dest theCheckboxes(theLimitCheckboxes.Current).imageHandle1
Line (0, 0)-(_Width - 1, _Height - 1), _RGBA32(0, 127, 0, 255), BF
Line (0, 0)-(_Width - 1, _Height - 1), _RGBA32(255, 255, 255, 255), B
_Dest 0
End Sub
Sub initSwitch (inPositionX As Integer, inPositionY As Integer, inSize As _Unsigned Integer, inIsEnabled As _Byte, inText As String)
theLimitSwitches.Current = theLimitSwitches.Current + 1
ReDim _Preserve theSwitches(theLimitSwitches.Current) As aSwitch
theSwitches(theLimitSwitches.Current).positionX = inPositionX
theSwitches(theLimitSwitches.Current).positionY = inPositionY
theSwitches(theLimitSwitches.Current).sizeX = inSize
theSwitches(theLimitSwitches.Current).sizeY = inSize * 2
theSwitches(theLimitSwitches.Current).isEnabled = inIsEnabled
theSwitches(theLimitSwitches.Current).Text = inText
theSwitches(theLimitSwitches.Current).imageHandle1 = _NewImage(theSwitches(theLimitSwitches.Current).sizeX, theSwitches(theLimitSwitches.Current).sizeY, 32)
theSwitches(theLimitSwitches.Current).imageHandle2 = _NewImage(theSwitches(theLimitSwitches.Current).sizeX, theSwitches(theLimitSwitches.Current).sizeY, 32)
_Dest theSwitches(theLimitSwitches.Current).imageHandle2
Line (0, 0)-(_Width - 1, _Height - 1), _RGBA32(0, 127, 0, 255), BF
Line (0, 0)-(_Width - 1, _Height - 1), _RGBA32(255, 255, 255, 255), B
Line (2, 2)-(_Width - 3, _Height / 2), _RGBA32(255, 255, 255, 255), BF
_Dest theSwitches(theLimitSwitches.Current).imageHandle1
Line (0, 0)-(_Width - 1, _Height - 1), _RGBA32(255, 0, 0, 255), BF
Line (0, 0)-(_Width - 1, _Height - 1), _RGBA32(255, 255, 255, 255), B
Line (2, _Height / 2)-(_Width - 3, _Height - 3), _RGBA32(255, 255, 255, 255), BF
_Dest 0
End Sub
Sub initRadiobutton (inPositionX As Integer, inPositionY As Integer, inSize As _Unsigned Integer, inGroupID As _Unsigned Integer, inIsSelected As _Byte, inText As String)
theLimitRadiobuttons.Current = theLimitRadiobuttons.Current + 1
ReDim _Preserve theRadiobuttons(theLimitRadiobuttons.Current) As aRadiobutton
theRadiobuttons(theLimitRadiobuttons.Current).positionX = inPositionX
theRadiobuttons(theLimitRadiobuttons.Current).positionY = inPositionY
theRadiobuttons(theLimitRadiobuttons.Current).sizeX = inSize
theRadiobuttons(theLimitRadiobuttons.Current).sizeY = inSize
theRadiobuttons(theLimitRadiobuttons.Current).groupID = inGroupID
theRadiobuttons(theLimitRadiobuttons.Current).isSelected = inIsSelected
theRadiobuttons(theLimitRadiobuttons.Current).Text = inText
theRadiobuttons(theLimitRadiobuttons.Current).imageHandle1 = _NewImage(theRadiobuttons(theLimitRadiobuttons.Current).sizeX, theRadiobuttons(theLimitCheckboxes.Current).sizeY, 32)
theRadiobuttons(theLimitRadiobuttons.Current).imageHandle2 = _NewImage(theRadiobuttons(theLimitRadiobuttons.Current).sizeX, theRadiobuttons(theLimitCheckboxes.Current).sizeY, 32)
_Dest theRadiobuttons(theLimitRadiobuttons.Current).imageHandle2
Line (0, 0)-(_Width - 1, _Height - 1), _RGBA32(255, 0, 255, 255), BF
Line (0, 0)-(_Width - 1, _Height - 1), _RGBA32(255, 255, 255, 255), B
Line (2, 2)-(_Width - 3, _Height - 3), _RGBA32(255, 255, 255, 255)
Line (2, _Height - 3)-(_Width - 3, 2), _RGBA32(255, 255, 255, 255)
_Dest theRadiobuttons(theLimitRadiobuttons.Current).imageHandle1
Line (0, 0)-(_Width - 1, _Height - 1), _RGBA32(255, 0, 255, 255), BF
Line (0, 0)-(_Width - 1, _Height - 1), _RGBA32(255, 255, 255, 255), B
_Dest 0
End Sub
Sub probeMouse
While _MouseInput
Wend
theMouse.positionX = _MouseX
theMouse.positionY = _MouseY
theMouse.buttonLeft = _MouseButton(1)
theMouse.buttonRight = _MouseButton(2)
theMouse.buttonMiddle = _MouseButton(3)
End Sub
Function isZone~& (inIdentifier As _Unsigned _Integer64, inSelector As String)
inSelector = LCase$(LTrim$(RTrim$(inSelector)))
Select Case inSelector
Case "window"
If theMouse.positionX >= theWindows(inIdentifier).positionX Then
If theMouse.positionY >= theWindows(inIdentifier).positionY Then
If theMouse.positionX <= theWindows(inIdentifier).positionX + theWindows(inIdentifier).sizeX Then
If theMouse.positionY <= theWindows(inIdentifier).positionY + theWindows(inIdentifier).sizeY Then
isZone~& = inIdentifier
End If
End If
End If
End If
Case "icon"
If theMouse.positionX >= theIcons(inIdentifier).positionX Then
If theMouse.positionY >= theIcons(inIdentifier).positionY Then
If theMouse.positionX <= theIcons(inIdentifier).positionX + theIcons(inIdentifier).sizeX Then
If theMouse.positionY <= theIcons(inIdentifier).positionY + theIcons(inIdentifier).sizeY Then
isZone~& = inIdentifier
End If
End If
End If
End If
Case "button"
If theMouse.positionX >= theButtons(inIdentifier).positionX Then
If theMouse.positionY >= theButtons(inIdentifier).positionY Then
If theMouse.positionX <= theButtons(inIdentifier).positionX + theButtons(inIdentifier).sizeX Then
If theMouse.positionY <= theButtons(inIdentifier).positionY + theButtons(inIdentifier).sizeY Then
isZone~& = inIdentifier
End If
End If
End If
End If
Case "checkbox"
If theMouse.positionX >= theCheckboxes(inIdentifier).positionX Then
If theMouse.positionY >= theCheckboxes(inIdentifier).positionY Then
If theMouse.positionX <= theCheckboxes(inIdentifier).positionX + theCheckboxes(inIdentifier).sizeX Then
If theMouse.positionY <= theCheckboxes(inIdentifier).positionY + theCheckboxes(inIdentifier).sizeY Then
isZone~& = inIdentifier
End If
End If
End If
End If
Case "switch"
If theMouse.positionX >= theSwitches(inIdentifier).positionX Then
If theMouse.positionY >= theSwitches(inIdentifier).positionY Then
If theMouse.positionX <= theSwitches(inIdentifier).positionX + theSwitches(inIdentifier).sizeX Then
If theMouse.positionY <= theSwitches(inIdentifier).positionY + theSwitches(inIdentifier).sizeY Then
isZone~& = inIdentifier
End If
End If
End If
End If
Case "radiobutton"
If theMouse.positionX >= theRadiobuttons(inIdentifier).positionX Then
If theMouse.positionY >= theRadiobuttons(inIdentifier).positionY Then
If theMouse.positionX <= theRadiobuttons(inIdentifier).positionX + theRadiobuttons(inIdentifier).sizeX Then
If theMouse.positionY <= theRadiobuttons(inIdentifier).positionY + theRadiobuttons(inIdentifier).sizeY Then
isZone~& = inIdentifier
End If
End If
End If
End If
End Select
End Function
|
|
|
Keybone's GUI (Ancient QB64.net version) |
Posted by: Keybone - 04-19-2022, 04:05 PM - Forum: Keybone
- No Replies
|
|
I made this version of the GUI when I was first starting programming (probably 2013/2014).
It draws a group of Win 3.x lookalike windows on screen. There is no input functionality included.
Obligatory screenshot:
Installation:
1) Copy Win31.bas and Clouds.bmp into your qb64 folder
2) Compile and run Win31.bas
Clouds.bmp:
Win31.bas:
Code: (Select All) Type window
windowStartX As _Unsigned Integer
windowStartY As _Unsigned Integer
windowSize As _Unsigned Integer
windowAspectSelector As _Unsigned _Byte
windowTypeSelector As _Unsigned _Byte
windowParent As _Unsigned _Byte
windowActive As _Unsigned _Byte
End Type
Type button
buttonStartX As _Unsigned Integer
buttonStartY As _Unsigned Integer
buttonSize As _Unsigned Integer
buttonAspectSelector As _Unsigned _Byte
buttonTypeSelector As _Unsigned _Byte
buttonPressed As _Unsigned _Byte
End Type
Dim Shared blackColor As _Unsigned Long
blackColor = _RGBA32(0, 0, 0, 255)
Dim Shared shadowColor As _Unsigned Long
shadowColor = _RGBA32(100, 100, 100, 255)
Dim Shared faceColor As _Unsigned Long
faceColor = _RGBA32(150, 150, 150, 255)
Dim Shared highlightColor As _Unsigned Long
highlightColor = _RGBA32(190, 190, 190, 255)
Dim Shared whiteColor As _Unsigned Long
whiteColor = _RGBA32(255, 255, 255, 255)
Dim Shared activeTitlebarColor As _Unsigned Long
activeTitlebarColor = _RGBA32(0, 0, 255, 255)
Dim Shared inactiveTitlebarColor As _Unsigned Long
inactiveTitlebarColor = _RGBA32(0, 0, 255, 255)
Dim Shared borderColor As _Unsigned Long
borderColor = _RGBA32(0, 127, 63, 255)
Dim Shared windowForegroundColor As _Unsigned Long
windowForegroundColor = _RGBA32(0, 127, 255, 255)
Dim Shared windowBackgroundColor As _Unsigned Long
windowBackgroundColor = _RGBA32(192, 192, 192, 255)
Dim Shared windowFrameColor As _Unsigned Long
windowFrameColor = _RGBA32(0, 255, 255, 255)
Dim Shared desktopColor As _Unsigned Long
desktopColor = _RGBA32(0, 0, 0, 255)
Screen _NewImage(800, 600, 32)
_PrintMode _KeepBackground
'_FullScreen
Dim Shared wallpaper As String
Dim Shared wallpaperUsed As _Bit
wallpaper = "Clouds.bmp"
wallpaperUsed = -1
Dim Shared maxWindow
maxWindow = 25
Dim Shared windows(maxWindow) As window
Dim Shared maxButton
maxButton = 500
Dim Shared buttons(maxButton) As button
Dim Shared currentWindows
Dim Shared currentButtons
Dim Shared firstAvailableWindow
Dim Shared firstAvailableButton
Dim Shared wSX: Dim Shared bSX
Dim Shared wSY: Dim Shared bSY
Dim Shared wS: Dim Shared bS
Dim Shared wAS: Dim Shared bAS
Dim Shared wT: Dim Shared bT
Dim Shared wA: Dim Shared bP
Dim Shared wP
'
' User Code Below
'
desktopDraw
Call putWindow(100, 100, 480, 1, 0, 1, 0)
Call putWindow(400, 200, 320, 0, 0, 0, 0)
Call putWindow(800, 384, 240, 1, 1, 0, 1)
Call putButton(150, 150, 30, 1, 0, 0)
Call putButton(150, 190, 30, 1, 0, 0)
Call putButton(520, 475, 30, 1, 0, 0)
Call getWindow(0)
Call windowDraw
Call getWindow(1)
Call windowDraw
Call getWindow(2)
Call windowDraw
Call getButton(0)
Call buttonDraw
Call getButton(1)
Call buttonDraw
Call getButton(2)
Call buttonDraw
Sleep
'
' User Code Above
'
Sub desktopDraw
If wallpaperUsed = -1 Then
image& = _LoadImage(wallpaper)
_PutImage , image&
Else
Line (0, 0)-(1365, 767), desktopColor, BF
End If
End Sub
Sub windowDraw
Call displayWindow(wSX, wSY, wS, wAS, wT, wP, wA)
End Sub
Sub buttonDraw
Call displayButton(bSX, bSY, bS, bAS, bT, bP)
End Sub
Sub putWindow (windowStartX, windowStartY, windowSize, windowAspectSelector, windowTypeSelector, windowParent, windowActive)
If firstAvailableWindow <= maxWindow Then
windows(firstAvailableWindow).windowStartX = windowStartX
windows(firstAvailableWindow).windowStartY = windowStartY
windows(firstAvailableWindow).windowSize = windowSize
windows(firstAvailableWindow).windowAspectSelector = windowAspectSelector
windows(firstAvailableWindow).windowTypeSelector = windowTypeSelector
windows(firstAvailableWindow).windowParent = windowParent
windows(firstAvailableWindow).windowActive = windowActive
If firstAvailableWindow < maxWindow Then firstAvailableWindow = firstAvailableWindow + 1
If firstAvailableWindow < maxWindow Then currentWindows = currentWindows + 1
Else
Rem Abort
End If
End Sub
Sub putButton (buttonStartX, buttonStartY, buttonSize, buttonAspectSelector, buttonTypeSelector, buttonPressed)
If firstAvailableButton <= maxButton Then
buttons(firstAvailableButton).buttonStartX = buttonStartX
buttons(firstAvailableButton).buttonStartY = buttonStartY
buttons(firstAvailableButton).buttonSize = buttonSize
buttons(firstAvailableButton).buttonAspectSelector = buttonAspectSelector
buttons(firstAvailableButton).buttonTypeSelector = buttonTypeSelector
buttons(firstAvailableButton).buttonPressed = buttonPressed
If firstAvailableButton < maxButton Then firstAvailableButton = firstAvailableButton + 1
If firstAvailableButton < maxButton Then currentButtons = currentButtons + 1
Else
Rem Abort
End If
End Sub
Sub removeWindow (windowNumber)
windows(windowNumber).windowStartX = 0
windows(windowNumber).windowStartY = 0
windows(windowNumber).windowSize = 0
windows(windowNumber).windowAspectSelector = 0
windows(windowNumber).windowTypeSelector = 0
windows(windowNumber).windowParent = 0
windows(windowNumber).windowActive = 0
End Sub
Sub removeButton (buttonNumber)
buttons(buttonNumber).buttonStartX = 0
buttons(buttonNumber).buttonStartY = 0
buttons(buttonNumber).buttonSize = 0
buttons(buttonNumber).buttonAspectSelector = 0
buttons(buttonNumber).buttonTypeSelector = 0
buttons(buttonNumber).buttonPressed = 0
End Sub
Sub getWindow (windowNumber)
wSX = windows(windowNumber).windowStartX
wSY = windows(windowNumber).windowStartY
wS = windows(windowNumber).windowSize
wAS = windows(windowNumber).windowAspectSelector
wT = windows(windowNumber).windowTypeSelector
wP = windows(windowNumber).windowParent
wA = windows(windowNumber).windowActive
End Sub
Sub getButton (buttonNumber)
bSX = buttons(buttonNumber).buttonStartX
bSY = buttons(buttonNumber).buttonStartY
bS = buttons(buttonNumber).buttonSize
bAS = buttons(buttonNumber).buttonAspectSelector
bT = buttons(buttonNumber).buttonTypeSelector
bA = buttons(buttonNumber).buttonPressed
End Sub
Sub displayWindow (windowStartX, windowStartY, windowSize, windowAspectSelector, windowType, windowParent, windowActive)
Dim windowAspect As _Float
If windowAspectSelector = 0 Then
windowAspect = 1 / 1
Else If windowAspectSelector = 1 Then
windowAspect = 4 / 3
Else If windowAspectSelector = 2 Then
windowAspect = 16 / 9
End If
End If
End If
windowEndX = windowStartX + (windowAspect * windowSize)
windowEndY = windowStartY + windowSize
Dim shadowDepth As _Unsigned Integer
shadowDepth = 7
If windowType = 0 Then
If windowParent = 0 Then
If windowActive = 0 Then
Line (windowStartX + shadowDepth, windowStartY + shadowDepth)-(windowEndX + shadowDepth, windowEndY + shadowDepth), blackColor, BF
Line (windowStartX, windowStartY)-(windowEndX, windowEndY), windowFrameColor, B
Line (windowStartX + 1, windowStartY + 1)-(windowEndX - 1, windowEndY - 1), borderColor, BF
Line (windowStartX + 3, windowStartY + 3)-(windowEndX - 3, windowEndY - 3), windowFrameColor, B
Line (windowStartX + 22, windowStartY)-(windowEndX - 22, windowEndY), windowFrameColor, B
Line (windowStartX, windowStartY + 22)-(windowEndX, windowEndY - 22), windowFrameColor, B
Line (windowEndX - 41, windowStartY + 3)-(windowEndX - 41, windowStartY + 22), windowFrameColor
Call displayButton(windowStartX + 4, windowStartY + 4, 17, 0, 4, 0)
Call displayButton(windowEndX - 40, windowStartY + 4, 17, 0, 1, 0)
Call displayButton(windowEndX - 21, windowStartY + 4, 17, 0, 2, 0)
Line (windowStartX + 23, windowStartY + 4)-(windowEndX - 42, windowStartY + 21), inactiveTitlebarColor, BF
Line (windowStartX + 4, windowStartY + 23)-(windowEndX - 4, windowEndY - 4), windowBackgroundColor, BF
Else
Line (windowStartX + shadowDepth, windowStartY + shadowDepth)-(windowEndX + shadowDepth, windowEndY + shadowDepth), blackColor, BF
Line (windowStartX, windowStartY)-(windowEndX, windowEndY), windowFrameColor, B
Line (windowStartX + 1, windowStartY + 1)-(windowEndX - 1, windowEndY - 1), borderColor, BF
Line (windowStartX + 3, windowStartY + 3)-(windowEndX - 3, windowEndY - 3), windowFrameColor, B
Line (windowStartX + 22, windowStartY)-(windowEndX - 22, windowEndY), windowFrameColor, B
Line (windowStartX, windowStartY + 22)-(windowEndX, windowEndY - 22), windowFrameColor, B
Line (windowEndX - 41, windowStartY + 3)-(windowEndX - 41, windowStartY + 22), windowFrameColor
Call displayButton(windowStartX + 4, windowStartY + 4, 17, 0, 4, 0)
Call displayButton(windowEndX - 40, windowStartY + 4, 17, 0, 1, 0)
Call displayButton(windowEndX - 21, windowStartY + 4, 17, 0, 2, 0)
Line (windowStartX + 23, windowStartY + 4)-(windowEndX - 42, windowStartY + 21), activeTitlebarColor, BF
Line (windowStartX + 4, windowStartY + 23)-(windowEndX - 4, windowEndY - 4), windowBackgroundColor, BF
End If
Else
If windowActive = 0 Then
Line (windowStartX + shadowDepth, windowStartY + shadowDepth)-(windowEndX + shadowDepth, windowEndY + shadowDepth), blackColor, BF
Line (windowStartX, windowStartY)-(windowEndX, windowEndY), windowFrameColor, B
Line (windowStartX + 1, windowStartY + 1)-(windowEndX - 1, windowEndY - 1), borderColor, BF
Line (windowStartX + 3, windowStartY + 3)-(windowEndX - 3, windowEndY - 3), windowFrameColor, B
Line (windowStartX + 22, windowStartY)-(windowEndX - 22, windowEndY), windowFrameColor, B
Line (windowStartX, windowStartY + 22)-(windowEndX, windowEndY - 22), windowFrameColor, B
Line (windowEndX - 41, windowStartY + 3)-(windowEndX - 41, windowStartY + 22), windowFrameColor
Call displayButton(windowStartX + 4, windowStartY + 4, 17, 0, 3, 0)
Call displayButton(windowEndX - 40, windowStartY + 4, 17, 0, 1, 0)
Call displayButton(windowEndX - 21, windowStartY + 4, 17, 0, 2, 0)
Line (windowStartX + 23, windowStartY + 4)-(windowEndX - 42, windowStartY + 21), inactiveTitlebarColor, BF
Line (windowStartX + 4, windowStartY + 23)-(windowEndX - 4, windowEndY - 4), windowBackgroundColor, BF
Else
Line (windowStartX + shadowDepth, windowStartY + shadowDepth)-(windowEndX + shadowDepth, windowEndY + shadowDepth), blackColor, BF
Line (windowStartX, windowStartY)-(windowEndX, windowEndY), windowFrameColor, B
Line (windowStartX + 1, windowStartY + 1)-(windowEndX - 1, windowEndY - 1), borderColor, BF
Line (windowStartX + 3, windowStartY + 3)-(windowEndX - 3, windowEndY - 3), windowFrameColor, B
Line (windowStartX + 22, windowStartY)-(windowEndX - 22, windowEndY), windowFrameColor, B
Line (windowStartX, windowStartY + 22)-(windowEndX, windowEndY - 22), windowFrameColor, B
Line (windowEndX - 41, windowStartY + 3)-(windowEndX - 41, windowStartY + 22), windowFrameColor
Call displayButton(windowStartX + 4, windowStartY + 4, 17, 0, 3, 0)
Call displayButton(windowEndX - 40, windowStartY + 4, 17, 0, 1, 0)
Call displayButton(windowEndX - 21, windowStartY + 4, 17, 0, 2, 0)
Line (windowStartX + 23, windowStartY + 4)-(windowEndX - 42, windowStartY + 21), activeTitlebarColor, BF
Line (windowStartX + 4, windowStartY + 23)-(windowEndX - 4, windowEndY - 4), windowBackgroundColor, BF
End If
End If
Else
If windowType = 1 Then
If windowParent = 1 Then
If windowActive = 0 Then
Line (windowStartX + shadowDepth, windowStartY + shadowDepth)-(windowEndX + shadowDepth, windowEndY + shadowDepth), blackColor, BF
Line (windowStartX, windowStartY)-(windowEndX, windowEndY), windowFrameColor, B
Line (windowStartX + 1, windowStartY + 1)-(windowEndX - 1, windowEndY - 1), inactiveTitlebarColor, B
Line (windowStartX + 2, windowStartY + 2)-(windowEndX - 2, windowEndY - 2), inactiveTitlebarColor, B
Line (windowStartX + 3, windowStartY + 3)-(windowEndX - 3, windowEndY - 3), inactiveTitlebarColor, B
Line (windowStartX + 4, windowStartY + 3)-(windowEndX - 4, windowEndY - 4), inactiveTitlebarColor, B
Line (windowStartX + 5, windowStartY + 4)-(windowEndX - 5, windowEndY - 5), windowFrameColor, B
Line (windowStartX + 6, windowStartY + 5)-(windowEndX - 6, windowStartY + 23), inactiveTitlebarColor, BF
Line (windowStartX + 6, windowStartY + 23)-(windowEndX - 6, windowStartY + 23), windowFrameColor
Line (windowStartX + 24, windowStartY + 5)-(windowStartX + 24, windowStartY + 23), windowFrameColor
Line (windowStartX + 6, windowStartY + 5)-(windowStartX + 23, windowStartY + 22), faceColor, BF
Call displayButton(windowStartX + 6, windowStartY + 5, 17, 0, 4, 0)
Line (windowStartX + 6, windowStartY + 24)-(windowEndX - 6, windowEndY - 6), windowBackgroundColor, BF
Else
Line (windowStartX + shadowDepth, windowStartY + shadowDepth)-(windowEndX + shadowDepth, windowEndY + shadowDepth), blackColor, BF
Line (windowStartX, windowStartY)-(windowEndX, windowEndY), windowFrameColor, B
Line (windowStartX + 1, windowStartY + 1)-(windowEndX - 1, windowEndY - 1), activeTitlebarColor, B
Line (windowStartX + 2, windowStartY + 2)-(windowEndX - 2, windowEndY - 2), activeTitlebarColor, B
Line (windowStartX + 3, windowStartY + 3)-(windowEndX - 3, windowEndY - 3), activeTitlebarColor, B
Line (windowStartX + 4, windowStartY + 3)-(windowEndX - 4, windowEndY - 4), activeTitlebarColor, B
Line (windowStartX + 5, windowStartY + 4)-(windowEndX - 5, windowEndY - 5), windowFrameColor, B
Line (windowStartX + 6, windowStartY + 5)-(windowEndX - 6, windowStartY + 23), activeTitlebarColor, BF
Line (windowStartX + 6, windowStartY + 23)-(windowEndX - 6, windowStartY + 23), windowFrameColor
Line (windowStartX + 24, windowStartY + 5)-(windowStartX + 24, windowStartY + 23), windowFrameColor
Line (windowStartX + 6, windowStartY + 5)-(windowStartX + 23, windowStartY + 22), faceColor, BF
Call displayButton(windowStartX + 6, windowStartY + 5, 17, 0, 4, 0)
Line (windowStartX + 6, windowStartY + 24)-(windowEndX - 6, windowEndY - 6), windowBackgroundColor, BF
End If
Else
If windowActive = 0 Then
Line (windowStartX + shadowDepth, windowStartY + shadowDepth)-(windowEndX + shadowDepth, windowEndY + shadowDepth), blackColor, BF
Line (windowStartX, windowStartY)-(windowEndX, windowEndY), windowFrameColor, B
Line (windowStartX + 1, windowStartY + 1)-(windowEndX - 1, windowEndY - 1), inactiveTitlebarColor, B
Line (windowStartX + 2, windowStartY + 2)-(windowEndX - 2, windowEndY - 2), inactiveTitlebarColor, B
Line (windowStartX + 3, windowStartY + 3)-(windowEndX - 3, windowEndY - 3), inactiveTitlebarColor, B
Line (windowStartX + 4, windowStartY + 3)-(windowEndX - 4, windowEndY - 4), inactiveTitlebarColor, B
Line (windowStartX + 5, windowStartY + 4)-(windowEndX - 5, windowEndY - 5), windowFrameColor, B
Line (windowStartX + 6, windowStartY + 5)-(windowEndX - 6, windowStartY + 23), inactiveTitlebarColor, BF
Line (windowStartX + 6, windowStartY + 23)-(windowEndX - 6, windowStartY + 23), windowFrameColor
Line (windowStartX + 24, windowStartY + 5)-(windowStartX + 24, windowStartY + 23), windowFrameColor
Line (windowStartX + 6, windowStartY + 5)-(windowStartX + 23, windowStartY + 22), faceColor, BF
Call displayButton(windowStartX + 6, windowStartY + 5, 17, 0, 3, 0)
Line (windowStartX + 6, windowStartY + 24)-(windowEndX - 6, windowEndY - 6), windowBackgroundColor, BF
Else
Line (windowStartX + shadowDepth, windowStartY + shadowDepth)-(windowEndX + shadowDepth, windowEndY + shadowDepth), blackColor, BF
Line (windowStartX, windowStartY)-(windowEndX, windowEndY), windowFrameColor, B
Line (windowStartX + 1, windowStartY + 1)-(windowEndX - 1, windowEndY - 1), activeTitlebarColor, B
Line (windowStartX + 2, windowStartY + 2)-(windowEndX - 2, windowEndY - 2), activeTitlebarColor, B
Line (windowStartX + 3, windowStartY + 3)-(windowEndX - 3, windowEndY - 3), activeTitlebarColor, B
Line (windowStartX + 4, windowStartY + 3)-(windowEndX - 4, windowEndY - 4), activeTitlebarColor, B
Line (windowStartX + 5, windowStartY + 4)-(windowEndX - 5, windowEndY - 5), windowFrameColor, B
Line (windowStartX + 6, windowStartY + 5)-(windowEndX - 6, windowStartY + 23), activeTitlebarColor, BF
Line (windowStartX + 6, windowStartY + 23)-(windowEndX - 6, windowStartY + 23), windowFrameColor
Line (windowStartX + 24, windowStartY + 5)-(windowStartX + 24, windowStartY + 23), windowFrameColor
Line (windowStartX + 6, windowStartY + 5)-(windowStartX + 23, windowStartY + 22), faceColor, BF
Call displayButton(windowStartX + 6, windowStartY + 5, 17, 0, 3, 0)
Line (windowStartX + 6, windowStartY + 24)-(windowEndX - 6, windowEndY - 6), windowBackgroundColor, BF
End If
End If
End If
End If
End Sub
Sub displayButton (buttonStartX, buttonStartY, buttonSize, buttonAspectSelector, buttonType, buttonPressed)
Dim buttonAspect As _Float
If buttonAspectSelector = 0 Then
buttonAspect = 1 / 1
Else If buttonAspectSelector = 1 Then
buttonAspect = 70 / 23
End If
End If
buttonEndX = buttonStartX + (buttonAspect * buttonSize)
buttonEndY = buttonStartY + buttonSize
If buttonType = 0 Then
If buttonPressed = 0 Then
Line (buttonStartX, buttonStartY)-(buttonEndX, buttonEndY), shadowColor, B
Line (buttonStartX, buttonStartY)-(buttonEndX - 1, buttonEndY - 1), highlightColor, B
Line (buttonStartX + 1, buttonStartY + 1)-(buttonEndX - 1, buttonEndY - 1), shadowColor, B
Line (buttonStartX + 1, buttonStartY + 1)-(buttonEndX - 2, buttonEndY - 2), highlightColor, B
Line (buttonStartX + 2, buttonStartY + 2)-(buttonEndX - 2, buttonEndY - 2), faceColor, BF
End If
If buttonPressed = 1 Then
Line (buttonStartX, buttonStartY)-(buttonEndX, buttonEndY), highlightColor, B
Line (buttonStartX, buttonStartY)-(buttonEndX - 1, buttonEndY - 1), shadowColor, B
Line (buttonStartX + 1, buttonStartY + 1)-(buttonEndX - 1, buttonEndY - 1), highlightColor, B
Line (buttonStartX + 1, buttonStartY + 1)-(buttonEndX - 2, buttonEndY - 2), shadowColor, B
Line (buttonStartX + 2, buttonStartY + 2)-(buttonEndX - 2, buttonEndY - 2), faceColor, BF
End If
End If
If buttonType = 1 Then
If buttonPressed = 0 Then
Line (buttonStartX, buttonStartY)-(buttonEndX, buttonEndY), shadowColor, B
Line (buttonStartX, buttonStartY)-(buttonEndX - 1, buttonEndY - 1), highlightColor, B
Line (buttonStartX + 1, buttonStartY + 1)-(buttonEndX - 1, buttonEndY - 1), shadowColor, B
Line (buttonStartX + 1, buttonStartY + 1)-(buttonEndX - 2, buttonEndY - 2), highlightColor, B
Line (buttonStartX + 2, buttonStartY + 2)-(buttonEndX - 2, buttonEndY - 2), faceColor, BF
End If
If buttonPressed = 1 Then
Line (buttonStartX, buttonStartY)-(buttonEndX, buttonEndY), highlightColor, B
Line (buttonStartX, buttonStartY)-(buttonEndX - 1, buttonEndY - 1), shadowColor, B
Line (buttonStartX + 1, buttonStartY + 1)-(buttonEndX - 1, buttonEndY - 1), highlightColor, B
Line (buttonStartX + 1, buttonStartY + 1)-(buttonEndX - 2, buttonEndY - 2), shadowColor, B
Line (buttonStartX + 2, buttonStartY + 2)-(buttonEndX - 2, buttonEndY - 2), faceColor, BF
End If
Line (buttonStartX + 5, buttonStartY + 7)-(buttonStartX + 11, buttonStartY + 7), blackColor
Line (buttonStartX + 6, buttonStartY + 8)-(buttonStartX + 10, buttonStartY + 8), blackColor
Line (buttonStartX + 7, buttonStartY + 9)-(buttonStartX + 9, buttonStartY + 9), blackColor
Line (buttonStartX + 8, buttonStartY + 10)-(buttonStartX + 8, buttonStartY + 10), blackColor
End If
If buttonType = 2 Then
If buttonPressed = 0 Then
Line (buttonStartX, buttonStartY)-(buttonEndX, buttonEndY), shadowColor, B
Line (buttonStartX, buttonStartY)-(buttonEndX - 1, buttonEndY - 1), highlightColor, B
Line (buttonStartX + 1, buttonStartY + 1)-(buttonEndX - 1, buttonEndY - 1), shadowColor, B
Line (buttonStartX + 1, buttonStartY + 1)-(buttonEndX - 2, buttonEndY - 2), highlightColor, B
Line (buttonStartX + 2, buttonStartY + 2)-(buttonEndX - 2, buttonEndY - 2), faceColor, BF
End If
If buttonPressed = 1 Then
Line (buttonStartX, buttonStartY)-(buttonEndX, buttonEndY), highlightColor, B
Line (buttonStartX, buttonStartY)-(buttonEndX - 1, buttonEndY - 1), shadowColor, B
Line (buttonStartX + 1, buttonStartY + 1)-(buttonEndX - 1, buttonEndY - 1), highlightColor, B
Line (buttonStartX + 1, buttonStartY + 1)-(buttonEndX - 2, buttonEndY - 2), shadowColor, B
Line (buttonStartX + 2, buttonStartY + 2)-(buttonEndX - 2, buttonEndY - 2), faceColor, BF
End If
Line (buttonStartX + 8, buttonStartY + 6)-(buttonStartX + 8, buttonStartY + 6), blackColor
Line (buttonStartX + 7, buttonStartY + 7)-(buttonStartX + 9, buttonStartY + 7), blackColor
Line (buttonStartX + 6, buttonStartY + 8)-(buttonStartX + 10, buttonStartY + 8), blackColor
Line (buttonStartX + 5, buttonStartY + 9)-(buttonStartX + 11, buttonStartY + 9), blackColor
End If
If buttonType = 3 Then
Line (buttonStartX, buttonStartY)-(buttonEndX, buttonEndY), faceColor, BF
Line (buttonStartX + 1, buttonStartY + 1)-(buttonStartX + 18, buttonStartY + 18), surfColor, BF
Line (buttonStartX + 3, buttonStartY + 9)-(buttonStartX + 16, buttonStartY + 11), shadColor, B
Line (buttonStartX + 2, buttonStartY + 8)-(buttonStartX + 15, buttonStartY + 10), blackColor, B
Line (buttonStartX + 3, buttonStartY + 9)-(buttonStartX + 14, buttonStartY + 9), whiteColor
End If
If buttonType = 4 Then
Line (buttonStartX, buttonStartY)-(buttonEndX, buttonEndY), faceColor, BF
Line (buttonStartX + 1, buttonStartY + 1)-(buttonStartX + 18, buttonStartY + 18), surfColor, BF
Line (buttonStartX + 6, buttonStartY + 9)-(buttonStartX + 11, buttonStartY + 11), shadColor, B
Line (buttonStartX + 5, buttonStartY + 8)-(buttonStartX + 12, buttonStartY + 10), blackColor, B
Line (buttonStartX + 6, buttonStartY + 9)-(buttonStartX + 11, buttonStartY + 9), whiteColor
End If
End Sub
Sub displayIcon (iconImagePath$, iconTitle$, iconStartX, iconStartY, iconSize, iconAspect, iconSelected)
Print "icon"
End Sub
|
|
|
Keybone's GUI (04/07/2022) |
Posted by: Keybone - 04-19-2022, 02:42 PM - Forum: Keybone
- Replies (6)
|
|
This is the latest rewrite of my GUI.
It is not complete by any means, as always work-in-progress.
What's working:
Restore window from Icon
Move window
Move Icon
Minimize window to icon
Maximize window to screen size
Not working:
Restore window from maximized
Minimize window from maximized
Close window
Z-order focus (windows do not rise to the top of z-order when clicked (yet).)
Also, unlike some of my previous versions, there is no background implemented yet.
Here for the obligatory screenshots:
All windows minimized:
One window restored from minimized:
Window resizing:
Window resized (and z-order bug):
Window maximized (and z-order bug):
Installing:
Copy and paste k-win-upload.bas and blank.png into your qb64 folder. Compile and run k-win-upload.bas.
blank.png :
k-win-upload.bas :
Code: (Select All) Type aSize
restoredSizeX As _Unsigned Integer
restoredSizeY As _Unsigned Integer
maximizedSizeX As _Unsigned Integer
maximizedSizeY As _Unsigned Integer
End Type
Type aProperty
isMinimizable As _Byte
isRestorable As _Byte
isMaximizable As _Byte
isMovable As _Byte
isResizable As _Byte
End Type
Type aStatus
isMinimized As _Byte
isRestored As _Byte
isMaximized As _Byte
isMoving As _Byte
isResizing As _Byte
End Type
Type aWindow
positionX As Integer
positionY As Integer
Size As aSize
restoredImageHandle As _Unsigned Long
maximizedImageHandle As _Unsigned Long
Properties As aProperty
Status As aStatus
isActive As _Byte
End Type
Type anIcon
positionX As Integer
positionY As Integer
sizeX As _Unsigned Integer
sizeY As _Unsigned Integer
imageHandle As _Unsigned Long
End Type
Type anObject
Title As String
Identifier As String
Windows As aWindow
Icons As anIcon
End Type
Type aMouse
positionX As Integer
positionY As Integer
buttonLeft As _Byte
buttonCenter As _Byte
buttonRight As _Byte
End Type
Type aZone
parentIdentifier As _Unsigned Integer
Identifier As _Unsigned Integer
positionX As Integer
positionY As Integer
sizeX As _Unsigned Integer
sizeY As _Unsigned Integer
Purpose As String
End Type
Type aLimit
Minimum As _Unsigned Integer
Current As _Unsigned Integer
Maximum As _Unsigned Integer
End Type
Dim Shared limitObjects As aLimit
limitObjects.Minimum = 0
limitObjects.Current = limitObjects.Minimum
limitObjects.Maximum = 0 - 1
Dim Shared limitZones As aLimit
limitZones.Minimum = 0
limitZones.Current = limitZones.Minimum
limitZones.Maximum = 0 - 1
ReDim Shared Objects(limitObjects.Current) As anObject
ReDim Shared Zones(limitZones.Current) As aZone
Dim Shared ZoneMatched As _Unsigned Integer
Dim Shared WindowMatched As _Unsigned Integer
Dim Shared Purpose As String
Dim Shared Mouse As aMouse
' BAS on down BI on up
Screen _NewImage(800, 600, 32)
'_FullScreen _SquarePixels
Dim Shared gray25 As _Unsigned Long: gray25 = _RGBA32(63, 63, 63, 255)
Dim Shared gray50 As _Unsigned Long: gray50 = _RGBA32(127, 127, 127, 255)
Dim Shared gray75 As _Unsigned Long: gray75 = _RGBA32(191, 191, 191, 255)
objectInit 100, 100, 200, 200, "Window 1", "Window Title 1"
'objectDisableMaximization limitObjects.Current
objectInit 200, 200, 200, 200, "Window 2", "Window Title 2"
'objectDisableMaximization limitObjects.Current
objectInit 300, 300, 200, 200, "Window 3", "Window Title 3"
'objectDisableMaximization limitObjects.Current
Do
Line (0, 0)-(_Width - 1, _Height - 1), _RGBA32(63, 0, 63, 255), BF
For i = 0 To limitObjects.Current
If Objects(i).Windows.Status.isMinimized Then
_PutImage (Objects(i).Icons.positionX, Objects(i).Icons.positionY), Objects(i).Icons.imageHandle
ElseIf Objects(i).Windows.Status.isRestored Then
_PutImage (Objects(i).Windows.positionX, Objects(i).Windows.positionY), Objects(i).Windows.restoredImageHandle
ElseIf Objects(i).Windows.Status.isMaximized Then
_PutImage (0, 0), Objects(i).Windows.maximizedImageHandle
End If
Next i
mouseProbe
If Mouse.buttonLeft Then
For i = 0 To limitObjects.Current
WindowMatched = isObject~%(i)
If WindowMatched Then
If Objects(WindowMatched).Windows.Status.isMinimized Then
_Delay .125
mouseProbe
If Mouse.buttonLeft Then
objectMove WindowMatched
Else
objectRestore WindowMatched
End If
ElseIf Objects(WindowMatched).Windows.Status.isRestored Then
If Mouse.positionX > Objects(WindowMatched).Windows.positionX + 4 And Mouse.positionX < Objects(WindowMatched).Windows.positionX + 24 Then
If Mouse.positionY > Objects(WindowMatched).Windows.positionY + 3 And Mouse.positionY < Objects(WindowMatched).Windows.positionY + 23 Then
' Close
End If
End If
If Mouse.positionX > Objects(WindowMatched).Windows.positionX + 24 And Mouse.positionX < Objects(WindowMatched).Windows.positionX + (_Width(Objects(WindowMatched).Windows.restoredImageHandle) - 69) Then
If Mouse.positionY > Objects(WindowMatched).Windows.positionY + 3 And Mouse.positionY < Objects(WindowMatched).Windows.positionY + 23 Then
objectMove WindowMatched
End If
End If
If Mouse.positionX > Objects(WindowMatched).Windows.positionX + (_Width(Objects(WindowMatched).Windows.restoredImageHandle) - 46) And Mouse.positionX < Objects(WindowMatched).Windows.positionX + (_Width(Objects(WindowMatched).Windows.restoredImageHandle) - 23) Then
If Mouse.positionY > Objects(WindowMatched).Windows.positionY + 3 And Mouse.positionY < Objects(WindowMatched).Windows.positionY + 23 Then
objectMinimize WindowMatched
End If
End If
If Mouse.positionX > Objects(WindowMatched).Windows.positionX + (_Width(Objects(WindowMatched).Windows.restoredImageHandle) - 23) And Mouse.positionX < Objects(WindowMatched).Windows.positionX + (_Width(Objects(WindowMatched).Windows.restoredImageHandle) - 3) Then
If Mouse.positionY > Objects(WindowMatched).Windows.positionY + 3 And Mouse.positionY < Objects(WindowMatched).Windows.positionY + 23 Then
objectMaximize WindowMatched
End If
End If
If Mouse.positionX > Objects(WindowMatched).Windows.positionX + (_Width(Objects(WindowMatched).Windows.restoredImageHandle) - 23) And Mouse.positionX < Objects(WindowMatched).Windows.positionX + (_Width(Objects(WindowMatched).Windows.restoredImageHandle) - 3) Then
If Mouse.positionY > Objects(WindowMatched).Windows.positionY + (_Height(Objects(WindowMatched).Windows.restoredImageHandle) - 23) And Mouse.positionY < Objects(WindowMatched).Windows.positionY + (_Height(Objects(WindowMatched).Windows.restoredImageHandle) - 3) Then
objectResize WindowMatched
End If
End If
End If
End If
Next i
End If
_Limit 60
_Display
Loop Until Len(InKey$)
Sub objectAdd
limitObjects.Current = limitObjects.Current + 1
ReDim _Preserve Objects(limitObjects.Current) As anObject
End Sub
Sub objectRemove (inIdentifier As _Unsigned Integer)
If Objects(inIdentifier).Icons.imageHandle Then
_FreeImage Objects(inIdentifier).Icons.imageHandle
End If
If Objects(inIdentifier).Windows.restoredImageHandle Then
_FreeImage Objects(inIdentifier).Windows.restoredImageHandle
End If
If Objects(inIdentifier).Windows.maximizedImageHandle Then
_FreeImage Objects(inIdentifier).Windows.maximizedImageHandle
End If
For i = inIdentifier To limitObjects.Current - 1 Step 1
Objects(i) = Objects(i + 1)
Next i
If limitObjects.Current > limitObjects.Minimum Then ' redim array
limitObjects.Current = limitObjects.Current - 1
ReDim _Preserve Objects(limitObjects.Current) As anObject
End If
End Sub
Sub objectInit (inPositionX As Integer, inPositionY As Integer, inSizeX As _Unsigned Integer, inSizeY As _Unsigned Integer, inIdentifier As String, inTitle As String)
objectAdd
Objects(limitObjects.Current).Title = inTitle
Objects(limitObjects.Current).Identifier = inIdentifier
Objects(limitObjects.Current).Windows.positionX = inPositionX
Objects(limitObjects.Current).Windows.positionY = inPositionY
Objects(limitObjects.Current).Windows.Size.restoredSizeX = inSizeX
Objects(limitObjects.Current).Windows.Size.restoredSizeY = inSizeY
Objects(limitObjects.Current).Windows.Size.maximizedSizeX = _Width
Objects(limitObjects.Current).Windows.Size.maximizedSizeY = _Height
Objects(limitObjects.Current).Windows.restoredImageHandle = _NewImage(Objects(limitObjects.Current).Windows.Size.restoredSizeX, Objects(limitObjects.Current).Windows.Size.restoredSizeY, 32)
Objects(limitObjects.Current).Windows.maximizedImageHandle = _NewImage(Objects(limitObjects.Current).Windows.Size.maximizedSizeX, Objects(limitObjects.Current).Windows.Size.maximizedSizeY, 32)
Objects(limitObjects.Current).Windows.Properties.isMinimizable = -1
Objects(limitObjects.Current).Windows.Properties.isRestorable = -1
Objects(limitObjects.Current).Windows.Properties.isMaximizable = -1
Objects(limitObjects.Current).Windows.Properties.isMovable = -1
Objects(limitObjects.Current).Windows.Properties.isResizable = -1
Objects(limitObjects.Current).Windows.Status.isMinimized = -1
Objects(limitObjects.Current).Windows.Status.isRestored = 0
Objects(limitObjects.Current).Windows.Status.isMaximized = 0
Objects(limitObjects.Current).Windows.Status.isMoving = 0
Objects(limitObjects.Current).Windows.Status.isResizing = 0
Objects(limitObjects.Current).Windows.isActive = 0
Objects(limitObjects.Current).Icons.positionX = Objects(limitObjects.Current).Windows.positionX + (Objects(limitObjects.Current).Windows.Size.restoredSizeX / 2)
Objects(limitObjects.Current).Icons.positionY = Objects(limitObjects.Current).Windows.positionY + (Objects(limitObjects.Current).Windows.Size.restoredSizeY / 2)
Objects(limitObjects.Current).Icons.imageHandle = _LoadImage("blank.png")
Objects(limitObjects.Current).Icons.sizeX = _Width(Objects(limitObjects.Current).Icons.imageHandle)
Objects(limitObjects.Current).Icons.sizeY = _Height(Objects(limitObjects.Current).Icons.imageHandle)
objectDraw limitObjects.Current, "Restored"
objectDraw limitObjects.Current, "Maximized"
End Sub
Sub objectDraw (inIdentifier As _Unsigned Integer, inMode As String)
inMode = LTrim$(RTrim$(UCase$(inMode)))
Select Case inMode
Case "RESTORED"
_Dest Objects(inIdentifier).Windows.restoredImageHandle
Line (0, 0)-(_Width - 1, _Height - 1), _RGBA32(127, 127, 127, 255), BF
box 0, 0, _Width - 1, _Height - 1, 1
box 0, 0, _Width - 1, _Height - 1, 1
If Objects(Identifier).Windows.isActive = -1 Then
Titlebar 2, 2, _Width - 5, 23, _RGBA32(0, 255, 255, 255)
Else
Titlebar 2, 2, _Width - 5, 23, _RGBA32(0, 127, 127, 255)
End If
box2 _Width - 48, 3, 20, 20, 1, 7
box2 _Width - 25, 3, 20, 20, 1, 2
box3 4, 3, 20, 20, 1, 1, 7
_Dest 0
Case "MAXIMIZED"
_Dest Objects(inIdentifier).Windows.maximizedImageHandle
Line (0, 0)-(_Width - 1, _Height - 1), _RGBA32(127, 127, 127, 255), BF
box 0, 0, _Width - 1, _Height - 1, 1
box 0, 0, _Width - 1, _Height - 1, 1
If Objects(Identifier).Windows.isActive = -1 Then
Titlebar 2, 2, _Width - 5, 23, _RGBA32(0, 255, 255, 255)
Else
Titlebar 2, 2, _Width - 5, 23, _RGBA32(0, 127, 127, 255)
End If
box2 _Width - 48, 3, 20, 20, 1, 7
box2 _Width - 25, 3, 20, 20, 1, 2
box3 4, 3, 20, 20, 1, 1, 7
_Dest 0
End Select
End Sub
Sub objectMinimize (inIdentifier As _Unsigned Integer)
If Objects(inIdentifier).Windows.Properties.isMinimizable = -1 Then
Objects(inIdentifier).Windows.Status.isMinimized = -1
Objects(inIdentifier).Windows.Status.isRestored = 0
Objects(inIdentifier).Windows.Status.isMaximized = 0
End If
End Sub
Sub objectRestore (inIdentifier As _Unsigned Integer)
If Objects(inIdentifier).Windows.Properties.isRestorable = -1 Then
Objects(inIdentifier).Windows.Status.isMinimized = 0
Objects(inIdentifier).Windows.Status.isRestored = -1
Objects(inIdentifier).Windows.Status.isMaximized = 0
End If
End Sub
Sub objectMaximize (inIdentifier As _Unsigned Integer)
If Objects(inIdentifier).Windows.Properties.isMaximizable = -1 Then
Objects(inIdentifier).Windows.Status.isMinimized = 0
Objects(inIdentifier).Windows.Status.isRestored = 0
Objects(inIdentifier).Windows.Status.isMaximized = -1
End If
End Sub
Sub objectMove (inIdentifier As _Unsigned Integer)
If Objects(inIdentifier).Windows.Properties.isMovable Then
Objects(inIdentifier).Windows.Status.isMoving = -1
Dim previousPositionX As _Unsigned Integer, previousPositionY As _Unsigned Integer
If Objects(inIdentifier).Windows.Status.isMinimized Then
previousPositionX = Objects(inIdentifier).Icons.positionX - Mouse.positionX
previousPositionY = Objects(inIdentifier).Icons.positionY - Mouse.positionY
While Mouse.buttonLeft
Line (0, 0)-(_Width - 1, _Height - 1), _RGBA32(63, 0, 63, 255), BF
mouseProbe
Objects(inIdentifier).Icons.positionX = Mouse.positionX + previousPositionX
Objects(inIdentifier).Icons.positionY = Mouse.positionY + previousPositionY
For i = 1 To limitObjects.Current
If Objects(i).Windows.Status.isMinimized Then
_PutImage (Objects(i).Icons.positionX, Objects(i).Icons.positionY), Objects(i).Icons.imageHandle
ElseIf Objects(i).Windows.Status.isRestored Then
_PutImage (Objects(i).Windows.positionX, Objects(i).Windows.positionY), Objects(i).Windows.restoredImageHandle
End If
Next i
_Display
Wend
ElseIf Objects(inIdentifier).Windows.Status.isRestored Then
previousPositionX = Objects(inIdentifier).Windows.positionX - Mouse.positionX
previousPositionY = Objects(inIdentifier).Windows.positionY - Mouse.positionY
While Mouse.buttonLeft
Line (0, 0)-(_Width - 1, _Height - 1), _RGBA32(63, 0, 63, 255), BF
mouseProbe
Objects(inIdentifier).Windows.positionX = Mouse.positionX + previousPositionX
Objects(inIdentifier).Windows.positionY = Mouse.positionY + previousPositionY
For i = 1 To limitObjects.Current
If Objects(i).Windows.Status.isMinimized Then
_PutImage (Objects(i).Icons.positionX, Objects(i).Icons.positionY), Objects(i).Icons.imageHandle
ElseIf Objects(i).Windows.Status.isRestored Then
_PutImage (Objects(i).Windows.positionX, Objects(i).Windows.positionY), Objects(i).Windows.restoredImageHandle
End If
Next i
_Display
Wend
End If
Objects(inIdentifier).Windows.Status.isMoving = 0
End If
End Sub
Sub objectResize (inIdentifier As _Unsigned Integer)
If Objects(inIdentifier).Windows.Properties.isResizable Then
Objects(inIdentifier).Windows.Status.isResizing = -1
Dim positionX As Integer, positionY As Integer
Dim sizeX As _Unsigned Integer, sizeY As _Unsigned Integer
positionX = Objects(inIdentifier).Windows.positionX
positionY = Objects(inIdentifier).Windows.positionY
While Mouse.buttonLeft
Line (0, 0)-(_Width - 1, _Height - 1), _RGBA32(63, 0, 63, 255), BF
mouseProbe
For i = 1 To limitObjects.Current
If Objects(i).Windows.Status.isMinimized Then
_PutImage (Objects(i).Icons.positionX, Objects(i).Icons.positionY), Objects(i).Icons.imageHandle
ElseIf Objects(i).Windows.Status.isRestored Then
_PutImage (Objects(i).Windows.positionX, Objects(i).Windows.positionY), Objects(i).Windows.restoredImageHandle
End If
Next i
sizeX = (Mouse.positionX - Objects(inIdentifier).Windows.positionX)
sizeY = (Mouse.positionY - Objects(inIdentifier).Windows.positionY)
Line (Objects(inIdentifier).Windows.positionX, Objects(inIdentifier).Windows.positionY)-(Objects(inIdentifier).Windows.positionX + sizeX, Objects(inIdentifier).Windows.positionY + sizeY), _RGBA32(255, 255, 255, 255), B
_Display
Wend
sizeX = (Mouse.positionX - Objects(inIdentifier).Windows.positionX)
sizeY = (Mouse.positionY - Objects(inIdentifier).Windows.positionY)
_FreeImage Objects(inIdentifier).Windows.restoredImageHandle
Objects(indentifier).Windows.restoredImageHandle = _NewImage(sizeX, sizeY, 32)
objectDraw inIdentifier, "Restored"
_PutImage (positionX, positionY), inIdentifier
Objects(inIdentifier).Windows.positionX = positionX
Objects(inIdentifier).Windows.positionY = positionY
Objects(inIdentifier).Windows.Size.restoredSizeX = sizeX
Objects(inIdentifier).Windows.Size.restoredSizeY = sizeY
Objects(inIdentifier).Windows.Status.isResizing = 0
End If
End Sub
Sub objectDisableMinimization (inIdentifier As _Unsigned Integer)
Objects(inIdentifier).Windows.Properties.isMinimizable = 0
End Sub
Sub objectDisableRestoration (inIdentifier As _Unsigned Integer)
Objects(inIdentifier).Windows.Properties.isRestorable = 0
End Sub
Sub objectDisableMaximization (inIdentifier As _Unsigned Integer)
Objects(inIdentifier).Windows.Properties.isMaximizable = 0
End Sub
Sub objectDisableMoving (inIdentifier As _Unsigned Integer)
Objects(inIdentifier).Windows.Properties.isMovable = 0
End Sub
Sub objectDisableResizing (inIdentifier As _Unsigned Integer)
Objects(inIdentifier).Windows.Properties.isResizable = 0
End Sub
Sub mouseProbe
While _MouseInput
Mouse.positionX = _MouseX
Mouse.positionY = _MouseY
Mouse.buttonLeft = _MouseButton(1)
Mouse.buttonCenter = _MouseButton(3)
Mouse.buttonRight = _MouseButton(2)
Wend
End Sub
Function isObject~% (inIdentifier As _Unsigned Integer)
If Objects(inIdentifier).Windows.Status.isMinimized Then
If Mouse.positionX >= Objects(inIdentifier).Icons.positionX Then
If Mouse.positionY >= Objects(inIdentifier).Icons.positionY Then
If Mouse.positionX <= Objects(inIdentifier).Icons.positionX + Objects(inIdentifier).Icons.sizeX Then
If Mouse.positionY <= Objects(inIdentifier).Icons.positionY + Objects(inIdentifier).Icons.sizeY Then
isObject~% = inIdentifier
End If
End If
End If
End If
ElseIf Objects(inIdentifier).Windows.Status.isRestored Then
If Mouse.positionX >= Objects(inIdentifier).Windows.positionX Then
If Mouse.positionY >= Objects(inIdentifier).Windows.positionY Then
If Mouse.positionX <= Objects(inIdentifier).Windows.positionX + Objects(inIdentifier).Windows.Size.restoredSizeX Then
If Mouse.positionY <= Objects(inIdentifier).Windows.positionY + Objects(inIdentifier).Windows.Size.restoredSizeY Then
isObject~% = inIdentifier
End If
End If
End If
End If
End If
End Function
Sub Titlebar (titlebarPositionX As _Unsigned Integer, titlebarPositionY As _Unsigned Integer, titlebarWidth As _Unsigned Integer, titlebarHeight As _Unsigned Integer, titlebarColor As _Unsigned Long)
Line (titlebarPositionX, titlebarPositionY)-(titlebarPositionX + titlebarWidth, titlebarPositionY + titlebarHeight), titlebarColor, BF
End Sub
Sub box (boxPositionX As _Unsigned Integer, boxPositionY As _Unsigned Integer, boxWidth As _Unsigned Integer, boxHeight As _Unsigned Integer, boxDepth As _Unsigned Integer)
Line (boxPositionX, boxPositionY)-(boxPositionX + boxWidth, boxPositionY + boxHeight), gray75, BF
Line (boxPositionX + boxDepth, boxPositionY + boxDepth)-(boxPositionX + boxWidth, boxPositionY + boxHeight), gray25, BF
Line (boxPositionX + boxDepth, boxPositionY + boxDepth)-((boxPositionX + boxWidth) - boxDepth, (boxPositionY + boxHeight) - boxDepth), gray50, BF
End Sub
Sub box2 (boxPositionX As _Unsigned Integer, boxPositionY As _Unsigned Integer, boxWidth As _Unsigned Integer, boxHeight As _Unsigned Integer, boxDepth As _Unsigned Integer, interiorDepth As _Unsigned Integer)
interiorDepth = interiorDepth * boxDepth
Line (boxPositionX, boxPositionY)-(boxPositionX + boxWidth, boxPositionY + boxHeight), gray25, BF
Line (boxPositionX + boxDepth, boxPositionY + boxDepth)-(boxPositionX + boxWidth, boxPositionY + boxHeight), gray75, BF
Line (boxPositionX + boxDepth, boxPositionY + boxDepth)-((boxPositionX + boxWidth) - boxDepth, (boxPositionY + boxHeight) - boxDepth), gray50, BF
Line (boxPositionX + boxDepth + interiorDepth, boxPositionY + boxDepth + interiorDepth)-(boxPositionX + boxWidth - boxDepth - interiorDepth, boxPositionY + boxHeight - boxDepth - interiorDepth), gray75, BF
Line (boxPositionX + (boxDepth * 2) + interiorDepth, boxPositionY + (boxDepth * 2) + interiorDepth)-(boxPositionX + boxWidth - boxDepth - interiorDepth, boxPositionY + boxHeight - boxDepth - interiorDepth), gray25, BF
Line (boxPositionX + (boxDepth * 2) + interiorDepth, boxPositionY + (boxDepth * 2) + interiorDepth)-(boxPositionX + boxWidth - (boxDepth * 2) - interiorDepth, boxPositionY + boxHeight - (boxDepth * 2) - interiorDepth), gray50, BF
End Sub
Sub box3 (boxPositionX As _Unsigned Integer, boxPositionY As _Unsigned Integer, boxWidth As _Unsigned Integer, boxHeight As _Unsigned Integer, boxDepth As _Unsigned Integer, interiorDepthX As _Unsigned Integer, interiorDepthY As _Unsigned Integer)
interiorDepthX = interiorDepthX * boxDepth
interiorDepthY = interiorDepthY * boxDepth
Line (boxPositionX, boxPositionY)-(boxPositionX + boxWidth, boxPositionY + boxHeight), gray25, BF
Line (boxPositionX + boxDepth, boxPositionY + boxDepth)-(boxPositionX + boxWidth, boxPositionY + boxHeight), gray75, BF
Line (boxPositionX + boxDepth, boxPositionY + boxDepth)-((boxPositionX + boxWidth) - boxDepth, (boxPositionY + boxHeight) - boxDepth), gray50, BF
Line (boxPositionX + boxDepth + interiorDepthX, boxPositionY + boxDepth + interiorDepthY)-(boxPositionX + boxWidth - boxDepth - interiorDepthX, boxPositionY + boxHeight - boxDepth - interiorDepthY), gray75, BF
Line (boxPositionX + (boxDepth * 2) + interiorDepthX, boxPositionY + (boxDepth * 2) + interiorDepthY)-(boxPositionX + boxWidth - boxDepth - interiorDepthX, boxPositionY + boxHeight - boxDepth - interiorDepthY), gray25, BF
Line (boxPositionX + (boxDepth * 2) + interiorDepthX, boxPositionY + (boxDepth * 2) + interiorDepthY)-(boxPositionX + boxWidth - (boxDepth * 2) - interiorDepthX, boxPositionY + boxHeight - (boxDepth * 2) - interiorDepthY), gray50, BF
End Sub
|
|
|
GUI..sort...of..... |
Posted by: Abacus - 04-19-2022, 09:23 AM - Forum: Works in Progress
- Replies (2)
|
|
Found my old code that I wrote back in 1996 on QBASIC...figured I share it.
Code: (Select All) 'old code for a GUI that I was working on back in 1996
'By: Abacus
1 Cls
2
Screen 12
3 Rem This is the main box
4 Draw "C8 BM0,0 R639 D479 L639 U479"
5 Paint (2, 2), 8, 8
6 Draw "c0 bm4,46 r630 d398 l629 u398"
7 Draw "C0 BM4,45 R631 D400 L631 U400"
8 Paint (10, 60), 7, 0
9 Draw "C0 BM5,474 R59 U24"
10 Draw "C0 BM5,450 R60 D25 L60 U25"
11 Paint (8, 455), 8, 0
12 Draw "C1 BM4,4 R631 D20 L631 U20"
13 Paint (5, 5), 1, 1
14 Draw "C0 BM4,24 R631 U20"
15 Draw "C0 BM4,23 R630 U19"
16 Rem This draws the icon face
17 Draw "c7 bm9,6 r15 d14 l15 u14"
18 Paint (10, 8), 7, 7
19 Circle (16, 13), 6, 0
20 Paint (13, 17), 14, 0
21 Circle (16, 13), 5, 0
22 PSet (13, 13), 0
23 PSet (14, 13), 0
24 PSet (18, 13), 0
25 PSet (19, 13), 0
26 Draw "c0 bm14,16 r4"
27 Rem This draws the exit box
28 Draw "c7 bm613,6 r15 d14 l15 u14"
29 Paint (614, 7), 7, 7
30 Draw "c4 bm617,8 d10 r6 l6 u5 r6 l6 u5 r6"
31 Draw "c0 bm616,9 d10 r6"
32 Draw "c0 bm618,14 r4"
33 Draw "c0 bm618,9 r4"
34 Rem This is the word OPEN
35 Draw "c0 bm8,454 r10 d15 l10 u15" 'Out line of the leter O
36 Draw "c0 bm10,457 r6 d9 l6 u9" 'In line of the leter O
37 Paint (12, 456), 4, 0
38 Draw "c0 bm21,454 r9 d8 l6 d7 l3 u14 " 'Out line of the leter P
39 Draw "c0 bm24,456 r4 d4 l4 u4" 'In line of the leter P
40 Paint (23, 459), 4, 0
41 Draw "c0 bm34,454 r9 d3 l7 d3 r7 d3 l7 d3 r7 d3 l10 u15 r2"
42 'The full leter E
43 Paint (35, 456), 4, 0
44 Draw "c0 bm46,454 r5 ta30 d10 ta0 u10 r4 d16 l4 ta40 u10 ta0 d8 l4 u14 "
45 'leter N
46 Paint (47, 455), 4, 0
47 Draw "c0 bm45,471 r16 " 'underline
48 Rem End of the word OPEN
49 Rem This is the word GUI
50 Draw "c0 bm30,6 r12 d3 l3 u1 l6 d10 r10 u4 l7 u2 r10 d9 l18 u15 r2" 'Leter G
51 Paint (31, 8), 4, 0
52 Draw "c0 bm50,6 d4 r3 d11 r16 u11 r3 u4 l10 d4 r2 d7 l6 u7 r2 u4 l10"
53 'Leter U
54 Paint (51, 8), 4, 0
55 Draw "c0 bm77,6 d4 r5 d6 l5 d5 r14 u5 l5 u6 r5 u4 l13 " 'Leter I
56 Paint (79, 7), 4, 0
57 Rem The Leters GUI on the other side
58 Draw "c0 bm547,6 r12 d3 l3 u1 l6 d10 r10 u4 l7 u2 r10 d9 l18 u15 r2" 'Leter G
59 Paint (548, 8), 4, 0
60 Draw "c0 bm567,6 d4 r3 d11 r16 u11 r3 u4 l10 d4 r2 d7 l6 u7 r2 u4 l10"
61 'Leter U
62 Paint (568, 8), 4, 0
63 Draw "c0 bm594,6 d4 r5 d6 l5 d5 r14 u5 l5 u6 r5 u4 l13 " 'Leter I
64 Paint (595, 7), 4, 0
65 Rem This is the option, about, and help list.
66 'word option
67 Draw "c15 bm30,29 r7 d10 l7 u10"
68 Draw "c15 bm40,29 r7 d5 l7 u5 d10"
69 Draw "c15 bm50,29 r8 l4 d10 "
70 Draw "c15 bm60,29 r8 l4 d10 l4 r8"
71 Draw "c15 bm70,29 r7 d10 l7 u10"
72 Draw "c15 bm81,39 u10 ta30 d11 ta0 u10"
73 Draw "c15 bm29,42 r9" 'underline
74 'word about
75 'leter A
78 Draw "c15 bm290,29 ta-20 d11 ta-20 u11 ta0 r4 ta20 d11 ta20 u6 ta0 l7"
79 ' leter B
80 Draw "c15 bm301,29 r8 d4 l8 u4 d10 r8 u10 "
81 'leter O
82 Draw "c15 bm312,29 r7 d10 l7 u10"
83 'leter U
84 Draw "c15 bm322,29 d10 r7 u10"
85 'leter T
86 Draw "c15 bm332,29 r8 l4 d10"
87 Draw "c15 bm284,42 r16 " 'underline
88 'word help
89 Draw "c15 bm525,29 d10 u5 r7 u5 d10" 'leter H
90 Draw "c15 bm535,29 d10 r5 l5 u5 r5 l5 u5 r5" 'E
91 Draw "c15 bm543,29 d10 r5" 'leter L
92 Draw "c15 bm551,29 d10 u4 r7 u6 l7" 'leter P
93 Draw "c15 bm524,42 r9"
Do
check$ = InKey$
Loop While check$ = ""
Select Case check$
Case Chr$(79)
GoTo 94
Case Chr$(111)
GoTo 94
Case Chr$(101)
GoTo 200
Case Chr$(69)
GoTo 200
Case Chr$(65)
GoTo 97
Case Chr$(97)
GoTo 97
Case Chr$(104)
GoTo 104
Case Chr$(72)
GoTo 104
Case Chr$(110)
GoTo 108
Case Chr$(78)
GoTo 108
Case Else
GoTo 2
End Select
94 Rem This is the option box
95 Draw "c0 bm26,27 r70 d20 l70 u20 d300 r200 u280 l200 r201 d281 l199"
96 Paint (27, 90), 8, 0
Do
check$ = InKey$
Loop While check$ = ""
Select Case check$
Case Chr$(27)
GoTo hold
Case Else
GoTo 94
End Select
hold:
Rem This is the option box
Draw "c7 bm26,27 r70 d20 l70 u20 d300 r200 u280 l200 r201 d281 l199"
Paint (27, 90), 7, 7
Draw "c8 bm26,27 r70 d17 u17 l70 d17"
GoTo 2
97 Rem this is the about box
99 Draw "c0 bm279,27 r70 d20 l70 u20 d140 r210 u120 l210"
100 Draw "c0 bm490,47 d121 l209"
101 Paint (281, 128), 8, 0
Do
check$ = InKey$
Loop While check$ = ""
Select Case check$
Case Chr$(27)
GoTo hold2
Case Else
GoTo 97
End Select
hold2:
Draw "c7 bm279,27 r70 d20 l70 u20 d140 r210 u120 l210"
Draw "c7 bm490,47 d121 l209"
Paint (281, 128), 7, 7
Draw "c8 bm279,27 r70 d17 u17 l70 d17"
GoTo 2
103 Rem this is the help box
104 Draw "c8 bm519,27 r50 d20 l50 u20 d20 l150 d110 r200 u130"
107 Paint (519, 156), 8, 8
105 Draw "c0 bm519,158 l150 u111 d111 r201 u112 l1 u19 l50 d19"
106 Draw "bm521,159 l150 r200 u112"
Do
check$ = InKey$
Loop While check$ = ""
Select Case check$
Case Chr$(27)
GoTo hold3
Case Else
GoTo 104
End Select
hold3:
Draw "c7 bm519,27 r50 d20 l50 u20 d20 l150 d110 r200 u130"
Paint (519, 156), 7, 7
Draw "c7 bm519,158 l150 u111 d111 r201 u112 l1 u19 l50 d19"
Draw " c7 bm521,159 l150 r200 u112"
Draw "c8 bm519,27 r50 d17 u17 l50 d17"
GoTo 2
108 Rem This is the open box
109 Draw "c8 bm2,450 u100 r150 d100 l150"
110 Paint (9, 438), 8, 8
111 Draw "c0 bm2,450 u100 r150 d100 l150"
112 Draw "c0 bm1,449 u100 r152 d102 l149"
Do
check$ = InKey$
Loop While check$ = ""
Select Case check$
Case Chr$(27)
GoTo hold4
Case Else
GoTo 108
End Select
hold4:
Draw "c7 bm2,450 u100 r150 d100 l150"
Paint (9, 438), 7, 7
Draw "c7 bm2,450 u100 r150 d100 l150"
Draw "c7 bm1,449 u100 r152 d102 l149"
Draw "c8 bm1,450 u101 r2 d97 r150 d5 l89 u2 l60 d2 l2"
Paint (100, 449), 8, 8
Draw "c8 bm5,451 r60"
GoTo 2
200 End
|
|
|
Old Modem Program |
Posted by: Abacus - 04-19-2022, 08:59 AM - Forum: Programs
- Replies (7)
|
|
Posting an old program from my 2006 backup disk of archived files. I hope someone will find it interesting.
Code: (Select All) Cls
Print "Simple Qbasic communications program."
Print "What COM port does your modem use?"
Input ">", port$
baud$ = "9600" '9600 should work fine with most modems. If you have
'an older one use 2400.
'Open up that com port.
Open "COM" + port$ + ":" + baud$ + ",N,8,1,RB2048,TB2048" For Random As #1
Print "OPTIONS:"
Print "1-Dial up to another computer"
Print "2-Wait for a call"
Print "3-Quit"
Do
a = Val(InKey$)
Loop Until a >= 1 And a <= 3
If a = 3 Then Close: System
If a = 2 Then GoTo waitfor
Print "Number to call?"
Input ">", number$
Print #1, "ATDT" + number$ 'Tell the modem to dial the number.
GoTo chat
waitfor:
Print #1, "ATS0=1" 'Tell modem to connect after 1 ring.
'When a modem connects it returns "CONNECT ####"
'The next hunk of code waits until the modem connects before moving on
a$ = ""
Do
If Loc(1) Then a$ = a$ + Input$(1, 1) 'if anything in modem add it to a$
Loop Until InStr(a$, "CONNECT") 'Wait until modem have connected.
chat:
'If you where waiting for a call, a lot of ASCII characters will be printed
'on the screen. Don't worry, that's just the computers getting in sync and
'talking. You also will not see what you type.
Cls
Print "You are now ready to chat, press ESC to quit."
Do
t$ = InKey$
If Len(t$) Then Print #1, t$ 'if you typed something send it to the modem
'this will be send by the modem to the other
'computer
If Loc(1) Then r$ = Input$(1, 1) 'if the is something to get, get it and save
'it as r$
If Len(r$) Then Print r$; 'if r$ <> "" then print it. the ";" means a
'line is not started
Loop Until t$ = Chr$(27) 'keep doing this until ESC is pressed
Print #1, "ATZ" 'tell the modem to hang up
Close 'close the open com statement
|
|
|
What Happened? |
Posted by: Tim - 04-19-2022, 04:12 AM - Forum: General Discussion
- Replies (53)
|
|
So, obviously something major has happened to qb64.org. And I just started to use qb64--and very happily. My question is, what did happen? I am completely out of the loop.
|
|
|
QB64 Independence Day by Not Really Martina McBride |
Posted by: Pete - 04-19-2022, 02:48 AM - Forum: General Discussion
- Replies (2)
|
|
I could have told ya this guy R C Cola
Would turn out to be a dangerous man
But when Fell found out, in a Discord rout
It was too late to come up with a plan
Now the forum's down, Youtube is not around
And the Odin's went their separate way
So Steve started up a revolution, it's Independence Day
Let Free Speech ring, let your posts be heard
Let everyone have a ton of fun and help spread the word
Good to be a part, of this brand new start
Throw dot org away, Phoenix is here to stay, It's Independence Day
Throw dot org away
It's Independence Day
-------------------------------
So no, despite the appearance o my avatar, I'm not really a big country music fan, but who couldn't love listening to Martina McBride?
https://www.youtube.com/watch?v=4VPpAZ9_qAw
You may want to fast forward the 30sec preamble.
Pete
|
|
|
|