This file contains 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 class(def) | |
local class = {} | |
local parents = {} | |
local upv | |
local env = _G | |
local wraps | |
local function super(parent_class) | |
if not parent_class then |
This file contains 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 self = {} | |
self.image = love.graphics.newImage("assets/imgs/ice.png") | |
self.reflectionImage = love.graphics.newImage("assets/imgs/iceReflection.png") | |
self.angle = 0 | |
self.canvas = love.graphics.newCanvas() |
This file contains 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 Player = { | |
image = love.graphics.newImage("assets/imgs/ice.png"), | |
reflectionImage = love.graphics.newImage("assets/imgs/iceReflection.png"), | |
angle = 0, | |
canvas = love.graphics.newCanvas(), | |
x = 75, | |
xv = 0, |
This file contains 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.draw() | |
local canvas, x, y, width, height, rotation, scaleX, scaleY, offsetX, offsetY = Scene:getRender() | |
love.graphics.setShader(crtShader) | |
love.graphics.draw(canvas, x, y, width, height, rotation, scaleX, scaleY, offsetX, offsetY) | |
end | |
scene.getRender = function (self, drawArg) | |
love.graphics.setColor(1,1,1) | |
love.graphics.setCanvas({self.threeCanvas, depth=true}) | |
love.graphics.clear(0,0,0,0) |
This file contains 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
crtShader = lg.newShader([[ | |
extern float elapsed; | |
extern float colorI; | |
vec2 radialDistortion(vec2 coord, float dist) { | |
vec2 cc = coord - 0.5; | |
dist = dot(cc, cc) * dist + cos(elapsed * .3) * .01; | |
return (coord + cc * (1.0 + dist) * dist); | |
} | |
This file contains 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
def lerp(a, b, t) | |
return a + (b - a) * t | |
end |
This file contains 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
#define M_PI 3.1415926535897932384626433832795 | |
#define NUM_LIGHTS 32 | |
struct Light { | |
vec2 position; | |
// color of the light | |
vec3 diffuse; | |
// power of the light | |
float power; | |
}; |
This file contains 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
let polygon = [ | |
[200, 100], [400, 130], [350, 300], [250, 300] | |
]; | |
function setup() { | |
createCanvas(800, 800); | |
} | |
function draw() { | |
background(0); |
This file contains 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
// This example loads an image and a shader that are used to draw the image. | |
#include <math.h> | |
#include <GL/glew.h> | |
#include <SDL2/SDL.h> | |
#include <SDL2/SDL_image.h> | |
#include <SDL2/SDL_opengl.h> | |
#define print SDL_Log |
This file contains 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
1. Download Compiler | |
2. Add Compiler to Path | |
3. Download SDL | |
4. Use SDL | |
$. Extras | |
1. Download compiler: |
OlderNewer