Compare commits
No commits in common. "491c71d7416d9e89bfaf5933d33f2be9b339ffa7" and "66fcc135adc28127324f7a40612ffd3e24d56010" have entirely different histories.
491c71d741
...
66fcc135ad
19
histoire.h
19
histoire.h
|
@ -16,11 +16,11 @@ typedef enum PersonneId {
|
||||||
#define MAX_PERSONNE 5
|
#define MAX_PERSONNE 5
|
||||||
int personne_idx = 0;
|
int personne_idx = 0;
|
||||||
Personne personnes[MAX_PERSONNE] = {
|
Personne personnes[MAX_PERSONNE] = {
|
||||||
[VIOLA] = { .name = "Viola" },
|
[0] = { .name = "Viola" },
|
||||||
[ARCHIE] = { .name = "Archie" },
|
[1] = { .name = "Archie" },
|
||||||
[MINUIT] = { .name = "Minuit" },
|
[2] = { .name = "Minuit" },
|
||||||
[PHILLIP] = { .name = "Phillip" },
|
[3] = { .name = "Phillip" },
|
||||||
[ED] = { .name = "Ed" },
|
[4] = { .name = "Ed" },
|
||||||
};
|
};
|
||||||
|
|
||||||
void init_personnes(void)
|
void init_personnes(void)
|
||||||
|
@ -54,15 +54,6 @@ typedef struct Histoire {
|
||||||
Branche branches[NB_BRANCHE];
|
Branche branches[NB_BRANCHE];
|
||||||
} Histoire;
|
} Histoire;
|
||||||
|
|
||||||
typedef struct Historique {
|
|
||||||
int idx_branche;
|
|
||||||
int branche[NB_BRANCHE];
|
|
||||||
int idx_conv;
|
|
||||||
int conversation[NB_CONVERSATION_MAX];
|
|
||||||
} Historique;
|
|
||||||
|
|
||||||
Historique historique = {0};
|
|
||||||
|
|
||||||
Histoire histoire = {
|
Histoire histoire = {
|
||||||
.nb_branche = 3,
|
.nb_branche = 3,
|
||||||
.branches = {
|
.branches = {
|
||||||
|
|
41
main.c
41
main.c
|
@ -10,8 +10,6 @@ int horloge_min = 9;
|
||||||
|
|
||||||
#include "histoire.h"
|
#include "histoire.h"
|
||||||
|
|
||||||
float timer = 0.0f;
|
|
||||||
|
|
||||||
#define CHOIX_PAD 2
|
#define CHOIX_PAD 2
|
||||||
#define CHOIX_COLOR WHITE
|
#define CHOIX_COLOR WHITE
|
||||||
#define CHOIX_COLOR_HOVER LIGHTGRAY
|
#define CHOIX_COLOR_HOVER LIGHTGRAY
|
||||||
|
@ -189,11 +187,8 @@ int main()
|
||||||
|
|
||||||
Texture phone_battery_tex = LoadTexture("data/phone-battery.png");
|
Texture phone_battery_tex = LoadTexture("data/phone-battery.png");
|
||||||
Texture left_arrow_tex = LoadTexture("data/left-arrow.png");
|
Texture left_arrow_tex = LoadTexture("data/left-arrow.png");
|
||||||
init_personnes();
|
|
||||||
|
|
||||||
historique.idx_branche = 1;
|
init_personnes();
|
||||||
historique.branche[0] = 0;
|
|
||||||
historique.conversation[0] = 0;
|
|
||||||
|
|
||||||
while (!WindowShouldClose()) {
|
while (!WindowShouldClose()) {
|
||||||
if (IsWindowResized()) {
|
if (IsWindowResized()) {
|
||||||
|
@ -201,8 +196,6 @@ int main()
|
||||||
window.y = GetScreenHeight();
|
window.y = GetScreenHeight();
|
||||||
}
|
}
|
||||||
|
|
||||||
timer += GetFrameTime();
|
|
||||||
|
|
||||||
Rectangle phone_box = {
|
Rectangle phone_box = {
|
||||||
window.x/2-window.y/3, 0,
|
window.x/2-window.y/3, 0,
|
||||||
window.y/3*2, window.y,
|
window.y/3*2, window.y,
|
||||||
|
@ -233,31 +226,6 @@ int main()
|
||||||
}, 0, phone_battery_scale, WHITE
|
}, 0, phone_battery_scale, WHITE
|
||||||
);
|
);
|
||||||
|
|
||||||
Branche branche = histoire.branches[historique.branche[historique.idx_branche-1]];
|
|
||||||
Conversation conv = branche.conversations[historique.conversation[historique.idx_conv-1]];
|
|
||||||
|
|
||||||
personnes[branche.personne].message = conv.question;
|
|
||||||
|
|
||||||
if (!personnes[branche.personne].active && timer > conv.read_time) {
|
|
||||||
personnes[branche.personne].active = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (IsKeyPressed(KEY_SPACE)) {
|
|
||||||
printf("idx branche = %d\n", historique.idx_branche);
|
|
||||||
printf("idx conv = %d\n", historique.idx_conv);
|
|
||||||
historique.idx_conv++;
|
|
||||||
historique.conversation[historique.idx_conv] = 0; // idx de la reponse
|
|
||||||
if (historique.idx_conv >= branche.nb_conversation) {
|
|
||||||
historique.idx_conv = 0;
|
|
||||||
historique.idx_branche++;
|
|
||||||
historique.branche[historique.idx_branche] =
|
|
||||||
historique.branche[historique.idx_branche-1]+1;
|
|
||||||
if (historique.idx_branche > histoire.nb_branche) {
|
|
||||||
printf("fin du monde\n");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static int choix_active = 0;
|
static int choix_active = 0;
|
||||||
if (!choix_active) {
|
if (!choix_active) {
|
||||||
float size = header_box.height*0.42;
|
float size = header_box.height*0.42;
|
||||||
|
@ -353,14 +321,9 @@ int main()
|
||||||
case 3: r = draw_4_choix(choix_box, "1st choice", "2nd choice", "3rd choice", "4th choice"); break;
|
case 3: r = draw_4_choix(choix_box, "1st choice", "2nd choice", "3rd choice", "4th choice"); break;
|
||||||
}
|
}
|
||||||
if (r) printf("%d\n", r);
|
if (r) printf("%d\n", r);
|
||||||
|
|
||||||
if (timer > conv.read_time) {
|
|
||||||
DrawText(conv.question, 500, 500, 50, ORANGE);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
DrawFPS(window.x - 100, 10);
|
DrawFPS(0,0);
|
||||||
DrawText(TextFormat("timer = %.01f", timer), 5, 25, 25, WHITE);
|
|
||||||
}
|
}
|
||||||
EndDrawing();
|
EndDrawing();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue