summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Barrett <tom@tombarrett.xyz>2021-01-31 06:12:43 -0600
committerTom Barrett <tom@tombarrett.xyz>2021-01-31 06:12:43 -0600
commit6a322b552583e75f8dc5b08ca1e1983c0e90af5b (patch)
treeefc8329d2eaec5e445e2204962908eee92e63773
parent637e4b338a6ee47802f7857679813ae50b79e0bf (diff)
starting gem
-rw-r--r--src/main.rs15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/main.rs b/src/main.rs
index d295f3a..4e18421 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -2,15 +2,20 @@ use ggez;
use ggez::event;
use ggez::graphics;
use ggez::nalgebra as na;
+use ggez::graphics::{self, spritebatch::SpriteBatch, DrawParam, FilterMode, Image, WrapMode};
-struct MainState {
- pos_x: f32,
+struct Game {
+ spritebatch: SpriteBatch,
}
impl MainState {
- fn new() -> ggez::GameResult<MainState> {
- let s = MainState { pos_x: 0.0 };
- Ok(s)
+ fn new() -> ggez::GameResult<Game> {
+ let mut image = Image::new(context, "/gem.png")?;
+ image.set_filter(FilterMode::Nearest);
+ image.set_wrap(WrapMode::Mirror, WrapMode::Mirror);
+
+
+ Ok(MainState { spritebatch: SpriteBatch::new(image) })
}
}