Make it run in VS to by not using hardcoded paths

This commit is contained in:
Patricia Aas 2020-11-27 15:44:21 +01:00
parent ea1986c8f2
commit b50085c345
2 changed files with 6 additions and 3 deletions

View File

@ -9,4 +9,7 @@ include_directories(${sdl2_INCLUDE_DIRS} ${sdl2_image_INCLUDE_DIRS})
file(GLOB_RECURSE sources CONFIGURE_DEPENDS "*.cpp")
add_executable(PacMan ${sources})
target_link_libraries(PacMan sdl2::sdl2 sdl2_image::sdl2_image)
target_link_libraries(PacMan sdl2::sdl2 sdl2_image::sdl2_image)
file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/../assets/maze.png DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/bin)
file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/../assets/sprites32.png DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/bin)

View File

@ -12,8 +12,8 @@ GameWindow::GameWindow(int width, int height) {
auto sdl_renderer = createRenderer(sdl_window);
createWindowSurface(sdl_window);
setDrawColor(sdl_renderer);
maze_texture = loadTexture(sdl_renderer, "../../../../pacman/assets/maze.png");
sprite_texture = loadTexture(sdl_renderer, "../../../../pacman/assets/sprites32.png");
maze_texture = loadTexture(sdl_renderer, "maze.png");
sprite_texture = loadTexture(sdl_renderer, "sprites32.png");
}
void GameWindow::update(const PacMan & pacMan, Board board) {