Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdlib.h>
- #include <stdio.h>
- #include <SDL/SDL.h>
- /*
- Nausée By Sakiir !
- Comment vomir en 30 secondes
- COMPILATION:
- gcc -lSDL source.c -o executable
- */
- SDL_Surface* s;
- void initSDL(void);
- void attendreTouche(void);
- void actualiser(Uint32 c);
- Uint32 changercouleur(int couleur);
- int main(int argc, char** argv)
- {
- initSDL();
- attendreTouche();
- return EXIT_SUCCESS;
- }
- void initSDL(void)
- {
- SDL_Init(SDL_INIT_VIDEO);
- atexit(SDL_Quit);
- s = SDL_SetVideoMode(1366, 768, 32, SDL_SWSURFACE | SDL_FULLSCREEN); // Mettre Votre Résolution ICI
- SDL_WM_SetCaption("Nausée By Sakiir !", NULL);
- }
- void attendreTouche(void)
- {
- SDL_Event event;
- int i;
- Uint32 c;
- do{
- for(i=0;i<=15;i++)
- {
- c = changercouleur(i);
- actualiser(c);
- }
- SDL_WaitEvent(&event);
- }
- while (event.type != SDL_QUIT && event.type != SDL_KEYDOWN);
- }
- void actualiser(Uint32 c)
- {
- SDL_FillRect(s, &s->clip_rect, c);
- SDL_Flip(s);
- }
- Uint32 changercouleur(int couleur)
- {
- Uint32 return_color;
- switch(couleur)
- {
- case 0:
- return_color = SDL_MapRGB(s->format, 0x00, 0x00, 0x00); // NOIR
- break;
- case 1:
- return_color = SDL_MapRGB(s->format, 0x00, 0x00, 0x80); // BLEU_FONCE
- break;
- case 2:
- return_color = SDL_MapRGB(s->format, 0x00, 0x80, 0x00); // VERT_FONCE
- break;
- case 3:
- return_color = SDL_MapRGB(s->format, 0x00, 0x80, 0x80); // CYAN_FONCE
- break;
- case 4:
- return_color = SDL_MapRGB(s->format, 0x80, 0x00, 0x00); // ROUGE_FONCE
- break;
- case 5:
- return_color = SDL_MapRGB(s->format, 0x80, 0x00, 0x80); // MAGENTA_FONCE
- break;
- case 6:
- return_color = SDL_MapRGB(s->format, 0x80, 0x80, 0x00); // OCRE
- break;
- case 7:
- return_color = SDL_MapRGB(s->format, 0xC0, 0xC0, 0xC0); // GRIS_CLAIR
- break;
- case 8:
- return_color = SDL_MapRGB(s->format, 0x80, 0x80, 0x80); // GRIS
- break;
- case 9:
- return_color = SDL_MapRGB(s->format, 0x00, 0x00, 0xFF); // BLEU
- break;
- case 10:
- return_color = SDL_MapRGB(s->format, 0x00, 0xFF, 0x00); // VERT
- break;
- case 11:
- return_color = SDL_MapRGB(s->format, 0x00, 0xFF, 0xFF); // CYAN
- break;
- case 12:
- return_color = SDL_MapRGB(s->format, 0xFF, 0x00, 0x00); // ROUGE
- break;
- case 13:
- return_color = SDL_MapRGB(s->format, 0xFF, 0x00, 0xFF); // MAGENTA
- break;
- case 14:
- return_color = SDL_MapRGB(s->format, 0xFF, 0xFF, 0x00); // JAUNE
- break;
- case 15:
- return_color = SDL_MapRGB(s->format, 0xFF, 0xFF, 0xFF); // BLANC
- break;
- }
- return (return_color);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement