Development > Newbie Coding
computing surface- and contentflags
DarkRain:
To check a flag you use the 'bitwise and' say: surfaceflags & someflag == someflag (like the example I gave with windows' calculator — which does precisely a bitwise and)
You can get the flag for a given level by *left* shifting like this: 1 << n where n is the level number (starts from zero)
Additionally you can add flags together with 'bitwise or' so for example to get the flags for the two bottom levels in a single value: levelflags = (1 << 0) | (1 << 1)
Mattn:
oh sorry, yes, left shifting of course.
Navigation
[0] Message Index
[*] Previous page
Go to full version