bits, bytes bite! help

Started by
11 comments, last by -Tony- 18 years, 5 months ago
just waning to know more about them, just like this

((unsigned int*)Screen->pixels)[ofs] = i * i + j * j + tick;

i know that im making a the pointer screen derefrence to pixels, but i really wanna know more in english whats happening here. its just for SDL
Advertisement
Quote:Original post by willthiswork89
just waning to know more about them, just like this

((unsigned int*)Screen->pixels)[ofs] = i * i + j * j + tick;

i know that im making a the pointer screen derefrence to pixels, but i really wanna know more in english whats happening here. its just for SDL


What are i, j and tick? I guess you are in a double loop. Are you creating a picture with the whole set of displayable colors (as in the color picking panel in photoshop?) or something like this?

It seems to me that this code has nothing to do with bit accessing (nor byte): you are simply accessing (presumibly) RGBA surface pixels throught a unsigned int pointer. Each pixel will have a i*i+j*j+tick color. Probably you're doing something like:
int ofs = 0;int tick = 0;for(int i = 0; i < something; i++){  for(int j = 0; j < somethingelse; j++)  {     ((unsigned int*)Screen->pixels)[ofs] = i * i + j * j + tick;     ofs++;  }}

And tick probably changes with time?
Can you post some more code?
Bitwise Operations in C

This topic is closed to new replies.

Advertisement