--- a/main.lua +++ b/main.lua @@ -115,8 +115,6 @@ love.graphics.setFont(m5x7) m5x7small = love.graphics.newFont('assets/fonts/m5x7.ttf', 16 * 1) - love.joystick.loadGamepadMappings("vendor/gamecontrollerdb.txt") - worldscene = WorldScene() Gamestate.registerEvents() --- a/neonphase/glitch.lua +++ b/neonphase/glitch.lua @@ -9,16 +9,15 @@ -- pauses or dialogue function Glitch:init() local shader = love.graphics.newShader([[ - extern int y_bands; // number of horizontal bands - extern int y_chunk; // how many bands constitute a chunk - extern int y_min; - extern int y_max; // which bands in each chunk are distorted + extern float y_bands; // number of horizontal bands + extern float y_chunk; // how many bands constitute a chunk + extern float y_min; + extern float y_max; // which bands in each chunk are distorted extern float y_offset; // 0-1, how much to offset y by before sining extern float x_distortion; // how much to offset x (in TEXTURES, not pixels!) vec4 effect(vec4 color, Image texture, vec2 texture_coords, vec2 screen_coords) { - int y = int(texture_coords.y * y_bands); - while (y >= y_chunk) y -= y_chunk; + float y = mod(floor(texture_coords.y * y_bands), y_chunk); if (y_min <= y && y <= y_max) { texture_coords.x += x_distortion * sin((texture_coords.y * y_bands + y_offset) * 6.28); }