Skip to content

Commit

Permalink
Traktor: Added "playing" and "stop" methods to Theater component.
Browse files Browse the repository at this point in the history
  • Loading branch information
apistol78 committed Apr 22, 2024
1 parent c552ade commit f5a12bb
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
2 changes: 2 additions & 0 deletions code/Theater/TheaterClassFactory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ T_IMPLEMENT_RTTI_FACTORY_CLASS(L"traktor.scene.TheaterClassFactory", 0, TheaterC
void TheaterClassFactory::createClasses(IRuntimeClassRegistrar* registrar) const
{
auto classTheaterComponent = new AutoRuntimeClass< TheaterComponent >();
classTheaterComponent->addProperty("playing", &TheaterComponent::isPlaying);
classTheaterComponent->addMethod("play", &TheaterComponent::play);
classTheaterComponent->addMethod("stop", &TheaterComponent::stop);
registrar->registerClass(classTheaterComponent);
}

Expand Down
8 changes: 7 additions & 1 deletion code/Theater/TheaterComponent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ void TheaterComponent::update(world::World* world, const world::UpdateParams& up
return;

// Evaluate current act.
m_act->update(world, update.totalTime - m_timeStart, update.deltaTime);
if (!m_act->update(world, update.totalTime - m_timeStart, update.deltaTime))
m_act = nullptr;

m_timeLast = update.totalTime;
}
Expand All @@ -74,4 +75,9 @@ bool TheaterComponent::play(const std::wstring& actName)
return true;
}

void TheaterComponent::stop()
{
m_act = nullptr;
}

}
4 changes: 4 additions & 0 deletions code/Theater/TheaterComponent.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ class T_DLLCLASS TheaterComponent : public world::IWorldComponent

bool play(const std::wstring& actName);

void stop();

bool isPlaying() const { return m_act != nullptr; }

private:
friend class TheaterComponentEditor;

Expand Down

0 comments on commit f5a12bb

Please sign in to comment.