v1.4.4
This commit is contained in:
commit
9c94d113d3
10260 changed files with 1237388 additions and 0 deletions
74
source/game/StarEffectSourceDatabase.hpp
Normal file
74
source/game/StarEffectSourceDatabase.hpp
Normal file
|
@ -0,0 +1,74 @@
|
|||
#ifndef STAR_EFFECT_SOURCE_DATABASE_HPP
|
||||
#define STAR_EFFECT_SOURCE_DATABASE_HPP
|
||||
|
||||
#include "StarVector.hpp"
|
||||
#include "StarJson.hpp"
|
||||
#include "StarThread.hpp"
|
||||
#include "StarParticle.hpp"
|
||||
|
||||
namespace Star {
|
||||
|
||||
STAR_CLASS(AudioInstance);
|
||||
STAR_CLASS(EffectSource);
|
||||
STAR_CLASS(EffectSourceConfig);
|
||||
STAR_CLASS(EffectSourceDatabase);
|
||||
|
||||
class EffectSource {
|
||||
public:
|
||||
EffectSource(String const& kind, String suggestedSpawnLocation, Json const& definition);
|
||||
String const& kind() const;
|
||||
void tick();
|
||||
bool expired() const;
|
||||
void stop();
|
||||
List<String> particles();
|
||||
List<AudioInstancePtr> sounds(Vec2F offset);
|
||||
void postRender();
|
||||
String effectSpawnLocation() const;
|
||||
String suggestedSpawnLocation() const;
|
||||
|
||||
private:
|
||||
String m_kind;
|
||||
Json m_config;
|
||||
bool m_loops;
|
||||
float m_loopDuration;
|
||||
float m_durationVariance;
|
||||
String m_effectSpawnLocation;
|
||||
String m_suggestedSpawnLocation;
|
||||
|
||||
bool m_initialTick;
|
||||
bool m_loopTick;
|
||||
bool m_finalTick;
|
||||
float m_timer;
|
||||
bool m_expired;
|
||||
bool m_stop;
|
||||
|
||||
List<AudioInstancePtr> m_mainSounds;
|
||||
};
|
||||
|
||||
class EffectSourceConfig {
|
||||
public:
|
||||
EffectSourceConfig(Json const& config);
|
||||
String const& kind();
|
||||
EffectSourcePtr instance(String const& suggestedSpawnLocation);
|
||||
|
||||
private:
|
||||
String m_kind;
|
||||
Json m_config;
|
||||
};
|
||||
|
||||
class EffectSourceDatabase {
|
||||
public:
|
||||
EffectSourceDatabase();
|
||||
|
||||
EffectSourceConfigPtr effectSourceConfig(String const& kind) const;
|
||||
|
||||
private:
|
||||
StringMap<EffectSourceConfigPtr> m_sourceConfigs;
|
||||
};
|
||||
|
||||
List<Particle> particlesFromDefinition(Json const& config, Vec2F const& position = Vec2F());
|
||||
List<AudioInstancePtr> soundsFromDefinition(Json const& config, Vec2F const& position = Vec2F());
|
||||
|
||||
}
|
||||
|
||||
#endif
|
Loading…
Add table
Add a link
Reference in a new issue