Skip to content

Commit

Permalink
fixed camera offset
Browse files Browse the repository at this point in the history
  • Loading branch information
Redcrafter committed Aug 20, 2024
1 parent c05aaab commit 320d8ff
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,11 @@ static bool load_game(const std::string& path) {
try {
game_data = GameData::load(path);
load_data();

selectedMap = 0;
auto& map = game_data.maps[selectedMap];
camera.position = -(map.offset + map.size / 2) * room_size * 8;

return true;
} catch(std::exception& e) {
error_dialog.push(e.what());
Expand Down Expand Up @@ -1655,7 +1660,7 @@ int runViewer() {
updateRender();
}
// center of screen
camera.position = (pos * 8) + 4;
camera.position = -(pos * 8 + 4);
});
tile_list.draw(game_data, render_data->atlas);
tile_viewer.draw(game_data, should_update);
Expand Down

0 comments on commit 320d8ff

Please sign in to comment.