how about a switch case?
This commit is contained in:
1 parent
452b213ac7
commit
bdc1a4561d
1 file changed
+13
-11
+13
-11
@@ -142,17 +142,18 @@ int main() {
|
||||
bool key_pressed = key_is_down && !key_was_down;
|
||||
key_was_down = key_is_down;
|
||||
|
||||
// don't judge me, it will work for now
|
||||
static unsigned int lines = 0;
|
||||
static bool dialog_finished = false;
|
||||
static bool transitioning = false; // HACK
|
||||
static bool transitioning = false;
|
||||
|
||||
if (mouse_clicked || key_pressed) {
|
||||
if (text_is_animating(dialogue_text)) {
|
||||
text_show_all_current(dialogue_text);
|
||||
}
|
||||
else {
|
||||
// do i like this approach? mixed feelings
|
||||
if (lines == 0) {
|
||||
switch (lines) {
|
||||
case 0:
|
||||
// line 2
|
||||
compositor_animation_complete_all(compositor);
|
||||
compositor_animate_scale(compositor, maksw_happy_id, 1.0f, 0.2f, EASE_IN_OUT_CUBIC);
|
||||
@@ -162,8 +163,8 @@ int main() {
|
||||
text_push(name_text, "wikor", 0.0f, true);
|
||||
text_push(dialogue_text, "Hello to you too, maksw..", 30.0f, true);
|
||||
lines++;
|
||||
}
|
||||
else if (lines == 1) {
|
||||
break;
|
||||
case 1:
|
||||
// line 3
|
||||
compositor_animation_complete_all(compositor);
|
||||
|
||||
@@ -172,18 +173,19 @@ int main() {
|
||||
|
||||
transitioning = true;
|
||||
lines++;
|
||||
}
|
||||
else if (lines == 2) {
|
||||
break;
|
||||
case 2:
|
||||
// (line 4), fade out
|
||||
compositor_animation_complete_all(compositor);
|
||||
|
||||
compositor_set_visible(compositor, black_id, true);
|
||||
compositor_animate_fade(compositor, black_id, 1.0f, 1.0f, EASE_IN_OUT_CUBIC, false);
|
||||
compositor_animate_fade(compositor, black_id, 1.0f, 1.0f, EASE_IN_CUBIC, false);
|
||||
|
||||
dialog_finished = true;
|
||||
lines++;
|
||||
}
|
||||
else {
|
||||
break;
|
||||
default:
|
||||
running = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -203,7 +205,7 @@ int main() {
|
||||
|
||||
compositor_set_visible(compositor, mask_id, false);
|
||||
compositor_set_visible(compositor, mask2_id, true);
|
||||
compositor_animate_move(compositor, mask2_id, 0, HEIGHT, 0.5f, EASE_IN_CUBIC, false);
|
||||
compositor_animate_move(compositor, mask2_id, 0, HEIGHT, 0.5f, EASE_OUT_CUBIC, false);
|
||||
|
||||
transitioning = false;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user