diff options
Diffstat (limited to 'src/game_tab/left_panel/board/Theme.cpp')
| -rw-r--r-- | src/game_tab/left_panel/board/Theme.cpp | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/src/game_tab/left_panel/board/Theme.cpp b/src/game_tab/left_panel/board/Theme.cpp index 6ecbafc..f72dfab 100644 --- a/src/game_tab/left_panel/board/Theme.cpp +++ b/src/game_tab/left_panel/board/Theme.cpp @@ -11,6 +11,8 @@ Theme::Theme() : square_radius(10) { config->Read("board/theme/squares/path", "default").ToStdString(); wxFileName square_file(square); CONFIG_CLOSE(config); + // Mat + skin['#']=LoadPNG("mat").ConvertToImage(); // Piece if (piece == "default" || !piece_file.FileExists()) { wxLogDebug("Loading piece skin from binres"); @@ -95,12 +97,18 @@ wxBitmap *Theme::Get(char c) { return (skin_scaled[c]); } void Theme::ResizePieces(std::uint32_t width) { for (std::pair<char, wxImage> c : skin) { - if (c.first != 's' && c.first != 'S') { + if (c.first != 's' && c.first != 'S' && c.first != '#') { if (skin_scaled.count(c.first)) delete skin_scaled[c.first]; skin_scaled[c.first] = new wxBitmap(c.second.Scale(width, width, wxIMAGE_QUALITY_HIGH)); } + else if(c.first == '#'){ + if (skin_scaled.count(c.first)) + delete skin_scaled[c.first]; + skin_scaled[c.first] = + new wxBitmap(c.second.Scale(width*MAT_SIZE_FACTOR, width*MAT_SIZE_FACTOR, wxIMAGE_QUALITY_HIGH)); + } } } @@ -130,10 +138,15 @@ void Theme::ResizeSquares(std::uint32_t width) { skin_scaled['3']->SetMask(RoundedMask(width, 3)); } -void Theme::Zoom(int amount) { +bool Theme::Zoom(int amount) { double width = skin_scaled['s']->GetWidth() + amount; + if(width<=20) + return false; + if(width>=180) + return false; ResizeSquares(std::max(width, 1.0)); ResizePieces(std::max(width * PIECE_SIZE_FACTOR, 1.0)); + return true; } void Theme::SetSquareRadius(std::uint8_t radius) { |
