This repository has been archived on 2023-11-03. You can view files and clone it, but cannot push or open issues or pull requests.
GINPA/Modele/verification.c

44 lines
782 B
C

#include "verification.h"
bool pointOnMap(const sfVector2f *const position)
{
if(position->x < 0 || position->x > WIDTH || position->y < 0 || position->y > HEIGHT)
{
return false;
}
else
{
return true;
}
}
bool mouseIsInCircle(const sfVector2f mousePosition, const Cercle cercle)
{
if(sqrt(pow(mousePosition.x - cercle.centre.x, 2.f) + pow(mousePosition.y - cercle.centre.y, 2.f)) <= cercle.rayon)
{
return true;
}
else
{
return false;
}
}
bool mouseIsInRect(const sfVector2f mousePosition, const Rectangle rectangle)
{
if(mousePosition.x >= rectangle.positionHG.x && mousePosition.x <= rectangle.positionBD.x && mousePosition.y >= rectangle.positionHG.y && mousePosition.y <= rectangle.positionBD.y)
{
return true;
}
else
{
return false;
}
}