Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Using CONST & _RGB used together seem to error...
#8
Allow me to clarify this for everyone with a few simple questions and answers. 

RED = _RGB(255, 0, 0)

Now, somebody tell me what number that RED is.   Anyone.  Please!

With the information provided above, you absolutely can't tell me what that value is.

In SCREEN 0, it would be color 4.
In SCREEN 13, it would be color 40.
In SCREEN _NEWIMAGE(x, y, 256), it would be 40.
In SCREEN _NEWIMAGE(x, y, 32), it would be &HFFFF0000~&.

By itself, it's... undefined.  Impossible to calculate.  It's NAN, if it's anything.
You have to know the SCREEN mode to be able to determine what that color number is.

_RGB is a transformative function which returns a value based upon the screen mode it's associated with.

So when we do this:

CONST RED = _RGB(255, 0, 0)

What screen is that associated with?   Is your red on a SCREEN 0 text screen?  OR are you looking for red on a 256 color screen?  How about on SCREEN 7?   How the BLEEP is CONST supposed to know that???   

---------

So.... How would one fix this?

Wouldn't you simply SPECIFY THE SCREEN MODE??

CONST RED = _RGB(255, 0, 0, 0) 'This is color 4, because it's on SCREEN 0 as defined in that last parameter.
CONST RED = _RGB(255, 0, 0, 256) 'This is color 40, because it's on a 256 color screen.

You need an extra parameter with _RGB and CONST to specify the screen mode from which you want to get your color value.  

@bplus was close when he said he thought it was an image handle, but it's not an image handle.  It's the SCREEN MODE.



And _RGB32 doesn't have this same need to specify a screen mode as it *ONLY* returns values for a 32-bit color screen.



So this is *not* a bug.  It's a design feature so you can specify which screen mode you want to use _RGB with and associate those values with for the proper color match on that screen mode.
Reply


Messages In This Thread
RE: Using CONST & _RGB used together seem to error... - by SMcNeill - 12-11-2025, 10:28 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Mac debugger not connecting, a user error! BlameTroi 0 99 02-07-2026, 06:18 PM
Last Post: BlameTroi
  ERROR MESSAGES COLORS ? aurel 5 385 01-02-2026, 11:26 AM
Last Post: aurel
  error doing image collision detection with _MemGet madscijr 55 4,660 10-01-2025, 03:25 PM
Last Post: bplus
  Using CONST Dimster 15 1,305 08-12-2025, 07:27 PM
Last Post: Kernelpanic
  error on function returning _mem Herve 5 683 07-05-2025, 08:06 PM
Last Post: hsiangch_ong

Forum Jump:


Users browsing this thread: 1 Guest(s)