This file contains hidden or 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 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") |
This file contains hidden or 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
| --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 |
This file contains hidden or 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 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 |
This file contains hidden or 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
| 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 |
This file contains hidden or 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
| 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 |
This file contains hidden or 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
| -- Create 256 shuffled numbers | |
| local perm = {} | |
| for i = 1, 256 do | |
| table.insert(perm, math.random(#perm + 1), i) | |
| end | |
| -- Repeat the list | |
| for i = 1, 256 do | |
| perm[i+256] = perm[i] | |
| end |
This file contains hidden or 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
| local Pswap = {} | |
| local orig_pal | |
| local new_pal | |
| local image | |
| local image2 | |
| local lookup = {} | |
| function Pswap:load() | |
| local orig_pal_data = love.image.newImageData("orig.png") |
This file contains hidden or 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
| local Colors = { | |
| RESET = {1,1,1,1}, | |
| WHITE = {1,1,1}, | |
| BLACK = {0,0,0}, | |
| RED = {1,0,0}, | |
| GREEN = {0,1,0}, | |
| BLUE = {0,0,1}, | |
| } | |
| local setup_args = function(args, tween) |
This file contains hidden or 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
| --Secret Code Parser - change strings into secret codes defined! | |
| --Created by Brandon Blanker Lim-it @flamendless | |
| local str_sample = arg[1] or "Hi, my name is Brandon" | |
| --this is the JEJEMON trend code | |
| local secret_code = { | |
| a = {"4","ha","ah"}, | |
| i = "1", | |
| e = "3", | |
| o = "0", |
This file contains hidden or 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
| --LOVE2D api/wiki trimmer | |
| --Also useful for other batch deletion using lua and lfs | |
| --Created by Brandon Blanker Lim-it @flamendless | |
| local lfs = require("lfs") | |
| local toRemove = { | |
| "_deutsch", | |
| "_portugu", | |
| "_fran", |