This file contains 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 cgmath::prelude::*; | |
use image::*; | |
use noise::*; | |
pub type Vec2d = cgmath::Vector2<f64>; | |
pub type Vec3d = cgmath::Vector3<f64>; | |
pub type Mat4d = cgmath::Matrix4<f64>; |
This file contains 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 cgmath::{Vector2, Vector3, Vector4}; | |
#[derive(Copy, Clone, Debug)] | |
pub struct Params { | |
pub offset: f32, | |
pub lacunarity: f32, | |
pub highest_dim: f32, | |
pub octaves: f32, | |
pub gain: f32, | |
} |
This file contains 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 = "planet" | |
version = "0.0.1" | |
[dependencies] | |
sdl2 = "0.19" | |
sdl2_image = "0.19" | |
cgmath = "*" | |
rand = "*" | |
rayon = "*" |
This file contains 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
extern crate rand; | |
extern crate time; | |
use std::path::Path; | |
use std::iter::Peekable; | |
use std::slice; | |
struct Parser<'input> { | |
input: Peekable<slice::Iter<'input, u8>>, | |
line: usize, |
This file contains 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
extern crate sdl2; | |
extern crate sdl2_image; | |
use sdl2::rect::Rect; | |
use sdl2_image::SaveSurface; | |
fn main() { | |
let _sdl = sdl2::init().unwrap(); | |
let _img_ctx = { use sdl2_image::*; init(INIT_PNG) }.unwrap(); |
This file contains 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 std::hash::Hash; | |
use std::sync::mpsc::{self, Sender, Receiver}; | |
use std::collections::HashMap; | |
#[cfg(test)] | |
mod test { | |
#[test] | |
fn simple_network() { | |
use super::*; |
This file contains 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 std::ffi::{OsString}; | |
use std::path::{Path}; | |
const MARKPATH_KEY: &'static str = "MARKPATH"; | |
const COMPLETE_ARG: &'static str = "--complete"; | |
/// | |
/// Port of some zsh code that reads a directory full of symlinks | |
/// and prints their names, followed by their destinations | |
/// |
This file contains 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 generate(format: PixelFormat) -> Vec<Tex> { | |
// Helper functions for wrangling colors | |
fn gray(val: u8) -> Color { RGB(val, val, val) } | |
fn red(val: u8, other: u8) -> Color { RGB(val, other, other) } | |
fn green(val: u8, other: u8) -> Color { RGB(other, val, other) } | |
fn blue(val: u8, other: u8) -> Color { RGB(other, other, val) } | |
fn scale_to_dim(val: int) -> u8 { | |
mix(0.0, 255.0, val as f64 / 64.0) as u8 | |
} | |
fn xor_shade(x: int, y: int) -> u8 { |
This file contains 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
{-# LANGUAGE RecordWildCards #-} | |
data Species = Species | |
{ speciesName :: String | |
, minHeight :: Int | |
, maxHeight :: Int | |
} deriving (Eq, Show, Ord) | |
instance Tabular Species where | |
readRecord = do |
This file contains 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
#!/usr/bin/env python | |
from __future__ import print_function | |
# This program takes Homestuck pesterlog files (.page) in plain text, | |
# colorizes them, and renders them in other formats. By default, it | |
# outputs a PNG file, but BBCode and HTML output are also supported. | |
# Planned features: | |
# - HTML output with classes | |
# - CSS output in separate files or <style> tags |
NewerOlder