mirror of
https://github.com/zhenyan121/SporeBG-Conid.git
synced 2026-04-10 06:14:08 +08:00
refactor: replace pair with vec2
This commit is contained in:
@@ -11,6 +11,7 @@
|
||||
#include "graphics/texture/TextureManager.h"
|
||||
#include "core/CoreData.h"
|
||||
#include <functional>
|
||||
#include <glm/glm.hpp>
|
||||
/**
|
||||
* @class Scene
|
||||
* @brief 场景基类
|
||||
|
||||
@@ -163,8 +163,9 @@ void SceneManager::changeScene(const std::string& sceneName) {
|
||||
|
||||
|
||||
|
||||
void SceneManager::handleClickCurrent(std::pair<int, int> clickOn) {
|
||||
auto [logicalX, logicalY] = clickOn;
|
||||
void SceneManager::handleClickCurrent(glm::ivec2 clickOn) {
|
||||
int logicalX = clickOn.x;
|
||||
int logicalY = clickOn.y;
|
||||
if (m_scene) m_scene->handleClick(logicalX, logicalY);
|
||||
}
|
||||
|
||||
|
||||
@@ -92,7 +92,7 @@ public:
|
||||
* @param clickOn 点击位置坐标对 {x, y}
|
||||
* @details 将点击事件转发给当前场景的 handleClick() 方法进行处理
|
||||
*/
|
||||
void handleClickCurrent(std::pair<int, int> clickOn);
|
||||
void handleClickCurrent(glm::ivec2 clickOn);
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -152,7 +152,8 @@ void GameScene::restartGame() {
|
||||
}
|
||||
|
||||
void GameScene::updatePieceInfo() {
|
||||
auto [mouseX, mouseY] = m_coreData->inputState.mouseCurrentLogicalPosition;
|
||||
int mouseX = m_coreData->inputState.mouseCurrentLogicalPosition.x;
|
||||
int mouseY = m_coreData->inputState.mouseCurrentLogicalPosition.y;
|
||||
auto click = m_CoordinateConverter->ScreenToBoard(mouseX, mouseY, m_boardRenderer->getBoardArea());
|
||||
|
||||
if (click == std::nullopt) {
|
||||
|
||||
Reference in New Issue
Block a user