#include<acknex.h>
#include<default.c>
typedef struct PEINT {
var toucher ; // touched
var bon_rep ; // good answer
var mau_rep ; // bad answer
var jeu ; // game
char slettre[2];
STRING* s_mi;
} PEINT;
// ----------------- definitions
PEINT* STmi = {toucher = 4; bon_rep = 3; mau_rep = 5; jeu=21; slettre = "bx"; s_mi = NULL;} //make sure s_mi=NULL
//------------------ panel
STRING* p_resultats_s_mi = "";
//
PANEL* p_resultats = {
pos_x = 0;
pos_y = 0;
layer 900;
digits (10,100," jeu no: %.0f ",*,1,STmi.jeu);
digits (350, 100, "toucher = %.0f",*,1,STmi.toucher);
digits (550,100,"bonne rp: %.0f ",*,1,STmi.bon_rep);
digits (650,100,"mau choix: %.0f ",*,1,STmi.mau_rep);
digits (300,130,"value of STmi.lettre: %s ",*,1,STmi.slettre);
// digits (300,160,"value of STmi.s_mi: %s ",*,1,STmi.s_mi);
// cant use s_mi in panels because panels dont like pointers...
digits (300,160,"value of STmi.s_mi: %s ",*,1,p_resultats_s_mi); // this is a different way
flags = OVERLAY ;
}
function give_new_val ()
{
while (STmi == NULL) { wait (1); }
p_resultats.flags |= VISIBLE;
// change the values to
STmi.toucher = 14;
STmi.bon_rep = 13;
STmi.mau_rep = 15;
STmi.jeu = 222;
STmi.slettre = "by";
if(STmi->s_mi==NULL) STmi->s_mi=str_create(""); //initialise String in struct
str_cpy(STmi->s_mi, "mmmm"); //This does work - but previous line MUST happen first
// //always use -> instead of . for s_mi because it is is a pointer
str_cpy(p_resultats_s_mi, STmi->s_mi); //for the panel to use
}
function main()
{
video_set(800,600,32,0);
screen_color.blue = 255;
level_load(NULL);
give_new_val ();
}
//