Upgraded look and feel of tiles

This commit is contained in:
Dmitriy Shishkov 2022-04-28 16:49:08 +03:00
parent a02f88af49
commit 0ea8336afd
No known key found for this signature in database
GPG Key ID: 14358F96FCDD8060
4 changed files with 19 additions and 7 deletions

View File

@ -49,8 +49,8 @@ void Drawer::initScreen(const wxSize& tableSize, const TLVec& layout) {
k--; k--;
if (k > -1) if (k > -1)
if (layout[i][j][k].first == layer) { if (layout[i][j][k].first == layer || layer == 0) {
drawTile(dc, layout[i][j][k].second, {tablePixelRect.x + tilePixelSize.x*i, tablePixelRect.y + tilePixelSize.y*j}); drawTile(dc, layout[i][j][k].second, {tablePixelRect.x + tilePixelSize.x*i, tablePixelRect.y + tilePixelSize.y*j}, layer);
cards_set++; cards_set++;
} }
} }
@ -60,11 +60,18 @@ void Drawer::initScreen(const wxSize& tableSize, const TLVec& layout) {
} }
} }
void Drawer::drawTile (wxDC& dc, int8_t index, const wxPoint& position) { void Drawer::drawTile(wxDC& dc, int8_t index, const wxPoint& position, uint8_t zIndex) {
dc.DrawRoundedRectangle(position, tilePixelSize * 2, 10); wxBrush _bgColor = dc.GetBrush();
dc.SetBrush(wxColor(200, 200, 200));
dc.DrawRoundedRectangle(position.x + (tilePixelSize.GetWidth()/10 + 3) - (tilePixelSize.GetWidth()/10 + 3)*zIndex, position.y + (tilePixelSize.GetHeight()/10 + 3) - (tilePixelSize.GetHeight()/10 + 3)*zIndex, tilePixelSize.GetWidth() * 2, tilePixelSize.GetHeight() * 2, 10);
dc.SetBrush(_bgColor);
dc.DrawRoundedRectangle(position.x - (tilePixelSize.GetWidth()/10 + 3)*zIndex, position.y - (tilePixelSize.GetHeight()/10 + 3)*zIndex, tilePixelSize.GetWidth() * 2, tilePixelSize.GetHeight() * 2, 10);
if (tileImages[index].GetWidth() != tilePixelSize.x * 2) if (tileImages[index].GetWidth() != tilePixelSize.x * 2)
dc.DrawBitmap(tileImages[index].Scale(tilePixelSize.x * 2 - 20, tilePixelSize.y * 2 - 20), {position.x + 10, position.y + 10}); dc.DrawBitmap(tileImages[index].Scale(tilePixelSize.x * 2 - 20, tilePixelSize.y * 2 - 20), {position.x + 10 - (tilePixelSize.GetWidth()/10 + 3)*zIndex, position.y + 10 - (tilePixelSize.GetHeight()/10 + 3)*zIndex});
else else
dc.DrawBitmap(tileImages[index], position); dc.DrawBitmap(tileImages[index], {position.x + 10 - (tilePixelSize.GetWidth()/10 + 3)*zIndex, position.y + 10 - (tilePixelSize.GetHeight()/10 + 3)*zIndex});
} }

View File

@ -26,7 +26,7 @@ public:
private: private:
void drawScreen(wxDC& dc); void drawScreen(wxDC& dc);
void drawTile(wxDC& dc, int8_t index, const wxPoint& position); void drawTile(wxDC& dc, int8_t index, const wxPoint& position, uint8_t zIndex);
wxImage tileImages[40]; wxImage tileImages[40];

View File

@ -24,6 +24,9 @@ void GamePanel::Start(const wxString& path) {
timer->Start(1000, wxTIMER_CONTINUOUS); timer->Start(1000, wxTIMER_CONTINUOUS);
sb->SetStatusText(LTimeToStr(controller.stopwatch)); sb->SetStatusText(LTimeToStr(controller.stopwatch));
drawer.initScreen(drawer.tableSize, *controller.getTable());
} }
void GamePanel::OnPaint(wxPaintEvent& _) { void GamePanel::OnPaint(wxPaintEvent& _) {

View File

@ -64,6 +64,8 @@ void MainFrame::bindMenu() {
openLayout(); openLayout();
else else
panel->Start(layoutPath); panel->Start(layoutPath);
Refresh();
}, IDM_New_Game); }, IDM_New_Game);
} }