diff --git a/sjplayer/src/sjplayer/PostEffect.d b/sjplayer/src/sjplayer/PostEffect.d index 15274f0..39038c2 100644 --- a/sjplayer/src/sjplayer/PostEffect.d +++ b/sjplayer/src/sjplayer/PostEffect.d @@ -12,7 +12,7 @@ class PostEffect { struct Instance { public: /// - align(1) float raster_fineness = 0; + align(1) float raster_fineness = 600; /// align(1) float raster_width = 0; diff --git a/sjplayer/src/sjplayer/PostEffectController.d b/sjplayer/src/sjplayer/PostEffectController.d index c907f0c..3885ab1 100644 --- a/sjplayer/src/sjplayer/PostEffectController.d +++ b/sjplayer/src/sjplayer/PostEffectController.d @@ -15,6 +15,11 @@ import sjplayer.AbstractScheduledController, /// class PostEffectController : PostEffectScheduledController, PostEffectControllerInterface { public: + /// + enum DamagedEffectLength = 30; + /// + enum DamagedEffectRasterWidth = 0.1; + /// this( PostEffect posteffect, @@ -25,12 +30,20 @@ class PostEffectController : PostEffectScheduledController, PostEffectController } override void CauseDamagedEffect() { + damaged_effect_frame_ = DamagedEffectLength; } override void Update() { + if (damaged_effect_frame_ > 0) damaged_effect_frame_--; + + posteffect_.raster_width = + damaged_effect_frame_*1f / DamagedEffectLength * + DamagedEffectRasterWidth; } private: PostEffect posteffect_; + + int damaged_effect_frame_; } private alias PostEffectScheduledController = ScheduledController!( diff --git a/sjplayer/standalone/main.d b/sjplayer/standalone/main.d index fc3dade..96056de 100644 --- a/sjplayer/standalone/main.d +++ b/sjplayer/standalone/main.d @@ -60,6 +60,7 @@ int main(string[] args) { const dmg = context.CalculateDamage(); if (dmg.damage != 0) { "damage: %f (%f)".writefln(dmg.damage, beat); + context.posteffect.CauseDamagedEffect(); } if (dmg.nearness != 0) { "nearby: %f (%f)".writefln(dmg.nearness, beat);