更新时间:2021-07-02 19:13:51
封面
版权信息
Packt Upsell
Why subscribe?
PacktPub.com
Contributors
About the authors
About the reviewers
Packt is searching for authors like you
Preface
Who this book is for
What this book covers
To get the most out of this book
Download the example code files
Download the color images
Conventions used
Get in touch
Reviews
Basics of Rust
Getting to know Rust
Installing Rust
Windows
Linux/Mac
Test your installation
Documentation and reference
Main function
Variables
Built-in data types
Integer types
Floating-point types
Boolean type
Character type
Control flow
Writing a condition
Creating while loops
Creating functions
Creating structures
References
Clone types
Copy types
Mutable references
Methods
Constructors
Tuples
Enumerations
Pattern matching
Irrefutable patterns
Traits
Default methods
Associated types
Rules
Generics
The Option type
Arrays
Slices
For loops
Macros
Multiple pattern rules
Repetitions
Optional quantifier
Summary
Starting with SDL
Understanding Rust crates
Installing SDL2
Installing SDL2 on Linux
Installing SDL2 on Mac
Installing SDL2 on Windows
Windows with Build Script
Windows (MinGW)
Windows (MSVC)
Setting up your Rust project
Cargo and crates.io
The docs.rs documentation
Back to our Cargo.toml file
Rust's modules
Tetris
Creating a window
Drawing
Playing with Options
Solution
Loading images
Installing SDL2_image on Mac
Installing SDL2_image on Linux
Installing SDL2_image on Windows
Playing with features
Playing with images
Handling files
Saving/loading high scores
Iterators
Reading formatted data from files
Events and Basic Game Mechanisms
Writing Tetris
Tetrimino
Creating tetriminos
Generating a tetrimino
Rotating a tetrimino
Tetris struct
Interacting with the game map
SDL events