aboutsummaryrefslogtreecommitdiff
path: root/src/game_tab/left_panel/board/BoardCanvas.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/game_tab/left_panel/board/BoardCanvas.cpp')
-rw-r--r--src/game_tab/left_panel/board/BoardCanvas.cpp13
1 files changed, 6 insertions, 7 deletions
diff --git a/src/game_tab/left_panel/board/BoardCanvas.cpp b/src/game_tab/left_panel/board/BoardCanvas.cpp
index 18c7288..ab1e969 100644
--- a/src/game_tab/left_panel/board/BoardCanvas.cpp
+++ b/src/game_tab/left_panel/board/BoardCanvas.cpp
@@ -15,15 +15,11 @@ BoardCanvas::BoardCanvas(wxFrame *parent)
ApplyPreferences();
// The following should be called when using an EVT_PAINT handler
SetBackgroundStyle(wxBG_STYLE_PAINT);
- timer.Bind(wxEVT_TIMER, &BoardCanvas::OnTimerTick, this);
+ timer.Bind(wxEVT_TIMER, [p=this](wxTimerEvent &e){p->Refresh();});
duration=500;
fps=30;
}
-void BoardCanvas::OnTimerTick(wxTimerEvent &event) {
- Refresh();
-}
-
BoardCanvas::~BoardCanvas() {
delete t;
delete t_captures;
@@ -64,7 +60,9 @@ void BoardCanvas::OnPaint(wxPaintEvent &event) {
else {
// Otherwise reuse buffer and animate. TEST CODE FOR NOW:
dc.DrawBitmap(*buffer, 0, 0, true);
- dc.DrawRectangle(wxRect(0+frame,0+frame,50,50));
+ // Draw piece
+ dc.DrawBitmap(*t->Get(piece_moved), 0+frame, 0+frame, false);
+ // end drawing
frame++;
if(frame*fps>=duration){
timer.Stop();
@@ -105,6 +103,7 @@ void BoardCanvas::SetupBoard(std::string board, bool is_black_turn,
}
void BoardCanvas::Animate(std::string board, bool is_black_turn, std::map<char, std::uint8_t> captures, std::string src, std::string dst){
+ return; // Shortcut this method for now
this->final_board=board;
this->final_is_black_turn=is_black_turn;
this->final_captures=captures;
@@ -113,7 +112,7 @@ void BoardCanvas::Animate(std::string board, bool is_black_turn, std::map<char,
std::uint8_t pfile = src[0]-'a';
std::uint8_t prank = src[1]-'1';
- char piece_moved = this->board[(7 - pfile) + 8 * (7-prank)]; // Piece to move
+ this->piece_moved = this->board[(7 - pfile) + 8 * (7-prank)]; // Piece to move
// Animate piece here
reuseBuffer=true;
frame=0;