update for new RLTK version

This commit is contained in:
2020-04-17 20:35:31 -04:00
parent 5593c4d14e
commit bf8204d1a3
5 changed files with 166 additions and 107 deletions

View File

@@ -1,4 +1,4 @@
use rltk::{Console, GameState, Point, Rltk, VirtualKeyCode, RGB};
use rltk::{GameState, Point, Rltk, VirtualKeyCode, RGB};
use specs::prelude::*;
use std::cmp::{max, min};
mod rect;
@@ -135,11 +135,11 @@ pub fn draw_map(ecs: &World, ctx: &mut Rltk) {
}
}
fn main() {
fn main() -> rltk::BError {
use rltk::RltkBuilder;
let context = RltkBuilder::simple80x50()
.with_title("Roguelike Tutorial")
.build();
.build()?;
let mut gs = State {
ecs: World::new(),
runstate: RunState::Running,
@@ -180,7 +180,7 @@ fn main() {
for (idx, room) in map.rooms.iter().skip(1).enumerate() {
let (x, y) = room.center();
let (glyph, name): (u8, String) = match rng.roll_dice(1, 2) {
let (glyph, name): (u16, String) = match rng.roll_dice(1, 2) {
1 => (rltk::to_cp437('g'), "Goblin".to_string()),
_ => (rltk::to_cp437('o'), "Orc".to_string()),
};
@@ -207,5 +207,5 @@ fn main() {
gs.ecs.insert(map);
gs.ecs.insert(Point::new(player_x, player_y));
rltk::main_loop(context, gs);
rltk::main_loop(context, gs)
}