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 fastSine | |
import "math" | |
// Generate any sort of 16-bit lookup table. | |
// fn expected to take in range 0.0-1.0, output full-range int16 | |
func makeLUT(fn func(float64) int16, size int) []int16 { | |
lut := make([]int16, size) | |
for i := 0; i < size; i++ { | |
lut[i] = fn(float64(i) / float64(size)) |
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 waveforms | |
import "math" | |
// Generate any sort of 16-bit lookup table. | |
// fn expected to take in range 0.0-1.0, output full-range int16 | |
func makeLUT(fn func(float64) int16, size int) []int16 { | |
lut := make([]int16, size) | |
for i := 0; i < size; i++ { | |
lut[i] = fn(float64(i) / float64(size)) |
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
#include <cstdio> | |
#include <cmath> | |
#include <vector> | |
int main() | |
{ | |
const auto sizes = {12.1, 13.3, 14.0}; | |
const auto res_x = {1440.0, 1680.0, 1920.0, 2048.0, 2560.0, 2880.0, 3840.0}; | |
const double aspect = 10.0/16.0; | |
const double x_multiple = 1.0/(1.0 + aspect*aspect); |
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
;; Added by Package.el. This must come before configurations of | |
;; installed packages. Don't delete this line. If you don't want it, | |
;; just comment it out by adding a semicolon to the start of the line. | |
;; You may delete these explanatory comments. | |
(package-initialize) | |
(setq package-archives '(("gnu" . "https://elpa.gnu.org/packages/") | |
("melpa" . "https://melpa.org/packages/"))) | |
(scroll-bar-mode -1) |
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
#include <SDL2/SDL.h> | |
#include <GL/glu.h> | |
#include <cmath> | |
const float OFF_R = 0; | |
const float OFF_G = M_PI * 0.75; | |
const float OFF_B = M_PI * 1.5; | |
// Doesn't work like a normal hue function; uses sine curve | |
float toHue(float f, float offset) |
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
const float game_wid = 512; | |
const float step = 1.0 / game_wid; | |
const float step2 = 1.0 / game_wid / 2.0; | |
#ifdef PASS1 | |
vec4 effect( sampler2D texture, vec2 tc ) | |
{ | |
float xcoord = tc.x / 2; | |
float blue = mod(xcoord, step) * game_wid; | |
float amber = mod(xcoord + step2, step) * game_wid; |
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
uniform float offset; | |
const int numcols = 6; | |
const vec4 col[numcols] = vec4[numcols]( | |
/* vec4( 0/255.0, 0/255.0, 0/255.0, 1), */ | |
/* vec4( 129/255.0, 29/255.0, 30/255.0, 1), */ | |
/* vec4( 253/255.0, 107/255.0, 91/255.0, 1), */ | |
/* vec4( 99/255.0, 191/255.0, 96/255.0, 1), */ | |
/* vec4( 222/255.0, 214/255.0, 162/255.0, 1)); */ | |
vec4(1,0,0,1), |
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
#include <stdio.h> | |
#include <stdlib.h> | |
#include <time.h> | |
void swap(int* a, int* b) | |
{ | |
int tmp = *a; | |
*a = *b; | |
*b = tmp; | |
} |
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
#include <stdio.h> | |
#include <string.h> | |
#include <stdlib.h> | |
char *wordgrid = "thiswatsoahgfgdt"; | |
const int grid_size = 4; | |
// List of words | |
char** wl; | |
int num_wl; |
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
trait Scene { | |
fn update(&mut self, &mut Game) -> bool; | |
fn draw(&self, game: &mut Game) {} | |
} | |
struct Game { | |
value: i32, | |
} | |
impl Game { |
OlderNewer