Fixed double painting of letters on grid

This commit is contained in:
2015-06-06 13:13:10 +03:00
parent f9b9af5c8e
commit befbe90a88
4 changed files with 26 additions and 5 deletions

2
.gitignore vendored
View File

@@ -47,5 +47,7 @@ Debug
*.cpp.o *.cpp.o
*.cpp.o.d *.cpp.o.d
*.d
#Release folder is NOT code! #Release folder is NOT code!
Release Release

View File

@@ -2,10 +2,10 @@
<CodeLite_Workspace Name="CrossGen" Database=""> <CodeLite_Workspace Name="CrossGen" Database="">
<Project Name="wxCrossGen" Path="wxCrossGen/wxCrossGen.project" Active="Yes"/> <Project Name="wxCrossGen" Path="wxCrossGen/wxCrossGen.project" Active="Yes"/>
<BuildMatrix> <BuildMatrix>
<WorkspaceConfiguration Name="Debug" Selected="no"> <WorkspaceConfiguration Name="Debug" Selected="yes">
<Project Name="wxCrossGen" ConfigName="Debug"/> <Project Name="wxCrossGen" ConfigName="Debug"/>
</WorkspaceConfiguration> </WorkspaceConfiguration>
<WorkspaceConfiguration Name="Release" Selected="yes"> <WorkspaceConfiguration Name="Release" Selected="no">
<Project Name="wxCrossGen" ConfigName="Release"/> <Project Name="wxCrossGen" ConfigName="Release"/>
</WorkspaceConfiguration> </WorkspaceConfiguration>
</BuildMatrix> </BuildMatrix>

View File

@@ -119,16 +119,35 @@ void MainFrame::SetGridImage(GridType &grid, size_t w) {
} }
if (_words.size() > 0) { if (_words.size() > 0) {
using std::vector;
vector< vector< bool > > usedCells(
grid.size(),
vector<bool>(grid.at(0).size(), false)
);
cur_f = dc.GetFont(); cur_f = dc.GetFont();
cur_f.SetPointSize(sq_h*0.6); cur_f.SetPointSize(sq_h*0.6);
dc.SetFont(cur_f); dc.SetFont(cur_f);
for (size_t i = 0; i < winfos.size(); ++i){ for (size_t i = 0; i < winfos.size(); ++i){
if (winfos.at(i).direct == true){ if (winfos.at(i).direct == true){
for (size_t j = 0; j < winfos.at(i).len; ++j) 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 { } else {
for (size_t j = 0; j < winfos.at(i).len; ++j) 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;
}
} }
} }

View File

@@ -13,7 +13,7 @@ CurrentFileName :=
CurrentFilePath := CurrentFilePath :=
CurrentFileFullPath := CurrentFileFullPath :=
User :=Aleksey Lobanov User :=Aleksey Lobanov
Date :=31/05/15 Date :=06/06/15
CodeLitePath :="/home/alex/.codelite" CodeLitePath :="/home/alex/.codelite"
LinkerName :=/usr/bin/g++-4.8 LinkerName :=/usr/bin/g++-4.8
SharedObjectLinkerName :=/usr/bin/g++-4.8 -shared -fPIC SharedObjectLinkerName :=/usr/bin/g++-4.8 -shared -fPIC