aboutsummaryrefslogtreecommitdiff
path: root/src/game_tab/board/Theme.hpp
blob: 88036d8b3703c4e21dfb421eaad6e7d0fcbf74d0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#pragma once

#include "ochess.hpp"

#include <string>
#include <unordered_map>

#define ELT_DIM 200
#define DEFAULT_SIZE 80
#define PIECE_SIZE_FACTOR 0.8 // Should be between 0 and 1
#define DEFAULT_PIECE_THEME "assets/pieces/cburnett.png"
#define DEFAULT_SQUARE_THEME "assets/boards/chesscom_8bits.png"

class Theme {
private:
  std::unordered_map<char, wxImage> skin;
  std::unordered_map<char, wxBitmap *> skin_scaled;
  std::uint8_t square_radius;
  wxMask *RoundedMask(std::uint32_t width, std::uint8_t corner);

public:
  Theme();
  Theme(std::string piece, std::string square);
  ~Theme();
  void LoadPiecesSkin(wxImage skin);
  void LoadSquaresSkin(wxImage iskin);
  void ResizePieces(std::uint32_t width);
  void ResizeSquares(std::uint32_t width);
  void ResizeSquaresAndPieces(std::uint32_t width);
  void SetSquareRadius(std::uint8_t radius);
  std::uint8_t GetSquareRadius();
  void Zoom(int amount);
  double GetPiecesSizes();
  double GetSquaresSizes();

  wxBitmap *Get(char c);
};