Skip to content

Commit

Permalink
Fix build with Visual Studio 2013
Browse files Browse the repository at this point in the history
The linker complained about font constants being multiply defined,
so I moved the definitions to constants.cpp.
  • Loading branch information
jyrkive committed Oct 16, 2016
1 parent 313aa32 commit 988096d
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 12 deletions.
15 changes: 15 additions & 0 deletions src/font/constants.cpp
Expand Up @@ -34,4 +34,19 @@ const SDL_Color NORMAL_COLOR = {0xDD,0xDD,0xDD,0},
BIGMAP_COLOR = {0xFF,0xFF,0xFF,0};
const SDL_Color DISABLED_COLOR = inverse(PETRIFIED_COLOR);

CONSTEXPR int SIZE_NORMAL = 14;

CONSTEXPR int
SIZE_TINY = 10 * SIZE_NORMAL / 14,
SIZE_SMALL = 12 * SIZE_NORMAL / 14,

SIZE_15 = 15 * SIZE_NORMAL / 14,
SIZE_PLUS = 16 * SIZE_NORMAL / 14,
SIZE_LARGE = 18 * SIZE_NORMAL / 14,
SIZE_TITLE = 20 * SIZE_NORMAL / 14,
SIZE_XLARGE = 24 * SIZE_NORMAL / 14
;

CONSTEXPR size_t max_text_line_width = 4096;

} // end namespace font
17 changes: 5 additions & 12 deletions src/font/constants.hpp
Expand Up @@ -25,18 +25,11 @@ extern const SDL_Color NORMAL_COLOR, GRAY_COLOR, LOBBY_COLOR, GOOD_COLOR, BAD_CO
PETRIFIED_COLOR, TITLE_COLOR, DISABLED_COLOR, LABEL_COLOR;

// font sizes, to be made theme parameters
CONSTEXPR int SIZE_NORMAL = 14;
extern CONSTEXPR int SIZE_NORMAL;
// automatic computation of other font sizes, to be made a default for theme-provided values
CONSTEXPR int
SIZE_TINY = 10 * SIZE_NORMAL / 14,
SIZE_SMALL = 12 * SIZE_NORMAL / 14,

SIZE_15 = 15 * SIZE_NORMAL / 14,
SIZE_PLUS = 16 * SIZE_NORMAL / 14,
SIZE_LARGE = 18 * SIZE_NORMAL / 14,
SIZE_TITLE = 20 * SIZE_NORMAL / 14,
SIZE_XLARGE = 24 * SIZE_NORMAL / 14
;
extern CONSTEXPR int SIZE_TINY, SIZE_SMALL,
SIZE_15, SIZE_PLUS, SIZE_LARGE, SIZE_TITLE, SIZE_XLARGE;

// For arbitrary scaling:
// (Not used in defining the SIZE_* consts because of spurious compiler warnings.)
CONSTEXPR inline int relative_size(int size)
Expand All @@ -45,6 +38,6 @@ CONSTEXPR inline int relative_size(int size)
}

// GUI1 built-in maximum
CONSTEXPR size_t max_text_line_width = 4096;
extern CONSTEXPR size_t max_text_line_width;

} // end namespace font

0 comments on commit 988096d

Please sign in to comment.