SparrowEngine/src/scene/gui/buttonshape.cpp
2017-02-16 19:57:51 +01:00

22 lines
736 B
C++

#include "buttonshape.h"
#include "glm/common.hpp"
#include "scene/gui/backgroundnode.h"
RectangleButtonShape::RectangleButtonShape(glm::vec2 dimension):ButtonShape(),m_dimension(dimension)
{
m_background = new BackGroundNode(dimension,glm::vec3(1.,1.,1.),1,0);
}
bool RectangleButtonShape::hover(glm::vec2 button_position, glm::vec2 mouse_position){
return (mouse_position.x >= button_position.x && mouse_position.x < button_position.x + m_dimension.x)
&& (mouse_position.y >= button_position.y && mouse_position.y < button_position.y + m_dimension.y);
}
BackGroundNode* RectangleButtonShape::getBackGround(){
return m_background;
}
glm::vec2 RectangleButtonShape::getDimension(){
return m_dimension;
}