Testing textures
This commit is contained in:
@ -21,4 +21,7 @@ set(LIMINAL_ASSETS_DIR ${DAWN_ASSETS_DIR}/games/liminal)
|
||||
tool_vnscene(${LIMINAL_ASSETS_DIR}/test.xml)
|
||||
|
||||
tool_prefab(${LIMINAL_ASSETS_DIR}/VNTextbox.xml)
|
||||
tool_truetype(font_main ${DAWN_ASSETS_DIR}/ark-pixel.ttf)
|
||||
tool_truetype(font_main ${DAWN_ASSETS_DIR}/ark-pixel.ttf)
|
||||
|
||||
tool_prefab(${LIMINAL_ASSETS_DIR}/prefabs/EthPrefab.xml)
|
||||
tool_texture(texture_eth ${LIMINAL_ASSETS_DIR}/textures/eth.png)
|
@ -10,6 +10,7 @@
|
||||
#include "prefabs/VNTextbox.hpp"
|
||||
#include "display/TextureRenderTarget.hpp"
|
||||
#include "scene/components/ui/UIImage.hpp"
|
||||
#include "prefabs/EthPrefab.hpp"
|
||||
|
||||
namespace Dawn {
|
||||
class HelloWorldScene : public Scene {
|
||||
@ -19,51 +20,59 @@ namespace Dawn {
|
||||
UICanvas *canvas;
|
||||
TextureRenderTarget *renderTarget;
|
||||
Texture text;
|
||||
TilesetGrid grid;
|
||||
|
||||
int32_t test = 0;
|
||||
|
||||
void stage() override {
|
||||
canvas = UICanvas::create(this);
|
||||
// canvas = UICanvas::create(this);
|
||||
|
||||
camera = Camera::create(this);
|
||||
glm::vec3 off = glm::vec3(90000, 100, 100);
|
||||
glm::vec3 off = glm::vec3(0, 0, 0);
|
||||
camera->transform->lookAt(glm::vec3(10, 10, 10) + off, glm::vec3(0, 0, 0) + off);
|
||||
|
||||
camNew = Camera::create(this);
|
||||
auto camTexture = camNew->item->addComponent<CameraTexture>();
|
||||
camNew->fov = 0.436332f;
|
||||
camNew->transform->lookAt(glm::vec3(10, 10, 10), glm::vec3(0, 0, 0));
|
||||
camTexture->renderTarget.setSize(1024, 1024);
|
||||
// auto textbox = VNTextbox::create(this);
|
||||
// textbox->transform.setParent(canvas->transform);
|
||||
|
||||
auto cube = SimpleSpinningCubePrefab::create(this);
|
||||
// camNew = Camera::create(this);
|
||||
// auto camTexture = camNew->item->addComponent<CameraTexture>();
|
||||
// camNew->fov = 0.436332f;
|
||||
// camNew->transform->lookAt(glm::vec3(10, 10, 10), glm::vec3(0, 0, 0));
|
||||
// camTexture->renderTarget.setSize(1024, 1024);
|
||||
|
||||
auto textbox = VNTextbox::create(this);
|
||||
textbox->transform.setParent(canvas->transform);
|
||||
// auto uiTest = this->createSceneItem();
|
||||
// uiTest->transform.setParent(canvas->transform);
|
||||
// auto 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;
|
||||
|
||||
auto uiTest = this->createSceneItem();
|
||||
uiTest->transform.setParent(canvas->transform);
|
||||
auto 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, 26,
|
||||
741, 20540,
|
||||
0, 0,
|
||||
0, 0
|
||||
);
|
||||
auto eth = EthPrefab::create(this);
|
||||
// eth->tiledSprite->tileset = &grid;
|
||||
|
||||
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;
|
||||
// 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));
|
||||
vectorAppend(&assets, EthPrefab::prefabAssets(assMan));
|
||||
return assets;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user