Skip to content

phughesmcr/game-of-life

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Conway's Game of Life in Rust

Conway's Game of Life in Rust using Piston.

Features in-game cell painting and custom grids from files.

Screenshot

screenshot

How to Play

Mouse click to paint cells.

Press C to clear the grid.

Press F to display FPS counter.

Press L to toggle grid lines.

Press P or to pause.

Press R to randomise the grid.

Command Line Flags

The game can be modified by passing command line flags.

Screen size

--width to set window width in pixels. Default is 1280.

--height to set window height in pixels. Default is 720.

For example: ./game_of_life --width 640 --height 480

Full screen window

---fullscreen sets the window to full screen mode.

For example: ./game_of_life --fullscreen

VSync

--vsync enables vsync.

For example: ./game_of_life --vsync

Custom grid from image

--map followed by an image filename, generate grid from image. White pixels (i.e rgba[255, 255, 255, 255]) are dead cells, any other colours will be treated as living cells. Image file must match window height and width.

For example: ./game_of_life --map example_map.png

Update speed

--ms followed by a number, controls the number of milliseconds between each grid update.

For example: ./game_of_life --ms 30

Cell size

--scale followed by a number, controls the size of the cells in pixels. Scale must be divisible by window height and width.

For example: ./game_of_life --scale 8

To Do

  • Window size command line flags (inc. start-fullscreen flag)
  • Resize grid on window resize
  • Custom colours
  • Toggleable FPS counter on screen
  • Toggleable on-screen game stats
  • Obstacle blocks (maybe?)
  • Refactor main.rs into main.rs and app.rs

Acknowledgements

Perfect DOS VGA 375 font by Zeh Fernando

License

Copyright P. Hughes 2019.

This project is licensed under the GNU General Public License v3.0. See LICENSE for further details.

Releases

No releases published

Packages

No packages published

Languages