git repos / blockattack-game

commit c5cd33e7

Poul Sander · 2019-12-04 19:54
c5cd33e7f72ef8bf0b12f0aca355a081c49b930f patch · browse files
parent 610539a5908d412bb3fd5f829e59a3b155b6ddee

Now marks the default selected char in the gamepad text input thingy

Changed files

M source/code/DialogBox.cpp before
M source/code/DialogBox.hpp before
diff --git a/source/code/DialogBox.cpp b/source/code/DialogBox.cpp index dcae536..3f6755b 100644 --- a/source/code/DialogBox.cpp +++ b/source/code/DialogBox.cpp
@@ -154,8 +154,12 @@ void DialogBox::Draw(SDL_Renderer* target) {
width -= 2;
cursorLabel.Draw(target, x+40+width,y+76);
}
+ const sago::SagoSprite& marked = globalData.spriteHolder->GetSprite("i_level_check_box_marked");
for (size_t i = 0; i<gamePadCharFields.size(); ++i) {
int limit = 20;
+ if (selectedChar == static_cast<int>(i)) {
+ marked.Draw(target, SDL_GetTicks(), globalData.xsize/2-400+(i%limit)*40-5, globalData.ysize/2+150+(i/limit)*40-5);
+ }
sago::SagoTextField& f = gamePadCharFields.at(i);
f.Draw(target, globalData.xsize/2-400+(i%limit)*40, globalData.ysize/2+150+(i/limit)*40);
}
diff --git a/source/code/DialogBox.hpp b/source/code/DialogBox.hpp index 7845568..2561541 100644 --- a/source/code/DialogBox.hpp +++ b/source/code/DialogBox.hpp
@@ -64,6 +64,7 @@ private:
".,:!?+_^@#%&=*";
std::vector<std::string> gamePadChars;
std::vector<sago::SagoTextField> gamePadCharFields;
+ int selectedChar = 0;
};
#endif /* DIALOGBOX_HPP */