Skip to content

Commit

Permalink
chore: add scaffolding
Browse files Browse the repository at this point in the history
  • Loading branch information
wh0am1-dev committed Jan 25, 2019
1 parent 5e2690f commit 5cb613c
Show file tree
Hide file tree
Showing 54 changed files with 3,433 additions and 0 deletions.
11 changes: 11 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
default: build run

clean:
$(RM) temperature.love

build:
# zip -r temperature.love *
7z a -r -tzip temperature.love *

run:
love temperature.love
Binary file added assets/bgm/music.mp3
Binary file not shown.
Binary file added assets/fnt/smart.ttf
Binary file not shown.
Binary file added assets/fnt/xaba.ttf
Binary file not shown.
Binary file added assets/img/btn-play-down.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/img/btn-play-up.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/img/credits.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/img/game.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/img/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/img/menu.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/sfx/select_0.ogg
Binary file not shown.
Binary file added assets/sfx/select_1.ogg
Binary file not shown.
Binary file added assets/sfx/select_2.ogg
Binary file not shown.
Binary file added assets/sfx/select_3.ogg
Binary file not shown.
Binary file added assets/sfx/woosh.ogg
Binary file not shown.
Binary file added assets/sfx/yaay.ogg
Binary file not shown.
173 changes: 173 additions & 0 deletions assets/shaders/4xBR.frag
Original file line number Diff line number Diff line change
@@ -0,0 +1,173 @@
/*
4xBR shader
Copyright (C) 2011 Hyllian.
This program is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the Free
Software Foundation; either version 2 of the License, or (at your option)
any later version.
This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
(justification for applying the GPLv2:
http://board.byuu.org/viewtopic.php?p=32616#p32616
)
modified by slime73 for use with love2d and mari0
*/


extern vec2 textureSize;

const vec3 dtt = vec3(65536.0, 255.0, 1.0);

float reduce(vec3 color)
{
return dot(color, dtt);
}

vec4 effect(vec4 vcolor, Image texture, vec2 texture_coords, vec2 pixel_coords)
{
vec2 ps = 1.0 / textureSize;
vec2 dx = vec2(ps.x, 0.0);
vec2 dy = vec2(0.0, ps.y);

vec2 pixcoord = texture_coords/ps;
vec2 fp = fract(pixcoord);
vec2 d11 = texture_coords - fp * ps;

// Reading the texels

vec3 A = Texel(texture, d11-dx-dy).xyz;
vec3 B = Texel(texture, d11 -dy).xyz;
vec3 C = Texel(texture, d11+dx-dy).xyz;
vec3 D = Texel(texture, d11-dx ).xyz;
vec3 E = Texel(texture, d11 ).xyz;
vec3 F = Texel(texture, d11+dx ).xyz;
vec3 G = Texel(texture, d11-dx+dy).xyz;
vec3 H = Texel(texture, d11+dy ).xyz;
vec3 I = Texel(texture, d11+dx+dy).xyz;

vec3 E0 = E;
vec3 E1 = E;
vec3 E2 = E;
vec3 E3 = E;
vec3 E4 = E;
vec3 E5 = E;
vec3 E6 = E;
vec3 E7 = E;
vec3 E8 = E;
vec3 E9 = E;
vec3 E10 = E;
vec3 E11 = E;
vec3 E12 = E;
vec3 E13 = E;
vec3 E14 = E;
vec3 E15 = E;

float a = reduce(A);
float b = reduce(B);
float c = reduce(C);
float d = reduce(D);
float e = reduce(E);
float f = reduce(F);
float g = reduce(G);
float h = reduce(H);
float i = reduce(I);


if ((h == f)&&(h != e))
{
if (
((e == g) && ((i == h) || (e == d)))
||
((e == c) && ((i == h) || (e == b)))
)
{
E11 = mix(E11, F, 0.5);
E14 = E11;
E15 = F;
}
}

if ((f == b)&&(f != e))
{
if (
((e == i) && ((f == c) || (e == h)))
||
((e == a) && ((f == c) || (e == d)))
)
{
E2 = mix(E2, B, 0.5);
E7 = E2;
E3 = B;
}
}

if ((b == d)&&(b != e))
{
if (
((e == c) && ((b == a) || (e == f)))
||
((e == g) && ((b == a) || (e == h)))
)
{
E1 = mix(E1, D, 0.5);
E4 = E1;
E0 = D;
}
}

if ((d == h)&&(d != e))
{
if (
((e == a) && ((d == g) || (e == b)))
||
((e == i) && ((d == g) || (e == f)))
)
{
E8 = mix(E8, H, 0.5);
E13 = E8;
E12 = H;
}
}

vec3 res;

if (fp.x < 0.25)
{
if (fp.y < 0.25) res = E0;
else if ((fp.y > 0.25) && (fp.y < 0.50)) res = E4;
else if ((fp.y > 0.50) && (fp.y < 0.75)) res = E8;
else res = E12;
}
else if ((fp.x > 0.25) && (fp.x < 0.50))
{
if (fp.y < 0.25) res = E1;
else if ((fp.y > 0.25) && (fp.y < 0.50)) res = E5;
else if ((fp.y > 0.50) && (fp.y < 0.75)) res = E9;
else res = E13;
}
else if ((fp.x > 0.50) && (fp.x < 0.75))
{
if (fp.y < 0.25) res = E2;
else if ((fp.y > 0.25) && (fp.y < 0.50)) res = E6;
else if ((fp.y > 0.50) && (fp.y < 0.75)) res = E10;
else res = E14;
}
else
{
if (fp.y < 0.25) res = E3;
else if ((fp.y > 0.25) && (fp.y < 0.50)) res = E7;
else if ((fp.y > 0.50) && (fp.y < 0.75)) res = E11;
else res = E15;
}

return vec4(res, 1.0);
}
188 changes: 188 additions & 0 deletions assets/shaders/CRT-Simple.frag
Original file line number Diff line number Diff line change
@@ -0,0 +1,188 @@
/*
CRT-simple shader
Copyright (C) 2011 DOLLS. Based on cgwg's CRT shader.
This program is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the Free
Software Foundation; either version 2 of the License, or (at your option)
any later version.
modified by slime73 for use with love2d and mari0
*/

extern vec2 inputSize;
extern vec2 outputSize;
extern vec2 textureSize;


#define SCANLINES

// Enable screen curvature.
#define CURVATURE

// Controls the intensity of the barrel distortion used to emulate the
// curvature of a CRT. 0.0 is perfectly flat, 1.0 is annoyingly
// distorted, higher values are increasingly ridiculous.
#define distortion 0.2

// Simulate a CRT gamma of 2.4.
#define inputGamma 2.4

// Compensate for the standard sRGB gamma of 2.2.
#define outputGamma 2.2

// Macros.
#define TEX2D(c) pow(checkTexelBounds(_tex0_, (c)), vec4(inputGamma))
#define PI 3.141592653589


vec2 bounds = vec2(inputSize.x / textureSize.x, 1.0 - inputSize.y / textureSize.y);

vec2 radialDistortion(vec2 coord, const vec2 ratio)
{
float offsety = 1.0 - ratio.y;
coord.y -= offsety;
coord /= ratio;

vec2 cc = coord - 0.5;
float dist = dot(cc, cc) * distortion;
vec2 result = coord + cc * (1.0 + dist) * dist;

result *= ratio;
result.y += offsety;

return result;
}

#ifdef CURVATURE
vec4 checkTexelBounds(Image texture, vec2 coords)
{
vec2 ss = step(coords, vec2(bounds.x, 1.0)) * step(vec2(0.0, bounds.y), coords);
return Texel(texture, coords) * ss.x * ss.y;
}
#else
vec4 checkTexelBounds(Image texture, vec2 coords)
{
return Texel(texture, coords);
}
#endif


/*
vec4 checkTexelBounds(Image texture, vec2 coords)
{
vec2 bounds = vec2(inputSize.x / textureSize.x, 1.0 - inputSize.y / textureSize.y);
vec4 color;
if (coords.x > bounds.x || coords.x < 0.0 || coords.y > 1.0 || coords.y < bounds.y)
color = vec4(0.0, 0.0, 0.0, 1.0);
else
color = Texel(texture, coords);
return color;
}
*/


// Calculate the influence of a scanline on the current pixel.
//
// 'distance' is the distance in texture coordinates from the current
// pixel to the scanline in question.
// 'color' is the colour of the scanline at the horizontal location of
// the current pixel.
vec4 scanlineWeights(float distance, vec4 color)
{
// The "width" of the scanline beam is set as 2*(1 + x^4) for
// each RGB channel.
vec4 wid = 2.0 + 2.0 * pow(color, vec4(4.0));

// The "weights" lines basically specify the formula that gives
// you the profile of the beam, i.e. the intensity as
// a function of distance from the vertical center of the
// scanline. In this case, it is gaussian if width=2, and
// becomes nongaussian for larger widths. Ideally this should
// be normalized so that the integral across the beam is
// independent of its width. That is, for a narrower beam
// "weights" should have a higher peak at the center of the
// scanline than for a wider beam.
vec4 weights = vec4(distance / 0.3);
return 1.4 * exp(-pow(weights * inversesqrt(0.5 * wid), wid)) / (0.6 + 0.2 * wid);
}

vec4 effect(vec4 vcolor, Image texture, vec2 texCoord, vec2 pixel_coords)
{
vec2 one = 1.0 / textureSize;
float mod_factor = texCoord.x * textureSize.x * outputSize.x / inputSize.x;


// Here's a helpful diagram to keep in mind while trying to
// understand the code:
//
// | | | | |
// -------------------------------
// | | | | |
// | 01 | 11 | 21 | 31 | <-- current scanline
// | | @ | | |
// -------------------------------
// | | | | |
// | 02 | 12 | 22 | 32 | <-- next scanline
// | | | | |
// -------------------------------
// | | | | |
//
// Each character-cell represents a pixel on the output
// surface, "@" represents the current pixel (always somewhere
// in the bottom half of the current scan-line, or the top-half
// of the next scanline). The grid of lines represents the
// edges of the texels of the underlying texture.

// Texture coordinates of the texel containing the active pixel.
#ifdef CURVATURE
vec2 xy = radialDistortion(texCoord, inputSize / textureSize);
#else
vec2 xy = texCoord;
#endif

#ifdef SCANLINES

// Of all the pixels that are mapped onto the texel we are
// currently rendering, which pixel are we currently rendering?
vec2 ratio_scale = xy * textureSize - 0.5;
vec2 uv_ratio = fract(ratio_scale);

// Snap to the center of the underlying texel.
xy.y = (floor(ratio_scale.y) + 0.5) / textureSize.y;

// Calculate the effective colour of the current and next
// scanlines at the horizontal location of the current pixel.
vec4 col = TEX2D(xy);
vec4 col2 = TEX2D(xy + vec2(0.0, one.y));

// Calculate the influence of the current and next scanlines on
// the current pixel.
vec4 weights = scanlineWeights(uv_ratio.y, col);
vec4 weights2 = scanlineWeights(1.0 - uv_ratio.y, col2);

vec4 mul_res_f = (col * weights + col2 * weights2);
vec3 mul_res = mul_res_f.rgb;

#else
vec3 mul_res_f = TEX2D(xy);
vec3 mul_res = mul_res_f.rgb;

#endif

// dot-mask emulation:
// Output pixels are alternately tinted green and magenta.
vec3 dotMaskWeights = mix(
vec3(1.0, 0.7, 1.0),
vec3(0.7, 1.0, 0.7),
floor(mod(mod_factor, 2.0))
);

mul_res *= dotMaskWeights;

return vec4(pow(mul_res, vec3(1.0 / outputGamma)), 1.0);
}

Loading

0 comments on commit 5cb613c

Please sign in to comment.