importation des models

This commit is contained in:
valentin carmona committed 2022-03-10 16:22:50 +01:00
1 parent 82385c833e
commit 2a4f53984c
2 files changed
+90

No files matched your search

+52
View File
@@ -0,0 +1,52 @@
// SDL2 Demo by aurelien.esnard@u-bordeaux.fr
#include "model.h"
#include <SDL.h>
#include <SDL_image.h> // required to load transparent texture from PNG
#include <SDL_ttf.h> // required to use TTF fonts
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
/* **************************************************************** */
struct Env_t {
/* PUT YOUR VARIABLES HERE */
};
/* **************************************************************** */
Env *init(SDL_Window *win, SDL_Renderer *ren, int argc, char *argv[]) {
Env *env = malloc(sizeof(struct Env_t));
/* PUT YOUR CODE HERE TO INIT TEXTURES, ... */
return env;
}
/* **************************************************************** */
void render(SDL_Window *win, SDL_Renderer *ren, Env *env) { /* PUT YOUR CODE HERE TO RENDER TEXTURES, ... */
}
/* **************************************************************** */
bool process(SDL_Window *win, SDL_Renderer *ren, Env *env, SDL_Event *e) {
if (e->type == SDL_QUIT) {
return true;
}
/* PUT YOUR CODE HERE TO PROCESS EVENTS */
return false;
}
/* **************************************************************** */
void clean(SDL_Window *win, SDL_Renderer *ren, Env *env) {
/* PUT YOUR CODE HERE TO CLEAN MEMORY */
free(env);
}
/* **************************************************************** */
+38
View File
@@ -0,0 +1,38 @@
// SDL2 Model by aurelien.esnard@u-bordeaux.fr
#ifndef MODEL_H
#define MODEL_H
#include <SDL.h>
#include <stdio.h>
#include <stdbool.h>
typedef struct Env_t Env;
/* **************************************************************** */
#ifdef __ANDROID__
#define PRINT(STR, ...) do { SDL_Log(STR, ##__VA_ARGS__); } while(0)
#define ERROR(STR, ...) do { SDL_Log(STR, ##__VA_ARGS__); exit(EXIT_FAILURE); } while(0)
#else
#define PRINT(STR, ...) do { printf(STR, ##__VA_ARGS__); } while(0)
#define ERROR(STR, ...) do { fprintf(stderr, STR, ##__VA_ARGS__); exit(EXIT_FAILURE); } while(0)
#endif
/* **************************************************************** */
#define APP_NAME "SDL2 Demo"
#define SCREEN_WIDTH 600
#define SCREEN_HEIGHT 600
#define DELAY 100
/* **************************************************************** */
Env * init(SDL_Window* win, SDL_Renderer* ren, int argc, char* argv[]);
void render(SDL_Window* win, SDL_Renderer* ren, Env * env);
void clean(SDL_Window* win, SDL_Renderer* ren, Env * env);
bool process(SDL_Window* win, SDL_Renderer* ren, Env * env, SDL_Event * e);
/* **************************************************************** */
#endif