Merge branch 'main' of gitlab.emi.u-bordeaux.fr:pt2/teams-s4/tm07/lightup-07c

This commit is contained in:
Mohamed Fatih committed 2022-03-18 16:27:20 +01:00
commit e5767a0e04
4 files changed
+57 -17

No files matched your search

+25
View File
@@ -57,6 +57,31 @@
],
"preLaunchTask": "make_build"
},
{
"name": "(gdb) game_sdl",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/build/game_sdl",
"args": [],
"stopAtEntry": false,
"cwd": "${fileDirname}",
"environment": [],
"externalConsole": false,
"MIMode": "gdb",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
},
{
"description": "Set Disassembly Flavor to Intel",
"text": "-gdb-set disassembly-flavor intel",
"ignoreFailures": true
}
],
"preLaunchTask": "make_build"
},
{
"name": "(gdb) debug tests",
"type": "cppdbg",
+17 -3
View File
@@ -31,6 +31,20 @@ set(CMAKE_C_FLAGS "-std=c99 -Wall")
set(CMAKE_C_FLAGS_DEBUG "-g --coverage -pthread -Wextra -Wunused-parameter -Wpedantic -Werror") # use CMake option: -DCMAKE_BUILD_TYPE=DEBUG
set(CMAKE_C_FLAGS_RELEASE "-O3 -DNDEBUG") # use CMake option: -DCMAKE_BUILD_TYPE=RELEASE
######################### COPY IMGAES #########################
file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/img/lightbulb_red.png DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/img/lightbulb_white.png DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/img/redo_down.png DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/img/redo_up.png DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/img/restart_up.png DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/img/restart_down.png DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/img/undo_down.png DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/img/undo_up.png DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/img/solve_up.png DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/img/solve_down.png DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/arial.ttf DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
############################# SRC #############################
# game_text
@@ -46,9 +60,9 @@ add_executable(game_solve game_solve.c)
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)
include_directories(${SDL2_ALL_INC})
add_executable(game_sdl main.c model.c)
target_link_libraries(game_sdl game ${SDL2_ALL_LIBS} m)
# libgame
add_library (game game.c game_aux.c game_ext.c game_private.c history.c game_tools.c game_examples.c)
+14 -13
View File
@@ -15,17 +15,17 @@
/* **************************************************************** */
#define RESTART_UP "../img/restart_up.png"
#define RESTART_DOWN "../img/restart_down.png"
#define UNDO_UP "../img/undo_up.png"
#define UNDO_DOWN "../img/undo_down.png"
#define REDO_UP "../img/redo_up.png"
#define REDO_DOWN "../img/redo_down.png"
#define SOLVE_UP "../img/solve_up.png"
#define SOLVE_DOWN "../img/solve_down.png"
#define LIGHTBULB_WHITE "../img/lightbulb_white.png"
#define LIGHTBULB_BLACK "../img/lightbulb_black.png"
#define FONT "../arial.ttf"
#define RESTART_UP "./img/restart_up.png"
#define RESTART_DOWN "./img/restart_down.png"
#define UNDO_UP "./img/undo_up.png"
#define UNDO_DOWN "./img/undo_down.png"
#define REDO_UP "./img/redo_up.png"
#define REDO_DOWN "./img/redo_down.png"
#define SOLVE_UP "./img/solve_up.png"
#define SOLVE_DOWN "./img/solve_down.png"
#define LIGHTBULB_WHITE "./img/lightbulb_white.png"
#define LIGHTBULB_BLACK "./img/lightbulb_black.png"
#define FONT "./arial.ttf"
#define FONTSIZE 36
/* **************************************************************** */
@@ -333,10 +333,11 @@ void render(SDL_Window* win, SDL_Renderer* ren, Env* env) {
render_blank(ren, &rec, game_is_lighted(env->g, i, j));
else if (game_is_marked(env->g, i, j))
render_mark(ren, &rec, game_is_lighted(env->g, i, j));
rec.x += size_rec;
}
rec.x = rec_x;
rec.y += size_rec;
}
rec.x = rec_x;
rec.y += size_rec;
}
/* **************************************************************** */
+1 -1
View File
@@ -3,7 +3,7 @@
#ifndef MODEL_H
#define MODEL_H
#include <SDL.h>
#include <SDL2/SDL.h>
#include <stdbool.h>
#include <stdio.h>