Skip to content

Instantly share code, notes, and snippets.

View torkleyy's full-sized avatar

Thomas Schaller torkleyy

  • Wolf GmbH
  • Bavaria, Germany
View GitHub Profile
@torkleyy
torkleyy / specs-lua.rs
Created October 29, 2017 15:15
A little snippet showing how Lua could be used together with Specs.
#[macro_use]
extern crate error_chain;
extern crate hlua;
extern crate specs;
use std::collections::HashMap;
error_chain! {
errors {
NoSuchComponent(name: String) {
@torkleyy
torkleyy / entities.rs
Created August 7, 2017 21:03
Creating entities in Specs
impl<'a> System<'a> for EntitiyCreator {
type SystemData = (Entities<'a>, WriteStorage<'a, Pos>);
fn run(&mut self, (entities, pos): Self::SystemData) {
let a = entities.create();
let b = entities.create();
pos.insert(a, Pos::new(2, 4));
pos.insert(b, Pos::new(3, 5));
@torkleyy
torkleyy / sys.rs
Created May 20, 2017 20:12
This is how the new specs API will look like
extern crate shred;
#[macro_use]
extern crate shred_derive;
extern crate specs;
use shred::{DispatcherBuilder, System};
use specs::{ReadStorage, WriteStorage, World};
use specs::entity::Component;
use specs::storages::VecStorage;
@torkleyy
torkleyy / scene.json
Last active April 10, 2017 11:54
That's how a scene configuration in amethyst might look like (we might use another file format).
{
"meshes": {
"cube": "obj",
"sphere": "fbx"
},
"textures": {
"grass": "png",
"brick": "jpg"
},