Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Hardware Acceleration and Uses
#9
@Pete your code gives me headaches.  It's the old school style of programming with single variable names and things not being declared and arrrghhh!!!

Explain a few things to me:

You only make Overlay once in the program.  Right?
And at no point do you ever CLS the Overlay?

And yet, you draw on this same Overlay a bazillion times...
Code: (Select All)
                            Color fb.BHybFg, fb.BHybBg2
                            Locate y1(q) + 1, x1(q) + 1: Print button$(l);
                            _Dest overlay
                            Line (8 * (x(k) - 1) + 2, 16 * (y(k) - 1) + 7 + 2)-((j + 2) * 8 + 8 * (x(k) - 1) - 2, 16 * 2 + 16 * (y(k) - 1) + 7 - 2), _RGB32(0, 155, 155), B
                            Overlay_Hardware = _CopyImage(overlay, 33)
                            _PutImage (0, 0), Overlay_Hardware
                            _FreeImage Overlay_Hardware
                            _Dest 0

When does those drawings ever get erased?  Do they ever get erased?  If they don't get erased, then why are you redrawing them repeatedly?

Look as I might, I just don't see where that screen is ever getting cleared or erased.  

What am I overlooking here?  All this seems to be one overly complex way to do things to me.

Why not go with a much simpler approach like:

TYPE button_type
   handle as LONG
   wide as LONG
   tall as LONG
END TYPE
REDIM button(0) AS button_type

Then when you assign button$(k) = "whatever the caption might be", you instead:

temp = _newimage(8, 16 * "whatever the caption might be" , 32)
_DEST temp
CLS ,whatever_background_color_wanted
Lines 'draw the border as wanted
LOCATE 1, 1: PRINT button$(k); 'print the caption
button(index).handle = _COPYIMAGE(temp, 33) 'make a copy of the button in hardware
button(index).wide = 16 *  "whatever the caption might be"
button(index).tall = 8 'or _FONTHEIGHT
_FREEIMAGE temp

Now you have that hardware image already created of that button.  You don't have to recreate it over and over.  You don't need to PRINT the caption back on the screen or anything else.  You just _PUTIMAGE that already created button on the screen where you want it, and be done with it.

Note that this also has the added effect of making each button the size of a button and not just a drawing on the whole screen.  You're not going for an overlay of the whole screen; you're just making a button to display over the screen where needed.
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: 7 Guest(s)