git repos / blockattack-game

commit 4ab66e14

Poul Sander · 2023-04-10 22:01
4ab66e1416f718d4a6d025c4d49760159d67b61d patch · browse files
parent f1b98f591db40e5215da64c577bc4cfe366ca644

Make the confirm and cancel button change form when hovered over

Changed files

M source/code/DialogBox.cpp before
diff --git a/source/code/DialogBox.cpp b/source/code/DialogBox.cpp index 83127d3..7936b13 100644 --- a/source/code/DialogBox.cpp +++ b/source/code/DialogBox.cpp
@@ -184,9 +184,19 @@ void DialogBox::Draw(SDL_Renderer* target) {
this->y = globalData.ysize/2-100;
DrawRectYellow(target, x, y, 200, 600);
headerLabel.Draw(target, x+300, y+20, sago::SagoTextField::Alignment::center);
- DrawRectYellow(target, x+25, y+128, 50, 250);
+ if (insideRect(x+25, y+128, 50, 250)) {
+ DrawRectYellow(target, x+24, y+127, 52, 252);
+ }
+ else {
+ DrawRectYellow(target, x+25, y+128, 50, 250);
+ }
enterLabel.Draw(target, x+150, y+140, sago::SagoTextField::Alignment::center);
- DrawRectYellow(target, x+325, y+128, 50, 250);
+ if (insideRect(x+325, y+128, 50, 250)) {
+ DrawRectYellow(target, x+324, y+127, 52, 252);
+ }
+ else {
+ DrawRectYellow(target, x+325, y+128, 50, 250);
+ }
cancelLabel.Draw(target, x+450, y+140, sago::SagoTextField::Alignment::center);
DrawRectWhite(target, x+26, y+64, 54, 600-2*26);
textField.SetText(rk->GetString());