Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Hardware Acceleration and Uses
#12
Well this is going to be fun. I was looking at some button examples by oldmoses. Now his stuff is pure graphics, but he used the create and putimage method. So my next post was going to be if there was a way to create each button once, and put the button into SCREEN 0. I haven't had a chance to run the examples you posted, because I had a headache. Not from the code, from some construction work. I'm allergic to dust, oh, and dropping that sack of cement on my head didn't do me any favors, either. Anyway, I'm going to get some extra sleep and have a look at this in the morning.

For now, I did get the improvements implemented, except the changes did create a bug I need to work through in the tab subroutine. Those changes cut CPU in half.

I edited the mouse subroutine so it reports activity. Funny, I made the changes then looked at your last post. Yep, same page again. My method was to assign and pass a variable named "act" which becomes non-zero anytime an action in the mouse/key subroutine takes place. Now the button routine only cycles if activity is present, meaning it doesn't even call the button sub unless some event has occurred. This cut the CPU usage down to just about null. I'm going to keep the mouse modifications, period. That is good for all programs. It's immediate, so it doesn't even require a system idle subroutine to be added like a screen saver would use.

Oh, and since you seem to be thinking along the same lines I am on this topic... yes, that damn Pete will be giving you plus points for all the help when he gets everything sorted out.

Edit:

Oh @SMcNeill This one still baffles me...

It only happens with the load image button. It always needs two passes to display. The graphics hybrid button (not shown here) only needs one, as does the text hybrid with lines added to it. Anyway, here is the code cut out and simplified.

Code: (Select All)
Type fields_and_buttons
a As String
fld As Integer
nof As Integer
nob As Integer
style As Integer
End Type
Dim fb As fields_and_buttons

ReDim button$(10), x(10), y(10)
x(9) = 5: y(9) = 10
x(10) = 25: y(10) = 10
fb.a = "Activate"
button$(9) = _Trim$(fb.a)
button$(10) = _Trim$(fb.a)
overlay = _NewImage(_Width * _FontWidth, _Height * _FontHeight, 32)
For p = 1 To 2 ' p is not part of the original code. It's just here to demo the problem.
Overlay_Hardware = _CopyImage(overlay, 33)
_Dest overlay
_PutImage (0, 0), Overlay_Hardware
For k = 9 To 10
img& = _LoadImage(button$(k) + "-static.png", 32)
_PutImage ((x(k) - 1) * 8 + 4, (y(k) - 1) * 16), img&
_FreeImage img&
Next
_FreeImage Overlay_Hardware
_Dest 0
_Display
Beep: Sleep
Next p

Note the for/next loop using p has no impact on the code in the loop. It just runs the process twice.

So the first time it displays absolutely nothing p=1. ???

Hit a key and then the next loop finally does display the html buttons. p=2.

Pete
Reply


Messages In This Thread
Hardware Acceleration and Uses - by Pete - 02-18-2025, 04:57 PM
RE: Hardware Acceleration and Uses - by SMcNeill - 02-18-2025, 05:42 PM
RE: Hardware Acceleration and Uses - by a740g - 02-18-2025, 05:47 PM
RE: Hardware Acceleration and Uses - by Pete - 02-18-2025, 10:35 PM
RE: Hardware Acceleration and Uses - by SMcNeill - 02-18-2025, 11:23 PM
RE: Hardware Acceleration and Uses - by SMcNeill - 02-18-2025, 11:36 PM
RE: Hardware Acceleration and Uses - by Pete - 02-18-2025, 11:45 PM
RE: Hardware Acceleration and Uses - by SMcNeill - 02-19-2025, 06:06 AM
RE: Hardware Acceleration and Uses - by SMcNeill - 02-19-2025, 06:42 AM
RE: Hardware Acceleration and Uses - by SMcNeill - 02-19-2025, 06:58 AM
RE: Hardware Acceleration and Uses - by SMcNeill - 02-19-2025, 07:06 AM
RE: Hardware Acceleration and Uses - by Pete - 02-19-2025, 12:05 PM
RE: Hardware Acceleration and Uses - by SMcNeill - 02-19-2025, 02:28 PM
RE: Hardware Acceleration and Uses - by SMcNeill - 02-19-2025, 02:16 PM
RE: Hardware Acceleration and Uses - by Pete - 02-19-2025, 06:00 PM
RE: Hardware Acceleration and Uses - by SMcNeill - 02-19-2025, 07:54 PM
RE: Hardware Acceleration and Uses - by Pete - 02-19-2025, 08:52 PM
RE: Hardware Acceleration and Uses - by SMcNeill - 02-20-2025, 04:23 PM
RE: Hardware Acceleration and Uses - by Pete - Yesterday, 02:28 AM
RE: Hardware Acceleration and Uses - by SMcNeill - Yesterday, 03:13 AM



Users browsing this thread: 8 Guest(s)