Refactoring transition


Day 2-4

English isn't my first language, so I might write some broken English.

I'll keep this one short (because I'm so tired now).

1. Made a font assets from some free fonts (galmuri(Korean alphabet font), m6x11)

(disclaimer: above image is just a test, not included in the today's github tag.)

(Plus, I've included license of the font on my source code.)

I wanted my game to support English and also Korean, so I had to apply a 한글(Hanguel, the Korean alphabet) font.

Which was... quite cumbersome to do it.

I've only put 2,355 glyphs (which is only 21% of whole Hangeul, but it's already a massive pain to find a workaround.)

I've even encountered compiler complaining: "constexpr evaluation limit reached", so I had to comment out some asserts in the engine.



2. Refactored Transition effect to seperate class, so that I can also use it on other scenes.

and I've also added the functionality to enable all kinds of transitions with just one Transition object! (fade, transparency, intensity, mosaic...)

(Title screen is incomplete;  very rudimentary)

You can already see me using the fade-in effect along with the mosaic-fade-in effect.

The Transition class declaration looks like this (there are some comments, but I've removed it to fit the source code in this article)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
class Transition
{
public:
    enum class Types
    {
        TRANSPARENCY = 1,
        FADE = 2,
        INTENSITY = 4,
        SPRITE_MOSAIC = 8,
        BG_MOSAIC = 16
    };
    enum class Direction { IN, OUT };
    enum class State { NOT_READY, ONGOING, DONE };
 
    Transition(Types types, Direction direction, int updateCount);
    ~Transition();
 
    void Init();
    void Update();
    void Destroy();
 
    State GetState() const { return state_; }
 
private:
    const Types types_;
    const Direction direction_;
    int updateCountDown_;
 
    State state_ = State::NOT_READY;
 
    bn::optional<bn::blending_transparency_alpha_to_action> transparencyAction_;
    bn::optional<bn::blending_fade_alpha_to_action> fadeAction_;
    bn::optional<bn::blending_intensity_alpha_to_action> intensityAction_;
    bn::optional<bn::sprites_mosaic_stretch_to_action> spriteMosaicAction_;
    bn::optional<bn::bgs_mosaic_stretch_to_action> bgMosaicAction_;
};
 
inline Transition::Types operator|(Transition::Types t1, Transition::Types t2)
{
    return static_cast<Transition::Types>(static_cast<int>(t1) | static_cast<int>(t2));
}
 
inline Transition::Types operator&(Transition::Types t1, Transition::Types t2)
{
    return static_cast<Transition::Types>(static_cast<int>(t1) & static_cast<int>(t2));
}
cs

It will take some time to explain it in-depth, and since I'm sooo tired now, I'm just gonna go to sleep.

You can check out my source code, if you want to.

github tab : Day-04

Download .gba file

Get Symbol★Merged

Leave a comment

Log in with itch.io to leave a comment.