Improve ui icons

This commit is contained in:
Loic Guegan 2023-06-03 15:44:46 +02:00
parent 9bc06b941a
commit 8b37da88aa
19 changed files with 536 additions and 2742 deletions

File diff suppressed because it is too large Load diff

View file

@ -1,4 +1,5 @@
#include "binres.hpp"
#include <unordered_map>
// Embedded binary data (e.g: PGNs icons):
#include "binary_data.hpp"
@ -10,23 +11,21 @@ wxBitmap LoadPNG(std::string icon, wxSize size) {
}
wxBitmap LoadPNG(std::string icon) {
if (icon == "swap") {
return (wxBITMAP_PNG_FROM_DATA(swap));
} else if (icon == "zoomin") {
return (wxBITMAP_PNG_FROM_DATA(zoomin));
} else if (icon == "zoomout") {
return (wxBITMAP_PNG_FROM_DATA(zoomout));
} else if (icon == "cburnett") {
return (wxBITMAP_PNG_FROM_DATA(cburnett));
} else if (icon == "chesscom_8bits") {
return (wxBITMAP_PNG_FROM_DATA(chesscom_8bits));
} else if (icon == "hide") {
return (wxBITMAP_PNG_FROM_DATA(hide));
} else if (icon == "mat") {
return (wxBITMAP_PNG_FROM_DATA(mat));
} else if (icon == "ochess") {
return (wxBITMAP_PNG_FROM_DATA(ochess));
std::unordered_map<std::string, wxBitmap> u = {
{"ui_zoom_in", wxBITMAP_PNG_FROM_DATA(ui_zoom_in)},
{"ui_zoom_out", wxBITMAP_PNG_FROM_DATA(ui_zoom_out)},
{"ui_coins_swap", wxBITMAP_PNG_FROM_DATA(ui_coins_swap)},
{"ui_eye_close", wxBITMAP_PNG_FROM_DATA(ui_eye_close)},
{"mat", wxBITMAP_PNG_FROM_DATA(mat)},
{"ochess", wxBITMAP_PNG_FROM_DATA(ochess)},
{"cburnett", wxBITMAP_PNG_FROM_DATA(cburnett)},
{"chesscom_8bits", wxBITMAP_PNG_FROM_DATA(chesscom_8bits)}
};
// Return png if exists
if(u.count(icon)){
return u[icon];
}
// Otherwise null bitmap
return (wxNullBitmap);
}

View file

@ -26,7 +26,7 @@ wxBitmap LoadPNG(std::string icon, wxSize size);
* @brief Load an icon from embedded binary resources
*
* @param icon
* @return wxBitmap
* @return wxBitmap the image or wxNullBitmap if not found
*/
wxBitmap LoadPNG(std::string icon);

View file

@ -15,9 +15,9 @@ GameTabLeftPanel::GameTabLeftPanel(wxFrame *parent, std::shared_ptr<Game> game)
main_sizer->Insert(1, board_canvas, 1, wxEXPAND);
// Configure buttons
swap_button->SetBitmapLabel(LoadPNG("swap"));
zoomin_button->SetBitmapLabel(LoadPNG("zoomin"));
zoomout_button->SetBitmapLabel(LoadPNG("zoomout"));
swap_button->SetBitmapLabel(LoadPNG("ui_coins_swap"));
zoomin_button->SetBitmapLabel(LoadPNG("ui_zoom_in"));
zoomout_button->SetBitmapLabel(LoadPNG("ui_zoom_out"));
// Configure FEN field
fen_text_field->SetFont(wxFont(*wxNORMAL_FONT).Bold().Larger());

View file

@ -2,7 +2,7 @@
EditorCanvas::EditorCanvas(wxFrame *parent, std::shared_ptr<Game> game)
: wxPanel(parent), game(game) {
hide_icon = LoadPNG("hide", wxSize(CGEditor::status.MoveIconWidth,
hide_icon = LoadPNG("ui_eye_close", wxSize(CGEditor::status.MoveIconWidth,
CGEditor::status.MoveIconWidth));
t.ResizePieces(CGEditor::status.MoveIconWidth);