Added talkey to texty
This commit is contained in:
		| @@ -164,7 +164,7 @@ void RenderPipeline::renderSceneCamera(Scene *scene, Camera *camera) { | |||||||
|   std::sort( |   std::sort( | ||||||
|     shaderPassItems.begin(), |     shaderPassItems.begin(), | ||||||
|     shaderPassItems.end(), |     shaderPassItems.end(), | ||||||
|     [](struct ShaderPassItem &a, struct ShaderPassItem  &b){ |     [](struct ShaderPassItem &a, struct ShaderPassItem  &b) { | ||||||
|       if(a.priority == b.priority) { |       if(a.priority == b.priority) { | ||||||
|         return a.w < b.w; |         return a.w < b.w; | ||||||
|       } |       } | ||||||
|   | |||||||
| @@ -24,6 +24,19 @@ namespace Dawn { | |||||||
|  |  | ||||||
|       } |       } | ||||||
|  |  | ||||||
|  |       /** | ||||||
|  |        * Sorts internal keyframes by their time to make them conform correctly. | ||||||
|  |        */ | ||||||
|  |       void sortKeyframes() { | ||||||
|  |         std::sort( | ||||||
|  |           this->keyframes.begin(), | ||||||
|  |           this->keyframes.end(), | ||||||
|  |           [](struct SimpleKeyframe<T> &a, struct SimpleKeyframe<T>  &b) { | ||||||
|  |             return a.time < b.time; | ||||||
|  |           } | ||||||
|  |         ); | ||||||
|  |       } | ||||||
|  |  | ||||||
|     public: |     public: | ||||||
|       easefunction_t *easing = &easeLinear; |       easefunction_t *easing = &easeLinear; | ||||||
|       T *modifies; |       T *modifies; | ||||||
| @@ -54,6 +67,8 @@ namespace Dawn { | |||||||
|         this->duration = mathMax<float_t>(this->duration, time); |         this->duration = mathMax<float_t>(this->duration, time); | ||||||
|         this->finished = false; |         this->finished = false; | ||||||
|         this->keyframes.push_back(keyframe); |         this->keyframes.push_back(keyframe); | ||||||
|  |  | ||||||
|  |         if(time < this->duration) this->sortKeyframes(); | ||||||
|       } |       } | ||||||
|  |  | ||||||
|       /** |       /** | ||||||
|   | |||||||
| @@ -19,6 +19,9 @@ namespace Dawn { | |||||||
|       UICanvas *uiCanvas = nullptr; |       UICanvas *uiCanvas = nullptr; | ||||||
|       VisualNovelTextbox *textBox = nullptr; |       VisualNovelTextbox *textBox = nullptr; | ||||||
|       VisualNovelFader *fader = nullptr; |       VisualNovelFader *fader = nullptr; | ||||||
|  |        | ||||||
|  |       AudioSource *audioBackground = nullptr; | ||||||
|  |       AudioSource *audioCharacter = nullptr; | ||||||
|  |  | ||||||
|       /** Event listener for unpaused scene updates. */ |       /** Event listener for unpaused scene updates. */ | ||||||
|       void onUnpausedUpdate(); |       void onUnpausedUpdate(); | ||||||
|   | |||||||
| @@ -14,10 +14,12 @@ VisualNovelCharacter::VisualNovelCharacter(SceneItem *item) : | |||||||
|  |  | ||||||
| std::vector<SceneItemComponent*> VisualNovelCharacter::getDependencies() { | std::vector<SceneItemComponent*> VisualNovelCharacter::getDependencies() { | ||||||
|   return std::vector<SceneItemComponent*>{ |   return std::vector<SceneItemComponent*>{ | ||||||
|     (this->material = this->item->getComponent<SimpleTexturedMaterial>()) |     (this->material = this->item->getComponent<SimpleTexturedMaterial>()), | ||||||
|  |     (this->tiledSprite = this->item->getComponent<TiledSprite>()) | ||||||
|   }; |   }; | ||||||
| } | } | ||||||
|  |  | ||||||
| void VisualNovelCharacter::onStart() { | void VisualNovelCharacter::onStart() { | ||||||
|   assertNotNull(this->material); |   assertNotNull(this->material); | ||||||
|  |   assertNotNull(this->tiledSprite); | ||||||
| } | } | ||||||
| @@ -5,13 +5,23 @@ | |||||||
|  |  | ||||||
| #pragma once | #pragma once | ||||||
| #include "scene/SceneItemComponent.hpp" | #include "scene/SceneItemComponent.hpp" | ||||||
|  | #include "asset/assets/AudioAsset.hpp" | ||||||
| #include "scene/components/display/material/SimpleTexturedMaterial.hpp" | #include "scene/components/display/material/SimpleTexturedMaterial.hpp" | ||||||
|  | #include "scene/components/display/TiledSprite.hpp" | ||||||
|  | #include "scene/components/audio/AudioSource.hpp" | ||||||
|  |  | ||||||
| namespace Dawn { | namespace Dawn { | ||||||
|  |   struct VisualNovelCharacterEmotion { | ||||||
|  |     int32_t tile = 0; | ||||||
|  |     AudioAsset *talkSound = nullptr; | ||||||
|  |     AudioAsset *emotionSound = nullptr; | ||||||
|  |   }; | ||||||
|  |  | ||||||
|   class VisualNovelCharacter : public SceneItemComponent { |   class VisualNovelCharacter : public SceneItemComponent { | ||||||
|     public: |     public: | ||||||
|       std::string nameKey = "character.unknown"; |       std::string nameKey = "character.unknown"; | ||||||
|       SimpleTexturedMaterial *material = nullptr; |       SimpleTexturedMaterial *material = nullptr; | ||||||
|  |       TiledSprite *tiledSprite = nullptr; | ||||||
|  |  | ||||||
|       /** |       /** | ||||||
|        * Visual Novel Character Component. Mostly logic-less but provides nice |        * Visual Novel Character Component. Mostly logic-less but provides nice | ||||||
|   | |||||||
| @@ -8,12 +8,22 @@ | |||||||
| using namespace Dawn; | using namespace Dawn; | ||||||
|  |  | ||||||
| VisualNovelTextboxEvent::VisualNovelTextboxEvent( | VisualNovelTextboxEvent::VisualNovelTextboxEvent( | ||||||
|         VisualNovelManager *manager, |   VisualNovelManager *manager, | ||||||
|         VisualNovelCharacter *character, |   VisualNovelCharacter *character, | ||||||
|         std::string languageKey |   struct VisualNovelCharacterEmotion emotion, | ||||||
|  |   std::string languageKey | ||||||
| ) : IVisualNovelEvent(manager) { | ) : IVisualNovelEvent(manager) { | ||||||
|   this->character = character; |   this->character = character; | ||||||
|   this->languageKey = languageKey; |   this->languageKey = languageKey; | ||||||
|  |   this->emotion = emotion; | ||||||
|  | } | ||||||
|  |  | ||||||
|  | VisualNovelTextboxEvent::VisualNovelTextboxEvent( | ||||||
|  |   VisualNovelManager *manager, | ||||||
|  |   std::string languageKey | ||||||
|  | ) : IVisualNovelEvent(manager) { | ||||||
|  |   this->character = nullptr; | ||||||
|  |   this->languageKey = languageKey; | ||||||
| } | } | ||||||
|  |  | ||||||
| void VisualNovelTextboxEvent::onStart(IVisualNovelEvent *previous) { | void VisualNovelTextboxEvent::onStart(IVisualNovelEvent *previous) { | ||||||
| @@ -21,20 +31,26 @@ void VisualNovelTextboxEvent::onStart(IVisualNovelEvent *previous) { | |||||||
|  |  | ||||||
|   this->manager->textBox->setText(this->languageKey); |   this->manager->textBox->setText(this->languageKey); | ||||||
|   this->manager->textBox->setCharacter(this->character); |   this->manager->textBox->setCharacter(this->character); | ||||||
|  |    | ||||||
|  |   if(this->character != nullptr) { | ||||||
|  |     this->character->tiledSprite->setTile(this->emotion.tile); | ||||||
|  |   } | ||||||
|  |    | ||||||
|  |   if(this->emotion.emotionSound != nullptr) { | ||||||
|  |     if(this->manager->audioCharacter != nullptr) { | ||||||
|  |       this->manager->audioCharacter->stop(); | ||||||
|  |       this->manager->audioCharacter->loop = false; | ||||||
|  |       this->manager->audioCharacter->setAudioData(this->emotion.emotionSound); | ||||||
|  |       this->manager->audioCharacter->play(); | ||||||
|  |     } | ||||||
|  |   } else if(this->emotion.talkSound != nullptr) { | ||||||
|  |     this->manager->textBox->setTalkingSound(this->emotion.talkSound); | ||||||
|  |   } | ||||||
|  |  | ||||||
|   this->manager->textBox->show(); |   this->manager->textBox->show(); | ||||||
|   this->hasSetText = true; |  | ||||||
| } | } | ||||||
|  |  | ||||||
| bool_t VisualNovelTextboxEvent::onUpdate() { | bool_t VisualNovelTextboxEvent::onUpdate() { | ||||||
|   if(this->manager->textBox == nullptr) return true; |  | ||||||
|  |  | ||||||
|   if(!this->hasSetText) { |  | ||||||
|     this->manager->textBox->setText(this->languageKey); |  | ||||||
|     this->manager->textBox->setCharacter(this->character); |  | ||||||
|     this->manager->textBox->show(); |  | ||||||
|     this->hasSetText = true; |  | ||||||
|   } |  | ||||||
|  |  | ||||||
|   return this->manager->textBox->isVisible(); |   return this->manager->textBox->isVisible(); | ||||||
| } | } | ||||||
|  |  | ||||||
|   | |||||||
| @@ -12,7 +12,7 @@ namespace Dawn { | |||||||
|     protected: |     protected: | ||||||
|       std::string languageKey; |       std::string languageKey; | ||||||
|       VisualNovelCharacter *character; |       VisualNovelCharacter *character; | ||||||
|       bool_t hasSetText = false; |       struct VisualNovelCharacterEmotion emotion; | ||||||
|        |        | ||||||
|       void onStart(IVisualNovelEvent *previous) override; |       void onStart(IVisualNovelEvent *previous) override; | ||||||
|       bool_t onUpdate() override; |       bool_t onUpdate() override; | ||||||
| @@ -30,6 +30,12 @@ namespace Dawn { | |||||||
|       VisualNovelTextboxEvent( |       VisualNovelTextboxEvent( | ||||||
|         VisualNovelManager *manager, |         VisualNovelManager *manager, | ||||||
|         VisualNovelCharacter *character, |         VisualNovelCharacter *character, | ||||||
|  |         struct VisualNovelCharacterEmotion emotion, | ||||||
|  |         std::string languageKey | ||||||
|  |       ); | ||||||
|  |        | ||||||
|  |       VisualNovelTextboxEvent( | ||||||
|  |         VisualNovelManager *manager, | ||||||
|         std::string languageKey |         std::string languageKey | ||||||
|       ); |       ); | ||||||
|   }; |   }; | ||||||
|   | |||||||
| @@ -7,4 +7,5 @@ | |||||||
| target_sources(${DAWN_TARGET_NAME} | target_sources(${DAWN_TARGET_NAME} | ||||||
|   PRIVATE |   PRIVATE | ||||||
|     VisualNovelFadeCharacterEvent.cpp |     VisualNovelFadeCharacterEvent.cpp | ||||||
|  |     VisualNovelTransformItemEvent.cpp | ||||||
| ) | ) | ||||||
| @@ -0,0 +1,36 @@ | |||||||
|  | // Copyright (c) 2023 Dominic Masters | ||||||
|  | //  | ||||||
|  | // This software is released under the MIT License. | ||||||
|  | // https://opensource.org/licenses/MIT | ||||||
|  |  | ||||||
|  | #pragma once | ||||||
|  | #include "visualnovel/events/animation/VisualNovelSimpleCallbackAnimationEvent.hpp" | ||||||
|  |  | ||||||
|  | namespace Dawn { | ||||||
|  |   class VisualNovelTransformItemEvent : | ||||||
|  |     public VisualNovelSimpleCallbackAnimationEvent<glm::vec3, Transform> | ||||||
|  |   { | ||||||
|  |     protected: | ||||||
|  |       bool_t relative = false; | ||||||
|  |       SceneItem *item = nullptr; | ||||||
|  |       void onStart(IVisualNovelEvent *previous) override; | ||||||
|  |  | ||||||
|  |     public: | ||||||
|  |       VisualNovelTransformItemEvent( | ||||||
|  |         VisualNovelManager *man, | ||||||
|  |         SceneItem *item, | ||||||
|  |         glm::vec3 start, | ||||||
|  |         glm::vec3 end, | ||||||
|  |         easefunction_t *ease, | ||||||
|  |         float_t duration | ||||||
|  |       ); | ||||||
|  |  | ||||||
|  |       VisualNovelTransformItemEvent( | ||||||
|  |         VisualNovelManager *man, | ||||||
|  |         SceneItem *item, | ||||||
|  |         glm::vec3 end, | ||||||
|  |         easefunction_t *ease, | ||||||
|  |         float_t duration | ||||||
|  |       ); | ||||||
|  |   }; | ||||||
|  | } | ||||||
| @@ -0,0 +1,50 @@ | |||||||
|  | // Copyright (c) 2023 Dominic Masters | ||||||
|  | //  | ||||||
|  | // This software is released under the MIT License. | ||||||
|  | // https://opensource.org/licenses/MIT | ||||||
|  |  | ||||||
|  | #include "VisualNovelTransformItemEvent.hpp" | ||||||
|  |  | ||||||
|  | using namespace Dawn; | ||||||
|  |  | ||||||
|  | VisualNovelTransformItemEvent::VisualNovelTransformItemEvent( | ||||||
|  |   VisualNovelManager *man, | ||||||
|  |   SceneItem *item, | ||||||
|  |   glm::vec3 start, | ||||||
|  |   glm::vec3 end, | ||||||
|  |   easefunction_t *ease, | ||||||
|  |   float_t duration | ||||||
|  | ) : VisualNovelSimpleCallbackAnimationEvent<glm::vec3, Transform>(man) { | ||||||
|  |   assertNotNull(item); | ||||||
|  |   this->item = item; | ||||||
|  |  | ||||||
|  |   this->callbackAnimation.setCallback( | ||||||
|  |     &item->transform, &Transform::setLocalPosition | ||||||
|  |   ); | ||||||
|  |   this->callbackAnimation.addKeyframe(0.0f, start); | ||||||
|  |   this->callbackAnimation.addKeyframe(duration, end); | ||||||
|  | } | ||||||
|  |  | ||||||
|  | VisualNovelTransformItemEvent::VisualNovelTransformItemEvent( | ||||||
|  |   VisualNovelManager *man, | ||||||
|  |   SceneItem *item, | ||||||
|  |   glm::vec3 end, | ||||||
|  |   easefunction_t *ease, | ||||||
|  |   float_t duration | ||||||
|  | ) : VisualNovelSimpleCallbackAnimationEvent<glm::vec3, Transform>(man) { | ||||||
|  |   assertNotNull(item); | ||||||
|  |   this->item = item; | ||||||
|  |  | ||||||
|  |   this->callbackAnimation.setCallback( | ||||||
|  |     &item->transform, &Transform::setLocalPosition | ||||||
|  |   ); | ||||||
|  |   this->relative = true; | ||||||
|  |   this->callbackAnimation.addKeyframe(duration, end); | ||||||
|  | } | ||||||
|  |  | ||||||
|  | void VisualNovelTransformItemEvent::onStart(IVisualNovelEvent *previous) { | ||||||
|  |   if(this->relative) { | ||||||
|  |     this->callbackAnimation.addKeyframe(0.0f, this->item->transform.getLocalPosition()); | ||||||
|  |   } | ||||||
|  |   VisualNovelSimpleCallbackAnimationEvent::onStart(previous); | ||||||
|  | } | ||||||
| @@ -25,17 +25,12 @@ void SimpleVNScene::stage() { | |||||||
|  |  | ||||||
|   // Camera |   // Camera | ||||||
|   this->camera = Camera::create(this); |   this->camera = Camera::create(this); | ||||||
|   // this->camera->item->addComponent<AudioListener>(); |  | ||||||
|   this->camera->transform->lookAtPixelPerfect( |   this->camera->transform->lookAtPixelPerfect( | ||||||
|     glm::vec3(0, 0, 0), |     glm::vec3(0, 0, 0), | ||||||
|     glm::vec3(0, 0, 0), |     glm::vec3(0, 0, 0), | ||||||
|     this->camera->getRenderTarget()->getHeight(), |     this->camera->getRenderTarget()->getHeight(), | ||||||
|     camera->fov |     camera->fov | ||||||
|   ); |   ); | ||||||
|    |  | ||||||
|   // Audio |  | ||||||
|   auto listenerItem = this->createSceneItem(); |  | ||||||
|   this->audioListener = listenerItem->addComponent<AudioListener>(); |  | ||||||
|  |  | ||||||
|   this->background = SimpleVisualNovelBackground::create(this); |   this->background = SimpleVisualNovelBackground::create(this); | ||||||
|  |  | ||||||
| @@ -49,6 +44,16 @@ void SimpleVNScene::stage() { | |||||||
|   // VN Manager |   // VN Manager | ||||||
|   auto vnManagerItem = this->createSceneItem(); |   auto vnManagerItem = this->createSceneItem(); | ||||||
|   this->vnManager = vnManagerItem->addComponent<VisualNovelManager>(); |   this->vnManager = vnManagerItem->addComponent<VisualNovelManager>(); | ||||||
|  |    | ||||||
|  |   // Audio | ||||||
|  |   auto listenerItem = this->createSceneItem(); | ||||||
|  |   this->audioListener = listenerItem->addComponent<AudioListener>(); | ||||||
|  |  | ||||||
|  |   auto audioBackgroundItem = this->createSceneItem(); | ||||||
|  |   vnManager->audioBackground = audioBackgroundItem->addComponent<AudioSource>(); | ||||||
|  |    | ||||||
|  |   auto audioCharacterItem = this->createSceneItem(); | ||||||
|  |   vnManager->audioCharacter = audioCharacterItem->addComponent<AudioSource>(); | ||||||
|  |  | ||||||
|   // Fader (Drawn over the top of everything else) |   // Fader (Drawn over the top of everything else) | ||||||
|   this->vnFader = VisualNovelFader::create(canvas); |   this->vnFader = VisualNovelFader::create(canvas); | ||||||
|   | |||||||
| @@ -5,6 +5,7 @@ | |||||||
|  |  | ||||||
| #include "VisualNovelTextbox.hpp" | #include "VisualNovelTextbox.hpp" | ||||||
| #include "game/DawnGame.hpp" | #include "game/DawnGame.hpp" | ||||||
|  | #include "visualnovel/VisualNovelManager.hpp" | ||||||
|  |  | ||||||
| using namespace Dawn; | using namespace Dawn; | ||||||
|  |  | ||||||
| @@ -43,10 +44,29 @@ void VisualNovelTextbox::show() { | |||||||
|   if(this->isVisible()) return; |   if(this->isVisible()) return; | ||||||
|   this->visible = true; |   this->visible = true; | ||||||
|   this->addChild(&this->selfParent); |   this->addChild(&this->selfParent); | ||||||
|  |  | ||||||
|  |   if(this->talkSound != nullptr) { | ||||||
|  |     auto vnManager = this->getVisualNovelManager(); | ||||||
|  |     assertNotNull(vnManager); | ||||||
|  |     assertNotNull(vnManager->audioCharacter); | ||||||
|  |  | ||||||
|  |     vnManager->audioCharacter->stop(); | ||||||
|  |     vnManager->audioCharacter->setAudioData(this->talkSound); | ||||||
|  |     vnManager->audioCharacter->loop = true; | ||||||
|  |     vnManager->audioCharacter->play(); | ||||||
|  |   } | ||||||
| } | } | ||||||
|  |  | ||||||
| void VisualNovelTextbox::hide() { | void VisualNovelTextbox::hide() { | ||||||
|   if(!this->isVisible()) return; |   if(!this->isVisible()) return; | ||||||
|  |  | ||||||
|  |   if(this->talkSound != nullptr) { | ||||||
|  |     auto vnManager = this->getVisualNovelManager(); | ||||||
|  |     assertNotNull(vnManager); | ||||||
|  |     assertNotNull(vnManager->audioCharacter); | ||||||
|  |     vnManager->audioCharacter->stop(); | ||||||
|  |   } | ||||||
|  |  | ||||||
|   this->visible = false; |   this->visible = false; | ||||||
|   this->removeChild(&this->selfParent); |   this->removeChild(&this->selfParent); | ||||||
|   this->eventHidden.invoke(); |   this->eventHidden.invoke(); | ||||||
| @@ -56,6 +76,10 @@ bool_t VisualNovelTextbox::isVisible() { | |||||||
|   return this->visible; |   return this->visible; | ||||||
| } | } | ||||||
|  |  | ||||||
|  | VisualNovelManager * VisualNovelTextbox::getVisualNovelManager() { | ||||||
|  |   return this->getScene()->findComponent<VisualNovelManager>(); | ||||||
|  | } | ||||||
|  |  | ||||||
| void VisualNovelTextbox::updatePositions() { | void VisualNovelTextbox::updatePositions() { | ||||||
|   UIComponent::updatePositions(); |   UIComponent::updatePositions(); | ||||||
|  |  | ||||||
| @@ -110,6 +134,15 @@ void VisualNovelTextbox::textboxOnSceneUpdate() { | |||||||
|         this->eventNewPage.invoke(); |         this->eventNewPage.invoke(); | ||||||
|       } |       } | ||||||
|     } |     } | ||||||
|  |      | ||||||
|  |  | ||||||
|  |     if(this->talkSound != nullptr) { | ||||||
|  |       auto vnManager = this->getVisualNovelManager(); | ||||||
|  |       assertNotNull(vnManager); | ||||||
|  |       assertNotNull(vnManager->audioCharacter); | ||||||
|  |       vnManager->audioCharacter->stop(); | ||||||
|  |     } | ||||||
|  |  | ||||||
|     return; |     return; | ||||||
|   } |   } | ||||||
|  |  | ||||||
| @@ -159,6 +192,11 @@ void VisualNovelTextbox::setText(std::string key, float_t fontSize) { | |||||||
|  |  | ||||||
| void VisualNovelTextbox::setCharacter(VisualNovelCharacter *character) { | void VisualNovelTextbox::setCharacter(VisualNovelCharacter *character) { | ||||||
|   this->character = character; |   this->character = character; | ||||||
|  |   this->talkSound = nullptr; | ||||||
|  | } | ||||||
|  |  | ||||||
|  | void VisualNovelTextbox::setTalkingSound(AudioAsset *asset) { | ||||||
|  |   this->talkSound = asset; | ||||||
| } | } | ||||||
|  |  | ||||||
| void VisualNovelTextbox::setText(std::string key) { | void VisualNovelTextbox::setText(std::string key) { | ||||||
|   | |||||||
| @@ -15,6 +15,8 @@ | |||||||
| #define VISUAL_NOVEL_TEXTBOX_SPEED_FASTER 40.0f | #define VISUAL_NOVEL_TEXTBOX_SPEED_FASTER 40.0f | ||||||
|  |  | ||||||
| namespace Dawn { | namespace Dawn { | ||||||
|  |   class VisualNovelManager; | ||||||
|  |  | ||||||
|   class VisualNovelTextbox : public UIComponent { |   class VisualNovelTextbox : public UIComponent { | ||||||
|     private: |     private: | ||||||
|       int32_t lineCurrent = 0; |       int32_t lineCurrent = 0; | ||||||
| @@ -23,6 +25,7 @@ namespace Dawn { | |||||||
|       float_t timeCharacter = 0.0f; |       float_t timeCharacter = 0.0f; | ||||||
|       bool_t visible = false; |       bool_t visible = false; | ||||||
|       VisualNovelCharacter *character = nullptr; |       VisualNovelCharacter *character = nullptr; | ||||||
|  |       AudioAsset *talkSound = nullptr; | ||||||
|  |  | ||||||
|       void updatePositions() override; |       void updatePositions() override; | ||||||
|        |        | ||||||
| @@ -67,6 +70,13 @@ namespace Dawn { | |||||||
|       void hide(); |       void hide(); | ||||||
|       bool_t isVisible(); |       bool_t isVisible(); | ||||||
|  |  | ||||||
|  |       /** | ||||||
|  |        * Returns the visual novel manager (if applicable). | ||||||
|  |        *  | ||||||
|  |        * @return Visual Novel Manager instance. | ||||||
|  |        */ | ||||||
|  |       VisualNovelManager * getVisualNovelManager(); | ||||||
|  |  | ||||||
|       /** |       /** | ||||||
|        * Sets the font for this vn textbox. Passed to the underlying label. |        * Sets the font for this vn textbox. Passed to the underlying label. | ||||||
|        *  |        *  | ||||||
| @@ -96,6 +106,14 @@ namespace Dawn { | |||||||
|        */ |        */ | ||||||
|       void setCharacter(VisualNovelCharacter *character); |       void setCharacter(VisualNovelCharacter *character); | ||||||
|  |  | ||||||
|  |       /** | ||||||
|  |        * Set the sound to use whenever the text is scrolling to represent a | ||||||
|  |        * character talking. | ||||||
|  |        *  | ||||||
|  |        * @param sound Sound asset to use. | ||||||
|  |        */ | ||||||
|  |       void setTalkingSound(AudioAsset *sound); | ||||||
|  |  | ||||||
|       /** |       /** | ||||||
|        * Sets the font size to use. |        * Sets the font size to use. | ||||||
|        *  |        *  | ||||||
|   | |||||||
| @@ -136,6 +136,18 @@ void AudioSource::setPlayMode(enum AudioSourcePlayMode playMode) { | |||||||
|   this->playMode = playMode; |   this->playMode = playMode; | ||||||
| } | } | ||||||
|  |  | ||||||
|  | void AudioSource::stop() { | ||||||
|  |   this->state = AUDIO_SOURCE_STATE_STOPPED; | ||||||
|  | } | ||||||
|  |  | ||||||
|  | void AudioSource::play() { | ||||||
|  |   this->state = AUDIO_SOURCE_STATE_PLAYING; | ||||||
|  | } | ||||||
|  |  | ||||||
|  | void AudioSource::pause() { | ||||||
|  |   this->state = AUDIO_SOURCE_STATE_PAUSED; | ||||||
|  | } | ||||||
|  |  | ||||||
| void AudioSource::onDispose() { | void AudioSource::onDispose() { | ||||||
|   assertTrue(this->ready); |   assertTrue(this->ready); | ||||||
|   this->ready = false; |   this->ready = false; | ||||||
| @@ -152,11 +164,12 @@ void AudioSource::onSceneUpdate() { | |||||||
|   ALint buffersProcessed; |   ALint buffersProcessed; | ||||||
|  |  | ||||||
|   assertTrue(this->ready); |   assertTrue(this->ready); | ||||||
|   assertTrue(this->data != nullptr); |  | ||||||
|   assertTrue(this->data->loaded); |  | ||||||
|  |  | ||||||
|   // What is the user trying to do? |   // What is the user trying to do? | ||||||
|   if(this->state == AUDIO_SOURCE_STATE_PLAYING) { |   if(this->state == AUDIO_SOURCE_STATE_PLAYING) { | ||||||
|  |     assertTrue(this->data != nullptr); | ||||||
|  |     assertTrue(this->data->loaded); | ||||||
|  |      | ||||||
|     // Handle the special game-paused music-paused state. |     // Handle the special game-paused music-paused state. | ||||||
|     if(this->playMode == AUDIO_PLAY_MODE_UNPAUSED && this->getGame()->timeManager.isPaused) { |     if(this->playMode == AUDIO_PLAY_MODE_UNPAUSED && this->getGame()->timeManager.isPaused) { | ||||||
|       if(this->internalState == AUDIO_SOURCE_STATE_PLAYING) { |       if(this->internalState == AUDIO_SOURCE_STATE_PLAYING) { | ||||||
| @@ -220,6 +233,9 @@ void AudioSource::onSceneUpdate() { | |||||||
|       assertUnreachable(); |       assertUnreachable(); | ||||||
|     } |     } | ||||||
|   } else if(this->state == AUDIO_SOURCE_STATE_PAUSED) { |   } else if(this->state == AUDIO_SOURCE_STATE_PAUSED) { | ||||||
|  |     assertTrue(this->data != nullptr); | ||||||
|  |     assertTrue(this->data->loaded); | ||||||
|  |      | ||||||
|     // Pause has been requested. |     // Pause has been requested. | ||||||
|     if(this->internalState != AUDIO_SOURCE_STATE_PLAYING) return; |     if(this->internalState != AUDIO_SOURCE_STATE_PLAYING) return; | ||||||
|  |  | ||||||
| @@ -231,6 +247,9 @@ void AudioSource::onSceneUpdate() { | |||||||
|   } else if(this->state == AUDIO_SOURCE_STATE_STOPPED) { |   } else if(this->state == AUDIO_SOURCE_STATE_STOPPED) { | ||||||
|     if(this->internalState == AUDIO_SOURCE_STATE_STOPPED) return; |     if(this->internalState == AUDIO_SOURCE_STATE_STOPPED) return; | ||||||
|      |      | ||||||
|  |     assertTrue(this->data != nullptr); | ||||||
|  |     assertTrue(this->data->loaded); | ||||||
|  |      | ||||||
|     // Release the buffers |     // Release the buffers | ||||||
|     alSourceStop(this->source); |     alSourceStop(this->source); | ||||||
|     this->detatchBuffers(); |     this->detatchBuffers(); | ||||||
|   | |||||||
| @@ -112,6 +112,21 @@ namespace Dawn { | |||||||
|        */ |        */ | ||||||
|       void setPlayMode(enum AudioSourcePlayMode mode); |       void setPlayMode(enum AudioSourcePlayMode mode); | ||||||
|  |  | ||||||
|  |       /** | ||||||
|  |        * Stop playing this audio source. Shorthand for setting the state. | ||||||
|  |        */ | ||||||
|  |       void stop(); | ||||||
|  |  | ||||||
|  |       /** | ||||||
|  |        * Play this audio source. Shorthand for state setting. | ||||||
|  |        */ | ||||||
|  |       void play(); | ||||||
|  |  | ||||||
|  |       /** | ||||||
|  |        * Pause this audio source. Shorthand for state setting. | ||||||
|  |        */ | ||||||
|  |       void pause(); | ||||||
|  |  | ||||||
|       void onStart() override; |       void onStart() override; | ||||||
|       void onDispose() override; |       void onDispose() override; | ||||||
|   }; |   }; | ||||||
|   | |||||||
| @@ -36,7 +36,7 @@ tool_tileset(tileset_death texture_death ${DIR_GAME_ASSETS}/characters/death/she | |||||||
|  |  | ||||||
| tool_truetype(truetype_alice ${DIR_GAME_ASSETS}/font/Alice-Regular.ttf truetype_alice 2048 2048 120) | tool_truetype(truetype_alice ${DIR_GAME_ASSETS}/font/Alice-Regular.ttf truetype_alice 2048 2048 120) | ||||||
|  |  | ||||||
| tool_audio(audio_test borrowed/sample_long.wav) | tool_audio(audio_test borrowed/sample_short.wav) | ||||||
|  |  | ||||||
| add_dependencies(${DAWN_TARGET_NAME} | add_dependencies(${DAWN_TARGET_NAME} | ||||||
|   language_en |   language_en | ||||||
|   | |||||||
| @@ -25,7 +25,7 @@ int32_t DawnGame::init() { | |||||||
|   this->renderManager.init(); |   this->renderManager.init(); | ||||||
|   this->audioManager.init(); |   this->audioManager.init(); | ||||||
|  |  | ||||||
|   this->scene = new SubSceneRendererScene<Scene_1>(this); |   this->scene = new Scene_1(this); | ||||||
|    |    | ||||||
|   return DAWN_GAME_INIT_RESULT_SUCCESS; |   return DAWN_GAME_INIT_RESULT_SUCCESS; | ||||||
| } | } | ||||||
|   | |||||||
| @@ -18,10 +18,13 @@ namespace Dawn { | |||||||
|       VisualNovelCharacter *vnCharacter; |       VisualNovelCharacter *vnCharacter; | ||||||
|       AnimationController *animation; |       AnimationController *animation; | ||||||
|  |  | ||||||
|  |       struct VisualNovelCharacterEmotion emotionDefault; | ||||||
|  |  | ||||||
|       static std::vector<Asset*> prefabAssets(AssetManager *assMan) { |       static std::vector<Asset*> prefabAssets(AssetManager *assMan) { | ||||||
|         return std::vector<Asset*>{ |         return std::vector<Asset*>{ | ||||||
|           assMan->get<TextureAsset>("texture_death"), |           assMan->get<TextureAsset>("texture_death"), | ||||||
|           assMan->get<TilesetAsset>("tileset_death") |           assMan->get<TilesetAsset>("tileset_death"), | ||||||
|  |           assMan->get<AudioAsset>("audio_test") | ||||||
|         }; |         }; | ||||||
|       } |       } | ||||||
|  |  | ||||||
| @@ -33,6 +36,10 @@ namespace Dawn { | |||||||
|       void prefabInit(AssetManager *man) override { |       void prefabInit(AssetManager *man) override { | ||||||
|         auto textureAsset = man->get<TextureAsset>("texture_death"); |         auto textureAsset = man->get<TextureAsset>("texture_death"); | ||||||
|         auto tilesetAsset = man->get<TilesetAsset>("tileset_death"); |         auto tilesetAsset = man->get<TilesetAsset>("tileset_death"); | ||||||
|  |         auto audioAsset = man->get<AudioAsset>("audio_test"); | ||||||
|  |  | ||||||
|  |         // Emotions | ||||||
|  |         this->emotionDefault.talkSound = audioAsset; | ||||||
|  |  | ||||||
|         auto meshRenderer = this->addComponent<MeshRenderer>(); |         auto meshRenderer = this->addComponent<MeshRenderer>(); | ||||||
|         auto meshHost = this->addComponent<MeshHost>(); |         auto meshHost = this->addComponent<MeshHost>(); | ||||||
| @@ -48,6 +55,8 @@ namespace Dawn { | |||||||
|         auto tiledSprite = this->addComponent<TiledSprite>(); |         auto tiledSprite = this->addComponent<TiledSprite>(); | ||||||
|         tiledSprite->setTilesetAndSize(&tilesetAsset->tileset); |         tiledSprite->setTilesetAndSize(&tilesetAsset->tileset); | ||||||
|         tiledSprite->setTile(0); |         tiledSprite->setTile(0); | ||||||
|  |  | ||||||
|  |         this->addComponent<AudioSource>(); | ||||||
|          |          | ||||||
|         this->transform.setLocalPosition(glm::vec3(0, 0, 0));  |         this->transform.setLocalPosition(glm::vec3(0, 0, 0));  | ||||||
|       } |       } | ||||||
|   | |||||||
| @@ -23,6 +23,6 @@ std::vector<Asset*> PixelVNScene::getRequiredAssets() { | |||||||
|  |  | ||||||
| void PixelVNScene::vnStage() { | void PixelVNScene::vnStage() { | ||||||
|   this->renderTarget.setClearColor(COLOR_RED); |   this->renderTarget.setClearColor(COLOR_RED); | ||||||
|   this->camera->setRenderTarget(&this->renderTarget); |   // this->camera->setRenderTarget(&this->renderTarget); | ||||||
|   auto pixelPerfectCamera = this->camera->item->addComponent<PixelPerfectCamera>(); |   auto pixelPerfectCamera = this->camera->item->addComponent<PixelPerfectCamera>(); | ||||||
| } | } | ||||||
| @@ -7,23 +7,19 @@ | |||||||
| #include "scenes/PixelVNScene.hpp" | #include "scenes/PixelVNScene.hpp" | ||||||
| #include "scenes/Scene_2.hpp" | #include "scenes/Scene_2.hpp" | ||||||
| #include "prefabs/characters/DeathPrefab.hpp" | #include "prefabs/characters/DeathPrefab.hpp" | ||||||
| #include "scene/components/audio/AudioListener.hpp" |  | ||||||
| #include "scene/components/audio/AudioSource.hpp" |  | ||||||
| #include "visualnovel/events/characters/VisualNovelFadeCharacterEvent.hpp" | #include "visualnovel/events/characters/VisualNovelFadeCharacterEvent.hpp" | ||||||
|  | #include "visualnovel/events/characters/VIsualNovelTransformItemEvent.hpp" | ||||||
| #include "visualnovel/events/timing/VisualNovelBatchEvent.hpp" | #include "visualnovel/events/timing/VisualNovelBatchEvent.hpp" | ||||||
|  |  | ||||||
| namespace Dawn { | namespace Dawn { | ||||||
|   class Scene_1 : public PixelVNScene { |   class Scene_1 : public PixelVNScene { | ||||||
|     protected: |     protected: | ||||||
|       DeathPrefab *death; |       DeathPrefab *death; | ||||||
|       DeathPrefab *death2; |  | ||||||
|  |  | ||||||
|       void vnStage() override { |       void vnStage() override { | ||||||
|         PixelVNScene::vnStage(); |         PixelVNScene::vnStage(); | ||||||
|          |          | ||||||
|         this->death = DeathPrefab::create(this); |         this->death = DeathPrefab::create(this); | ||||||
|         this->death2 = DeathPrefab::create(this); |  | ||||||
|         this->death2->transform.setLocalPosition(glm::vec3(100, 0, 0)); |  | ||||||
|       } |       } | ||||||
|  |  | ||||||
|       void onSceneEnded() { |       void onSceneEnded() { | ||||||
| @@ -52,26 +48,7 @@ namespace Dawn { | |||||||
|       IVisualNovelEvent * getVNEvent() override { |       IVisualNovelEvent * getVNEvent() override { | ||||||
|         auto start = new VisualNovelPauseEvent(vnManager, 0.1f); |         auto start = new VisualNovelPauseEvent(vnManager, 0.1f); | ||||||
|         start |         start | ||||||
|           ->then(new VisualNovelBatchEvent( |           ->then(new VisualNovelTextboxEvent(vnManager, this->death->vnCharacter, this->death->emotionDefault, "scene.1.1")) | ||||||
|             vnManager, |  | ||||||
|             std::vector<IVisualNovelEvent*>{ |  | ||||||
|               new VisualNovelFadeCharacterEvent( |  | ||||||
|                 vnManager, |  | ||||||
|                 this->death->vnCharacter, |  | ||||||
|                 true, |  | ||||||
|                 &easeLinear, |  | ||||||
|                 2.0f |  | ||||||
|               ), |  | ||||||
|               new VisualNovelFadeCharacterEvent( |  | ||||||
|                 vnManager, |  | ||||||
|                 this->death2->vnCharacter, |  | ||||||
|                 false, |  | ||||||
|                 &easeLinear, |  | ||||||
|                 2.0f |  | ||||||
|               ) |  | ||||||
|             } |  | ||||||
|           )) |  | ||||||
|           ->then(new VisualNovelTextboxEvent(vnManager, nullptr, "scene.1.1")) |  | ||||||
|           // ->then(new VisualNovelCallbackEvent<Scene_1>(vnManager, this, &Scene_1::onSceneEnded)) |           // ->then(new VisualNovelCallbackEvent<Scene_1>(vnManager, this, &Scene_1::onSceneEnded)) | ||||||
|         ; |         ; | ||||||
|         return start; |         return start; | ||||||
|   | |||||||
| @@ -36,7 +36,7 @@ namespace Dawn { | |||||||
|       IVisualNovelEvent * getVNEvent() override { |       IVisualNovelEvent * getVNEvent() override { | ||||||
|         auto start = new VisualNovelPauseEvent(vnManager, 0.1f); |         auto start = new VisualNovelPauseEvent(vnManager, 0.1f); | ||||||
|         start |         start | ||||||
|           ->then(new VisualNovelTextboxEvent(vnManager, nullptr, "scene.10.1")) |           ->then(new VisualNovelTextboxEvent(vnManager, "scene.10.1")) | ||||||
|           ->then(new VisualNovelCallbackEvent<Scene_10>(vnManager, this, &Scene_10::onSceneEnded)) |           ->then(new VisualNovelCallbackEvent<Scene_10>(vnManager, this, &Scene_10::onSceneEnded)) | ||||||
|         ; |         ; | ||||||
|         return start; |         return start; | ||||||
|   | |||||||
| @@ -36,7 +36,7 @@ namespace Dawn { | |||||||
|       IVisualNovelEvent * getVNEvent() override { |       IVisualNovelEvent * getVNEvent() override { | ||||||
|         auto start = new VisualNovelPauseEvent(vnManager, 0.1f); |         auto start = new VisualNovelPauseEvent(vnManager, 0.1f); | ||||||
|         start |         start | ||||||
|           ->then(new VisualNovelTextboxEvent(vnManager, nullptr, "scene.11.1")) |           ->then(new VisualNovelTextboxEvent(vnManager, "scene.11.1")) | ||||||
|           ->then(new VisualNovelCallbackEvent<Scene_11>(vnManager, this, &Scene_11::onSceneEnded)) |           ->then(new VisualNovelCallbackEvent<Scene_11>(vnManager, this, &Scene_11::onSceneEnded)) | ||||||
|         ; |         ; | ||||||
|         return start; |         return start; | ||||||
|   | |||||||
| @@ -56,7 +56,7 @@ namespace Dawn { | |||||||
|       } |       } | ||||||
|  |  | ||||||
|       IVisualNovelEvent * getVNEvent() override { |       IVisualNovelEvent * getVNEvent() override { | ||||||
|         auto start = new VisualNovelTextboxEvent(vnManager, penny->vnCharacter, "scene.12.1"); |         auto start = new VisualNovelTextboxEvent(vnManager, "scene.12.1"); | ||||||
|         start |         start | ||||||
|           ->then(new VisualNovelCallbackEvent<Scene_12>(vnManager, this, &Scene_12::onSceneEnded)) |           ->then(new VisualNovelCallbackEvent<Scene_12>(vnManager, this, &Scene_12::onSceneEnded)) | ||||||
|         ; |         ; | ||||||
|   | |||||||
| @@ -36,7 +36,7 @@ namespace Dawn { | |||||||
|       IVisualNovelEvent * getVNEvent() override { |       IVisualNovelEvent * getVNEvent() override { | ||||||
|         auto start = new VisualNovelPauseEvent(vnManager, 0.1f); |         auto start = new VisualNovelPauseEvent(vnManager, 0.1f); | ||||||
|         start |         start | ||||||
|           ->then(new VisualNovelTextboxEvent(vnManager, nullptr, "scene.13.1")) |           ->then(new VisualNovelTextboxEvent(vnManager, "scene.13.1")) | ||||||
|           ->then(new VisualNovelCallbackEvent<Scene_13>(vnManager, this, &Scene_13::onSceneEnded)) |           ->then(new VisualNovelCallbackEvent<Scene_13>(vnManager, this, &Scene_13::onSceneEnded)) | ||||||
|         ; |         ; | ||||||
|         return start; |         return start; | ||||||
|   | |||||||
| @@ -36,7 +36,7 @@ namespace Dawn { | |||||||
|       IVisualNovelEvent * getVNEvent() override { |       IVisualNovelEvent * getVNEvent() override { | ||||||
|         auto start = new VisualNovelPauseEvent(vnManager, 0.1f); |         auto start = new VisualNovelPauseEvent(vnManager, 0.1f); | ||||||
|         start |         start | ||||||
|           ->then(new VisualNovelTextboxEvent(vnManager, nullptr, "scene.14.1")) |           ->then(new VisualNovelTextboxEvent(vnManager, "scene.14.1")) | ||||||
|           ->then(new VisualNovelCallbackEvent<Scene_14>(vnManager, this, &Scene_14::onSceneEnded)) |           ->then(new VisualNovelCallbackEvent<Scene_14>(vnManager, this, &Scene_14::onSceneEnded)) | ||||||
|         ; |         ; | ||||||
|         return start; |         return start; | ||||||
|   | |||||||
| @@ -36,7 +36,7 @@ namespace Dawn { | |||||||
|       IVisualNovelEvent * getVNEvent() override { |       IVisualNovelEvent * getVNEvent() override { | ||||||
|         auto start = new VisualNovelPauseEvent(vnManager, 0.1f); |         auto start = new VisualNovelPauseEvent(vnManager, 0.1f); | ||||||
|         start |         start | ||||||
|           ->then(new VisualNovelTextboxEvent(vnManager, nullptr, "scene.15.1")) |           ->then(new VisualNovelTextboxEvent(vnManager, "scene.15.1")) | ||||||
|           ->then(new VisualNovelCallbackEvent<Scene_15>(vnManager, this, &Scene_15::onSceneEnded)) |           ->then(new VisualNovelCallbackEvent<Scene_15>(vnManager, this, &Scene_15::onSceneEnded)) | ||||||
|         ; |         ; | ||||||
|         return start; |         return start; | ||||||
|   | |||||||
| @@ -35,7 +35,7 @@ namespace Dawn { | |||||||
|       IVisualNovelEvent * getVNEvent() override { |       IVisualNovelEvent * getVNEvent() override { | ||||||
|         auto start = new VisualNovelPauseEvent(vnManager, 0.1f); |         auto start = new VisualNovelPauseEvent(vnManager, 0.1f); | ||||||
|         start |         start | ||||||
|           ->then(new VisualNovelTextboxEvent(vnManager, nullptr, "scene.16.1")) |           ->then(new VisualNovelTextboxEvent(vnManager, "scene.16.1")) | ||||||
|           ->then(new VisualNovelCallbackEvent<Scene_16>(vnManager, this, &Scene_16::onSceneEnded)) |           ->then(new VisualNovelCallbackEvent<Scene_16>(vnManager, this, &Scene_16::onSceneEnded)) | ||||||
|         ; |         ; | ||||||
|         return start; |         return start; | ||||||
|   | |||||||
| @@ -56,7 +56,7 @@ namespace Dawn { | |||||||
|       } |       } | ||||||
|  |  | ||||||
|       IVisualNovelEvent * getVNEvent() override { |       IVisualNovelEvent * getVNEvent() override { | ||||||
|         auto start = new VisualNovelTextboxEvent(vnManager, penny->vnCharacter, "scene.17.1"); |         auto start = new VisualNovelTextboxEvent(vnManager, "scene.17.1"); | ||||||
|         start |         start | ||||||
|           ->then(new VisualNovelCallbackEvent<Scene_17>(vnManager, this, &Scene_17::onSceneEnded)) |           ->then(new VisualNovelCallbackEvent<Scene_17>(vnManager, this, &Scene_17::onSceneEnded)) | ||||||
|         ; |         ; | ||||||
|   | |||||||
| @@ -28,7 +28,7 @@ namespace Dawn { | |||||||
|       IVisualNovelEvent * getVNEvent() override { |       IVisualNovelEvent * getVNEvent() override { | ||||||
|         auto start = new VisualNovelPauseEvent(vnManager, 0.1f); |         auto start = new VisualNovelPauseEvent(vnManager, 0.1f); | ||||||
|         start |         start | ||||||
|           ->then(new VisualNovelTextboxEvent(vnManager, nullptr, "scene.18.1")) |           ->then(new VisualNovelTextboxEvent(vnManager, "scene.18.1")) | ||||||
|           ->then(new VisualNovelCallbackEvent<Scene_18>(vnManager, this, &Scene_18::onSceneEnded)) |           ->then(new VisualNovelCallbackEvent<Scene_18>(vnManager, this, &Scene_18::onSceneEnded)) | ||||||
|         ; |         ; | ||||||
|         return start; |         return start; | ||||||
|   | |||||||
| @@ -37,7 +37,7 @@ namespace Dawn { | |||||||
|       IVisualNovelEvent * getVNEvent() override { |       IVisualNovelEvent * getVNEvent() override { | ||||||
|         auto start = new VisualNovelPauseEvent(vnManager, 0.1f); |         auto start = new VisualNovelPauseEvent(vnManager, 0.1f); | ||||||
|         start |         start | ||||||
|           ->then(new VisualNovelTextboxEvent(vnManager, nullptr, "scene.2.1")) |           ->then(new VisualNovelTextboxEvent(vnManager, "scene.2.1")) | ||||||
|           ->then(new VisualNovelCallbackEvent<Scene_2>(vnManager, this, &Scene_2::onSceneEnded)) |           ->then(new VisualNovelCallbackEvent<Scene_2>(vnManager, this, &Scene_2::onSceneEnded)) | ||||||
|         ; |         ; | ||||||
|         return start; |         return start; | ||||||
|   | |||||||
| @@ -37,7 +37,7 @@ namespace Dawn { | |||||||
|       IVisualNovelEvent * getVNEvent() override { |       IVisualNovelEvent * getVNEvent() override { | ||||||
|         auto start = new VisualNovelPauseEvent(vnManager, 0.1f); |         auto start = new VisualNovelPauseEvent(vnManager, 0.1f); | ||||||
|         start |         start | ||||||
|           ->then(new VisualNovelTextboxEvent(vnManager, nullptr, "scene.3.1")) |           ->then(new VisualNovelTextboxEvent(vnManager, "scene.3.1")) | ||||||
|           ->then(new VisualNovelCallbackEvent<Scene_3>(vnManager, this, &Scene_3::onSceneEnded)) |           ->then(new VisualNovelCallbackEvent<Scene_3>(vnManager, this, &Scene_3::onSceneEnded)) | ||||||
|         ; |         ; | ||||||
|         return start; |         return start; | ||||||
|   | |||||||
| @@ -56,7 +56,7 @@ namespace Dawn { | |||||||
|       } |       } | ||||||
|  |  | ||||||
|       IVisualNovelEvent * getVNEvent() override { |       IVisualNovelEvent * getVNEvent() override { | ||||||
|         auto start = new VisualNovelTextboxEvent(vnManager, penny->vnCharacter, "scene.4.1"); |         auto start = new VisualNovelTextboxEvent(vnManager, "scene.4.1"); | ||||||
|         start |         start | ||||||
|           ->then(new VisualNovelCallbackEvent<Scene_4>(vnManager, this, &Scene_4::onSceneEnded)) |           ->then(new VisualNovelCallbackEvent<Scene_4>(vnManager, this, &Scene_4::onSceneEnded)) | ||||||
|         ; |         ; | ||||||
|   | |||||||
| @@ -37,7 +37,7 @@ namespace Dawn { | |||||||
|       IVisualNovelEvent * getVNEvent() override { |       IVisualNovelEvent * getVNEvent() override { | ||||||
|         auto start = new VisualNovelPauseEvent(vnManager, 0.1f); |         auto start = new VisualNovelPauseEvent(vnManager, 0.1f); | ||||||
|         start |         start | ||||||
|           ->then(new VisualNovelTextboxEvent(vnManager, nullptr, "scene.5.1")) |           ->then(new VisualNovelTextboxEvent(vnManager, "scene.5.1")) | ||||||
|           ->then(new VisualNovelCallbackEvent<Scene_5>(vnManager, this, &Scene_5::onSceneEnded)) |           ->then(new VisualNovelCallbackEvent<Scene_5>(vnManager, this, &Scene_5::onSceneEnded)) | ||||||
|         ; |         ; | ||||||
|         return start; |         return start; | ||||||
|   | |||||||
| @@ -37,7 +37,7 @@ namespace Dawn { | |||||||
|       IVisualNovelEvent * getVNEvent() override { |       IVisualNovelEvent * getVNEvent() override { | ||||||
|         auto start = new VisualNovelPauseEvent(vnManager, 0.1f); |         auto start = new VisualNovelPauseEvent(vnManager, 0.1f); | ||||||
|         start |         start | ||||||
|           ->then(new VisualNovelTextboxEvent(vnManager, nullptr, "scene.6.1")) |           ->then(new VisualNovelTextboxEvent(vnManager, "scene.6.1")) | ||||||
|           ->then(new VisualNovelCallbackEvent<Scene_6>(vnManager, this, &Scene_6::onSceneEnded)) |           ->then(new VisualNovelCallbackEvent<Scene_6>(vnManager, this, &Scene_6::onSceneEnded)) | ||||||
|         ; |         ; | ||||||
|         return start; |         return start; | ||||||
|   | |||||||
| @@ -36,7 +36,7 @@ namespace Dawn { | |||||||
|       IVisualNovelEvent * getVNEvent() override { |       IVisualNovelEvent * getVNEvent() override { | ||||||
|         auto start = new VisualNovelPauseEvent(vnManager, 0.1f); |         auto start = new VisualNovelPauseEvent(vnManager, 0.1f); | ||||||
|         start |         start | ||||||
|           ->then(new VisualNovelTextboxEvent(vnManager, nullptr, "scene.7.1")) |           ->then(new VisualNovelTextboxEvent(vnManager, "scene.7.1")) | ||||||
|           ->then(new VisualNovelCallbackEvent<Scene_7>(vnManager, this, &Scene_7::onSceneEnded)) |           ->then(new VisualNovelCallbackEvent<Scene_7>(vnManager, this, &Scene_7::onSceneEnded)) | ||||||
|         ; |         ; | ||||||
|         return start; |         return start; | ||||||
|   | |||||||
| @@ -56,7 +56,7 @@ namespace Dawn { | |||||||
|       } |       } | ||||||
|  |  | ||||||
|       IVisualNovelEvent * getVNEvent() override { |       IVisualNovelEvent * getVNEvent() override { | ||||||
|         auto start = new VisualNovelTextboxEvent(vnManager, penny->vnCharacter, "scene.8.1"); |         auto start = new VisualNovelTextboxEvent(vnManager, "scene.8.1"); | ||||||
|         start |         start | ||||||
|           ->then(new VisualNovelCallbackEvent<Scene_8>(vnManager, this, &Scene_8::onSceneEnded)) |           ->then(new VisualNovelCallbackEvent<Scene_8>(vnManager, this, &Scene_8::onSceneEnded)) | ||||||
|         ; |         ; | ||||||
|   | |||||||
| @@ -36,7 +36,7 @@ namespace Dawn { | |||||||
|       IVisualNovelEvent * getVNEvent() override { |       IVisualNovelEvent * getVNEvent() override { | ||||||
|         auto start = new VisualNovelPauseEvent(vnManager, 0.1f); |         auto start = new VisualNovelPauseEvent(vnManager, 0.1f); | ||||||
|         start |         start | ||||||
|           ->then(new VisualNovelTextboxEvent(vnManager, nullptr, "scene.9.1")) |           ->then(new VisualNovelTextboxEvent(vnManager, "scene.9.1")) | ||||||
|           ->then(new VisualNovelCallbackEvent<Scene_9>(vnManager, this, &Scene_9::onSceneEnded)) |           ->then(new VisualNovelCallbackEvent<Scene_9>(vnManager, this, &Scene_9::onSceneEnded)) | ||||||
|         ; |         ; | ||||||
|         return start; |         return start; | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user