mirror of
https://gitlab.com/manzerbredes/ochess.git
synced 2025-04-07 02:26:29 +02:00
Cleaning code
This commit is contained in:
parent
f04f9b7019
commit
796ba531ea
3 changed files with 20 additions and 4 deletions
|
@ -58,8 +58,8 @@ MainWindow::MainWindow()
|
||||||
|
|
||||||
|
|
||||||
// Temporary TO REMOVE JUST FOR TESTS:
|
// Temporary TO REMOVE JUST FOR TESTS:
|
||||||
BaseTab *bt = new BaseTab((wxFrame *)notebook, "/home/loic/pgn/twic1467.pgn");
|
//BaseTab *bt = new BaseTab((wxFrame *)notebook, "/home/loic/pgn/twic1467.pgn");
|
||||||
this->AddPage(bt,bt);
|
//this->AddPage(bt,bt);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::AddPage(wxWindow* window, TabInfos* infos){
|
void MainWindow::AddPage(wxWindow* window, TabInfos* infos){
|
||||||
|
|
|
@ -64,7 +64,7 @@ void BoardCanvas::OnPaint(wxPaintEvent &event) {
|
||||||
dc.Blit(0,0,canvas_size.x,canvas_size.y,(wxDC*)&memDC,0,0);
|
dc.Blit(0,0,canvas_size.x,canvas_size.y,(wxDC*)&memDC,0,0);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// Otherwise reuse buffer and animate. TEST CODE FOR NOW:
|
// Otherwise reuse buffer and animate
|
||||||
dc.DrawBitmap(*adata.buffer, 0, 0, true);
|
dc.DrawBitmap(*adata.buffer, 0, 0, true);
|
||||||
double percent=adata.frame/adata.frames;
|
double percent=adata.frame/adata.frames;
|
||||||
// Draw moving piece
|
// Draw moving piece
|
||||||
|
|
|
@ -42,14 +42,29 @@ typedef std::tuple<short, short, short> ClockTime;
|
||||||
|
|
||||||
// Drawing buffer (ANIMATIONS)
|
// Drawing buffer (ANIMATIONS)
|
||||||
typedef struct AnimState {
|
typedef struct AnimState {
|
||||||
|
/// @brief Temporary buffer to reduce latency
|
||||||
wxBitmap *buffer;
|
wxBitmap *buffer;
|
||||||
|
/// @brief Should *buffer be used?
|
||||||
bool reuseBuffer;
|
bool reuseBuffer;
|
||||||
int frame,frames,duration,fps,duration_fast;
|
/// @brief Current animated frame
|
||||||
|
int frame;
|
||||||
|
/// @brief Total number of frames for the animation
|
||||||
|
int frames;
|
||||||
|
/// @brief Animation durations (in ms)
|
||||||
|
int duration,duration_fast;
|
||||||
|
/// @brief Animation FPS
|
||||||
|
std::uint8_t fps;
|
||||||
|
/// @brief Board to draw at the end of the animation
|
||||||
std::string final_board;
|
std::string final_board;
|
||||||
|
/// @brief Which player is to move at the end of the animation
|
||||||
bool final_is_black_turn;
|
bool final_is_black_turn;
|
||||||
|
/// @brief Final state of captured pieces at the end of the animation
|
||||||
std::map<char, std::uint8_t> final_captures;
|
std::map<char, std::uint8_t> final_captures;
|
||||||
|
/// @brief Current animated piece
|
||||||
char piece_moved;
|
char piece_moved;
|
||||||
|
/// @brief Starting point of the animated piece
|
||||||
wxPoint src;
|
wxPoint src;
|
||||||
|
/// @brief Translation vector of the animated piece
|
||||||
wxPoint transVect;
|
wxPoint transVect;
|
||||||
} AnimState;
|
} AnimState;
|
||||||
|
|
||||||
|
@ -70,6 +85,7 @@ class BoardCanvas : public wxPanel {
|
||||||
ClockTime black_time, white_time;
|
ClockTime black_time, white_time;
|
||||||
bool frozen,lock_square_size;
|
bool frozen,lock_square_size;
|
||||||
|
|
||||||
|
// Current animation state
|
||||||
AnimState adata;
|
AnimState adata;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
Loading…
Add table
Reference in a new issue