Dawn/src/dawnliminal/scenes/HelloWorldScene.hpp
2023-04-21 23:30:33 -07:00

67 lines
1.9 KiB
C++

// Copyright (c) 2023 Dominic Masters
//
// This software is released under the MIT License.
// https://opensource.org/licenses/MIT
#pragma once
#include "scene/Scene.hpp"
#include "scene/components/display/Camera.hpp"
#include "prefabs/SimpleSpinningCubePrefab.hpp"
#include "games/vn/components/VNManager.hpp"
#include "games/vn/events/VNDummyEvent.hpp"
#include "games/vn/events/VNTextEvent.hpp"
#include "games/vn/events/VNPositionEvent.hpp"
#include "games/vn/events/VNSetEvent.hpp"
namespace Dawn {
class HelloWorldScene : public Scene {
protected:
Camera *camera;
UICanvas *canvas;
int32_t test = 0;
void stage() override {
canvas = UICanvas::create(this);
camera = Camera::create(this);
camera->fov = 0.436332f;
camera->transform->lookAt(glm::vec3(10, 10, 10), glm::vec3(0, 0, 0));
auto cube = SimpleSpinningCubePrefab::create(this);
auto vnItem = this->createSceneItem();
auto vnManager = vnItem->addComponent<VNManager>();
auto eventTest = vnManager->createEvent<VNDummyEvent>();
auto positionEvent = vnManager->createEvent<VNPositionEvent>();
positionEvent->to.x = 2.0f;
positionEvent->item = cube;
positionEvent->duration = 3.0f;
auto vnTextEvent = vnManager->createEvent<VNTextEvent>();
vnTextEvent->text = "Hello World!";
auto setPropertyEvent = vnManager->createEvent<VNSetEvent<int32_t>>();
setPropertyEvent->modifies = &test;
setPropertyEvent->to = 10;
eventTest
->then(positionEvent)
->then(vnTextEvent)
->then(setPropertyEvent)
;
vnManager->setEvent(eventTest);
}
std::vector<Asset*> getRequiredAssets() override {
auto assMan = &this->game->assetManager;
std::vector<Asset*> assets;
return assets;
}
public:
HelloWorldScene(DawnGame *game) : Scene(game) {}
};
}