commit daa660ab
Replaced the name change dialog with a translateable one. Text not added yet.
Changed files
| M | Game/data/sprites/blockattack.sprite before |
| A | Game/data/textures/gui_back.png |
| M | source/code/DialogBox.cpp before |
| M | source/code/global.hpp before |
diff --git a/Game/data/sprites/blockattack.sprite b/Game/data/sprites/blockattack.sprite
index 0e43732..0372c14 100644
--- a/Game/data/sprites/blockattack.sprite
+++ b/Game/data/sprites/blockattack.sprite
@@ -176,6 +176,78 @@
"width" : 52,
"originx" : 1,
"originy" : 1
+},
+
+"ui_rect_white_nw" : {
+ "texture" : "gui_back",
+ "topx" : 0,
+ "topy" : 0,
+ "height" : 32,
+ "width" : 32
+},
+
+"ui_rect_white_n" : {
+ "texture" : "gui_back",
+ "topx" : 32,
+ "topy" : 0,
+ "height" : 32,
+ "width" : 32
+},
+
+"ui_rect_white_ne" : {
+ "texture" : "gui_back",
+ "topx" : 160,
+ "topy" : 0,
+ "height" : 32,
+ "width" : 32
+},
+
+"ui_rect_white_e" : {
+ "texture" : "gui_back",
+ "topx" : 160,
+ "topy" : 32,
+ "height" : 32,
+ "width" : 32
+},
+
+"ui_rect_white_se" : {
+ "texture" : "gui_back",
+ "topx" : 160,
+ "topy" : 160,
+ "height" : 32,
+ "width" : 32
+},
+
+"ui_rect_white_s" : {
+ "texture" : "gui_back",
+ "topx" : 32,
+ "topy" : 160,
+ "height" : 32,
+ "width" : 32
+},
+
+"ui_rect_white_sw" : {
+ "texture" : "gui_back",
+ "topx" : 0,
+ "topy" : 160,
+ "height" : 32,
+ "width" : 32
+},
+
+"ui_rect_white_w" : {
+ "texture" : "gui_back",
+ "topx" : 0,
+ "topy" : 32,
+ "height" : 32,
+ "width" : 32
+},
+
+"ui_rect_white_fill" : {
+ "texture" : "gui_back",
+ "topx" : 32,
+ "topy" : 32,
+ "height" : 32,
+ "width" : 32
}
}
diff --git a/Game/data/textures/gui_back.png b/Game/data/textures/gui_back.png
new file mode 100644
index 0000000..93a1c21
Binary files /dev/null and b/Game/data/textures/gui_back.png differ
diff --git a/source/code/DialogBox.cpp b/source/code/DialogBox.cpp
index 294a336..b69e9c2 100644
--- a/source/code/DialogBox.cpp
+++ b/source/code/DialogBox.cpp
@@ -30,6 +30,38 @@ static void NFont_Write(SDL_Renderer* target, int x, int y, const std::string& t
nf_standard_blue_font.draw(target, x, y, "%s", text.c_str());
}
+static void DrawRect(SDL_Renderer* target, int topx, int topy, int height, int width) {
+
+ std::string name = "ui_rect_white_";
+ const int size = 32;
+ SDL_Rect bounds_ns = {topx, topy+size, width, height-2*size}; //bounds for south
+ SDL_Rect bounds_e = {topx, topy, width-size, height};
+ const sago::SagoSprite& n = spriteHolder->GetSprite(name+"n");
+ const sago::SagoSprite& s = spriteHolder->GetSprite(name+"s");
+ const sago::SagoSprite& e = spriteHolder->GetSprite(name+"e");
+ const sago::SagoSprite& w = spriteHolder->GetSprite(name+"w");
+ const sago::SagoSprite& fill = spriteHolder->GetSprite(name+"fill");
+ for (int i = 1; i < width/size; ++i) {
+ n.DrawBounded(target, SDL_GetTicks(), topx+i*size, topy, bounds_e);
+ for (int j = 1; j < height/size; ++j) {
+ w.DrawBounded(target, SDL_GetTicks(), topx, topy+j*size, bounds_ns);
+ fill.Draw(target, SDL_GetTicks(),topx+i*size, topy+j*size);
+ e.DrawBounded(target, SDL_GetTicks(), topx+width-size, topy+j*size, bounds_ns);
+ }
+ s.DrawBounded(target, SDL_GetTicks(), topx+i*size, topy+height-size, bounds_e);
+ }
+ //Corners
+ const sago::SagoSprite& nw = spriteHolder->GetSprite(name+"nw");
+ const sago::SagoSprite& ne = spriteHolder->GetSprite(name+"ne");
+ const sago::SagoSprite& se = spriteHolder->GetSprite(name+"se");
+ const sago::SagoSprite& sw = spriteHolder->GetSprite(name+"sw");
+ nw.Draw(target, SDL_GetTicks(), topx, topy);
+ ne.Draw(target, SDL_GetTicks(), topx+width-size, topy);
+ se.Draw(target, SDL_GetTicks(), topx+width-size, topy+height-size);
+ sw.Draw(target, SDL_GetTicks(), topx, topy+height-size);
+
+}
+
bool OpenDialogbox(int x, int y, std::string& name) {
DialogBox d(x, y, name);
RunGameState(d);
@@ -57,7 +89,9 @@ bool DialogBox::IsActive() {
void DialogBox::Draw(SDL_Renderer* target) {
backgroundImage.Draw(screen, SDL_GetTicks(), 0, 0);
- dialogBox.Draw(screen, SDL_GetTicks(), x, y);
+ //dialogBox.Draw(screen, SDL_GetTicks(), x, y);
+ DrawRect(screen, 200, 100, 200, 600);
+ DrawRect(screen, 226, 164, 54, 600-2*26);
NFont_Write(screen, x+40,y+76,rk->GetString());
std::string strHolder = rk->GetString();
strHolder.erase((int)rk->CharsBeforeCursor());
diff --git a/source/code/global.hpp b/source/code/global.hpp
index 546b6c9..ce11b19 100644
--- a/source/code/global.hpp
+++ b/source/code/global.hpp
@@ -58,6 +58,7 @@ extern bool NoSound;
extern int verboseLevel;
extern Highscore theTopScoresEndless; //Stores highscores for endless
extern Highscore theTopScoresTimeTrial; //Stores highscores for timetrial
+extern std::unique_ptr<sago::SagoSpriteHolder> spriteHolder;
#endif /* _GLOBAL_HPP */