Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Another way to think about hardware accelerated images in Screen 0
#1
Hi
@Pete
using Hardware images in Screen 0 for buttons and menus..
Q1: how many menus do you have ? Build an image for each menu and make it an hardware accelerated image!
Q2: how many buttons do you have? Build an image for each button and make it an hardware accelerated image!
And for the Hover selection effect? Well you need of another hardware accelerated image with a grade of transparency to cover the area of selection pointed by mouse!

here screenshots:

window in screen 0 and button with hardware graphic
[Image: 1-Hardware-study3.jpg]

window in screen 0 software graphic, popupmenu over button and hover popup menu in hardware graphic

[Image: 2-hardware-study3.jpg]



here the code:
Code: (Select All)

Screen 0
_DisplayOrder _Software , _Hardware ' this says only what must be shown
Dim As Long Img1, Img2, Img3
Dim As Integer X, Y, Mb, Xm, Ym

' here it creates a square to overlap menu to make the shadow of selection
Img1 = _NewImage(112, 16, 32)
_Dest Img1
Cls , _RGBA32(127, 205, 255, 125)
Img1 = _CopyImage(Img1, 33)

' here it creates the Button image
Img2 = _NewImage(100, 50, 32)
_Dest Img2
Cls , _RGBA32(127, 0, 255, 180)
Color _RGBA32(0, 10, 140, 180), _RGBA32(0, 0, 0, 100)
_PrintString (10, 17), "Click Here"
Img2 = _CopyImage(Img2, 33)

' it creates image of popup from screen 0
Img3 = _NewImage(112, 64, 32)
_Dest Img3
Color _RGBA32(211, 166, 6, 255), _RGBA32(44, 44, 255, 255)
'Locate 1, 1
_PrintString (1, 1), "New.....Ctrl+N"
'Locate , 1
_PrintString (1, 16), "Open....Ctrl+O"
'Locate , 1
_PrintString (1, 32), "Close...Ctrl+X"
'Locate , 1
_PrintString (1, 48), "Quit....Ctrl+Q"
Img3 = _CopyImage(Img3, 33)
Screen 0

' inizialization and main loop
_Dest 0
Color 11, 3
Cls , 2
X = 0
Y = 0
Xm = 0
Ym = 0
Mb = 0
Do
    Cls , 2
    Locate 1, 1: Print "Left click to show popup menu"; ' it shows help on first line of text
    _PutImage (300, 300), Img2, 0 ' button
    If _MouseInput Then
        X = _MouseX
        Y = _MouseY
        If _MouseButton(1) Then Mb = 1
        If _MouseButton(2) Then Mb = 2
    End If
    If Mb = 1 Then
        If X < 1 Or X + 13 > 80 Or Y < 1 Or Y + 3 > 24 Then
            Beep ' mouse's popup menu goes out of window's area
        Else
            Xm = X: Ym = Y ' X and Y  for popup and hovering menu
            ' popup menu
        End If
        Mb = 0
    End If
    If Xm And Ym Then
        _PutImage (1 + ((Xm - 1) * 8), 1 + ((Ym - 1) * 16)), Img3, 0
        If (X >= Xm And X <= Xm + 13) And (Y >= Ym And Y <= Ym + 3) Then
            _PutImage ((Xm - 1) * 8, (Y - 1) * 16), Img1, 0 ' hover / selection item of popup menu
        End If
    End If
    _Display
Loop Until Mb = 2
_FreeImage Img1
_FreeImage Img2
_FreeImage Img3
End
Reply


Messages In This Thread
Another way to think about hardware accelerated images in Screen 0 - by TempodiBasic - 03-30-2025, 04:44 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  about Hardware Images and _DisplayOrder,Help! qbfans 11 541 02-11-2026, 07:10 AM
Last Post: SMcNeill
  Nth problem with hardware images Ikerkaz 9 471 01-23-2026, 02:58 PM
Last Post: bplus
  Hardware images questions Dav 5 461 12-04-2025, 04:18 PM
Last Post: Pete
  Hardware images...Talk to me! Unseen Machine 5 722 09-22-2025, 11:12 PM
Last Post: TempodiBasic
  Transparency with Hardware Images NakedApe 8 1,018 07-10-2025, 09:47 AM
Last Post: Pete

Forum Jump:


Users browsing this thread: 1 Guest(s)