#include <acknex.h>
#include <default.c>
typedef struct RND_Q {
BMAP* questions;
char* model;
// int answer;
} RND_Q;
RND_Q* rnd_q; //pointer for array of structs
int int_rndQuestionCount; //stores the number of random questions
int int_rndQuestionSelected;
//panel for displaying the question
PANEL* pnl_question = {
flags = SHOW;
}
//function for adding question to the pool
void question_add(char* questions, char* model)
{
int i = int_rndQuestionCount;
int_rndQuestionCount++;
rnd_q = realloc(rnd_q, sizeof(RND_Q) * (int_rndQuestionCount));
rnd_q[i].questions = bmap_create(questions);
rnd_q[i].model = model;
// rnd_q[i].answer = answer;
}
void main(){
wait(1);
question_add("tanong1.tga", "paccherry.mdl");
question_add("tanong2.tga", "bilog.mdl");
question_add("tanong3.tga", "heart.mdl");
question_add("tanong4.tga", "strip.mdl");
random_seed(0);
int_rndQuestionSelected = random(integer(int_rndQuestionCount)); //randomly generates a question
//rnd_q[int_rndQuestionSelected].bmap; //stores the question image
//rnd_q[int_rndQuestionSelected].model; //stores the mode name
//rnd_q[int_rndQuestionSelected].answer; //stores the correct answer
//so to display the question in pnl_question use
pnl_question.questions = rnd_q[int_rndQuestionSelected].questions;
}