Skip to content

Instantly share code, notes, and snippets.

local Object = require("lib.classic")
local TextureAtlas = Object:extend()
function TextureAtlas:new(texture, numCols, numRows, regionX, regionY, regionW, regionH)
self.texture = texture
self.numCols = numCols
self.numRows = numRows
self.quads = {}
@marclurr
marclurr / loader.cpp
Last active October 16, 2024 00:00
TMX loader using tinyxml
namespace txml = tinyxml2; // just to reduce typing
// load tileset (.tsx) XML document into TileSet struct
std::shared_ptr<TileSet> LoadTileSet(const char* path)
{
std::shared_ptr<TileSet> tileSet = std::make_shared<TileSet>();
txml::XMLDocument document;
document.LoadFile(path);
class Battle
{
private:
std::vector<Unit*> participants;
std::vector<Unit*> playerUnits;
std::vector<Unit*> aiUnits;
std::vector<Unit*> readyUnits;
uint16_t turnCounter;
@Override
protected void onCreate(Bundle savedInstanceState) {
try {
super.onCreate(savedInstanceState);
getApplication();
final int duration = getResources().getInteger(android.R.integer.config_longAnimTime);
final JSONObject ride = new JSONObject(getIntent().getStringExtra("ride"));
ActionBar actionBar = getActionBar();
actionBar.setTitle(ride.getString("name"));
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="@string/google_maps_key" />
@marclurr
marclurr / gist:1888335
Created February 22, 2012 23:25
holy shit
public static void convolveAndTranspose(Kernel kernel, int[] inPixels, int[] outPixels, int width, int height, boolean alpha, int edgeAction) {
float[] matrix = kernel.getKernelData( null );
int cols = kernel.getWidth();
int cols2 = cols/2;
for (int y = 0; y < height; y++) {
int index = y;
int ioffset = y*width;
for (int x = 0; x < width; x++) {
float r = 0, g = 0, b = 0, a = 0;
@marclurr
marclurr / gist:1352660
Created November 9, 2011 19:33 — forked from hay/gist:1351230
Enterprisify your Java Class Names!
<!doctype html>
<html>
<head>
<title></title>
<style>
body {
background: white;
text-align: center;
padding: 20px;
font-family: Georgia, serif;
@marclurr
marclurr / prawn.py
Created November 4, 2011 20:45
forkin' prawns!
import os
print "Forking prawns..."
for i in range(5):
prawn_pid = os.fork()
if prawn_pid == 0:
print "I'm a forkin prawn!"
print "omg kerryma sux"