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;
|
bool key_pressed = key_is_down && !key_was_down;
|
||||||
key_was_down = key_is_down;
|
key_was_down = key_is_down;
|
||||||
|
|
||||||
|
// don't judge me, it will work for now
|
||||||
static unsigned int lines = 0;
|
static unsigned int lines = 0;
|
||||||
static bool dialog_finished = false;
|
static bool dialog_finished = false;
|
||||||
static bool transitioning = false; // HACK
|
static bool transitioning = false;
|
||||||
|
|
||||||
if (mouse_clicked || key_pressed) {
|
if (mouse_clicked || key_pressed) {
|
||||||
if (text_is_animating(dialogue_text)) {
|
if (text_is_animating(dialogue_text)) {
|
||||||
text_show_all_current(dialogue_text);
|
text_show_all_current(dialogue_text);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// do i like this approach? mixed feelings
|
switch (lines) {
|
||||||
if (lines == 0) {
|
case 0:
|
||||||
// line 2
|
// line 2
|
||||||
compositor_animation_complete_all(compositor);
|
compositor_animation_complete_all(compositor);
|
||||||
compositor_animate_scale(compositor, maksw_happy_id, 1.0f, 0.2f, EASE_IN_OUT_CUBIC);
|
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(name_text, "wikor", 0.0f, true);
|
||||||
text_push(dialogue_text, "Hello to you too, maksw..", 30.0f, true);
|
text_push(dialogue_text, "Hello to you too, maksw..", 30.0f, true);
|
||||||
lines++;
|
lines++;
|
||||||
}
|
break;
|
||||||
else if (lines == 1) {
|
case 1:
|
||||||
// line 3
|
// line 3
|
||||||
compositor_animation_complete_all(compositor);
|
compositor_animation_complete_all(compositor);
|
||||||
|
|
||||||
@@ -172,18 +173,19 @@ int main() {
|
|||||||
|
|
||||||
transitioning = true;
|
transitioning = true;
|
||||||
lines++;
|
lines++;
|
||||||
}
|
break;
|
||||||
else if (lines == 2) {
|
case 2:
|
||||||
// (line 4), fade out
|
// (line 4), fade out
|
||||||
compositor_animation_complete_all(compositor);
|
compositor_animation_complete_all(compositor);
|
||||||
|
|
||||||
compositor_set_visible(compositor, black_id, true);
|
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;
|
dialog_finished = true;
|
||||||
lines++;
|
lines++;
|
||||||
}
|
break;
|
||||||
else {
|
default:
|
||||||
|
running = false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -203,7 +205,7 @@ int main() {
|
|||||||
|
|
||||||
compositor_set_visible(compositor, mask_id, false);
|
compositor_set_visible(compositor, mask_id, false);
|
||||||
compositor_set_visible(compositor, mask2_id, true);
|
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;
|
transitioning = false;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user