Skip to content

Instantly share code, notes, and snippets.

View 17cupsofcoffee's full-sized avatar

Joe Clay 17cupsofcoffee

View GitHub Profile
@17cupsofcoffee
17cupsofcoffee / main.rs
Created September 6, 2020 19:10
Simple crash logging in Tetra
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!(
@17cupsofcoffee
17cupsofcoffee / Cargo.toml
Created January 7, 2021 23:04
Triangle From Scratch (but it's web)
[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"]
@17cupsofcoffee
17cupsofcoffee / main.rs
Last active September 8, 2021 11:13
Multi-threaded Asset Loading with Tetra
//! 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
@17cupsofcoffee
17cupsofcoffee / main.rs
Created March 4, 2021 18:05
A blank Tetra template
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 {