|
|
@ -40,10 +40,10 @@ sf::Color GUI::color(Value val) { |
|
|
|
return VALUES[size_t(val)]; |
|
|
|
return VALUES[size_t(val)]; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
GUI::GUI() : $game_map(50, 20), |
|
|
|
GUI::GUI() : $game_map(GAME_MAP_X, GAME_MAP_Y), |
|
|
|
$canvas(60 * 2, 20 * 4), |
|
|
|
$canvas(GAME_MAP_X * 2, GAME_MAP_Y * 4), |
|
|
|
$window(sf::VideoMode(1600,900), "Roguish"), |
|
|
|
$window(sf::VideoMode(VIDEO_X,VIDEO_Y), "Roguish"), |
|
|
|
$screen(0,0) |
|
|
|
$screen(SCREEN_X, SCREEN_Y) |
|
|
|
{ |
|
|
|
{ |
|
|
|
int res = $hit_buf.loadFromFile("./assets/hit.wav"); |
|
|
|
int res = $hit_buf.loadFromFile("./assets/hit.wav"); |
|
|
|
dbc::check(res, "failed to load hit.wav"); |
|
|
|
dbc::check(res, "failed to load hit.wav"); |
|
|
@ -57,7 +57,6 @@ GUI::GUI() : $game_map(50, 20), |
|
|
|
$player.location = $game_map.place_entity(0); |
|
|
|
$player.location = $game_map.place_entity(0); |
|
|
|
$enemy.location = $game_map.place_entity(1); |
|
|
|
$enemy.location = $game_map.place_entity(1); |
|
|
|
$goal = $game_map.place_entity($game_map.room_count() - 1); |
|
|
|
$goal = $game_map.place_entity($game_map.room_count() - 1); |
|
|
|
$screen = Screen::Create(Dimension::Full()); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void GUI::create_renderer() { |
|
|
|
void GUI::create_renderer() { |
|
|
@ -165,6 +164,8 @@ int GUI::main() { |
|
|
|
while($window.isOpen()) { |
|
|
|
while($window.isOpen()) { |
|
|
|
render_scene(); |
|
|
|
render_scene(); |
|
|
|
handle_events(); |
|
|
|
handle_events(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
std::this_thread::sleep_for(10ms); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return 0; |
|
|
|
return 0; |
|
|
|