diff --git a/Frostbite2D/src/frostbite2D/core/application.cpp b/Frostbite2D/src/frostbite2D/core/application.cpp index c2080f5..0a8c9df 100644 --- a/Frostbite2D/src/frostbite2D/core/application.cpp +++ b/Frostbite2D/src/frostbite2D/core/application.cpp @@ -250,28 +250,6 @@ void Application::render() { } } - // 简单的测试代码 - 绘制彩色方块 - if (renderer_) { - static float angle = 0.0f; - angle += 0.02f; - - renderer_->beginFrame(); - - // 绘制橙色方块 - renderer_->drawQuad(Vec2(0, 0), Size(200, 150), 1.0f, 0.5f, 0.2f); - - // 绘制蓝色移动方块 - float x = 1920.0 / 2 + cosf(angle) * 100.0f; - float y = 1080.0 / 2 + sinf(angle) * 100.0f; - renderer_->drawQuad(Vec2(x, y), Size(100, 100), 0.3f, 0.5f, 1.0f); - - renderer_->drawQuad(Vec2(1920 - 100, 1080 - 150), Size(100, 150), 1.0f, - 0.5f, 0.2f); - - renderer_->endFrame(); - renderer_->flush(); - } - if (window_) { window_->swap(); } diff --git a/Frostbite2D/src/main.cpp b/Frostbite2D/src/main.cpp index 92c54cb..78f8dc5 100644 --- a/Frostbite2D/src/main.cpp +++ b/Frostbite2D/src/main.cpp @@ -2,7 +2,6 @@ #include #include #include -#include #include #include #include @@ -14,48 +13,25 @@ int main(int argc, char **argv) { AppConfig config = AppConfig::createDefault(); config.appName = "Frostbite2D Test App"; config.appVersion = "1.0.0"; - config.windowConfig.width = 1920; - config.windowConfig.height = 1080; + config.windowConfig.width = 800; + config.windowConfig.height = 600; config.windowConfig.title = "Frostbite2D - Renderer Test"; - Application &app = Application::get(); + Application& app = Application::get(); if (!app.init(config)) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Failed to initialize application!"); return -1; } - auto &renderer = Renderer::get(); - renderer.setClearColor(0.1f, 0.1f, 0.15f); + auto& renderer = Renderer::get(); + renderer.setClearColor(0.2f, 0.3f, 1.0f); + renderer.setViewport(0, 0, 800, 600); - // 获取屏幕实际大小 - auto *window = app.getWindow(); - int screenWidth = window ? window->width() : config.windowConfig.width; - int screenHeight = window ? window->height() : config.windowConfig.height; - - // 设置 Renderer 的视口到屏幕大小 - renderer.setViewport(0, 0, screenWidth, screenHeight); - - // 相机使用游戏逻辑分辨率 (1280x720) - static Camera camera; - camera.setViewport(config.windowConfig.width, config.windowConfig.height); - renderer.setCamera(&camera); - - auto &asset = Asset::get(); -#ifdef __SWITCH__ - asset.setWorkingDirectory("/switch/testgame"); -#else - asset.setWorkingDirectory("."); -#endif - - // 初始化着色器管理器 - auto &shaderManager = renderer.getShaderManager(); - shaderManager.init("shaders"); + auto& asset = Asset::get(); + asset.setWorkingDirectory("assets"); SDL_Log("Application initialized successfully"); - SDL_Log("Screen size: %dx%d", screenWidth, screenHeight); - SDL_Log("Render size: %dx%d", config.windowConfig.width, - config.windowConfig.height); SDL_Log("Starting main loop..."); app.run();