mirror of
https://github.com/HowestDAE/dae16-VerhulstBram.git
synced 2025-12-18 12:49:20 +01:00
Remove Point2f, replace with Vector2f
This commit is contained in:
@@ -5,10 +5,10 @@
|
||||
|
||||
#include "colors.h"
|
||||
#include "utils.h"
|
||||
Button::Button(const std::string& filePath, Point2f pos, Point2f size, TextureManager* manager): m_Position(pos), m_Size(size) {
|
||||
Button::Button(const std::string& filePath, Vector2f pos, Vector2f size, TextureManager* manager): m_Position(pos), m_Size(size) {
|
||||
m_Texture = manager->GetTexture(filePath);
|
||||
if(size.x == 0 && size.y == 0) {
|
||||
m_Size = Point2f{float(m_Texture->GetWidth()), float(m_Texture->GetHeight())};
|
||||
m_Size = Vector2f{float(m_Texture->GetWidth()), float(m_Texture->GetHeight())};
|
||||
}
|
||||
std::cout << "Button created" << '\n';
|
||||
}
|
||||
@@ -23,7 +23,7 @@ void Button::Draw() const {
|
||||
}
|
||||
}
|
||||
void Button::Update(float elapsedSec) {
|
||||
Point2f mousePos = utils::GetMousePos();
|
||||
Vector2f mousePos = utils::GetMousePos();
|
||||
Rectf buttonRect = Rectf(m_Position, m_Size);
|
||||
|
||||
this->m_IsHovered = utils::IsPointInRect(mousePos, buttonRect);
|
||||
|
||||
Reference in New Issue
Block a user