This commit is contained in:
Loic Guegan 2023-01-01 16:09:23 +01:00
parent ea76a42c6b
commit f0e6f0b665

View file

@ -22,6 +22,9 @@ BoardCanvas::BoardCanvas(wxFrame *parent)
// Let GameTableLeftPanel process keyboard events:
Bind(wxEVT_KEY_DOWN, [p=this](wxKeyEvent &e){e.ResumePropagation(1);e.Skip();});
Bind(wxEVT_KEY_UP, [p=this](wxKeyEvent &e){e.ResumePropagation(1);e.Skip();});
Bind(wxEVT_PAINT, &BoardCanvas::OnPaint, this);
//Bind(wxEVT_IDLE, [p=this](wxIdleEvent& event){p->Refresh();p->Update();});
}
BoardCanvas::~BoardCanvas() {
@ -44,6 +47,7 @@ void BoardCanvas::OnPaint(wxPaintEvent &event) {
wxBufferedPaintDC dc(this);
dc.SetBackground(*wxWHITE_BRUSH);
dc.Clear();
wxLogDebug("lll");
if(!adata.reuseBuffer){
// Setting up required attributes
@ -73,6 +77,7 @@ void BoardCanvas::OnPaint(wxPaintEvent &event) {
dc.DrawBitmap(*t->Get(adata.piece_moved),
adata.src.x + adata.frame*(adata.transVect.x/adata.frames),
adata.src.y + adata.frame*(adata.transVect.y/adata.frames), false);
wxLogDebug("Here: %d",(int)adata.src.y + adata.frame*(adata.transVect.y/adata.frames));
// end drawing
adata.frame++;
}
@ -404,6 +409,6 @@ void BoardCanvas::SetClockTime(short hours, short min, short sec,
}
}
wxBEGIN_EVENT_TABLE(BoardCanvas, wxPanel) EVT_PAINT(BoardCanvas::OnPaint)
wxBEGIN_EVENT_TABLE(BoardCanvas, wxPanel)
EVT_MOUSE_EVENTS(BoardCanvas::MouseEvent)
wxEND_EVENT_TABLE()