<commit_before># Piston [![Build Status](https://travis-ci.org/PistonDevelopers/piston.svg)](https://travis-ci.org/PistonDevelopers/piston)

A user friendly game engine written in Rust

Maintainers: @bvssvni

[Examples](https://github.com/pistondevelopers/piston-examples)

[List of features](https://github.com/PistonDevelopers/piston/issues/668)

[List of games made with Piston](https://github.com/PistonDevelopers/piston/wiki/Games-Made-With-Piston)

[Piston online docs](http://www.piston.rs/docs/piston/piston/index.html)

[How to contribute](https://github.com/PistonDevelopers/piston/blob/master/CONTRIBUTING.md)

## Start new project with Piston

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

Piston uses FreeType for font rendering.

#### Freetype on OS X

With [Homebrew](http://brew.sh), install freetype with

```
brew install freetype
```

Alternatively, download directly from http://www.freetype.org/download.html

#### Freetype on Ubuntu
If you are on Ubuntu, you can run

```
sudo apt-get install libfreetype6-dev`
```

#### Freetype on Windows
Copy `libfreetype-6.a` to `$RUST_ROOT\bin\rustlib\$CPU_ARCH-pc-windows-gnu\lib`.
- For 32-bit Windows, download [this libfreetype-6.a](https://github.com/tedsta/getting-started-with-piston/blob/master/windows_clibs/i686/libfreetype-6.a?raw=true) to e.g. `C:\Rust\bin\rustlib\i686-pc-windows-gnu\lib\`.
- For 64-bit Windows, download [that libfreetype-6.a](https://github.com/tedsta/getting-started-with-piston/blob/master/windows_clibs/x86_64/libfreetype-6.a?raw=true) to e.g. `C:\Rust\bin\rustlib\x86_64-pc-windows-gnu\lib\`.

### Drawing a red rectangle

Add [piston_window](https://crates.io/crates/piston_window) to your Cargo.toml, for example:

```
[dependencies]
piston_window = "0.3.0"
```

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

```Rust
extern crate piston_window;

use piston_window::*;

fn main() {
    let window: PistonWindow = WindowSettings::new("Hello Piston!", [640, 480])
        .exit_on_esc(true).into();
    for e in window {
        e.draw_2d(|c, g| {
            clear([1.0; 4], g);
            rectangle([1.0, 0.0, 0.0, 1.0], // red
                      [0.0, 0.0, 100.0, 100.0],
                      c.transform, g);
        });
    }
}
```

Use `cargo run` to start the application. It should clear the screen in white color and draw a 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:

* Graphics, 2D and 3D
* Idiomatic Rust game design
* Interactive applications<commit_msg>Added screenshot of red rectangle<commit_after># Piston [![Build Status](https://travis-ci.org/PistonDevelopers/piston.svg)](https://travis-ci.org/PistonDevelopers/piston)

A user friendly game engine written in Rust

Maintainers: @bvssvni

[Examples](https://github.com/pistondevelopers/piston-examples)

[List of features](https://github.com/PistonDevelopers/piston/issues/668)

[List of games made with Piston](https://github.com/PistonDevelopers/piston/wiki/Games-Made-With-Piston)

[Piston online docs](http://www.piston.rs/docs/piston/piston/index.html)

[How to contribute](https://github.com/PistonDevelopers/piston/blob/master/CONTRIBUTING.md)

## Start new project with Piston

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

Piston uses FreeType for font rendering.

#### Freetype on OS X

With [Homebrew](http://brew.sh), install freetype with

```
brew install freetype
```

Alternatively, download directly from http://www.freetype.org/download.html

#### Freetype on Ubuntu
If you are on Ubuntu, you can run

```
sudo apt-get install libfreetype6-dev`
```

#### Freetype on Windows
Copy `libfreetype-6.a` to `$RUST_ROOT\bin\rustlib\$CPU_ARCH-pc-windows-gnu\lib`.
- For 32-bit Windows, download [this libfreetype-6.a](https://github.com/tedsta/getting-started-with-piston/blob/master/windows_clibs/i686/libfreetype-6.a?raw=true) to e.g. `C:\Rust\bin\rustlib\i686-pc-windows-gnu\lib\`.
- For 64-bit Windows, download [that libfreetype-6.a](https://github.com/tedsta/getting-started-with-piston/blob/master/windows_clibs/x86_64/libfreetype-6.a?raw=true) to e.g. `C:\Rust\bin\rustlib\x86_64-pc-windows-gnu\lib\`.

### Drawing a red rectangle

Add [piston_window](https://crates.io/crates/piston_window) to your Cargo.toml, for example:

```
[dependencies]
piston_window = "0.3.0"
```

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

```Rust
extern crate piston_window;

use piston_window::*;

fn main() {
    let window: PistonWindow = WindowSettings::new("Hello Piston!", [640, 480])
        .exit_on_esc(true).into();
    for e in window {
        e.draw_2d(|c, g| {
            clear([1.0; 4], g);
            rectangle([1.0, 0.0, 0.0, 1.0], // red
                      [0.0, 0.0, 100.0, 100.0],
                      c.transform, g);
        });
    }
}
```

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

![red-rectangle](./images/red-rectangle.png)

## 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:

* Graphics, 2D and 3D
* Idiomatic Rust game design
* Interactive applications
{'fraction_non_alphanumeric': 0.12383107088989442, 'fraction_numerical': 0.019306184012066366, 'mean_word_length': 3.8225454545454545, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 18, 'lorem ipsum': 0, 'www.': 6, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 18, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3761682', 'n_tokens_mistral': 2364, 'n_tokens_neox': 2132, 'n_words': 666}