移除多余的getGameObjects

This commit is contained in:
Ziyu
2026-01-10 16:22:37 +08:00
parent a549918af2
commit ff02a0d031
2 changed files with 3 additions and 2 deletions
+3 -1
View File
@@ -1,6 +1,7 @@
#include "time.h"
#include <spdlog/spdlog.h>
#include <SDL3/SDL_timer.h> // 用于 SDL_GetTicksNS()
#include <algorithm>
namespace engine::core {
@@ -32,7 +33,8 @@ void Time::limitFrameRate(float current_delta_time) {
SDL_DelayNS(ns_to_wait);
delta_time_ = static_cast<double>(SDL_GetTicksNS() - last_time_) / 1000000000.0;
} else { // 否则,直接使用当前帧耗费的时间
delta_time_ = static_cast<double>(current_delta_time);
// 限制最大 delta time 为 0.1秒 (即最低 10 FPS),防止刚启动或卡顿时的物理穿模
delta_time_ = std::min(static_cast<double>(current_delta_time), 0.1);
}
}
-1
View File
@@ -88,7 +88,6 @@ public:
engine::core::Context& getContext() const { return context_; } ///< @brief 获取上下文引用
engine::scene::SceneManager& getSceneManager() const { return scene_manager_; } ///< @brief 获取场景管理器引用
std::vector<std::unique_ptr<engine::object::GameObject>>& getGameObjects() { return game_objects_; } ///< @brief 获取场景中的游戏对象
protected:
void processPendingAdditions(); ///< @brief 处理待添加的游戏对象。(每轮更新的最后调用)