-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathindex.html
120 lines (103 loc) · 4.53 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="chrome=1">
<title>ggez: Rust game thing</title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/normalize/6.0.0/normalize.min.css">
<!-- <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/github-fork-ribbon-css/0.2.0/gh-fork-ribbon.min.css" /> -->
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.11.0/styles/hopscotch.min.css">
<link rel="stylesheet" href="style/style.css">
<meta name="viewport" content="width=device-width">
</head>
<body>
<div class="container">
<!-- <a class="github-fork-ribbon" href="https://github.com/ggez/ggez" title="Fork me on GitHub">Fork me on GitHub</a> -->
<header>
<a id="logo" href="/"></a>
</header>
<nav>
<ul>
<li><a href="/screenshots.html">Screenshots</a></li>
<li><a href="https://github.com/ggez/ggez/tree/master/examples">Examples</a></li>
<li><a href="https://docs.rs/ggez/">API Docs</a></li>
<li><a href="https://github.com/ggez/ggez/">Source and install instructions</a></li>
</ul>
</nav>
<section class="main">
<section class="banner">
<h1>A Rust library to create Good Games Easily</h1>
</section>
<p class="text">More specifically, ggez is a lightweight game framework for making 2D
games with minimum friction. It aims to implement an API based on (a
Rustified version of) the <a href="https://love2d.org/">LÖVE</a> game framework. Thus it contains portable 2D drawing, sound, resource loading and
event handling.</p>
<pre>
<code class="rust">
use ggez::event;
use ggez::graphics::{self, Color};
use ggez::{Context, GameResult};
use ggez::glam::*;
struct MainState {
pos_x: f32,
}
impl MainState {
fn new() -> GameResult<MainState> {
let s = MainState { pos_x: 0.0 };
Ok(s)
}
}
impl event::EventHandler<ggez::GameError> for MainState {
fn update(&mut self, _ctx: &mut Context) -> GameResult {
self.pos_x = self.pos_x % 800.0 + 1.0;
Ok(())
}
fn draw(&mut self, ctx: &mut Context) -> GameResult {
let mut canvas = graphics::Canvas::from_frame(
ctx,
graphics::Color::from([0.1, 0.2, 0.3, 1.0]),
);
let circle = graphics::Mesh::new_circle(
ctx,
graphics::DrawMode::fill(),
Vec2::new(0.0, 0.0),
100.0,
2.0,
Color::WHITE,
)?;
canvas.draw(&circle, Vec2::new(self.pos_x, 380.0));
canvas.finish(ctx)?;
Ok(())
}
}
pub fn main() -> GameResult {
let cb = ggez::ContextBuilder::new("super_simple", "ggez");
let (ctx, event_loop) = cb.build()?;
let state = MainState::new()?;
event::run(ctx, event_loop, state)
}
</code>
</pre>
<p class="text">ggez is not meant to be everything to everyone, but rather a good base upon which to build higher-level systems and a useful tool that lets you immediately get started on projects such as game jams. As such, it provides:</p>
<ul class="text">
<li>Filesystem abstraction that lets you load resources from folders or zip files</li>
<li>Hardware-accelerated rendering engine built on the <code>wgpu</code> graphics engine</li>
<li>Playing and loading .ogg, .wav and .flac files via the <code>rodio</code> crate</li>
<li>TTF font rendering with <code>glyph_brush</code></li>
<li>Interface for handling keyboard and mouse events easily through callbacks</li>
<li>Config file for defining engine and game settings</li>
<li>Easy timing and FPS measurement functions</li>
<li>Math integration with <code><a href="https://github.com/kvark/mint">mint</a></code>, letting
you use any vector math library</li>
<li>Some more advanced graphics options: shaders, sprite batches (i.e. instanced drawing) and render targets</li>
</ul>
<footer>
Copyright © 2023 <a href="https://github.com/orgs/ggez/people">The ggez team</a>
</footer>
</section>
</div>
<script src="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.11.0/highlight.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.11.0/languages/rust.min.js"></script>
<script>hljs.initHighlightingOnLoad();</script>
</body>
</html>