Skip to content

Instantly share code, notes, and snippets.

View morgan3d's full-sized avatar
🎮

Morgan McGuire morgan3d

🎮
View GitHub Profile
/*
Applies arithmetic vector op to all elements of a and b.
If one is an object, then the result is also an object
*/
function _ch_vecApply(opname, op, a, b) {
var c, i, p;
var noB = arguments.length <= 3;
if (isNumber(a)) {
if (noB || isNumber(b)) {
var [rnd, srand] = (function() {
/* Based on https://github.com/AndreasMadsen/xorshift/blob/master/xorshift.js
Copyright (c) 2014 Andreas Madsen & Emil Bay
Permission is hereby granted, free of charge, to any person obtaining a copy of this
software and associated documentation files (the "Software"), to deal in the Software
without restriction, including without limitation the rights to use, copy, modify,
// @CasualEffects & @pervognsen
var shift = ((border !== TRANSPARENT) && (border !== fill)) ? 0.5 : 0;
// For each non-horizontal edge, store:
//
// [startX, startY, dx/dy slope, vertical height].
//
// These are the values needed for the edge-intersection test. Add edges so that the
// start Y coordinate is less than the end one.
var edgeArray = [];
// A cooperative-"multithreading" JavaScript routine to allow asynchronous rendering and
// display without the cost of WebWorker serialization. -- @CasualEffects
var updateImageData = ctx.createImageData(screenWidth, screenHeight);
var updateImage = document.createElement('canvas');
updateImage.width = screenWidth;
updateImage.height = screenHeight;
var makeRenderLoop = function*() {
while (true) {
@morgan3d
morgan3d / powera-sdl_controllers.txt
Last active March 22, 2017 13:47
PICO-8 Controller mapping for PowerA Kid Game Controllers (http://amzn.to/2n7d3AV)
c6240000000000001a53000000000000,PowerA,a:b0,b:b1,x:b2,y:b3,back:b9,start:b8,leftstick:b6,rightstick:b7,leftshoulder:b4,rightshoulder:b5,dpup:b11,dpdown:b12,dpleft:b13,dpright:b14,leftx:a0,lefty:a1,rightx:a3,righty:a4,lefttrigger:a2,righttrigger:a5,platform:Mac OS X,