Commit da8e4cd0 authored by mercury233's avatar mercury233 Committed by GitHub

add settings scrollbar (#18)

parent 60dcb295
...@@ -1884,6 +1884,18 @@ bool ClientField::OnCommonEvent(const irr::SEvent& event) { ...@@ -1884,6 +1884,18 @@ bool ClientField::OnCommonEvent(const irr::SEvent& event) {
return true; return true;
break; break;
} }
case SCROLL_TAB_HELPER: {
rect<s32> pos = mainGame->tabHelper->getRelativePosition();
mainGame->tabHelper->setRelativePosition(recti(0, mainGame->scrTabHelper->getPos() * -1, pos.LowerRightCorner.X, pos.LowerRightCorner.Y));
return true;
break;
}
case SCROLL_TAB_SYSTEM: {
rect<s32> pos = mainGame->tabSystem->getRelativePosition();
mainGame->tabSystem->setRelativePosition(recti(0, mainGame->scrTabSystem->getPos() * -1, pos.LowerRightCorner.X, pos.LowerRightCorner.Y));
return true;
break;
}
} }
break; break;
} }
......
...@@ -249,14 +249,24 @@ bool Game::Initialize() { ...@@ -249,14 +249,24 @@ bool Game::Initialize() {
scrCardText->setSmallStep(1); scrCardText->setSmallStep(1);
scrCardText->setVisible(false); scrCardText->setVisible(false);
//log //log
irr::gui::IGUITab* tabLog = wInfos->addTab(dataManager.GetSysString(1271)); irr::gui::IGUITab* tabLog = wInfos->addTab(dataManager.GetSysString(1271));
lstLog = env->addListBox(rect<s32>(10, 10, 290, 290), tabLog, LISTBOX_LOG, false); lstLog = env->addListBox(rect<s32>(10, 10, 290, 290), tabLog, LISTBOX_LOG, false);
lstLog->setItemHeight(18); lstLog->setItemHeight(18);
btnClearLog = env->addButton(rect<s32>(160, 300, 260, 325), tabLog, BUTTON_CLEAR_LOG, dataManager.GetSysString(1272)); btnClearLog = env->addButton(rect<s32>(160, 300, 260, 325), tabLog, BUTTON_CLEAR_LOG, dataManager.GetSysString(1272));
//helper //helper
irr::gui::IGUITab* tabHelper = wInfos->addTab(dataManager.GetSysString(1298)); irr::gui::IGUITab* _tabHelper = wInfos->addTab(dataManager.GetSysString(1298));
int posX = 20; _tabHelper->setRelativePosition(recti(16, 49, 299, 362));
int posY = 20; tabHelper = env->addWindow(recti(0, 0, 250, 300), false, L"", _tabHelper);
tabHelper->setDrawTitlebar(false);
tabHelper->getCloseButton()->setVisible(false);
tabHelper->setDrawBackground(false);
tabHelper->setDraggable(false);
scrTabHelper = env->addScrollBar(false, rect<s32>(252, 0, 272, 300), _tabHelper, SCROLL_TAB_HELPER);
scrTabHelper->setLargeStep(1);
scrTabHelper->setSmallStep(1);
scrTabHelper->setVisible(false);
int posX = 0;
int posY = 0;
chkMAutoPos = env->addCheckBox(false, rect<s32>(posX, posY, posX + 260, posY + 25), tabHelper, -1, dataManager.GetSysString(1274)); chkMAutoPos = env->addCheckBox(false, rect<s32>(posX, posY, posX + 260, posY + 25), tabHelper, -1, dataManager.GetSysString(1274));
chkMAutoPos->setChecked(gameConf.chkMAutoPos != 0); chkMAutoPos->setChecked(gameConf.chkMAutoPos != 0);
posY += 30; posY += 30;
...@@ -274,9 +284,20 @@ bool Game::Initialize() { ...@@ -274,9 +284,20 @@ bool Game::Initialize() {
posY += 30; posY += 30;
chkQuickAnimation = env->addCheckBox(false, rect<s32>(posX, posY, posX + 260, posY + 25), tabHelper, CHECKBOX_QUICK_ANIMATION, dataManager.GetSysString(1299)); chkQuickAnimation = env->addCheckBox(false, rect<s32>(posX, posY, posX + 260, posY + 25), tabHelper, CHECKBOX_QUICK_ANIMATION, dataManager.GetSysString(1299));
chkQuickAnimation->setChecked(gameConf.quick_animation != 0); chkQuickAnimation->setChecked(gameConf.quick_animation != 0);
elmTabHelperLast = chkQuickAnimation;
//system //system
irr::gui::IGUITab* tabSystem = wInfos->addTab(dataManager.GetSysString(1273)); irr::gui::IGUITab* _tabSystem = wInfos->addTab(dataManager.GetSysString(1273));
posY = 20; _tabSystem->setRelativePosition(recti(16, 49, 299, 362));
tabSystem = env->addWindow(recti(0, 0, 250, 300), false, L"", _tabSystem);
tabSystem->setDrawTitlebar(false);
tabSystem->getCloseButton()->setVisible(false);
tabSystem->setDrawBackground(false);
tabSystem->setDraggable(false);
scrTabSystem = env->addScrollBar(false, rect<s32>(252, 0, 272, 300), _tabSystem, SCROLL_TAB_SYSTEM);
scrTabSystem->setLargeStep(1);
scrTabSystem->setSmallStep(1);
scrTabSystem->setVisible(false);
posY = 0;
chkIgnore1 = env->addCheckBox(false, rect<s32>(posX, posY, posX + 260, posY + 25), tabSystem, CHECKBOX_DISABLE_CHAT, dataManager.GetSysString(1290)); chkIgnore1 = env->addCheckBox(false, rect<s32>(posX, posY, posX + 260, posY + 25), tabSystem, CHECKBOX_DISABLE_CHAT, dataManager.GetSysString(1290));
chkIgnore1->setChecked(gameConf.chkIgnore1 != 0); chkIgnore1->setChecked(gameConf.chkIgnore1 != 0);
posY += 30; posY += 30;
...@@ -296,14 +317,14 @@ bool Game::Initialize() { ...@@ -296,14 +317,14 @@ bool Game::Initialize() {
chkAutoSearch->setChecked(gameConf.auto_search_limit >= 0); chkAutoSearch->setChecked(gameConf.auto_search_limit >= 0);
posY += 30; posY += 30;
env->addStaticText(dataManager.GetSysString(1282), rect<s32>(posX + 23, posY + 3, posX + 120, posY + 28), false, false, tabSystem); env->addStaticText(dataManager.GetSysString(1282), rect<s32>(posX + 23, posY + 3, posX + 120, posY + 28), false, false, tabSystem);
btnWinResizeS = env->addButton(rect<s32>(posX + 125, posY, posX + 155, posY + 25), tabSystem, BUTTON_WINDOW_RESIZE_S, dataManager.GetSysString(1283)); btnWinResizeS = env->addButton(rect<s32>(posX + 115, posY, posX + 145, posY + 25), tabSystem, BUTTON_WINDOW_RESIZE_S, dataManager.GetSysString(1283));
btnWinResizeM = env->addButton(rect<s32>(posX + 160, posY, posX + 190, posY + 25), tabSystem, BUTTON_WINDOW_RESIZE_M, dataManager.GetSysString(1284)); btnWinResizeM = env->addButton(rect<s32>(posX + 150, posY, posX + 180, posY + 25), tabSystem, BUTTON_WINDOW_RESIZE_M, dataManager.GetSysString(1284));
btnWinResizeL = env->addButton(rect<s32>(posX + 195, posY, posX + 225, posY + 25), tabSystem, BUTTON_WINDOW_RESIZE_L, dataManager.GetSysString(1285)); btnWinResizeL = env->addButton(rect<s32>(posX + 185, posY, posX + 215, posY + 25), tabSystem, BUTTON_WINDOW_RESIZE_L, dataManager.GetSysString(1285));
btnWinResizeXL = env->addButton(rect<s32>(posX + 230, posY, posX + 260, posY + 25), tabSystem, BUTTON_WINDOW_RESIZE_XL, dataManager.GetSysString(1286)); btnWinResizeXL = env->addButton(rect<s32>(posX + 220, posY, posX + 250, posY + 25), tabSystem, BUTTON_WINDOW_RESIZE_XL, dataManager.GetSysString(1286));
posY += 30; posY += 30;
chkEnableSound = env->addCheckBox(gameConf.enable_sound, rect<s32>(posX, posY, posX + 120, posY + 25), tabSystem, -1, dataManager.GetSysString(1279)); chkEnableSound = env->addCheckBox(gameConf.enable_sound, rect<s32>(posX, posY, posX + 120, posY + 25), tabSystem, -1, dataManager.GetSysString(1279));
chkEnableSound->setChecked(gameConf.enable_sound); chkEnableSound->setChecked(gameConf.enable_sound);
scrSoundVolume = env->addScrollBar(true, rect<s32>(posX + 126, posY + 4, posX + 260, posY + 21), tabSystem, SCROLL_VOLUME); scrSoundVolume = env->addScrollBar(true, rect<s32>(posX + 116, posY + 4, posX + 250, posY + 21), tabSystem, SCROLL_VOLUME);
scrSoundVolume->setMax(100); scrSoundVolume->setMax(100);
scrSoundVolume->setMin(0); scrSoundVolume->setMin(0);
scrSoundVolume->setPos(gameConf.sound_volume * 100); scrSoundVolume->setPos(gameConf.sound_volume * 100);
...@@ -312,7 +333,7 @@ bool Game::Initialize() { ...@@ -312,7 +333,7 @@ bool Game::Initialize() {
posY += 30; posY += 30;
chkEnableMusic = env->addCheckBox(gameConf.enable_music, rect<s32>(posX, posY, posX + 120, posY + 25), tabSystem, CHECKBOX_ENABLE_MUSIC, dataManager.GetSysString(1280)); chkEnableMusic = env->addCheckBox(gameConf.enable_music, rect<s32>(posX, posY, posX + 120, posY + 25), tabSystem, CHECKBOX_ENABLE_MUSIC, dataManager.GetSysString(1280));
chkEnableMusic->setChecked(gameConf.enable_music); chkEnableMusic->setChecked(gameConf.enable_music);
scrMusicVolume = env->addScrollBar(true, rect<s32>(posX + 126, posY + 4, posX + 260, posY + 21), tabSystem, SCROLL_VOLUME); scrMusicVolume = env->addScrollBar(true, rect<s32>(posX + 116, posY + 4, posX + 250, posY + 21), tabSystem, SCROLL_VOLUME);
scrMusicVolume->setMax(100); scrMusicVolume->setMax(100);
scrMusicVolume->setMin(0); scrMusicVolume->setMin(0);
scrMusicVolume->setPos(gameConf.music_volume * 100); scrMusicVolume->setPos(gameConf.music_volume * 100);
...@@ -321,6 +342,7 @@ bool Game::Initialize() { ...@@ -321,6 +342,7 @@ bool Game::Initialize() {
posY += 30; posY += 30;
chkMusicMode = env->addCheckBox(false, rect<s32>(posX, posY, posX + 260, posY + 25), tabSystem, -1, dataManager.GetSysString(1281)); chkMusicMode = env->addCheckBox(false, rect<s32>(posX, posY, posX + 260, posY + 25), tabSystem, -1, dataManager.GetSysString(1281));
chkMusicMode->setChecked(gameConf.music_mode != 0); chkMusicMode->setChecked(gameConf.music_mode != 0);
elmTabSystemLast = chkMusicMode;
// //
wHand = env->addWindow(rect<s32>(500, 450, 825, 605), false, L""); wHand = env->addWindow(rect<s32>(500, 450, 825, 605), false, L"");
wHand->getCloseButton()->setVisible(false); wHand->getCloseButton()->setVisible(false);
...@@ -1629,8 +1651,31 @@ void Game::OnResize() { ...@@ -1629,8 +1651,31 @@ void Game::OnResize() {
stHintMsg->setRelativePosition(ResizeWin(500, 60, 820, 90)); stHintMsg->setRelativePosition(ResizeWin(500, 60, 820, 90));
//sound / music volume bar //sound / music volume bar
scrSoundVolume->setRelativePosition(recti(20 + 126, 230 + 4, 20 + (300 * xScale) - 40, 230 + 21)); scrSoundVolume->setRelativePosition(recti(scrSoundVolume->getRelativePosition().UpperLeftCorner.X, scrSoundVolume->getRelativePosition().UpperLeftCorner.Y, 20 + (300 * xScale) - 70, scrSoundVolume->getRelativePosition().LowerRightCorner.Y));
scrMusicVolume->setRelativePosition(recti(20 + 126, 260 + 4, 20 + (300 * xScale) - 40, 260 + 21)); scrMusicVolume->setRelativePosition(recti(scrMusicVolume->getRelativePosition().UpperLeftCorner.X, scrMusicVolume->getRelativePosition().UpperLeftCorner.Y, 20 + (300 * xScale) - 70, scrMusicVolume->getRelativePosition().LowerRightCorner.Y));
recti tabHelperPos = recti(0, 0, 300 * xScale - 50, 365 * yScale - 65);
tabHelper->setRelativePosition(tabHelperPos);
scrTabHelper->setRelativePosition(recti(tabHelperPos.LowerRightCorner.X + 2, 0, tabHelperPos.LowerRightCorner.X + 22, tabHelperPos.LowerRightCorner.Y));
s32 tabHelperLastY = elmTabHelperLast->getRelativePosition().LowerRightCorner.Y;
if(tabHelperLastY > tabHelperPos.LowerRightCorner.Y) {
scrTabHelper->setMax(tabHelperLastY - tabHelperPos.LowerRightCorner.Y + 5);
scrTabHelper->setPos(0);
scrTabHelper->setVisible(true);
}
else
scrTabHelper->setVisible(false);
recti tabSystemPos = recti(0, 0, 300 * xScale - 50, 365 * yScale - 65);
tabSystem->setRelativePosition(tabSystemPos);
scrTabSystem->setRelativePosition(recti(tabSystemPos.LowerRightCorner.X + 2, 0, tabSystemPos.LowerRightCorner.X + 22, tabSystemPos.LowerRightCorner.Y));
s32 tabSystemLastY = elmTabSystemLast->getRelativePosition().LowerRightCorner.Y;
if(tabSystemLastY > tabSystemPos.LowerRightCorner.Y) {
scrTabSystem->setMax(tabSystemLastY - tabSystemPos.LowerRightCorner.Y + 5);
scrTabSystem->setPos(0);
scrTabSystem->setVisible(true);
} else
scrTabSystem->setVisible(false);
if(gameConf.resize_popup_menu) { if(gameConf.resize_popup_menu) {
int width = 100 * mainGame->xScale; int width = 100 * mainGame->xScale;
......
...@@ -262,12 +262,18 @@ public: ...@@ -262,12 +262,18 @@ public:
irr::gui::IGUIListBox* lstLog; irr::gui::IGUIListBox* lstLog;
irr::gui::IGUIButton* btnClearLog; irr::gui::IGUIButton* btnClearLog;
irr::gui::IGUIButton* btnSaveLog; irr::gui::IGUIButton* btnSaveLog;
irr::gui::IGUIWindow* tabHelper;
irr::gui::IGUIElement* elmTabHelperLast;
irr::gui::IGUIScrollBar* scrTabHelper;
irr::gui::IGUICheckBox* chkMAutoPos; irr::gui::IGUICheckBox* chkMAutoPos;
irr::gui::IGUICheckBox* chkSTAutoPos; irr::gui::IGUICheckBox* chkSTAutoPos;
irr::gui::IGUICheckBox* chkRandomPos; irr::gui::IGUICheckBox* chkRandomPos;
irr::gui::IGUICheckBox* chkAutoChain; irr::gui::IGUICheckBox* chkAutoChain;
irr::gui::IGUICheckBox* chkWaitChain; irr::gui::IGUICheckBox* chkWaitChain;
irr::gui::IGUICheckBox* chkQuickAnimation; irr::gui::IGUICheckBox* chkQuickAnimation;
irr::gui::IGUIWindow* tabSystem;
irr::gui::IGUIElement* elmTabSystemLast;
irr::gui::IGUIScrollBar* scrTabSystem;
irr::gui::IGUICheckBox* chkHideSetname; irr::gui::IGUICheckBox* chkHideSetname;
irr::gui::IGUICheckBox* chkHideHintButton; irr::gui::IGUICheckBox* chkHideHintButton;
irr::gui::IGUICheckBox* chkIgnoreDeckChanges; irr::gui::IGUICheckBox* chkIgnoreDeckChanges;
...@@ -659,9 +665,11 @@ extern Game* mainGame; ...@@ -659,9 +665,11 @@ extern Game* mainGame;
#define BUTTON_BOT_START 340 #define BUTTON_BOT_START 340
#define LISTBOX_BOT_LIST 341 #define LISTBOX_BOT_LIST 341
#define CHECKBOX_BOT_OLD_RULE 342 #define CHECKBOX_BOT_OLD_RULE 342
#define LISTBOX_SINGLEPLAY_LIST 350 #define LISTBOX_SINGLEPLAY_LIST 343
#define BUTTON_LOAD_SINGLEPLAY 351 #define BUTTON_LOAD_SINGLEPLAY 344
#define BUTTON_CANCEL_SINGLEPLAY 352 #define BUTTON_CANCEL_SINGLEPLAY 345
#define SCROLL_TAB_HELPER 350
#define SCROLL_TAB_SYSTEM 351
#define CHECKBOX_AUTO_SEARCH 360 #define CHECKBOX_AUTO_SEARCH 360
#define CHECKBOX_ENABLE_SOUND 361 #define CHECKBOX_ENABLE_SOUND 361
#define CHECKBOX_ENABLE_MUSIC 362 #define CHECKBOX_ENABLE_MUSIC 362
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment