1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99
| #include <iostream>
#include <fstream>
#include <string>
#include <stdlib.h>
#include <stdio.h>
#ifdef __cplusplus
#include <cstdlib>
#else
#include <stdlib.h>
#endif
#ifdef __APPLE__
#include <SDL/SDL.h>
#else
#include <SDL/SDL.h>
#include <SDL/SDL_ttf.h>
#endif
using namespace std;
void SDL_Delay(Uint32 ms);
int main ( int argc, char** argv )
{
char ANserie[100] ;
char NNserie[100] ;
char nom[100] ;
char Ndevie[100] ;
char temp [1000000];
FILE *stdprn;
while (1)
{
ifstream fichier("Test.txt", ios::in);
fichier>>ANserie>>NNserie>>Ndevie>>nom;
fichier.close();
SDL_Surface *ecran = NULL, *texte = NULL, *fond = NULL;
SDL_Rect position;
SDL_Event event;
TTF_Font *police = NULL;
SDL_Color couleurNoire = {0, 0, 0};
SDL_Init(SDL_INIT_VIDEO | SDL_INIT_TIMER);
TTF_Init();
ecran = SDL_SetVideoMode(600, 480, 32, SDL_HWSURFACE);
SDL_WM_SetCaption("nom du prog !", NULL);
police = TTF_OpenFont("arial.ttf", 18);
SDL_FillRect(ecran, NULL, SDL_MapRGB(ecran->format, 255, 255, 255));
position.x = 0;
position.y = 0;
SDL_BlitSurface(fond, NULL, ecran, &position);
texte = TTF_RenderText_Blended(police,nom , couleurNoire);
position.x = 45;
position.y = 180;
SDL_BlitSurface(texte , NULL, ecran, &position);
texte = TTF_RenderText_Blended(police, NNserie, couleurNoire);
position.x = 45;
position.y = 260;
SDL_BlitSurface(texte, NULL, ecran, & position);
texte = TTF_RenderText_Blended(police, Ndevie, couleurNoire);
position.x = 45;
position.y = 340;
SDL_BlitSurface(texte, NULL, ecran, & position);
SDL_Flip(ecran);
sprintf(temp, "%s" , SDL_Surface());
if(NNserie != ANserie)
{
stdprn = fopen("PRN","wb");
fprintf(stdprn, temp);
texte = TTF_RenderText_Blended(police, "test", couleurNoire);
position.x = 100;
position.y = 360;
SDL_BlitSurface(texte, NULL, ecran, & position);
SDL_Flip(ecran);
fstream fichier("Test.txt", ios::out | ios::trunc);
fichier<<NNserie<<endl;
fichier<<NNserie<<endl;
fichier<<Ndevie<<endl;
fichier<<nom<<endl;
fichier.close();
}
SDL_Delay(2000);
TTF_CloseFont(police);
TTF_Quit();
SDL_FreeSurface(texte);
SDL_Quit();
}
return EXIT_SUCCESS;
} |
Partager