Skip to content

Commit

Permalink
rename constant to avoid macro conflict on linux
Browse files Browse the repository at this point in the history
  • Loading branch information
jdratlif committed Sep 15, 2019
1 parent 0726ff6 commit e6980a4
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
12 changes: 6 additions & 6 deletions source/view/PasswordPanel.cc
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ PasswordPanel::PasswordPanel() : alphabet(alphabet_xpm), password(0) {}
wxPoint PasswordPanel::getLetterPos(wxChar letter) const {
int index = Password::ALPHABET.Find(letter);

return wxPoint(((index % CHARS_PER_ROW) * CHAR_WIDTH * 2),
((index / CHARS_PER_ROW) * CHAR_HEIGHT * 2));
return wxPoint(((index % CHARS_PER_ROW) * PCHAR_WIDTH * 2),
((index / CHARS_PER_ROW) * PCHAR_HEIGHT * 2));
}

void PasswordPanel::onPaint(wxPaintEvent &) {
Expand All @@ -69,19 +69,19 @@ void PasswordPanel::onPaint(wxPaintEvent &) {
for (int col = 0; col < 12; ++col) {
// separated in the middle with a space
if (col == 6) {
pos.x += CHAR_WIDTH;
pos.x += PCHAR_WIDTH;
}

// (row * 12) + col = [0, 23]
wxPoint letter = getLetterPos(encoded[(row * 12) + col]);
dc.Blit(pos.x, pos.y, CHAR_WIDTH, CHAR_HEIGHT,
dc.Blit(pos.x, pos.y, PCHAR_WIDTH, PCHAR_HEIGHT,
&xpm, letter.x, letter.y);

pos.x += CHAR_WIDTH;
pos.x += PCHAR_WIDTH;
}

pos.x = START_X;
pos.y = START_Y + (2 * CHAR_HEIGHT);
pos.y = START_Y + (2 * PCHAR_HEIGHT);
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions source/view/PasswordPanel.hh
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ namespace mpg {
static const int START_X = 4;
static const int START_Y = 4;
static const int CHARS_PER_ROW = 13;
static const int CHAR_WIDTH = 16;
static const int CHAR_HEIGHT = 16;
static const int PCHAR_WIDTH = 16;
static const int PCHAR_HEIGHT = 16;

/**
* Gets the upper-left corner position of a letter in the alphabet
Expand Down

0 comments on commit e6980a4

Please sign in to comment.