2014-12-11 21:14:23 +01:00
|
|
|
#ifndef BOARD_H
|
|
|
|
#define BOARD_H
|
|
|
|
|
|
|
|
#include "defines.h"
|
|
|
|
#include "cell.h"
|
|
|
|
|
|
|
|
// Draw a new board
|
|
|
|
void board_init(rect* r);
|
|
|
|
|
2014-12-14 18:05:58 +01:00
|
|
|
// Free board resources
|
|
|
|
void board_delete();
|
|
|
|
|
2014-12-11 21:14:23 +01:00
|
|
|
// Redraw board and all content (animation will started if needed)
|
|
|
|
void board_redraw();
|
|
|
|
|
|
|
|
// Add one tile with 2 or 4 value in a random cell place
|
|
|
|
// Return true if tile added, false - if no more place for tile
|
|
|
|
__u8 board_add_random_tile();
|
|
|
|
|
2014-12-19 23:28:11 +01:00
|
|
|
// Add one tile with needed value to needed position
|
|
|
|
// No return value. Used for loading from file.
|
|
|
|
void board_add_tile(__u32 value, __u16 index);
|
|
|
|
|
2014-12-11 21:14:23 +01:00
|
|
|
// Check for available moves
|
|
|
|
// Return true if board has moves, false - if not
|
|
|
|
__u8 board_has_moves();
|
|
|
|
|
|
|
|
// Get score
|
|
|
|
__u32 board_score();
|
2014-12-15 23:59:51 +01:00
|
|
|
__u32 board_highscore();
|
2014-12-11 21:14:23 +01:00
|
|
|
|
|
|
|
// Try to move all tiles up
|
|
|
|
// Will return true if something moved or false - if not
|
|
|
|
__u8 board_up();
|
|
|
|
|
|
|
|
// Try to move all tiles down
|
|
|
|
// Will return true if something moved or false - if not
|
|
|
|
__u8 board_down();
|
|
|
|
|
|
|
|
// Try to move all tiles left
|
|
|
|
// Will return true if something moved or false - if not
|
|
|
|
__u8 board_left();
|
|
|
|
|
|
|
|
// Try to move all tiles right
|
|
|
|
// Will return true if something moved or false - if not
|
|
|
|
__u8 board_right();
|
|
|
|
|
|
|
|
#endif // BOARD_H
|