The boolian function that detects a collision between two SDL_RECT's and returns a bool.
bool collision(SDL_Rect a, SDL_Rect b)
{
if((a.y + a.h) <= b.y)
return false;
if((a.x + a.w) <= b.x)
return false;
if(a.x >= (b.x + b.w))
return false;
if(a.y >= (b.y + b.h))
return false;
return true;
}
Subscribe to:
Post Comments (Atom)
How to create Custom push button in QT5
To be honest this is not my work its an exact copy from this link. http://mcmtechtips.blogspot.com/2012/03/shape-qpushbutton-in-your-own-st...
-
Drawing a graph on an x, y plane... you can disregard the load image function, remember i am using the sdl_draw.h library, which is freely a...
-
Progress Bar #include "sdl/sdl.h" #include "sdl/sdl_image.h" #include "SDL/SDL_ttf.h" #include "sdl/...
-
To be honest this is not my work its an exact copy from this link. http://mcmtechtips.blogspot.com/2012/03/shape-qpushbutton-in-your-own-st...
No comments:
Post a Comment