here karx
This commit is contained in:
parent
5f1333c22f
commit
961b455c40
1
Cargo.lock
generated
1
Cargo.lock
generated
|
@ -40,6 +40,7 @@ name = "practice_game"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cat-box",
|
"cat-box",
|
||||||
|
"sdl2",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
|
|
@ -6,4 +6,5 @@ edition = "2021"
|
||||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
cat-box = "0.1.6"
|
cat-box = "0.1.6"
|
||||||
|
sdl2 = "0.35.2"
|
18
src/main.rs
18
src/main.rs
|
@ -1,12 +1,14 @@
|
||||||
use cat_box::{draw_text, Game, Sprite, SpriteCollection, get_keyboard_state};
|
use cat_box::{draw_text, Game, Sprite, SpriteCollection, get_keyboard_state};
|
||||||
use std::{thread, time};
|
use std::{thread, time};
|
||||||
|
use sdl2::keyboard::Scancode;
|
||||||
|
|
||||||
struct state {
|
struct state {
|
||||||
running: bool,
|
running: bool,
|
||||||
jumping: bool
|
jumping: bool
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let game = Game::new("Running", 500, 500);
|
let game = Game::new("Running", 500, 500);
|
||||||
|
|
||||||
|
@ -38,7 +40,7 @@ fn main() {
|
||||||
i=200;
|
i=200;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*for key in keys {
|
for key in keys {
|
||||||
let offset = match key {
|
let offset = match key {
|
||||||
Scancode::Escape => {
|
Scancode::Escape => {
|
||||||
game.terminate();
|
game.terminate();
|
||||||
|
@ -51,8 +53,18 @@ fn main() {
|
||||||
_ => (0, 0),
|
_ => (0, 0),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
let mut spriteindex = sprites.get(0).unwrap();
|
||||||
|
/*
|
||||||
|
|
||||||
}*/
|
*/
|
||||||
|
/*pub const fn unwrap(self) -> T {
|
||||||
|
match self {
|
||||||
|
Some(val) => val,
|
||||||
|
None => panic("called `Option::unwrap()` on a `None` value"),
|
||||||
|
}
|
||||||
|
}*/
|
||||||
|
//spriteindex.translate(offset);
|
||||||
|
}
|
||||||
|
|
||||||
ctx.set_background_colour( 129, 201, i);
|
ctx.set_background_colour( 129, 201, i);
|
||||||
sprites.draw(ctx).unwrap();
|
sprites.draw(ctx).unwrap();
|
||||||
|
|
Reference in a new issue