wxMahjong/Drawer.h

49 lines
857 B
C++

#ifndef DRAWER_H
#define DRAWER_H
#include "wxw.h"
#include "utils.h"
#define TILE_HEIGHT 8
#define TILE_WIDTH 6
#define TILE_IMAGES_N 42
class Drawer {
public:
Drawer();
void drawTable(wxDC& dc);
wxSize tableSize;
wxSize tilePixelSize; // 600x800
wxSize resolution;
Dimensions gridSize;
wxRect tablePixelRect;
void setBG(const wxSize& tableSize);
void initScreen(const TLVec& layout);
wxPoint toGrid(const wxPoint& point);
wxPoint fromGrid(int x, int y);
wxPoint fromGrid(const wxPoint& point);
ThreePoint marked;
private:
void drawScreen(wxDC& dc);
void drawTile(wxDC& dc, int8_t index, const wxPoint& position, uint8_t zIndex);
wxImage tileImages[40];
wxBitmap bgBitmap;
wxBitmap screenBitmap;
bool isBgReady = false;
bool isScreenReady = false;
};
#endif