Added inheritance for the screen system

basic edge detection for tile rendering
This commit is contained in:
Bram Verhulst
2024-04-04 13:49:38 +02:00
parent eb4c7b4d76
commit 71d364d9d8
23 changed files with 203 additions and 481 deletions

View File

@@ -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;
}
}