Skip to content

Instantly share code, notes, and snippets.

View piedoom's full-sized avatar
🦀
rust rust rust rust rust rust rust rust

doomy piedoom

🦀
rust rust rust rust rust rust rust rust
View GitHub Profile

What is this?

This gist keeps a copy of my questions when using Amethyst. Hopefully it can help fill in some common questions beginners might have.

Questions

q. How can I create a sprite that always has a single image, for instance a background image.

a. (Partial) Can use UI texture. Ended up just creating a spritesheet with one image


Running `rustc --edition=2018 --crate-name amethyst_renderer C:\Users\doomy\.cargo\git\checkouts\amethyst-fedb0a1032a075ce\1a77ac4\amethyst_renderer\src\lib.rs --color always --crate-type lib --emit=dep-info,link -C debuginfo=2 --cfg "feature=\"default\"" --cfg "feature=\"gfx_device_gl\"" --cfg "feature=\"gfx_window_glutin\"" --cfg "feature=\"glutin\"" --cfg "feature=\"opengl\"" -C metadata=ec37c4cb6d247a43 -C extra-filename=-ec37c4cb6d247a43 --out-dir C:\Users\doomy\Documents\code\stry\target\debug\deps -L dependency=C:\Users\doomy\Documents\code\stry\target\debug\deps --extern amethyst_assets=C:\Users\doomy\Documents\code\stry\target\debug\deps\libamethyst_assets-04b28c3c22c99813.rlib --extern amethyst_core=C:\Users\doomy\Documents\code\stry\target\debug\deps\libamethyst_core-823cb6700766c446.rlib --extern amethyst_derive=C:\Users\doomy\Documents\code\stry\target\debug\deps\amethyst_derive-57e620394be74dc8.dll --extern amethyst_error=C:\Users\doomy\Documents\code\stry\target\debug\deps\libamethyst_error-f28
@piedoom
piedoom / models.rs
Created September 23, 2018 19:36
serde parsing
#[serde(rename_all = "snake_case")]
#[derive(Serialize, Deserialize, Debug)]
pub enum Response {
Posts(Vec<Post>),
}
#[derive(Serialize, Deserialize, Debug)]
#[serde(rename_all = "snake_case")]
#[serde(tag = "type")]
pub enum Post {
fn get<T>() -> Result<T, Error> {
serde_json::from_str(..)
}
/// Send a given request and deserialize the response
pub fn send_and_deserialize(&self, header: OAuthAuthorizationHeader) -> Result<Root, Error> {
let req = self.clone();
// Send the request
let mut response = req
.client
.hyper
.request(req.method, &req.url)
.header(Authorization(header.to_string()))
Compiling rumblr v0.1.0 (file:///C:/Users/doomy/Documents/code/rumblr)
error[E0277]: the trait bound `error::Error: data::blog::_IMPL_DESERIALIZE_FOR_Blog::_serde::Deserialize<'_>` is not satisfied
--> src\request.rs:65:9
|
65 | serde_json::from_str(&buf)?
| ^^^^^^^^^^^^^^^^^^^^ the trait `data::blog::_IMPL_DESERIALIZE_FOR_Blog::_serde::Deserialize<'_>` is not implemented for `error::Error`
|
= note: required because of the requirements on the impl of `data::blog::_IMPL_DESERIALIZE_FOR_Blog::_serde::Deserialize<'_>` for `std::result::Result<data::root::Root, error::Error>`
= note: required by `serde_json::from_str`
channel Lead {
plugin {
file Piano.vst
name 'baby_grand'
modify {
gain -6db
detune 2%
}
}
}
#include <ESP8266WiFi.h>
#include <WiFiClient.h>
// How many clients should be able to telnet to this ESP8266
#define MAX_SERVER_CLIENTS 2
// Baud rate for serial monitors (useful for development)
#define BAUD_RATE 115200
// Network name and password for the ESP to connect
warning: Hard linking files in the incremental compilation cache failed. Copying files instead. Consider moving the cache directory to a file system which supports hard linking in session dir `/vagrant/target/debug/incremental/resamplr-uuwdn7ep95ho/s-ez1onym2h6-14feiei-working`
warning: unused `#[macro_use]` import
--> src/main.rs:19:1
|
19 | #[macro_use]
| ^^^^^^^^^^^^
|
= note: #[warn(unused_imports)] on by default