summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/main.rs10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/main.rs b/src/main.rs
index 42595ad..edbb973 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -11,7 +11,7 @@ use rand::{
Rng,
};
-pub const TILE_SCALE: f32 = 2.0;
+pub const TILE_SCALE: f32 = 3.0;
pub const TILE_HEIGHT: f32 = 16.0;
pub const TILE_WIDTH: f32 = 16.0;
pub const BORDER_SIZE: f32 = 3.0;
@@ -140,10 +140,14 @@ struct Game {
selected: Option<(usize, usize)>,
spritebatch: SpriteBatch,
grid: Vec<Vec<Cell>>,
+ background: Image,
}
impl Game {
fn new(context: &mut Context) -> GameResult<Game> {
+ let mut background = Image::new(context, "/background.png")?;
+ background.set_filter(FilterMode::Nearest);
+
let mut image = Image::new(context, "/gem.png")?;
image.set_filter(FilterMode::Nearest);
image.set_wrap(WrapMode::Mirror, WrapMode::Mirror);
@@ -190,6 +194,7 @@ impl Game {
grid,
selected: None,
spritebatch: SpriteBatch::new(image),
+ background,
})
}
}
@@ -275,7 +280,8 @@ impl EventHandler for Game {
}
fn draw(&mut self, context: &mut Context) -> GameResult {
- graphics::clear(context, [0.1, 0.2, 0.3, 1.0].into());
+ graphics::clear(context, [0.0, 0.0, 0.0, 1.0].into());
+ graphics::draw(context, &self.background, DrawParam::default())?;
for row in self.grid.iter() {
for cell in row.iter() {