Skip to content

Instantly share code, notes, and snippets.

Sam Atkins AtkinsSJ

Block or report user

Report or block AtkinsSJ

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@AtkinsSJ
AtkinsSJ / DatabaseInfo.java
Last active Oct 6, 2016
Java code generation attempt
View DatabaseInfo.java
package uk.co.samatkins.windowcleaningassistant;
import android.content.ContentValues;
import android.database.Cursor;
import android.net.Uri;
import android.os.Parcel;
import android.os.Parcelable;
import android.provider.BaseColumns;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
@AtkinsSJ
AtkinsSJ / export_icons.bat
Last active Aug 29, 2015
Windows Batch File for generating drawable PNGs from SVG files using Inkscape.
View export_icons.bat
setlocal EnableDelayedExpansion
@echo off
set sizes[m]=24
set sizes[h]=36
set sizes[xh]=48
set sizes[xxh]=72
set sizes[xxxh]=96
for %%f in (.\svg\*.svg) do (
@AtkinsSJ
AtkinsSJ / night.fragment.glsl
Created Sep 18, 2014
Problematic shader code
View night.fragment.glsl
#ifdef GL_ES
precision mediump float;
#endif
varying vec4 v_color;
varying vec2 v_texCoords;
uniform sampler2D u_texture;
uniform vec3 u_playerPosition;
uniform float u_playerLightRangeScaled;
@AtkinsSJ
AtkinsSJ / Alternative, for ShaderToy.
Last active Aug 29, 2015
Basic shader that makes things dark and blueish. The Vertex shader is just a generic one. The fragment shader gets the lightness of the pixel at the right place on the texture, darkens it, and gives it a blue tint.
View Alternative, for ShaderToy.
float lightDistance = 100.0;
void main(void)
{
vec2 uv = gl_FragCoord.xy / iResolution.xy;
uv.y = iResolution.y - uv.y;
vec4 tex = texture2D(iChannel0, uv);
// How far are we from the mouse?
float mouseDist = distance(gl_FragCoord.xy, iMouse.xy);
@AtkinsSJ
AtkinsSJ / MapGenerator.java
Created Jul 1, 2013
The map generation code from Beard of Bees.
View MapGenerator.java
package uk.co.samatkins.beebeard;
import java.util.List;
import com.badlogic.gdx.math.MathUtils;
import com.badlogic.gdx.math.Rectangle;
import uk.co.samatkins.Tilemap;
import uk.co.samatkins.beebeard.PlayScene.Tile;
View gist:5693400
private HashMap<String, String> tracks;
// ...
tracks = new HashMap<String, String>();
tracks.put("Dumb Loop", "track1.svg");
tracks.put("Dumb Loop 2", "track1.svg");
tracks.put("Dumb Loop 3", "track1.svg");
tracks.put("All these are the same", "track1.svg");
@AtkinsSJ
AtkinsSJ / 1gam.php
Created May 31, 2013
Scraper for #1GAM games. Grabs the information from http://www.onegameamonth.com/gameslist and generates a csv file. Because of how the #1GAM site is set-up, this only gets the entries for the current month. Hopefully there will be an official API at some point.
View 1gam.php
<?php
error_reporting(E_ALL ^ E_NOTICE);
$url = 'http://www.onegameamonth.com/gameslist';
$games = array();
function addGame($gameDiv) {
$game = array();
$ga = $gameDiv->firstChild;
@AtkinsSJ
AtkinsSJ / gist:5611633
Created May 20, 2013
Things that cause box2d to crash. Most of these are things you shouldn't do in your code anyway, but it'd be better if it gave an error rather than just crash with no explanation. >_<
View gist:5611633
  • Creating or destroying bodies and fixtures during a callback.
  • Casting a ray where the start and end points are the same position.
  • Creating a fixture with a PolygonShape set as a box with 0 width and height
@AtkinsSJ
AtkinsSJ / AIDriver.java
Created May 16, 2013
For some reason, the Java code I'm working on crashes, as a class tries to find itself. Line 43 of AIDriver.java defines a RayCastCallback, and this for some reason causes a class loader to search for "uk.co.samatkins.racing.drivers.AIDriver$MoveCalculator$1", which I think is the RayCastCallback itself. Any ideas?
View AIDriver.java
package uk.co.samatkins.racing.drivers;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.math.Vector2;
import com.badlogic.gdx.physics.box2d.Fixture;
import com.badlogic.gdx.physics.box2d.RayCastCallback;
import com.badlogic.gdx.physics.box2d.World;
import uk.co.samatkins.racing.Car;
import uk.co.samatkins.racing.Move;
@AtkinsSJ
AtkinsSJ / SvgParser.java
Created Apr 6, 2013
This is a class I've written to grab data from svg files made in Inkscape. (Saved as Inkscape svg, not plain svg) Create an SvgParser, call fromFile() with a file handle to the svg file, and you'll be able to access layers by what you named then in Inkscape, using getLayer(name), then access paths from the Layer with getPath(id), or points with …
View SvgParser.java
package uk.co.samatkins.racing;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import com.badlogic.gdx.files.FileHandle;
import com.badlogic.gdx.utils.Array;
import com.badlogic.gdx.utils.XmlReader;
import com.badlogic.gdx.utils.XmlReader.Element;
You can’t perform that action at this time.