Welcome, Guest |
You have to register before you can post on our site.
|
Forum Statistics |
» Members: 473
» Latest member: jofers
» Forum threads: 2,755
» Forum posts: 26,114
Full Statistics
|
Latest Threads |
Flying
Forum: SierraKen
Last Post: SierraKen
7 hours ago
» Replies: 0
» Views: 18
|
Pinball
Forum: Works in Progress
Last Post: NakedApe
Yesterday, 11:34 PM
» Replies: 3
» Views: 48
|
Anyone with free time wan...
Forum: Help Me!
Last Post: bplus
Yesterday, 04:06 PM
» Replies: 19
» Views: 400
|
Need some help getting ch...
Forum: Help Me!
Last Post: Cobalt
Yesterday, 01:19 AM
» Replies: 6
» Views: 95
|
It might be useful for so...
Forum: Programs
Last Post: madscijr
11-21-2024, 10:29 PM
» Replies: 6
» Views: 320
|
New QBJS Samples Site
Forum: QBJS, BAM, and Other BASICs
Last Post: DANILIN
11-21-2024, 09:36 PM
» Replies: 23
» Views: 623
|
Ascii Christmas Tree
Forum: Christmas Code
Last Post: Pete
11-21-2024, 09:03 PM
» Replies: 1
» Views: 36
|
request for printing patt...
Forum: Learning Resources and Archives
Last Post: bplus
11-21-2024, 03:45 PM
» Replies: 13
» Views: 153
|
Literature about QuickBas...
Forum: General Discussion
Last Post: quickbasic
11-21-2024, 12:34 PM
» Replies: 17
» Views: 1,009
|
QB64-PE v3.14.1 is now re...
Forum: Announcements
Last Post: bplus
11-21-2024, 01:48 AM
» Replies: 13
» Views: 1,080
|
|
|
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
|
|
|
qbs_str my mod |
Posted by: Jack - 04-19-2022, 01:18 AM - Forum: General Discussion
- Replies (9)
|
|
as seen here https://qb64phoenix.com/forum/showthread...114#pid114 I worked on changing the qbs_str function for double and float
I went ahead and incorporated the changes in libqb.cpp and built QB64, here's a sample
Code: (Select All) $Console:Only
_Dest _Console
Print Factorial_Recursive(1000)
Function Factorial_Recursive## (n As Integer)
If n = 0 Then Factorial_Recursive## = 1: Exit Function
Factorial_Recursive## = n * Factorial_Recursive##(n - 1)
End Function
output
Quote:4.02387260077093773F+2567
Press any key to continue
even though I did some testing for bugs some may have slipped trough
looks like I found a bug, not ready for prime-time
it has a strange effect on print using
Code: (Select All) $Console:Only
_Dest _Console
Dim As _Float f
f = Factorial_Recursive(50)
Print Using "##.##################"; f
Print f
Function Factorial_Recursive## (n As Integer)
If n = 0 Then Factorial_Recursive## = 1: Exit Function
Factorial_Recursive## = n * Factorial_Recursive##(n - 1)
End Function
Quote:%30414093201713378039796484017234741538658648106343392576177963008.000000000000000000
3.0414093201713378F+64
Press any key to continue
|
|
|
|