Fixed XML Parser not parsing empty XML sheets 100% correctly.

This commit is contained in:
2023-05-20 22:53:53 -07:00
parent f8ca5f2e17
commit a64df032e2
7 changed files with 17 additions and 94 deletions

View File

@ -24,7 +24,7 @@ tool_texture(texture_eth ${LIMINAL_ASSETS_DIR}/textures/eth.png)
tool_texture(texture_border ${LIMINAL_ASSETS_DIR}/textures/texture_test.png)
tool_scene(${LIMINAL_ASSETS_DIR}/scenes/SceneBase.xml)
tool_vnscene(${LIMINAL_ASSETS_DIR}/scenes/VNSceneTest.xml)
tool_vnscene(${LIMINAL_ASSETS_DIR}/scenes/Scene1Prologue.xml)
tool_prefab(${LIMINAL_ASSETS_DIR}/prefabs/EthPrefab.xml)
tool_prefab(${LIMINAL_ASSETS_DIR}/prefabs/VNTextbox.xml)

View File

@ -4,12 +4,10 @@
// https://opensource.org/licenses/MIT
#include "game/DawnGame.hpp"
#include "scenes/HelloWorldScene.hpp"
#include "vnscenes/VNSceneTest.hpp"
#include "vnscenes/Scene1Prologue.hpp"
using namespace Dawn;
Scene * Dawn::dawnGameGetInitialScene(DawnGame *game) {
// return new HelloWorldScene(game);
return new VNSceneTest(game);
return new Scene1Prologue(game);
}

View File

@ -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) {}
};
}