1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
|
#include <SFML/Graphics.hpp>
#include "Square.h"
SQUARE::SQUARE(){
}
int SQUARE::getX(){
return x;
}
int SQUARE::getY(){
return y;
}
int SQUARE::getSide(){
return width;
}
bool SQUARE::isInside(float mouse_x, float mouse_y){
if(mouse_x >= x && mouse_x <= (x+width) && mouse_y >= y && mouse_y <+ (y+width))
return true;
}
void SQUARE::drawSquare(RenderWindow *win){
SIDE UpperH(x, y, x+width, y, win);
SIDE LeftV(x, y+width, x, y, win);
SIDE RightV(x+width, y+width, x+width, y, win);
SIDE LowerH(x, y+width, x+width, y+width, win);
}
void SQUARE::setDimension(float _x,float _y, float _width){
x = _x;
y = _y;
width = _width;
}
|