fix a bit of memory leak
This commit is contained in:
1 parent
f763238a4e
commit
aaca2d2ae7
2 files changed
+5
-7
No files matched your search
+1
-1
@@ -62,7 +62,7 @@ target_link_libraries(game_solve game)
|
||||
# game_sdl
|
||||
include_directories(${SDL2_ALL_INC})
|
||||
add_executable(game_sdl main.c model.c)
|
||||
target_link_libraries(game_sdl game ${SDL2_ALL_LIBS} m)
|
||||
target_link_libraries(game_sdl game ${SDL2_ALL_LIBS})
|
||||
|
||||
# libgame
|
||||
add_library (game game.c game_aux.c game_ext.c game_private.c history.c game_tools.c game_examples.c)
|
||||
|
||||
@@ -392,17 +392,12 @@ void render(SDL_Window* win, SDL_Renderer* ren, Env* env) {
|
||||
bool process(SDL_Window* win, Env* env, SDL_Event* e) {
|
||||
int w, h;
|
||||
SDL_GetWindowSize(win, &w, &h);
|
||||
|
||||
if (e->type == SDL_QUIT) {
|
||||
return true;
|
||||
}
|
||||
|
||||
#ifdef _ANDROID_
|
||||
#else
|
||||
|
||||
else if (e->type == SDL_WINDOWEVENT) {
|
||||
|
||||
} else if (e->type == SDL_MOUSEMOTION) {
|
||||
if (e->type == SDL_MOUSEMOTION) {
|
||||
SDL_Point mouse;
|
||||
SDL_GetMouseState(&mouse.x, &mouse.y);
|
||||
if (SDL_PointInRect(&mouse, env->rec_restart)) {
|
||||
@@ -477,6 +472,9 @@ void clean(Env* env) {
|
||||
SDL_DestroyTexture(env->one[0]);
|
||||
SDL_DestroyTexture(env->one[1]);
|
||||
free(env->one);
|
||||
SDL_DestroyTexture(env->two[0]);
|
||||
SDL_DestroyTexture(env->two[1]);
|
||||
free(env->two);
|
||||
SDL_DestroyTexture(env->three[0]);
|
||||
SDL_DestroyTexture(env->three[1]);
|
||||
free(env->three);
|
||||
|
||||
Reference in new issue
Block a user