This project is a simple Rust implementation of a game window using the ggez
library. It creates a window with a movable white square that can be controlled using arrow keys.
- Rust programming language
- Cargo package manager
-
Clone this repository:
git clone git@github.com:cschladetsch/RustGame.git cd RustGame
-
Ensure you have the latest stable version of Rust:
rustup update stable
To run the game, use the following command in the project directory:
cargo run
If you're using WSL, you'll need to set up an X server on Windows and use the following command to run the game:
DISPLAY=:0 cargo run
You may also need to set the LIBGL_ALWAYS_INDIRECT
environment variable:
export LIBGL_ALWAYS_INDIRECT=1
- Use the arrow keys to move the white square:
- Left Arrow: Move left
- Right Arrow: Move right
- Up Arrow: Move up
- Down Arrow: Move down
Cargo.toml
: Contains the project configuration and dependencies.src/main.rs
: Contains the main game logic, including window creation, event handling, and rendering.
You can customize the game by modifying the constants at the top of main.rs
:
WINDOW_WIDTH
andWINDOW_HEIGHT
: Change the size of the game window.SQUARE_SIZE
: Adjust the size of the movable square.SQUARE_SPEED
: Modify the speed at which the square moves.
Contributions are welcome! Please feel free to submit a Pull Request.
This project is open source and available under the MIT License.