mirror of
https://github.com/zhenyan121/SporeBG-Conid.git
synced 2026-04-10 06:14:08 +08:00
feat: add texture destory function
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user