-
Le-Bao-Tin.Ha authoredLe-Bao-Tin.Ha authored
GAME.c 1.09 KiB
/*
// Created by Tiny on 3/3/2021.
*/
/*!
* \file GAME.c
* \brief Game Source File
* \authors Tin
* \version 1
* \date 03/03/2021
*
* Explanation.
*
*/
#include <stdio.h>
#include <SDL2/SDL.h>
#include <SDL2/SDL_image.h>
#include "GAME.h"
#include "prof.h"
#include "personnage.h"
#include "map.h"
#include "DS.h"
SDL_Texture * query_hero(Personnage * hero, SDL_Rect * hero_rect, SDL_Renderer * renderer, SDL_Window * window){
SDL_Texture * texture_hero;
init_pers(hero,3,480,28,23,SPEED,"ressource/man.png");
// load the image data into the graphics hardware's memory
texture_hero = IMG_LoadTexture(renderer, hero->image_pers);
if (!texture_hero)
{
printf("Cannot create texture for persson: %s\n", SDL_GetError());
SDL_DestroyRenderer(renderer);
SDL_DestroyWindow(window);
SDL_Quit();
return NULL;
}
// get and scale the dimensions of texture
SDL_QueryTexture(texture_hero, NULL, NULL, &hero_rect->w, &hero_rect->h);
hero_rect->w = hero->larg_pers;
hero_rect->h = hero->long_pers;
return texture_hero;
}