#include <SDL2/SDL.h>
#include <SDL2/SDL_image.h>
int w = 0, h = 0;
SDL_Window *win = NULL;
SDL_Renderer *renderer = NULL;
SDL_Texture *Tex = NULL;
SDL_Surface *Surface = NULL;
int main(int argc, char **argv) {
SDL_Init(SDL_INIT_EVERYTHING);
IMG_Init(IMG_INIT_PNG);
win = SDL_CreateWindow("Hello World", 0, 0, 0, 0, 0);
SDL_GetWindowSize(win, &w, &h);
renderer = SDL_CreateRenderer(win, -1, SDL_RENDERER_ACCELERATED);
Surface = IMG_Load("wp/bal.png");
if (Surface==NULL)
return 0;
Tex = SDL_CreateTextureFromSurface(renderer, Surface);
SDL_RenderCopy(renderer, Tex, NULL, NULL);
SDL_RenderPresent(renderer);
while (true)
SDL_Delay(2000);
SDL_FreeSurface(Surface);
SDL_RenderClear(renderer);
SDL_DestroyRenderer(renderer);
SDL_DestroyTexture(Tex);
SDL_DestroyWindow(win);
SDL_Quit();
return 0;
}
#include <SDL2/SDL_image.h>
int w = 0, h = 0;
SDL_Window *win = NULL;
SDL_Renderer *renderer = NULL;
SDL_Texture *Tex = NULL;
SDL_Surface *Surface = NULL;
int main(int argc, char **argv) {
SDL_Init(SDL_INIT_EVERYTHING);
IMG_Init(IMG_INIT_PNG);
win = SDL_CreateWindow("Hello World", 0, 0, 0, 0, 0);
SDL_GetWindowSize(win, &w, &h);
renderer = SDL_CreateRenderer(win, -1, SDL_RENDERER_ACCELERATED);
Surface = IMG_Load("wp/bal.png");
if (Surface==NULL)
return 0;
Tex = SDL_CreateTextureFromSurface(renderer, Surface);
SDL_RenderCopy(renderer, Tex, NULL, NULL);
SDL_RenderPresent(renderer);
while (true)
SDL_Delay(2000);
SDL_FreeSurface(Surface);
SDL_RenderClear(renderer);
SDL_DestroyRenderer(renderer);
SDL_DestroyTexture(Tex);
SDL_DestroyWindow(win);
SDL_Quit();
return 0;
}