推
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
#include "Scene/Scene_Loading_UI.h"
|
||||
#include "Scene/Scene_MainUi.h"
|
||||
#include "Scene/Scene_Test.h"
|
||||
#include "Actor/Map/GameWorld.h"
|
||||
#include "Scene_Loading_UI.h"
|
||||
#include "EngineFrame/Component/Sprite.h"
|
||||
#include "EngineFrame/Component/Text.h"
|
||||
@@ -15,6 +15,10 @@ void Scene_Loading_UI::Enter()
|
||||
{
|
||||
Mix_PlayMusic(music, 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("Mix_LoadMUS: %s\n", Mix_GetError());
|
||||
}
|
||||
|
||||
RefPtr<Actor> actor = new Actor;
|
||||
AddChild(actor);
|
||||
@@ -22,19 +26,19 @@ void Scene_Loading_UI::Enter()
|
||||
RefPtr<Sprite> BackGroundSp = new Sprite("ImagePacks2/Loading1.png");
|
||||
actor->AddChild(BackGroundSp);
|
||||
RefPtr<Sprite> BackGround2Sp = new Sprite("ImagePacks2/Loading0.png");
|
||||
BackGround2Sp->SetPos(Vec2{0, 686});
|
||||
BackGround2Sp->SetPosition(0, 686);
|
||||
actor->AddChild(BackGround2Sp);
|
||||
RefPtr<Sprite> LoadCircleSp = new Sprite("ImagePacks2/Loading2.png");
|
||||
LoadCircleSp->SetName("LoadCircle");
|
||||
LoadCircleSp->SetPos(Vec2{1280 - 60, 686 - 60});
|
||||
LoadCircleSp->SetPosition(1280 - 60, 686 - 60);
|
||||
LoadCircleSp->SetBlendMode(LINEARDODGE);
|
||||
LoadCircleSp->SetAnchor(Vec2{0.5f, 0.5f});
|
||||
LoadCircleSp->SetAnchor(0.5f, 0.5f);
|
||||
actor->AddChild(LoadCircleSp);
|
||||
|
||||
actor->SetCallbackOnUpdate("Rotate", [LoadCircleSp](float deltaTime) mutable
|
||||
{
|
||||
{
|
||||
float angle = LoadCircleSp->GetRotation();
|
||||
LoadCircleSp->SetRotation(angle + 180.0f * deltaTime); });
|
||||
LoadCircleSp->SetRotation(angle - 180.0f * deltaTime); });
|
||||
}
|
||||
|
||||
void Scene_Loading_UI::Update(float deltaTime)
|
||||
@@ -43,7 +47,7 @@ void Scene_Loading_UI::Update(float deltaTime)
|
||||
if (Global_Game::GetInstance().InitFlag)
|
||||
{
|
||||
// 设定游戏层场景
|
||||
RefPtr<Scene_Test> scene = new Scene_Test;
|
||||
RefPtr<GameWorld> scene = new GameWorld;
|
||||
Game::GetInstance().ChangeScene(scene);
|
||||
// 设定UI层场景
|
||||
RefPtr<Scene_MainUi> sceneUI = new Scene_MainUi;
|
||||
|
||||
@@ -1,122 +0,0 @@
|
||||
#include "Scene_Test.h"
|
||||
#include <memory>
|
||||
#include "EngineCore/Game.h"
|
||||
#include "EngineFrame/Component/AnimationManager.h"
|
||||
#include "EngineFrame/Component/Text.h"
|
||||
#include "EngineFrame/Component/Canvas.h"
|
||||
#include "Global/Global_Game.h"
|
||||
Scene_Test::Scene_Test()
|
||||
{
|
||||
}
|
||||
|
||||
Scene_Test::~Scene_Test()
|
||||
{
|
||||
SDL_Log("Scene_Test::我的ID是%d --- 我被释放了!", this->MyId);
|
||||
}
|
||||
|
||||
void Scene_Test::Enter()
|
||||
{
|
||||
map = new GameMap;
|
||||
map->LoadMap("map/cataclysm/town/elvengard/new_elvengard.map");
|
||||
map->Enter(this);
|
||||
AddChild(map);
|
||||
map->SetCallbackOnUpdate("csas", [this](float dt)
|
||||
{
|
||||
Vec2 pos = map->GetPos();
|
||||
pos.x -= 10 * dt;
|
||||
map->SetPos(pos); });
|
||||
|
||||
// RefPtr<CharacterObject> obj = new CharacterObject();
|
||||
// obj->SetPosition({1000, 300, 0});
|
||||
// obj->Construction(0);
|
||||
// map->AddObject(obj);
|
||||
|
||||
// RefPtr<MonsterObject> monster = new MonsterObject();
|
||||
// monster->SetPosition({1200, 301, 0});
|
||||
// monster->Construction(1);
|
||||
// monster->SetDirection(1);
|
||||
// map->AddObject(monster);
|
||||
|
||||
return;
|
||||
|
||||
// // SDL_Log("Scene_Test::进入测试场景!");
|
||||
RefPtr<Actor> actor = new Actor;
|
||||
AddChild(actor);
|
||||
|
||||
// RefPtr<Sprite> sprite = new Sprite("ImagePacks2/test_white_background.png");
|
||||
|
||||
RefPtr<Sprite> chr = new Sprite("sprite/interface2/hud/hud.img", 0);
|
||||
chr->SetPos(Vec2{200, 100});
|
||||
// chr->SetAlpha(0.5);
|
||||
// chr->SetShadow();
|
||||
// actor->AddComponent(chr);
|
||||
|
||||
RefPtr<Canvas> canvas = new Canvas(VecSize{250, 720});
|
||||
actor->AddChild(canvas);
|
||||
canvas->DrawImg("sprite/interface2/hud/hud.img", 0, Vec2{0, 0});
|
||||
|
||||
// canvas->AddChild(chr);
|
||||
|
||||
// RefPtr<AnimationManager> Am = new AnimationManager;
|
||||
// RefPtr<Animation> ani4 = new Animation("map/cataclysm/town/hendonmyre/animation/object/gateall_02.ani");
|
||||
// Am->AddAnimation(ani4);
|
||||
|
||||
// // Am->SetPos(Vec2{200, 100});
|
||||
// actor->AddChild(Am);
|
||||
|
||||
// // sprite2->UnsetClipRect();
|
||||
|
||||
// RefPtr<Actor> actor2 = new Actor;
|
||||
// actor->AddChild(actor2);
|
||||
|
||||
// RefPtr<Animation> ani4 = new Animation("map/cataclysm/town/hendonmyre/animation/object/gateall_02.ani");
|
||||
// // ani4->SetScale(Vec2{-1.0, 1.0});
|
||||
// actor->AddChild(ani4);
|
||||
|
||||
// RefPtr<Animation> ani3 = new Animation("map/cataclysm/town/elvengard/animation/obj/serialight01_right.ani");
|
||||
// actor->AddChild(ani3);
|
||||
|
||||
// RefPtr<Animation> ani4 = new Animation("map/cataclysm/town/hendonmyre/animation/object/gateall_02.ani");
|
||||
// ani4->SetPos(VecPos{300, 500});
|
||||
// actor->AddChild(ani4);
|
||||
|
||||
// for (size_t i = 0; i < 400; i++)
|
||||
// {
|
||||
// RefPtr<Actor> actor = new Actor;
|
||||
// AddChild(actor);
|
||||
|
||||
// // RefPtr<Animation> ani3 = new Animation("common/commoneffect/animation/priestslowheal1.ani");
|
||||
// // actor->AddComponent(ani3);
|
||||
// // ani3->SetRenderZOrder(1000);
|
||||
|
||||
// // RefPtr<Animation> ani = new Animation("common/anton/main.ani");
|
||||
// // actor->AddComponent(ani);
|
||||
// // ani->SetRenderZOrder(500);
|
||||
|
||||
// RefPtr<Sprite> sprite = new Sprite("sprite/item/avatar/swordman/0sm_acap.img", 0);
|
||||
// actor->AddComponent(sprite);
|
||||
// // RefPtr<Animation> ani2 = new Animation("common/anton/face/0/0.ani");
|
||||
// // actor->AddComponent(ani2);
|
||||
// // ani2->SetRenderZOrder(1000);
|
||||
// }
|
||||
}
|
||||
|
||||
void Scene_Test::HandleEvents(SDL_Event *e)
|
||||
{
|
||||
Scene::HandleEvents(e);
|
||||
}
|
||||
|
||||
void Scene_Test::Update(float deltaTime)
|
||||
{
|
||||
Scene::Update(deltaTime);
|
||||
}
|
||||
|
||||
void Scene_Test::Render()
|
||||
{
|
||||
Scene::Render();
|
||||
}
|
||||
|
||||
void Scene_Test::Exit()
|
||||
{
|
||||
SDL_Log("Scene_Test::退出测试场景!当前引用计数%d", this->GetRefCount());
|
||||
}
|
||||
@@ -1,28 +0,0 @@
|
||||
#pragma once
|
||||
#include "EngineFrame/Scene/Scene.h"
|
||||
#include "Asset/AssetManager.h"
|
||||
#include "EngineFrame/Component/Animation.h"
|
||||
#include "Actor/Map/GameMap.h"
|
||||
#include "Actor/Object/CharacterObject.h"
|
||||
#include "Actor/Object/MonsterObject.h"
|
||||
|
||||
class Scene_Test : public Scene
|
||||
{
|
||||
private:
|
||||
GameMap *map = nullptr;
|
||||
|
||||
public:
|
||||
Scene_Test(/* args */);
|
||||
~Scene_Test();
|
||||
|
||||
public:
|
||||
void Enter() override;
|
||||
void HandleEvents(SDL_Event *e) override;
|
||||
void Update(float deltaTime) override;
|
||||
void Render() override;
|
||||
void Exit() override;
|
||||
|
||||
public:
|
||||
int MyId = 0;
|
||||
|
||||
};
|
||||
Reference in New Issue
Block a user