Hello SDL members,
First my excuse why i write
I am new to SDL and Game programming.
OK
I want to build in a Collosion Detection in my game. Pixel exact
The bitmask contains only 1 for e.g. WALL and 0 for Water
I have a Surface wich contains only Black and White Pixels
Then i have a Function which read the Pixel information from a given point
and returns the content ( i copied it from a example of this list )
like this
for( i = 0; i<640; i++) {
for( j = 0; j <480; j++ ) {
storage[i][j] = get_pixel( levelraw, i, j );
/* the function get_pixel is at the bottom */
}
}
Yo it is the whole background as you can see
now i have the whole thing in memory so i start to convert 32 Byte from this
array to 4 Byte of my Bitfield I used the ORD schema
/* Convert the Informations into a 4 byte Bitmask */
int m, g, a, h;
for(h=0; h<640; h++ ) {
for(m=0; m<20; m++) {
for(g=0; g<15; g++) {
b = 1;
for(a=0; a<32; a++ ) {
if( storage[h][a] == 0 ) {
cstorage[m][g] |= b;
}
b *= 2;
}
}
}
}
/* Convert the Informations into a Bitmask Ende */
this is the first part that did not work
and if i print the array[640][480]
for( i = 0; i<640; i++) {
printf("\n");
for( j = 0; j <480; j++ ) {
printf("%x", storage[i][j]);
}
}
the picture looks right but it is rotatet its that my fault or how bitmaps are
saved in memory?
i think thats are all my problems until now
ps: if its relevant in the moment i develop on a windows machine
best regards, simson
-------------- next part --------------
A non-text attachment was scrubbed…
Name: test.zip
Type: application/x-zip-compressed
Size: 7536 bytes
Desc: not available
URL: http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20001010/7558ab5d/attachment.bin