Dawn/src/dawnliminal/scenes/HelloWorldScene.hpp

59 lines
1.7 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 "prefabs/VNTextbox.hpp"
namespace Dawn {
class HelloWorldScene : public Scene {
protected:
Camera *camera;
Camera *camNew;
UICanvas *canvas;
Texture text;
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));
camNew = Camera::create(this);
camNew->transform->lookAt(glm::vec3(10, 10, 10), glm::vec3(0, 0, 0));
camNew->renderTarget = nullptr;
auto cube = SimpleSpinningCubePrefab::create(this);
auto textbox = VNTextbox::create(this);
textbox->transform.setParent(canvas->transform);
struct Color colors[] = {
COLOR_BLUE, COLOR_MAGENTA, COLOR_WHITE,
COLOR_MAGENTA, COLOR_CORNFLOWER_BLUE, COLOR_MAGENTA,
COLOR_BLACK, COLOR_MAGENTA, COLOR_BLUE
};
text.setSize(3, 3);
text.buffer(colors);
textbox->border->texture = &text;
}
std::vector<Asset*> getRequiredAssets() override {
auto assMan = &this->game->assetManager;
std::vector<Asset*> assets;
vectorAppend(&assets, SimpleSpinningCubePrefab::prefabAssets(assMan));
vectorAppend(&assets, VNTextbox::prefabAssets(assMan));
return assets;
}
public:
HelloWorldScene(DawnGame *game) : Scene(game) {}
};
}