-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
52 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
#ifndef FADE_OUT_PIXEL_TRANSITION_EFFECT_H | ||
#define FADE_OUT_PIXEL_TRANSITION_EFFECT_H | ||
|
||
#include <libgba-sprite-engine/effects/scene_effect.h> | ||
#include <libgba-sprite-engine/scene.h> | ||
|
||
#include "utils/EffectUtils.h" | ||
#include "utils/SceneUtils.h" | ||
|
||
const u32 FINAL_OPACITY = 15; | ||
const u32 FINAL_MOSAIC = 10; | ||
|
||
class FadeOutPixelTransitionEffect : public SceneEffect { | ||
public: | ||
FadeOutPixelTransitionEffect(){}; | ||
|
||
void update() override { | ||
EFFECT_setBlendAlpha(opacity * 3 / 4); | ||
EFFECT_setMosaic(mosaic); | ||
|
||
if (opacity * 3 / 4 < FINAL_OPACITY) | ||
opacity++; | ||
else | ||
mosaic++; | ||
|
||
if (isDone()) | ||
BACKGROUND_enable(false, false, false, false); | ||
} | ||
|
||
bool isDone() override { return mosaic >= FINAL_MOSAIC; } | ||
|
||
private: | ||
u32 opacity = 0; | ||
u32 mosaic = 0; | ||
}; | ||
|
||
#endif // FADE_OUT_PIXEL_TRANSITION_EFFECT_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters