First attempt to play audio
This commit is contained in:
52
src/dawnpokergame/prefabs/characters/DeathPrefab.hpp
Normal file
52
src/dawnpokergame/prefabs/characters/DeathPrefab.hpp
Normal file
@ -0,0 +1,52 @@
|
||||
// Copyright (c) 2023 Dominic Masters
|
||||
//
|
||||
// This software is released under the MIT License.
|
||||
// https://opensource.org/licenses/MIT
|
||||
|
||||
#pragma once
|
||||
#include "prefab/SceneItemPrefab.hpp"
|
||||
#include "asset/AssetManager.hpp"
|
||||
#include "poker/PokerPlayer.hpp"
|
||||
#include "scene/components/Components.hpp"
|
||||
#include "visualnovel/components/VisualNovelCharacter.hpp"
|
||||
#include "display/animation/TiledSpriteAnimation.hpp"
|
||||
#include "scene/components/display/shader/SimpleTexturedShaderInterface.hpp"
|
||||
|
||||
namespace Dawn {
|
||||
class DeathPrefab : public SceneItemPrefab<DeathPrefab> {
|
||||
public:
|
||||
VisualNovelCharacter *vnCharacter;
|
||||
SimpleTexturedShaderInterface *shaderInterface;
|
||||
|
||||
static std::vector<Asset*> prefabAssets(AssetManager *assMan) {
|
||||
return std::vector<Asset*>{
|
||||
assMan->get<TextureAsset>("texture_death"),
|
||||
assMan->get<TilesetAsset>("tileset_death")
|
||||
};
|
||||
}
|
||||
|
||||
DeathPrefab(Scene *scene, sceneitemid_t id) : SceneItemPrefab(scene, id){}
|
||||
|
||||
void prefabInit(AssetManager *man) override {
|
||||
auto textureAsset = man->get<TextureAsset>("texture_death");
|
||||
auto tilesetAsset = man->get<TilesetAsset>("tileset_death");
|
||||
|
||||
auto meshRenderer = this->addComponent<MeshRenderer>();
|
||||
auto material = this->addComponent<Material>();
|
||||
auto meshHost = this->addComponent<MeshHost>();
|
||||
auto animation = this->addComponent<AnimationController>();
|
||||
|
||||
auto tiledSprite = this->addComponent<TiledSprite>();
|
||||
tiledSprite->setTilesetAndSize(&tilesetAsset->tileset);
|
||||
tiledSprite->setTile(0);
|
||||
|
||||
vnCharacter = this->addComponent<VisualNovelCharacter>();
|
||||
vnCharacter->nameKey = "character.death.name";
|
||||
|
||||
shaderInterface = this->addComponent<SimpleTexturedShaderInterface>();
|
||||
shaderInterface->setTexture(&textureAsset->texture);
|
||||
|
||||
this->transform.setLocalPosition(glm::vec3(0, 0, 0));
|
||||
}
|
||||
};
|
||||
}
|
@ -46,10 +46,10 @@ namespace Dawn {
|
||||
tiledSprite->setTile(0);
|
||||
this->transform.setLocalPosition(glm::vec3(0, 0, 0));
|
||||
|
||||
auto anim = new TiledSpriteAnimation(tiledSprite);
|
||||
anim->addSequentialKeyframes(0.1f, 0, 22);
|
||||
anim->loop = true;
|
||||
animation->animation = anim;
|
||||
// auto anim = new TiledSpriteAnimation(tiledSprite);
|
||||
// anim->addSequentialKeyframes(0.1f, 0, 22);
|
||||
// anim->loop = true;
|
||||
// animation->animation = anim;
|
||||
}
|
||||
};
|
||||
}
|
@ -14,17 +14,18 @@ namespace Dawn {
|
||||
public:
|
||||
static std::vector<Asset*> prefabAssets(AssetManager *man) {
|
||||
std::vector<Asset*> assets;
|
||||
assets.push_back(man->get<TrueTypeAsset>("truetype_ark"));
|
||||
assets.push_back(man->get<TrueTypeAsset>("truetype_alice"));
|
||||
vectorAppend(&assets, UIBorderPrefab::getRequiredAssets(man));
|
||||
return assets;
|
||||
}
|
||||
|
||||
static void prefabApply(AssetManager *man, VisualNovelTextbox *textbox) {
|
||||
auto assetFont = man->get<TrueTypeAsset>("truetype_ark");
|
||||
auto assetFont = man->get<TrueTypeAsset>("truetype_alice");
|
||||
UIBorderPrefab::apply(&textbox->border);
|
||||
textbox->setFont(&assetFont->font);
|
||||
textbox->setFontSize(10.0f);
|
||||
textbox->setFontSize(48.0f);
|
||||
textbox->setLabelPadding(glm::vec2(2, 2));
|
||||
textbox->label.textColor = COLOR_WHITE;
|
||||
|
||||
textbox->setTransform(
|
||||
UI_COMPONENT_ALIGN_STRETCH, UI_COMPONENT_ALIGN_END,
|
||||
|
Reference in New Issue
Block a user