aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/Openings.hpp29
-rw-r--r--src/ochess.hpp16
-rw-r--r--tools/doxygen/BoardTheming.md19
-rw-r--r--tools/doxygen/Doxyfile4
-rw-r--r--tools/doxygen/Libraries.md24
-rw-r--r--tools/doxygen/Opening.md2
6 files changed, 85 insertions, 9 deletions
diff --git a/src/Openings.hpp b/src/Openings.hpp
index adf05c1..f3dfb6d 100644
--- a/src/Openings.hpp
+++ b/src/Openings.hpp
@@ -8,14 +8,41 @@
* See: https://github.com/lichess-org/chess-openings
*/
class Openings {
- typedef std::vector<std::string> MoveList;
+ /// @brief Loaded tsv data format as a vector of tuples (<eco>,<name>,<pgn-moves-list>)
typedef std::vector<std::tuple<std::string,std::string,std::string>> Volume;
Volume A,B,C,D,E;
+ /**
+ * @brief Search opening name an ECO code based on the given \a moves
+ *
+ * @param moves Half moves that you want to search for the opening
+ * @param name Fill by the method if opening is found
+ * @param eco Fill by the method if opening is found
+ */
void SearchOpening(const pgnp::HalfMove *moves,std::string &name, std::string &eco);
+ /**
+ * @brief Load a volume using tsv data (see openings.hpp)
+ *
+ * @param tsv data to load
+ * @param vol volume in which the data will be loaded
+ */
void LoadVolume(const std::string &tsv, Volume *vol);
public:
+ /**
+ * @brief Guess the opening based on a list of SAN moves (PGN)
+ *
+ * @param SANMoves
+ * @param name
+ * @param eco
+ */
void GuessOpening(const std::string &SANMoves, std::string &name, std::string &eco);
+ /**
+ * @brief Guess the opening based on a half moves (wrapper around ::SearchOpening)
+ *
+ * @param moves
+ * @param name
+ * @param eco
+ */
void GuessOpening(const pgnp::HalfMove *moves, std::string &name, std::string &eco);
Openings();
}; \ No newline at end of file
diff --git a/src/ochess.hpp b/src/ochess.hpp
index 8366926..a8f96a0 100644
--- a/src/ochess.hpp
+++ b/src/ochess.hpp
@@ -41,17 +41,19 @@
class Game;
class GameBase;
/**
- * @brief Attach informations to the application tabs
+ * @brief Used by each tab of the GUI to attach informations additional informations and features
*
*/
class TabInfos {
+ /// @brief Keep track of the number of opened tabs
static long tab_count;
public:
+ /// @brief Which type of tab is it?
typedef enum Type { GAME, BASE, ENGINE, NONE } Type;
Type type;
/// @brief Each tab has an associated unique id
long id;
- /// @brief Specify to which tab id this tab is linked (e.g: database to linked to game tab)
+ /// @brief Specify to which tab id this tab is linked (e.g: database to linked to on of its opened game tab)
long linked_id;
/// @brief Set to true if this tab is attach to another one (c.f linked_id)
bool is_linked;
@@ -60,8 +62,9 @@ public:
TabInfos(Type type_) : type(type_), id(tab_count), is_linked(false), is_dirty(false) { tab_count++; }
void Link(TabInfos *tab);
virtual void Refresh(){};
- /// @brief Call when tab is linked to another one
+ /// @brief Callback that is called when the current tab is linked to another one
virtual void OnLink(){};
+ /// @brief Can be called to load preferences that have been modify in the application settings
virtual void ApplyPreferences() {};
virtual std::shared_ptr<Game> GetGame() = 0;
virtual std::shared_ptr<GameBase> GetBase() = 0;
@@ -78,14 +81,19 @@ public:
Openings Book;
/// @brief Entry point of the application
virtual bool OnInit();
+ /// @brief Get a list of all the tabs opened in OChess
std::vector<TabInfos *> ListTabInfos();
+ /// @brief Trigger a wxWidget focus event on a specific tab
void FocusOnTab(TabInfos *);
+ /// @brief Open a new game tab linked to @a tabsrc that uses game @a g
void NewGame(TabInfos *tabsrc,std::shared_ptr<Game> g);
+ /// @brief Open a new game that uses game @a g
void NewGame(std::shared_ptr<Game> g);
+ /// @brief Singleton to get the opening book (see Openings)
Openings& GetBook();
};
wxDECLARE_APP(MyApp);
-///@brief Abort ochess with a message
+///@brief Abort OChess with a message
void Abort(std::string msg);
diff --git a/tools/doxygen/BoardTheming.md b/tools/doxygen/BoardTheming.md
index 0bdb857..a7de422 100644
--- a/tools/doxygen/BoardTheming.md
+++ b/tools/doxygen/BoardTheming.md
@@ -1,4 +1,21 @@
Board Theming
======
-TBA \ No newline at end of file
+In OChess, every board skins (squares and pieces) are made of *200x200* pixels tiles stored in <i>.png</i> images. OChess is in charge of breaking these tiles apart into individual elements.
+
+### Squares
+Squares skins are <i>.png</i> images, with a dimension of *400x200* pixels (2 tiles next to each other). The tile starting at pixel (0,0) are for dark squares and the other one for light squares.
+
+### Pieces
+
+Pieces skins are <i>.png</i> images, with a dimension of *400x1200* pixels (2 columns of 6 tiles). The first column, starting at pixel (0,0) are for black pieces and the other column for the white pieces. From top, to bottom pieces are in the following order: King, Queen, Rook, Bishop, Knight, Pawn.
+
+### Create a Skin with generate.sh
+
+To create a pieces skin named *myskin*, create the folder `tools/skin/pieces/myskin`. In this folder, place all the pieces in the <i>.svg</i> format with the following name convention: `bb.svg` for <b>b</b>lack <b>b</b>ishop, `wk.svg` for <b>w</b>hite <b>k</b>ing, `wn.svg` for <b>w</b>hite <b>k</b>night, `bn.svg` for <b>b</b>lack <b>k</b>night,...
+
+Then, run the `tools/skin/generate.sh` script. This script will combine the <i>.svg</i> file into a single <i>.png</i> file located in `tools/assets/pieces/myskin.png`.
+
+Use the same approach to create boards skins.
+
+**Note:** The `tools/skin/generate.sh` script is meant to be used on Linux Distributions and requires [Bash](https://www.gnu.org/software/bash/), [ImageMagick](https://imagemagick.org/) and [Inkscape](https://inkscape.org/). \ No newline at end of file
diff --git a/tools/doxygen/Doxyfile b/tools/doxygen/Doxyfile
index e54771f..6ade874 100644
--- a/tools/doxygen/Doxyfile
+++ b/tools/doxygen/Doxyfile
@@ -505,7 +505,7 @@ EXTRACT_ALL = NO
# be included in the documentation.
# The default value is: NO.
-EXTRACT_PRIVATE = NO
+EXTRACT_PRIVATE = YES
# If the EXTRACT_PRIV_VIRTUAL tag is set to YES, documented private virtual
# methods of a class will be included in the documentation.
@@ -917,7 +917,7 @@ WARN_LOGFILE =
# spaces. See also FILE_PATTERNS and EXTENSION_MAPPING
# Note: If this tag is empty the current directory is searched.
-INPUT = ../../src MainPage.md Opening.md BoardTheming.md
+INPUT = ../../src MainPage.md Opening.md BoardTheming.md Libraries.md
# This tag can be used to specify the character encoding of the source files
# that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses
diff --git a/tools/doxygen/Libraries.md b/tools/doxygen/Libraries.md
new file mode 100644
index 0000000..77a6bd0
--- /dev/null
+++ b/tools/doxygen/Libraries.md
@@ -0,0 +1,24 @@
+Internal Libraries
+====
+
+Ochess uses 5 internal libraries (excluding [wxWidgets](https://www.wxwidgets.org/)):
+- [cgeditor](https://gitlab.com/manzerbredes/cgeditor): A 2D chess game moves presenter/editor
+- [pgnp](https://gitlab.com/manzerbredes/pgnp): An efficient PGN parser
+- [chessarbiter](https://gitlab.com/manzerbredes/chessarbiter): A chess classical chess game arbiter for C++
+- [uciadapter](https://gitlab.com/manzerbredes/uciadapter): A cross platform utility to interact with UCI chess engines
+- [chess-move-interface](https://gitlab.com/manzerbredes/chess-move-interface): A chess half move interface for libraries interoperability
+
+### CGEditor
+It is only used in EditorCanvas.
+
+### PGNP
+It is only used in PGNGameBase.
+
+### ChessArbiter
+Mostly used in Game and HalfMove.
+
+### UCIAdapter
+Used in various engine related areas such as MainWindow, EngineTab and LiveEngineDialog.
+
+### Chess-Move-Interface
+Used in various region of OChess such as PGNGameBase and HalfMove. \ No newline at end of file
diff --git a/tools/doxygen/Opening.md b/tools/doxygen/Opening.md
index e2bd91e..7078135 100644
--- a/tools/doxygen/Opening.md
+++ b/tools/doxygen/Opening.md
@@ -1,7 +1,7 @@
%Opening Names DB
=====
-The chess opening names database uses the [Lichess chess-openings](https://github.com/lichess-org/chess-openings) project. The script `tools/openings.sh` is used to fetch the last updates from the project, and generate the `binres/openings.hpp` file.
+The chess opening names database uses the [Lichess chess-openings](https://github.com/lichess-org/chess-openings) project. The script `tools/openings.sh` is used to fetch the last updates from the project, and generate the `binres/openings.hpp` file. In turn, this file is used in Openings.hpp.
#### Acknowledgements