refactor: 移除测试模块并清理主函数代码
This commit is contained in:
parent
ab3dd829b8
commit
afbd5bae6b
|
|
@ -2,51 +2,12 @@
|
|||
#include <SDL2/SDL.h>
|
||||
#include <frostbite2D/core/application.h>
|
||||
#include <frostbite2D/core/window.h>
|
||||
#include <frostbite2D/module/module.h>
|
||||
#include <frostbite2D/utils/asset.h>
|
||||
|
||||
#include <glad/glad.h>
|
||||
|
||||
using namespace frostbite2D;
|
||||
|
||||
class TestModule : public Module {
|
||||
public:
|
||||
const char* getName() const override { return "TestModule"; }
|
||||
|
||||
void setupModule() override {
|
||||
SDL_Log("TestModule: setupModule()");
|
||||
}
|
||||
|
||||
void onUpdate() override {
|
||||
static int frameCount = 0;
|
||||
frameCount++;
|
||||
|
||||
if (frameCount % 120 == 0) {
|
||||
SDL_Log("TestModule: onUpdate() - Frame %d, FPS: %d", frameCount, Application::get().fps());
|
||||
}
|
||||
|
||||
if (frameCount > 600) {
|
||||
SDL_Log("TestModule: Requesting quit after 600 frames");
|
||||
Application::get().quit();
|
||||
}
|
||||
}
|
||||
|
||||
void beforeRender() override {
|
||||
glClearColor(0.2f, 0.3f, 0.8f, 1.0f);
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
}
|
||||
|
||||
void onRender() override {
|
||||
}
|
||||
|
||||
void afterRender() override {
|
||||
}
|
||||
|
||||
void destroyModule() override {
|
||||
SDL_Log("TestModule: destroyModule()");
|
||||
}
|
||||
};
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
AppConfig config = AppConfig::createDefault();
|
||||
config.appName = "Frostbite2D Test App";
|
||||
|
|
@ -57,9 +18,6 @@ int main(int argc, char **argv) {
|
|||
|
||||
Application &app = Application::get();
|
||||
|
||||
TestModule testModule;
|
||||
app.use(testModule);
|
||||
|
||||
if (!app.init(config)) {
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Failed to initialize application!");
|
||||
return -1;
|
||||
|
|
|
|||
Loading…
Reference in New Issue