Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int mouseX,mouseY;
- void Unit::handle_input()
- {
- if(occur.type == SDL_MOUSEBUTTONDOWN)
- {
- mouseX = occur.button.x;
- mouseY = occur.button.y;
- }
- }
- Pass mouseX and mouseY as reference to the handle_input function.
- void Unit::show()
- {
- int BoxX;
- int BoxY;
- Box.x = BoxX;
- Box.y = BoxY;
- SDL_Rect unitOffset;
- unitOffset.x = BoxX;
- unitOffset.y = BoxY;
- SDL_BlitSurface(Unit,NULL,screen,unitOffset);
- }
- What's happening here? You create two ints and assign them to the previous ones? You know they are zero-initialized? So basically `BoxX, BoxY, Box.x, Box.y, unitOffset.x, unitOffset.y` are all zeros.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement