I know what bitmasks are, but due to my crappy programming skills I just don't understand how to use them.
For example, i want my shape to occupy layers 5,8 and 31.
shape->layers=(?????);
What should i type instead of "?????"?
Sorry for a stupid question, which isn't even about chipmunk.
Need help with layers.
-
- Posts: 29
- Joined: Sat May 10, 2008 1:41 pm
- Contact:
Need help with layers.
Last edited by scorp on Mon May 19, 2008 9:01 am, edited 2 times in total.
-
- Posts: 56
- Joined: Tue Sep 11, 2007 2:30 pm
- Contact:
Re: Need help with layers.
The general idea is that you want bits 5, 8 and 31 to be '1' and the rest of the bits to be '0'. I find that the following line is a nice way of accomplishing that:
Alternatively, either of the following are completely equivalent:
(I've assumed that you meant the layer number to be zero-based, i.e.: the first layer is layer 0)
Code: Select all
shape->layers = 1 << 5 | 1 << 8 | 1 << 31
Code: Select all
shape->layers = 0x80000000 | 0x00000100 | 0x00000020
shape->layers = 0x80000120
-
- Posts: 29
- Joined: Sat May 10, 2008 1:41 pm
- Contact:
Re: Need help with layers.
Big-big thx for examples!!!
Who is online
Users browsing this forum: No registered users and 19 guests