77 lines
2.3 KiB
C++
77 lines
2.3 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"
|
|
#include "games/vn/events/VNChoiceEvent.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;
|
|
|
|
auto choiceEvent = vnManager->createEvent<VNChoiceEvent>();
|
|
choiceEvent->text = "Choice?";
|
|
choiceEvent->choices["state0"] = "State 0";
|
|
choiceEvent->choices["state1"] = "State 1";
|
|
choiceEvent->choices["state2"] = "State 2";
|
|
choiceEvent->choices["state3"] = "State 3";
|
|
|
|
|
|
eventTest
|
|
->then(positionEvent)
|
|
->then(vnTextEvent)
|
|
->then(setPropertyEvent)
|
|
->then(choiceEvent)
|
|
;
|
|
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) {}
|
|
};
|
|
} |