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 com.sketchpunk; | |
import android.animation.AnimatorSet; | |
import android.animation.ObjectAnimator; | |
import android.app.Activity; | |
import android.graphics.Color; | |
import android.util.TypedValue; | |
import android.view.Gravity; | |
import android.view.MotionEvent; | |
import android.view.View; |
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 com.sketchpunk; | |
import android.content.Context; | |
import android.database.sqlite.SQLiteDatabase; | |
import android.database.sqlite.SQLiteOpenHelper; | |
import java.io.IOException; | |
import java.util.Scanner; | |
public class MainDBHelper extends SQLiteOpenHelper{ |
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 com.sketchpunk; | |
import android.app.Activity; | |
import android.content.Context; | |
import android.view.LayoutInflater; | |
import android.view.View; | |
import android.widget.Button; | |
import android.widget.ImageView; | |
import android.widget.PopupWindow; | |
import android.widget.TextView; |
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 com.sketchpunk.shared; | |
import java.util.ArrayList; | |
/* TESTING CODE | |
byte[] bytes = "rawr~woot~amazing".getBytes(); | |
ByteStack stack = new ByteStack(50); | |
stack.put(bytes); | |
stack.getAvailable('~'); | |
//System.out.println(stack.getTill('~', true)); |
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
/*EXAMPLE CODE | |
var tObj = {val:"woot",func:function(){ console.log(this.val); console.log(arguments); }} | |
var evt = new EventManager("onprogress","oncomplete"); | |
evt.addEventListener("onprogress",function(){ console.log(arguments); }); | |
evt.addEventListenerDelegate("onprogress",tObj,tObj.func); | |
evt.dispatchEvent("onprogress",[1,3]); | |
*/ |
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
function Delegate(obj,funcRef){ | |
var args = null; | |
if(arguments.length > 2){ args = []; for(var i=2; i < arguments.length; i++) args.push(arguments[i]); } | |
return function(){ | |
if(args == null) funcRef.apply(obj,arguments); | |
else{ | |
var params = args.slice(); //Need to make a copy of args, When just adding to args caused a problem with bubbling events. | |
for(var i=0; i < arguments.length; i++) params.push(arguments[i]); | |
funcRef.apply(obj,params); | |
}//if |
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
var blob = window.atob("AAAAAAAAAAAAAAAAAACAPwAAAAAAAAAAAAAAAAAAgD8AAAAA"), // Base64 string converted to a char array | |
fLen = blob.length / Float32Array.BYTES_PER_ELEMENT, // How many floats can be made, but be even | |
dView = new DataView( new ArrayBuffer(Float32Array.BYTES_PER_ELEMENT) ), // ArrayBuffer/DataView to convert 4 bytes into 1 float. | |
fAry = new Float32Array(fLen), // Final Output at the correct size | |
p = 0; // Position | |
for(var j=0; j < fLen; j++){ | |
p = j * 4; | |
dView.setUint8(0,blob.charCodeAt(p)); | |
dView.setUint8(1,blob.charCodeAt(p+1)); |
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
// http://www.cse.chalmers.se/edu/year/2010/course/TDA361/grid.pdf | |
function voxel_raycast_min(ray,chunk,aabb){ | |
//.................................................. | |
// Determine if the voxel chunk has an intersection. | |
var tBox = {}; | |
if(!Ray.inAABB(aabb,ray,tBox)){ return null; } | |
//.................................................. | |
var inPos = ray.getPos(tBox.min).nearZero(), // entry point for chunk, Clean up vals near zero. | |
cellSize = chunk.scale, |
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
//============================================================== | |
//Example | |
var vertex = [ 1, 1, 0, -1, -1, 0 ]; | |
var somefloat = [2.0, 18.0]; | |
var componentCnt = [3,1]; //Define the size of the vertext data for each array, for example: in vertex every 3 floats counts as one | |
var vertexCnt = vertex.length / 3; // How many vertices are there | |
var attrLocOffset = 1; | |
var interInfo = interleavedFloatArray( vertexCnt, [vertex,somefloat], componentCnt ); | |
interleavedInstanceFloatBuffer(interInfo ,attrLocOffset); |
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
/* | |
let xhr = new XhrPromise(); | |
xhr.get(url, "json").then( r=>console.log(r) ).catch(err=>console.log(err)); | |
*/ | |
class XhrPromise{ | |
static get( url, type ){ | |
let xhr = new XhrPromise(); | |
return xhr.get.apply( xhr, arguments ); | |
} |
OlderNewer