mirror of
https://gitlab.com/manzerbredes/ochess.git
synced 2025-04-07 02:26:29 +02:00
Debug and cleaning
This commit is contained in:
parent
e40f98ccda
commit
7077fef33e
6 changed files with 13 additions and 5 deletions
|
@ -1,5 +1,5 @@
|
||||||
cmake_minimum_required(VERSION 3.10)
|
cmake_minimum_required(VERSION 3.10)
|
||||||
project(ochess VERSION "0.0.0")
|
project(ochess VERSION 0.0.0)
|
||||||
|
|
||||||
# wxWidgets
|
# wxWidgets
|
||||||
find_package(wxWidgets COMPONENTS net gl core base adv aui propgrid REQUIRED)
|
find_package(wxWidgets COMPONENTS net gl core base adv aui propgrid REQUIRED)
|
||||||
|
@ -8,6 +8,8 @@ include(${wxWidgets_USE_FILE})
|
||||||
# Ochess
|
# Ochess
|
||||||
include_directories(src)
|
include_directories(src)
|
||||||
file(GLOB_RECURSE CPP_FILES src/*.cpp)
|
file(GLOB_RECURSE CPP_FILES src/*.cpp)
|
||||||
|
configure_file(${CMAKE_SOURCE_DIR}/src/config.h.in ${CMAKE_BINARY_DIR}/config.h)
|
||||||
|
include_directories(${CMAKE_CURRENT_BINARY_DIR}) # Enable access to config.h
|
||||||
add_executable(ochess ${CPP_FILES})
|
add_executable(ochess ${CPP_FILES})
|
||||||
target_link_libraries(ochess ${wxWidgets_LIBRARIES})
|
target_link_libraries(ochess ${wxWidgets_LIBRARIES})
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,7 @@ MainWindow::MainWindow()
|
||||||
: MainFrame(NULL, wxID_ANY, "OChess: The Open Chess software",
|
: MainFrame(NULL, wxID_ANY, "OChess: The Open Chess software",
|
||||||
wxDefaultPosition, wxSize(1500, 1000)),
|
wxDefaultPosition, wxSize(1500, 1000)),
|
||||||
prefsEditor(nullptr) {
|
prefsEditor(nullptr) {
|
||||||
SetStatusText("OChess");
|
SetStatusText("OChess v"+std::string(OCHESS_VERSION));
|
||||||
|
|
||||||
/// File menu
|
/// File menu
|
||||||
menu_file->Append(1, "Settings", "Configure OChess");
|
menu_file->Append(1, "Settings", "Configure OChess");
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
#include <wx/filedlg.h>
|
#include <wx/filedlg.h>
|
||||||
#include <wx/preferences.h>
|
#include <wx/preferences.h>
|
||||||
#include <wx/textdlg.h>
|
#include <wx/textdlg.h>
|
||||||
|
#include "config.h"
|
||||||
|
|
||||||
wxDECLARE_EVENT(REFRESH_TAB_TITLE, wxCommandEvent);
|
wxDECLARE_EVENT(REFRESH_TAB_TITLE, wxCommandEvent);
|
||||||
wxDECLARE_EVENT(NEW_GAME_EVENT, wxCommandEvent);
|
wxDECLARE_EVENT(NEW_GAME_EVENT, wxCommandEvent);
|
||||||
|
|
5
src/config.h.in
Normal file
5
src/config.h.in
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
#define OCHESS_VERSION "@PROJECT_VERSION@"
|
||||||
|
#define OCHESS_MAJOR "@PROJECT_VERSION_MAJOR@"
|
||||||
|
#define OCHESS_MINOR "@PROJECT_VERSION_MINOR@"
|
||||||
|
#define OCHESS_PATCH "@PROJECT_VERSION_PATCH@"
|
||||||
|
#define OCHESS_TWEAK "@PROJECT_VERSION_TWEAK@"
|
|
@ -133,7 +133,7 @@ void BoardCanvas::SetupBoard(const GameState &new_gs) {
|
||||||
Refresh();
|
Refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
void BoardCanvas::Animate(const GameState &new_gs, std::string src, std::string dst, bool faster){
|
void BoardCanvas::Animate(const GameState &new_gs, const std::string &src, const std::string &dst, bool faster){
|
||||||
std::uint8_t pfile = src[0]-'a';
|
std::uint8_t pfile = src[0]-'a';
|
||||||
std::uint8_t prank = src[1]-'1';
|
std::uint8_t prank = src[1]-'1';
|
||||||
adata.piece_moved = gs.board[pfile + 8 * (7-prank)]; // Piece to move
|
adata.piece_moved = gs.board[pfile + 8 * (7-prank)]; // Piece to move
|
||||||
|
|
|
@ -65,7 +65,7 @@ typedef struct GameState {
|
||||||
bool is_black_turn;
|
bool is_black_turn;
|
||||||
bool mat_black;
|
bool mat_black;
|
||||||
bool mat_white;
|
bool mat_white;
|
||||||
ClockTime black_time, white_time;
|
ClockTime black_time={-1,-1,-1}, white_time={-1,-1,-1};
|
||||||
} GameState;
|
} GameState;
|
||||||
|
|
||||||
class BoardCanvas : public wxPanel {
|
class BoardCanvas : public wxPanel {
|
||||||
|
@ -101,6 +101,6 @@ public:
|
||||||
void Swap();
|
void Swap();
|
||||||
void OnResize(wxSizeEvent &e);
|
void OnResize(wxSizeEvent &e);
|
||||||
void SetupBoard(const GameState &new_gs);
|
void SetupBoard(const GameState &new_gs);
|
||||||
void Animate(const GameState &new_gs, std::string src, std::string dst,bool faster);
|
void Animate(const GameState &new_gs, const std::string &src, const std::string &dst,bool faster);
|
||||||
void SetClockTime(short hours, short min, short sec, bool IsBlack);
|
void SetClockTime(short hours, short min, short sec, bool IsBlack);
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Reference in a new issue