feat(渲染): 添加Sprite类并实现基础渲染功能
添加Sprite类用于2D精灵渲染,支持纹理、着色器、颜色、翻转等属性 在Application中增加批处理渲染逻辑 在示例游戏中添加测试精灵
This commit is contained in:
BIN
Game/assets/player.png
Normal file
BIN
Game/assets/player.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 126 KiB |
@@ -8,6 +8,7 @@
|
||||
|
||||
#include <frostbite2D/scene/scene.h>
|
||||
#include <frostbite2D/scene/scene_manager.h>
|
||||
#include <frostbite2D/2d/sprite.h>
|
||||
|
||||
using namespace frostbite2D;
|
||||
|
||||
@@ -28,6 +29,13 @@ int main(int argc, char **argv) {
|
||||
|
||||
SDL_Log("Starting main loop...");
|
||||
|
||||
auto menuScene = MakePtr<Scene>();
|
||||
SceneManager::get().PushScene(menuScene);
|
||||
|
||||
auto sprite = Sprite::createFromFile("assets\\player.png");
|
||||
sprite->SetPosition(100, 100);
|
||||
menuScene->AddActor(sprite);
|
||||
|
||||
app.run();
|
||||
|
||||
app.shutdown();
|
||||
|
||||
Reference in New Issue
Block a user