From befbe90a88cb997d991704c9972bc7113a3d4919 Mon Sep 17 00:00:00 2001 From: Aleksey Lobanov Date: Sat, 6 Jun 2015 13:13:10 +0300 Subject: [PATCH] Fixed double painting of letters on grid --- .gitignore | 2 ++ CrossGen.workspace | 4 ++-- wxCrossGen/main.cpp | 23 +++++++++++++++++++++-- wxCrossGen/wxCrossGen.mk | 2 +- 4 files changed, 26 insertions(+), 5 deletions(-) diff --git a/.gitignore b/.gitignore index 69d3576..caf83f1 100644 --- a/.gitignore +++ b/.gitignore @@ -47,5 +47,7 @@ Debug *.cpp.o *.cpp.o.d +*.d + #Release folder is NOT code! Release \ No newline at end of file diff --git a/CrossGen.workspace b/CrossGen.workspace index 0a4b414..1d039f5 100644 --- a/CrossGen.workspace +++ b/CrossGen.workspace @@ -2,10 +2,10 @@ - + - + diff --git a/wxCrossGen/main.cpp b/wxCrossGen/main.cpp index 8109592..448dc65 100644 --- a/wxCrossGen/main.cpp +++ b/wxCrossGen/main.cpp @@ -119,16 +119,35 @@ void MainFrame::SetGridImage(GridType &grid, size_t w) { } if (_words.size() > 0) { + using std::vector; + vector< vector< bool > > usedCells( + grid.size(), + vector(grid.at(0).size(), false) + ); cur_f = dc.GetFont(); cur_f.SetPointSize(sq_h*0.6); dc.SetFont(cur_f); for (size_t i = 0; i < winfos.size(); ++i){ if (winfos.at(i).direct == true){ for (size_t j = 0; j < winfos.at(i).len; ++j) - dc.DrawText(_words.at(i).at(j),sq_w*(winfos.at(i).x+j)+sq_w*0.24, sq_h*winfos.at(i).y); + if ( !usedCells.at(i).at(j) ){ + dc.DrawText( + _words.at(i).at(j), + sq_w*(winfos.at(i).x+j) + sq_w*0.24, + sq_h*winfos.at(i).y + ); + usedCells.at(i).at(j) = true; + } } else { for (size_t j = 0; j < winfos.at(i).len; ++j) - dc.DrawText(_words.at(i).at(j),sq_w*winfos.at(i).x+sq_w*0.24, sq_h*(winfos.at(i).y+j)); + if ( !usedCells.at(i).at(j) ){ + dc.DrawText( + _words.at(i).at(j), + sq_w*winfos.at(i).x + sq_w*0.24, + sq_h*(winfos.at(i).y+j) + ); + usedCells.at(i).at(j) = true; + } } } diff --git a/wxCrossGen/wxCrossGen.mk b/wxCrossGen/wxCrossGen.mk index 90b6ee2..3ad1fb1 100644 --- a/wxCrossGen/wxCrossGen.mk +++ b/wxCrossGen/wxCrossGen.mk @@ -13,7 +13,7 @@ CurrentFileName := CurrentFilePath := CurrentFileFullPath := User :=Aleksey Lobanov -Date :=31/05/15 +Date :=06/06/15 CodeLitePath :="/home/alex/.codelite" LinkerName :=/usr/bin/g++-4.8 SharedObjectLinkerName :=/usr/bin/g++-4.8 -shared -fPIC