diff options
| author | daoge_cmd <3523206925@qq.com> | 2026-03-01 12:16:08 +0800 |
|---|---|---|
| committer | daoge_cmd <3523206925@qq.com> | 2026-03-01 12:16:08 +0800 |
| commit | b691c43c44ff180d10e7d4a9afc83b98551ff586 (patch) | |
| tree | 3e9849222cbc6ba49f2f1fc6e5fe7179632c7390 /Minecraft.Client/ConfirmScreen.cpp | |
| parent | def8cb415354ac390b7e89052a50605285f1aca9 (diff) | |
Initial commit
Diffstat (limited to 'Minecraft.Client/ConfirmScreen.cpp')
| -rw-r--r-- | Minecraft.Client/ConfirmScreen.cpp | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/Minecraft.Client/ConfirmScreen.cpp b/Minecraft.Client/ConfirmScreen.cpp new file mode 100644 index 00000000..b67ea19d --- /dev/null +++ b/Minecraft.Client/ConfirmScreen.cpp @@ -0,0 +1,55 @@ +#include "stdafx.h" +#include "ConfirmScreen.h" +#include "SmallButton.h" +#include "..\Minecraft.World\net.minecraft.locale.h" + +ConfirmScreen::ConfirmScreen(Screen *parent, const wstring& title1, const wstring& title2, int id) +{ + this->parent = parent; + this->title1 = title1; + this->title2 = title2; + this->id = id; + + Language *language = Language::getInstance(); + yesButton = language->getElement(L"gui.yes"); + noButton = language->getElement(L"gui.no"); +} + +ConfirmScreen::ConfirmScreen(Screen *parent, const wstring& title1, const wstring& title2, const wstring& yesButton, const wstring& noButton, int id) +{ + this->parent = parent; + this->title1 = title1; + this->title2 = title2; + this->yesButton = yesButton; + this->noButton = noButton; + this->id = id; +} + +void ConfirmScreen::init() +{ + buttons.push_back(new SmallButton(0, width / 2 - 155 + 0 % 2 * 160, height / 6 + 24 * 4, yesButton)); + buttons.push_back(new SmallButton(1, width / 2 - 155 + 1 % 2 * 160, height / 6 + 24 * 4, noButton)); +} + +void ConfirmScreen::buttonClicked(Button *button) +{ + parent->confirmResult(button->id == 0, id); +} + +void ConfirmScreen::render(int xm, int ym, float a) +{ + renderBackground(); + + drawCenteredString(font, title1, width / 2, 70, 0xffffff); + drawCenteredString(font, title2, width / 2, 90, 0xffffff); + + Screen::render(xm, ym, a); + + // 4J - debug code - remove + static int count = 0; + if( count++ == 100 ) + { + count = 0; + buttonClicked(buttons[0]); + } +}
\ No newline at end of file |
