Ce programme explique comment récupérer la taille des boîtes de textes avant de les afficher.
void print_cote(
int O,
int N,
int width,
int height,
MLV_Color color ){
int espace = 3;
int sizeLine = 10;
int S = N + height -1;
int E = O + width - 1;
}
int main( int argc, char *argv[] ){
int width = 640, height = 480;
"advanced - 1 - texts and boxes", "texts and boxes", width, height );
const char* text = "Voici une boite de texte, centré par rapport à la fenetre.";
int width_text, height_text;
int positionX = (width-width_text)/2, positionY = 100;
print_cote( positionX, positionY, width_text, height_text,
MLV_COLOR_GREEN );
const char *text_box = "Voici une boîte de texte.\nCette Boîte de texte est elle aussi centré horizontalement dans la fenetre.";
int width_box = 0 , height_box = 0, size_interligne = 9;
text_box,
size_interligne,
&width_box, &height_box
);
int positionBoxX = (width-width_box)/2, positionBoxY = 300;
positionBoxX, positionBoxY,
text_box,
size_interligne,
);
print_cote(
);
return 0;
}