Skip to content

Commit 5a56f52

Browse files
Add the base game
1 parent 5ff5a51 commit 5a56f52

File tree

11 files changed

+267
-74
lines changed

11 files changed

+267
-74
lines changed

.github/workflows/rust.yml

Lines changed: 0 additions & 22 deletions
This file was deleted.

Cargo.lock

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,5 @@ edition = "2018"
77
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
88

99
[dependencies]
10-
ggez = "0.5"
10+
ggez = "0.5"
11+
rand = "0.7"

resources/apple_dereference.png

1.78 KB
Loading

resources/apple_reference.png

1.97 KB
Loading

resources/ferris_pacman_1.png

2.84 KB
Loading

resources/ferris_pacman_2.png

2.18 KB
Loading

src/dead.rs

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,20 @@ use ggez::{
66

77
pub struct Death {
88
consolas: graphics::Font,
9-
ferris_planet: graphics::Image
9+
ferris_planet: graphics::Image,
1010
}
1111

1212
impl Death {
1313
pub fn spawn(ctx: &mut Context) -> Self {
1414
Self {
1515
consolas: graphics::Font::new(ctx, "/Consolas.ttf").unwrap(),
16-
ferris_planet: graphics::Image::new(ctx, "/ferris_planet.png").unwrap()
16+
ferris_planet: graphics::Image::new(ctx, "/ferris_planet.png").unwrap(),
1717
}
1818
}
1919

2020
pub fn draw(&mut self, ctx: &mut Context) -> GameResult<()> {
2121
graphics::clear(ctx, graphics::BLACK);
22-
22+
2323
let dead = Text::new(TextFragment {
2424
// `TextFragment` stores a string, and optional parameters which will override those
2525
// of `Text` itself. This allows inlining differently formatted lines, words,
@@ -33,7 +33,7 @@ impl Death {
3333
// This doesn't do anything at this point; can be used to omit fields in declarations.
3434
..Default::default()
3535
});
36-
36+
3737
let unsafe_dead = Text::new(TextFragment {
3838
// `TextFragment` stores a string, and optional parameters which will override those
3939
// of `Text` itself. This allows inlining differently formatted lines, words,
@@ -47,7 +47,7 @@ impl Death {
4747
// This doesn't do anything at this point; can be used to omit fields in declarations.
4848
..Default::default()
4949
});
50-
50+
5151
let unsafe_dead_block_start = Text::new(TextFragment {
5252
// `TextFragment` stores a string, and optional parameters which will override those
5353
// of `Text` itself. This allows inlining differently formatted lines, words,
@@ -61,7 +61,7 @@ impl Death {
6161
// This doesn't do anything at this point; can be used to omit fields in declarations.
6262
..Default::default()
6363
});
64-
64+
6565
let unsafe_dead_block_func = Text::new(TextFragment {
6666
// `TextFragment` stores a string, and optional parameters which will override those
6767
// of `Text` itself. This allows inlining differently formatted lines, words,
@@ -75,7 +75,7 @@ impl Death {
7575
// This doesn't do anything at this point; can be used to omit fields in declarations.
7676
..Default::default()
7777
});
78-
78+
7979
let unsafe_dead_block_end = Text::new(TextFragment {
8080
// `TextFragment` stores a string, and optional parameters which will override those
8181
// of `Text` itself. This allows inlining differently formatted lines, words,
@@ -89,7 +89,7 @@ impl Death {
8989
// This doesn't do anything at this point; can be used to omit fields in declarations.
9090
..Default::default()
9191
});
92-
92+
9393
graphics::draw(
9494
ctx,
9595
&dead,
@@ -98,7 +98,7 @@ impl Death {
9898
y: 40.0,
9999
},),
100100
)?;
101-
101+
102102
graphics::draw(
103103
ctx,
104104
&unsafe_dead,
@@ -107,7 +107,7 @@ impl Death {
107107
y: 200.0,
108108
},),
109109
)?;
110-
110+
111111
graphics::draw(
112112
ctx,
113113
&unsafe_dead_block_start,
@@ -116,7 +116,7 @@ impl Death {
116116
y: 200.0,
117117
},),
118118
)?;
119-
119+
120120
graphics::draw(
121121
ctx,
122122
&unsafe_dead_block_func,
@@ -125,7 +125,7 @@ impl Death {
125125
y: 260.0,
126126
},),
127127
)?;
128-
128+
129129
graphics::draw(
130130
ctx,
131131
&unsafe_dead_block_end,
@@ -134,7 +134,7 @@ impl Death {
134134
y: 300.0,
135135
},),
136136
)?;
137-
137+
138138
graphics::draw(
139139
ctx,
140140
&self.ferris_planet,
@@ -144,7 +144,11 @@ impl Death {
144144
),),
145145
)
146146
.unwrap();
147-
147+
148148
graphics::present(ctx)
149-
}
150-
}
149+
}
150+
151+
pub fn update(&self, _ctx: &mut Context) -> GameResult {
152+
Ok(())
153+
}
154+
}

0 commit comments

Comments
 (0)