Make it run in VS to by not using hardcoded paths
This commit is contained in:
parent
ea1986c8f2
commit
b50085c345
2 changed files with 6 additions and 3 deletions
|
@ -10,3 +10,6 @@ include_directories(${sdl2_INCLUDE_DIRS} ${sdl2_image_INCLUDE_DIRS})
|
||||||
file(GLOB_RECURSE sources CONFIGURE_DEPENDS "*.cpp")
|
file(GLOB_RECURSE sources CONFIGURE_DEPENDS "*.cpp")
|
||||||
add_executable(PacMan ${sources})
|
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)
|
|
@ -12,8 +12,8 @@ GameWindow::GameWindow(int width, int height) {
|
||||||
auto sdl_renderer = createRenderer(sdl_window);
|
auto sdl_renderer = createRenderer(sdl_window);
|
||||||
createWindowSurface(sdl_window);
|
createWindowSurface(sdl_window);
|
||||||
setDrawColor(sdl_renderer);
|
setDrawColor(sdl_renderer);
|
||||||
maze_texture = loadTexture(sdl_renderer, "../../../../pacman/assets/maze.png");
|
maze_texture = loadTexture(sdl_renderer, "maze.png");
|
||||||
sprite_texture = loadTexture(sdl_renderer, "../../../../pacman/assets/sprites32.png");
|
sprite_texture = loadTexture(sdl_renderer, "sprites32.png");
|
||||||
}
|
}
|
||||||
|
|
||||||
void GameWindow::update(const PacMan & pacMan, Board board) {
|
void GameWindow::update(const PacMan & pacMan, Board board) {
|
||||||
|
|
Loading…
Reference in a new issue