feat: add texture destory function

This commit is contained in:
2026-01-15 20:49:11 +08:00
parent 4ae99a44a3
commit 562599b8b4
8 changed files with 65 additions and 3 deletions

View File

@@ -282,4 +282,24 @@ void BoardRenderer::renderBlackOverlay() {
// 恢复原来的混合模式
SDL_SetRenderDrawBlendMode(m_renderer, SDL_BLENDMODE_NONE);
}
void BoardRenderer::handleGamePieceEvent(GamePieceEvent event, int row, int col) {
auto area = getBoardArea();
float x = area.x + col * area.cellSize;
float y = area.y + row * area.cellSize;
float pieceRadius = m_cellSize * m_pieceRadiusRatio / 2.0f;
switch (event) {
case (GamePieceEvent::REMOVE_PIECE):
//SDL_Log("BoardRenderer: try to destory texture\n");
m_textureManager->destoryTexture(
x + (area.cellSize - pieceRadius * 2) / 2.0f,
y + (area.cellSize - pieceRadius * 2) / 2.0f);
break;
case (GamePieceEvent::PLACE_PIECE):
break;
default:
break;
}
}