Fixed XML Parser not parsing empty XML sheets 100% correctly.
This commit is contained in:
@ -1,82 +0,0 @@
|
||||
// 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/CameraTexture.hpp"
|
||||
#include "prefabs/SimpleSpinningCubePrefab.hpp"
|
||||
#include "prefabs/VNTextbox.hpp"
|
||||
#include "display/TextureRenderTarget.hpp"
|
||||
#include "scene/components/ui/UIImage.hpp"
|
||||
#include "prefabs/EthPrefab.hpp"
|
||||
|
||||
namespace Dawn {
|
||||
class HelloWorldScene : public Scene {
|
||||
protected:
|
||||
Camera *camera;
|
||||
Camera *camNew;
|
||||
UICanvas *canvas;
|
||||
TextureRenderTarget *renderTarget;
|
||||
Texture text;
|
||||
TilesetGrid grid;
|
||||
CameraTexture *camTexture;
|
||||
UIImage *image;
|
||||
|
||||
int32_t test = 0;
|
||||
|
||||
void stage() override {
|
||||
canvas = UICanvas::create(this);
|
||||
|
||||
camera = Camera::create(this);
|
||||
glm::vec3 off = glm::vec3(0, 0, 0);
|
||||
camera->transform->lookAt(glm::vec3(10, 10, 10) + off, glm::vec3(0, 0, 0) + off);
|
||||
|
||||
auto textbox = VNTextbox::create(this);
|
||||
textbox->transform.setParent(canvas->transform);
|
||||
|
||||
camNew = Camera::create(this);
|
||||
camTexture = camNew->item->addComponent<CameraTexture>();
|
||||
camNew->fov = 0.436332f;
|
||||
camNew->transform->lookAt(glm::vec3(0, 0, 5), glm::vec3(0, 0, 0));
|
||||
camTexture->renderTarget.setSize(1, 1);
|
||||
|
||||
auto uiTest = this->createSceneItem();
|
||||
uiTest->transform.setParent(canvas->transform);
|
||||
image = uiTest->addComponent<UIImage>();
|
||||
image->texture = camTexture->renderTarget.getTexture();
|
||||
image->alignment = glm::vec4(0, 0, 50, 0);
|
||||
image->alignX = UI_COMPONENT_ALIGN_START;
|
||||
image->alignUnitRight = UI_COMPONENT_ALIGN_UNIT_PERCENT;
|
||||
image->alignY = UI_COMPONENT_ALIGN_STRETCH;
|
||||
|
||||
this->grid = TilesetGrid(
|
||||
1, 13,
|
||||
741, 10270,
|
||||
0, 0,
|
||||
0, 0
|
||||
);
|
||||
auto eth = EthPrefab::create(this);
|
||||
eth->tiledSprite->tileset = &grid;
|
||||
|
||||
useEvent([&]{
|
||||
assertNotNull(camTexture);
|
||||
assertNotNull(image);
|
||||
std::cout << "Size Update" << std::endl;
|
||||
camTexture->renderTarget.setSize(image->getWidth(), image->getHeight());
|
||||
}, image->eventAlignmentUpdated);
|
||||
}
|
||||
|
||||
std::vector<Asset*> getRequiredAssets() override {
|
||||
auto assMan = &this->game->assetManager;
|
||||
std::vector<Asset*> assets;
|
||||
vectorAppend(&assets, VNTextbox::prefabAssets(assMan));
|
||||
vectorAppend(&assets, EthPrefab::prefabAssets(assMan));
|
||||
return assets;
|
||||
}
|
||||
|
||||
public:
|
||||
HelloWorldScene(DawnGame *game) : Scene(game) {}
|
||||
};
|
||||
}
|
Reference in New Issue
Block a user