Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdlib.h>
- #include <stdio.h>
- #include <SDL/SDL.h>
- #include <SDL/SDL_image.h>
- #include <SDL/SDL_ttf.h>
- int main(int argc, char *argv[])
- {
- SDL_Surface *na7la2=NULL,*ecran=NULL;
- SDL_Surface *texte1;
- SDL_Rect position1,position2;
- SDL_Event event;
- position1.x = 0;
- position1.y = 0;
- position2.x = 0;
- position2.y = 0;
- SDL_Init(SDL_INIT_VIDEO);
- TTF_Init();
- ecran = SDL_SetVideoMode(800, 600, 32, SDL_HWSURFACE);
- na7la2=IMG_Load("na7la2.png");
- TTF_Font *font;
- font=TTF_OpenFont("ouh.ttf",32);
- SDL_Color fontcouleur={0,0,0};
- while (1)
- {
- SDL_BlitSurface(na7la2, NULL, ecran, &position1);
- SDL_WaitEvent(&event);
- if (event.type==SDL_MOUSEBUTTONDOWN)
- {
- if(event.button.button==SDL_BUTTON_RIGHT)
- {
- texte1=TTF_RenderText_Solid(font,"HELLO , can you hear me ?",fontcouleur);
- TTF_CloseFont(font);
- position2.x=0;
- position2.y=0;
- SDL_BlitSurface(texte1,NULL,ecran,&position2);
- }
- }
- SDL_Flip(ecran);
- }
- SDL_FreeSurface(texte1);
- SDL_FreeSurface(na7la2);
- SDL_FreeSurface(ecran);
- TTF_Quit();
- SDL_Quit();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement