Skip to content

Instantly share code, notes, and snippets.

Avatar
🎯
Focusing on Game Development and University

Brandon Blanker Lim-it flamendless

🎯
Focusing on Game Development and University
View GitHub Profile
View asset_bundler_love.lua
function test1()
local imgdata = love.image.newImageData("avatar.png")
local format = imgdata:getFormat()
local filename = "pack"
if love.filesystem.getInfo(filename) then
love.filesystem.remove(filename)
end
local file = love.filesystem.newFile(filename, "w")
View tokenizer.lua
-- these have to be sorted by longest first
local keywords = {
"function",
"then",
"end",
"if",
}
local symbols = {
View FrequencyTable.java
package frequencytable;
public class FrequencyTable {
public static void main(String[] args) {
test();
}
private static void test() {
for (int noteNumber = 0; noteNumber < 128; noteNumber++) {
View MIDISequenceExtractor.java
package midisequenceextractor;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.sound.midi.InvalidMidiDataException;
import javax.sound.midi.MidiChannel;
@flamendless
flamendless / shockwave.glsl
Created Mar 8, 2019
from steveroll over @ discord
View shockwave.glsl
extern number minRadius = 0.05;
extern number maxRadius = 0.1;
extern number mul = 0.01;
extern vec2 center = vec2(0.5,0.5);
number dist(vec2 a, vec2 b){
return sqrt(pow(b.x-a.x,2)+pow(b.y-a.y,2));
}
@flamendless
flamendless / main.lua
Created Nov 13, 2018 — forked from 1bardesign/main.lua
recolour.lua
View main.lua
--[[
example use
]]
local recolour = require("recolour")
--we want to recolour this asset image
local to_recolour = love.image.newImageData("path/to/image.png")
--using this palette image
local palette = love.image.newImageData("path/to/palette.png")
@flamendless
flamendless / MakefileLoveAndroid
Last active Nov 8, 2018
Makefile for easier love development for android using apktool
View MakefileLoveAndroid
--usage: make build-android
--usage: make apk-release VERSION=0.1.3
--note: You must still edit the versionCode in AndroidManifest.xml
SHELL := /bin/zsh
ANDROID = PATH:/opt/android-sdk/build-tools/28.0.2
LOVE_NAME = game.love
BUILD_DIR = build
OUTPUT_DIR = ${BUILD_DIR}/output
RELEASE_DIR = ${BUILD_DIR}/release
NAME = purrr
@flamendless
flamendless / convert-to-grayscale.lua
Created Oct 16, 2018
Convert a palette .png (num of colours x 1 pixel) to appropriate grayscaled palette (for colour swap shader)
View convert-to-grayscale.lua
function love.load()
for k, file in pairs(love.filesystem.getDirectoryItems("source")) do
convert(file)
end
end
function convert(file)
local data = love.image.newImageData("source/" .. file)
local width = data:getWidth()
local div = 255/width
@flamendless
flamendless / CircleTransformation.lua
Last active Sep 28, 2018
Interpolate a circle to another circle (number of points/2)
View CircleTransformation.lua
local processPoints = function(shape1, shape2)
local d = #shape1/#shape2 * 2
local all = {}
for i = 1, #shape1, 2 do
all[i] = false
if i % d == 1 then
all[i] = true
end
end
return all
@flamendless
flamendless / noise-to-image.lua
Created Jul 10, 2018
Save a noise to a texture! thanks Positive07
View noise-to-image.lua
local data = love.image.newImageData(w, h)
data:mapPixel(function(x,y,r,g,b,a)
local a = love.math.noise(x, y)
return a, a, a, 1
end)
if isSaveIt then
data:encode("png", filename or "noise.png")
local image = love.graphics.newImage(data)
return image
else
You can’t perform that action at this time.