I'm working on a microprocessor with an LCD screen, and i'm writing code which randomly displays some sprites.
void setup_sprite() {
Sprite sprite[8];
Sprite * sprite_pointer = &sprite;
byte sprite_bitmap [] = {
BYTE( 10100000 ),
BYTE( 01000000 ),
BYTE( 10100000 )
};
const int width = 3;
const int height = 3;
for (int i = 0; i < 8; i++) {
init_sprite(&sprite, rand()%82, rand()%43, 3, 3, sprite_bitmap);//83/43 is the LCD screen dimensions
draw_sprite(&sprite);
refresh();
}
return 0;
}
How would I go about placing boundaries on where it can be drawn? it should only be drawn within a specific area on the screen. I was thinking an if statement where if the sprite is drawn outside the boundary it redraws until it's correct.
Specifically the problem is I have about 10 pixels in from the left side of the screen left for a menu, the sprites shouldn't be drawn in that area.