#define color with 0x prefix
#1

Is it possible to create a #define using another define adding the "0x" prefix?
pawn Code:
#define INLINE_RED FF0000
#define COLOR_RED 0xINLINE_REDFF //would result in 0xFF0000FF
Reply
#2

nope sir
Reply
#3

Just to be precise: it isn't because nesting macros doesn't work, it's just because there isn't a kind of "stop" character before your new macro:
pawn Code:
#define RED FF0000
#define OTHER_RED 0x|RED

//OTHER_RED => 0x|FF0000
Reply
#4

Found a workaround:
pawn Code:
#define RED[%0,%1] %0FF0000%1
#define INLINE[%0] "{"#%0[,]"}"
#define COLOR[%0] %0[0x,FF]

//INLINE[RED] = "{FF0000}"
//COLOR[RED] = 0xFF0000FF
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)