je veux metre le code ci-dessous dans ma propre dll.
je voudrais une fonction dans ma DLL que j'appel avec les paramètres (char*, int) et qui me retourne un bitmap "bmp" ou un tableau.
#include <stdio.h>
#include <allegro.h>
#include <alfont.h>
int main(){
BITMAP *bmp ;
ALFONT_FONT *user_font;
char *S="A";
int Char_H=12;
int Char_W=0;
//format pour le codage du texte (ASCII, ascii normal)
set_uformat(U_ASCII);
allegro_init();//initialise allegro
alfont_init();//initialise la font
//Charge une police
user_font = alfont_load_font("times.ttf");
// change the font height to 40 pixels
alfont_set_font_size(user_font, Char_H);
//créé un bitmap
Char_W = alfont_text_length(user_font, S);
bmp=create_bitmap(Char_W,Char_H);
//initialise le bitmap a 0
clear_to_color(bmp,0);
//Déssine "S" a patir de la ppolice "user_font" ds le bitmap "bmp" avec la couleur "makecol(255, 255, 255)"
alfont_textprintf_ex(bmp, user_font, 0, 0, makecol(0, 255, 0), 0, S);
//libere la memoire
destroy_bitmap(bmp);
alfont_destroy_font(user_font);
alfont_exit();
allegro_exit();
return 0;
} END_OF_MAIN() ; // obligatoire sous allegro après la fermeture du bloc du main()
merci d'avance![]()
Partager