Bonjour à tous, j'aimerais bien créer un ptit flooder avec SDL mais à part l'interface je ne sais pas quoi faire...
[code:1:a06b5b401b]
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <SDL/SDL.h>
#include <SDL/SDL_ttf.h>
#include "saisieSDL.h"
#include <SDL/SDL_image.h>
int main( int argc, char* argv[] )
{
SDL_Event event;
SDL_Rect pos = { 0, 0, 0, 0 };
SDL_Color couleur = { 255, 255, 255, 32 },
a = { 255, 255, 255, 32 };
int continuer = 1;
SDL_Rect position;
saisieSDL *saisie = NULL;
TTF_Font *police = NULL;
int quitter = 0;
SDL_Init(SDL_INIT_VIDEO);
TTF_Init();
SDL_Surface *ecran = NULL, *imageDeFond = NULL, *texte = NULL, *texte1 = NULL, *texte2 = NULL, *texte3 = NULL, *texte4 = NULL, *texte5 = NULL, *texte6 = NULL, *fond = NULL, *sapin = NULL;
SDL_Rect positionFond, positionSapin;
positionFond.x = 0;
positionFond.y = 0;
ecran = SDL_SetVideoMode(400, 400, 32, SDL_HWSURFACE);
SDL_WM_SetCaption("DM5087 flooder 1.0 * * * BETA * * *", NULL);
SDL_FillRect(ecran, NULL, SDL_MapRGB(ecran->format, 255, 255, 255));
imageDeFond = SDL_LoadBMP("background.bmp");
SDL_BlitSurface(imageDeFond, NULL, ecran, &positionFond);
SDL_Flip(ecran); /* Mise à jour de l'écran avec sa nouvelle couleur */
police = TTF_OpenFont("arial.ttf", 14); /* Ouverture de la police au début */
texte = TTF_RenderText_Blended(police, "Flooder: Temps avantde commancer à flooder:", a);
position.x = 10;
position.y = 50;
SDL_BlitSurface(texte, NULL, ecran, &position); /* Blit du texte par-dessus */
SDL_Flip(ecran);
texte1 = TTF_RenderText_Blended(police, "Flooder: Nombre de messages:", a);
position.x = 10;
position.y = 90;
SDL_BlitSurface(texte1, NULL, ecran, &position); /* Blit du texte par-dessus */
SDL_Flip(ecran);
texte2 = TTF_RenderText_Blended(police, "Flooder: Message:", a);
position.x = 10;
position.y = 130;
SDL_BlitSurface(texte2, NULL, ecran, &position); /* Blit du texte par-dessus */
SDL_Flip(ecran);
texte3 = TTF_RenderText_Blended(police, "Flooder Created by DM5087", a);
position.x = 10;
position.y = 250;
SDL_BlitSurface(texte3, NULL, ecran, &position); /* Blit du texte par-dessus */
SDL_Flip(ecran);
texte4 = TTF_RenderText_Blended(police, "Contactes:", a);
position.x = 10;
position.y = 300;
SDL_BlitSurface(texte4, NULL, ecran, &position); /* Blit du texte par-dessus */
SDL_Flip(ecran);
texte5 = TTF_RenderText_Blended(police, "web: http://dm5087.free.fr", a);
position.x = 10;
position.y = 340;
SDL_BlitSurface(texte5, NULL, ecran, &position); /* Blit du texte par-dessus */
SDL_Flip(ecran);
texte6 = TTF_RenderText_Blended(police, "mail: ****.****@****.**", a); /* je l'ai caché pour vité les spams */
position.x = 10;
position.y = 360;
SDL_BlitSurface(texte6, NULL, ecran, &position); /* Blit du texte par-dessus */
SDL_Flip(ecran);
if(( saisie = creerSaisieSDL( 15 )) == NULL ) {
TTF_CloseFont( police );
}
SDL_EnableUNICODE( 1 );
do {
SDL_Flip( ecran );
SDL_WaitEvent( &event );
switch( event.type ) {
case SDL_QUIT:
quitter = 1;
break;
case SDL_KEYDOWN:
if( event.key.keysym.unicode == SDLK_1 ) {
saisirSDL( saisie, ecran, police, pos,
couleur, a, FOND_UNI, 1 );
}
break;
default:
break;
}
} while( !quitter );
libererSaisieSDL( saisie );
TTF_CloseFont( police );
TTF_Quit();
SDL_FreeSurface(texte);
SDL_Quit();
return EXIT_SUCCESS;
}
[/code:1:a06b5b401b]
Si quelqu'un pouvais me dire comment faire la zone de saisie car elle est invisible ...
Sinon apres il faudrait faire les boucles(juste à lire le tuto la dessus sur le sdz), coller(j'ai recherché mais pas trouvé en C), et le boutton(aucune idée)
Voila merci !