This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| fn run() -> tetra::Result { | |
| ContextBuilder::new("My Game", 1280, 720) | |
| .build()? | |
| .run(GameState::new) | |
| } | |
| fn report_crash(err: TetraError) { | |
| let mut crash_log = File::create("./crash_log.txt").unwrap(); | |
| write!( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [package] | |
| name = "triangle-from-scratch" | |
| version = "0.1.0" | |
| authors = ["Joe Clay <[email protected]>"] | |
| edition = "2018" | |
| # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html | |
| [lib] | |
| crate-type = ["cdylib"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //! This is an example of one way you could achieve multi-threaded asset loading with Tetra | |
| //! (or any other Rust game framework). | |
| //! | |
| //! The design is intended to be similar to: | |
| //! | |
| //! * https://github.com/kikito/love-loader | |
| //! * https://github.com/libgdx/libgdx/wiki/Managing-your-assets | |
| //! | |
| //! This should not be taken as production-ready code (for one thing, it only supports | |
| //! textures!) or the 'best' way of implementing this functionality. It's just an example |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| use tetra::graphics::scaling::{ScalingMode, ScreenScaler}; | |
| use tetra::graphics::{self, Color}; | |
| use tetra::input::{self, Key}; | |
| use tetra::{Context, ContextBuilder, Event, State}; | |
| struct Assets { | |
| // assets go here... | |
| } | |
| impl Assets { |
OlderNewer