MCPcopy Index your code
hub / github.com/PistonDevelopers/piston

github.com/PistonDevelopers/piston @V0.33.0

Chat with this repo
repository ↗ · DeepWiki ↗ · release V0.33.0 ↗ · + Follow
238 symbols 442 edges 33 files 109 documented · 46%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

Piston

Build Status Crates.io Crates.io

A modular game engine written in Rust

Maintainers of Piston core libraries: @bvssvni

Dive into the world of Piston

Start new project with Piston

You should know how to build "hello world" with Rust, see http://www.rust-lang.org/.

Drawing a red rectangle

Add piston_window to your Cargo.toml, for example:

[dependencies]
piston_window = "0.61.0"

In "src/main.rs", type the following code:

extern crate piston_window;

use piston_window::*;

fn main() {
    let mut window: PistonWindow =
        WindowSettings::new("Hello Piston!", [640, 480])
        .exit_on_esc(true).build().unwrap();
    while let Some(event) = window.next() {
        window.draw_2d(&event, |context, graphics| {
            clear([1.0; 4], graphics);
            rectangle([1.0, 0.0, 0.0, 1.0], // red
                      [0.0, 0.0, 100.0, 100.0],
                      context.transform,
                      graphics);
        });
    }
}

Use cargo run to start the application. It should clear the screen in white color and draw a red rectangle.

red-rectangle

Goals

The Piston project is a large collaboration among many developers. There are libraries for 2D, 3D, event programming, AI, image processing etc. By sharing the maintenance, we get more time to build new stuff.

Piston is as much a community project as it is a collection of libraries. Writing and maintaining code is expensive, and by sharing this cost we reach our goals faster. We believe that seeking personal goals and ambitions, while helping each other, results in higher quality.

  • Our main goal is to free up time for maintainers and the people involved
  • ... such that we can create new amazing stuff and reach our personal goals
  • ... by making more people use Rust for game development and become engaged in open source

In addition we do research or plan to in the following areas:

Dependency graph

dependencies

Extension points exported contracts — how you extend this code

EventLoop (Interface)
Methods implemented for changing event loop settings. [2 implementers]
src/event_loop/src/lib.rs
BuildFromWindowSettings (Interface)
Constructs a window from a [`WindowSettings`](./struct.WindowSettings.html) object. It is used by [`WindowSettings::bui [1 …
src/window/src/lib.rs
ControllerAxisEvent (Interface)
The position of a controller axis changed. [1 implementers]
src/input/src/controller.rs
Window (Interface)
Trait representing the minimum requirements for defining a window. This trait defines all the behavior needed for makin [1 …
src/window/src/lib.rs
GenericEvent (Interface)
Implemented by all events [1 implementers]
src/input/src/generic_event.rs
AdvancedWindow (Interface)
Trait representing a window with the most features that are still generic. This trait is implemented by fully featured [1 …
src/window/src/lib.rs
RenderEvent (Interface)
When the next frame should be rendered [1 implementers]
src/input/src/render.rs
OpenGLWindow (Interface)
Trait for OpenGL specific operations on a window. OpenGL uses a strategy called "function pointer loading" to hook up t
src/window/src/lib.rs

Core symbols most depended-on inside this repo

into
called by 36
src/input/src/lib.rs
ns_to_duration
called by 8
src/event_loop/src/lib.rs
poll_event
called by 6
src/window/src/no_window.rs
get_event_settings
called by 6
src/event_loop/src/lib.rs
set_event_settings
called by 6
src/event_loop/src/lib.rs
should_close
called by 4
src/window/src/no_window.rs
button_args
called by 4
src/input/src/button.rs
touch
called by 3
src/input/src/touch.rs

Shape

Method 150
Function 38
Interface 23
Class 16
Enum 11

Languages

Rust100%

Modules by API surface

src/window/src/lib.rs49 symbols
src/event_loop/src/lib.rs24 symbols
src/window/src/no_window.rs20 symbols
src/input/src/mouse.rs16 symbols
src/input/src/button.rs15 symbols
src/input/src/touch.rs14 symbols
src/input/src/lib.rs12 symbols
src/input/src/keyboard.rs9 symbols
src/input/src/controller.rs8 symbols
src/input/src/update.rs7 symbols
src/input/src/render.rs7 symbols
src/input/src/idle.rs7 symbols

For agents

$ claude mcp add piston \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact