Skip to content

Instantly share code, notes, and snippets.

@shakesoda
shakesoda / gist:8552233
Created January 22, 2014 01:57
Tegra 3 GLES extensions
GL_NV_platform_binary
GL_OES_rgb8_rgba8
GL_OES_EGL_sync
GL_OES_fbo_render_mipmap
GL_NV_depth_nonlinear
GL_NV_draw_path
GL_NV_texture_npot_2D_mipmap
GL_OES_EGL_image
GL_OES_EGL_image_external
GL_OES_vertex_half_float
@shakesoda
shakesoda / thing.cpp
Created February 20, 2014 20:46
sdl example for missingno
#include <GLXW/glxw.h>
#include <SDL2/SDL.h>
class DisplaySystem {
public:
DisplaySystem() {
window = SDL_CreateWindow(
"thingy",
SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED,
1280, 720,
@shakesoda
shakesoda / gist:9506865
Last active August 29, 2015 13:57
Skullgirls command line options (the probably useful/public looking ones, at least)
-c config_file
-defaultkeys
-log (enable logging to a file)
-fs (fullscreen)
-fw (fullscreen windowed)
-res blahxblah (set screen resolution)
-sc 1.0 (screen scale)
-ignorefocus (take input in the background)
-vjoyfix (always poll joystick pov hats? I don't know the context of this. irc says ps3 controllers)
-noonlineconfirm (disable confirm message when picking character online)
@shakesoda
shakesoda / timer.h
Last active October 25, 2015 21:16
simple high resolution timer w/SDL2
/* USAGE:
* Timer foo; // Start the timer
* const TimeData &time = foo.touch(); // Update and return TimeData (delta being the time since last touch)
* const TimeData &time_peek = foo.peek(); // returns current TimeData only updating the current time (does not reset!)
* SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION
*
* I haven't actually tested peek, but it looks right... */
#pragma once
#include <SDL.h>
mod player {
type AdvancerFn = fn(exp: uint) -> uint;
pub struct Stat {
pub skill: String,
pub exp: uint,
pub level: uint,
advancer: AdvancerFn,
}
// insert exp, receive current level
@shakesoda
shakesoda / main.rs
Last active February 16, 2017 12:20
// Apparently, this needs to be *before* I actually import the fucking mod
// wat.
use player::*;
mod player;
fn main() {
let mut stats = vec![
Stat::new("HP".to_string(), player::default_advancer_fn),
Stat::new("SP".to_string(), player::default_advancer_fn),
Stat::new("ATK".to_string(), player::default_advancer_fn),
struct Entity { id: int }
struct World { entities: Vec<Entity> }
impl World {
fn get_entities(&self) -> Vec<Entity> {
return self.entities; // KABOOM
}
}
@shakesoda
shakesoda / chord.lua
Created September 11, 2014 04:18
axis + face button -> letters. the guts of a controller keyboard.
function gate(axis, num)
local function wrap(x)
return math.fmod(x, math.pi * 2)
end
if math.abs(axis.x) < 0.1 and math.abs(axis.y) < 0.1 then
return num + 1
end
local angle = math.atan2(axis.y, axis.x) -- in radians
@shakesoda
shakesoda / demo.lua
Last active August 29, 2015 14:07 — forked from LPGhatguy/demo.lua
local glfw = require("glfw3") --Let's say we have a magic GLFW3 binding there!
local openGL = require("opengl")
openGL.loader = glfw.GetProcAddress
openGL:import()
--and somewhere else
local vbo = ffi.new("GLuint[1]")
gl.GenBuffers(1, vbo)
gl.BindBuffer(GL.ARRAY_BUFFER, vbo[0])
gl.BufferData(GL.ARRAY_BUFFER, ffi.sizeof(vertices), vertices, GL.STATIC_DRAW)
@shakesoda
shakesoda / gist:c8d1d108101776f461d9
Created October 22, 2014 12:27
don't even worry about it
// Generate vertices
const int size = 256;
verts.reserve(size*size);
faces.reserve(size*size);
for (int j = 0; j < size; j++)
{
for (int i = 0; i < size; i++)
{