mirror of
https://github.com/HowestDAE/dae16-VerhulstBram.git
synced 2025-12-18 12:49:20 +01:00
Added inheritance for the screen system
basic edge detection for tile rendering
This commit is contained in:
@@ -26,11 +26,17 @@ void Button::Update(float elapsedSec) {
|
||||
Rectf buttonRect = Rectf(m_Position, m_Size);
|
||||
|
||||
this->m_IsHovered = utils::IsPointInRect(mousePos, buttonRect);
|
||||
|
||||
m_IsPressed = m_IsHovered && utils::IsMouseButtonDown(SDL_BUTTON_LEFT);
|
||||
|
||||
if(m_IsPressed) {
|
||||
if(m_IsPressed && !m_IsPrimed) {
|
||||
m_IsPrimed = true;
|
||||
m_OnClick();
|
||||
}
|
||||
|
||||
if(!m_IsPressed) {
|
||||
m_IsPrimed = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user