Browse Source

Merge branch 'master' into cursor_offset

rexim 2 years ago
parent
commit
e28ae5449f
5 changed files with 30 additions and 5 deletions
  1. 12 0
      CONTRIBUTING.md
  2. 7 1
      README.md
  3. 4 1
      shaders/simple_epic.frag
  4. 4 1
      shaders/simple_text.frag
  5. 3 2
      src/free_glyph.c

+ 12 - 0
CONTRIBUTING.md

@@ -0,0 +1,12 @@
+I have very limited resources in terms of handling feedback on my projects, sorry. So here are the limitations to keep in mind:
+
+- I don't look into reported Issues.
+- I only look into small PRs that suggest
+  - bug fixes,
+  - documentation fixes.
+- I do not look into PRs that
+  - implement new features,
+  - refactor/cleanup the code.
+- What qualifies as a bug, a feature, or refactoring is entirely upon my interpretation.
+
+Sorry for any inconveniences. If you want to stir the project in a particular direction in terms of features feel free to fork it, I don't mind. Just make sure you have fun while developing it! This is like the whole point!

+ 7 - 1
README.md

@@ -1,9 +1,15 @@
 # Dramatic EDitor
 
-**THIS SOFTWARE IS UNFINISHED!!!**
+**THIS SOFTWARE IS UNFINISHED!!! Don't have any high expectations.**
 
 # Quick Start
 
+## Dependencies
+
+- [SDL2 2.0.9+](https://www.libsdl.org/)
+- [FreeType 2.13.0+](https://freetype.org/)
+- [GLEW 2.1.0+](https://glew.sourceforge.net/)
+
 ## POSIX
 
 ```console

+ 4 - 1
shaders/simple_epic.frag

@@ -13,7 +13,10 @@ vec3 hsl2rgb(vec3 c) {
 
 void main() {
     vec4 tc = texture(image, out_uv);
+    float d = tc.r;
+    float aaf = fwidth(d);
+    float alpha = smoothstep(0.5 - aaf, 0.5 + aaf, d);
     vec2 frag_uv = gl_FragCoord.xy / resolution;
     vec4 rainbow = vec4(hsl2rgb(vec3((time + frag_uv.x + frag_uv.y), 0.5, 0.5)), 1.0);
-    gl_FragColor = tc.x * rainbow;
+    gl_FragColor = vec4(rainbow.rgb, alpha);
 }

+ 4 - 1
shaders/simple_text.frag

@@ -6,5 +6,8 @@ in vec4 out_color;
 in vec2 out_uv;
 
 void main() {
-    gl_FragColor = texture(image, out_uv).x*out_color;
+    float d = texture(image, out_uv).r;
+    float aaf = fwidth(d);
+    float alpha = smoothstep(0.5 - aaf, 0.5 + aaf, d);
+    gl_FragColor = vec4(out_color.rgb, alpha);
 }

+ 3 - 2
src/free_glyph.c

@@ -4,8 +4,9 @@
 
 void free_glyph_atlas_init(Free_Glyph_Atlas *atlas, FT_Face face)
 {
+    FT_Int32 load_flags = FT_LOAD_RENDER | FT_LOAD_TARGET_(FT_RENDER_MODE_SDF);
     for (int i = 32; i < 128; ++i) {
-        if (FT_Load_Char(face, i, FT_LOAD_RENDER)) {
+        if (FT_Load_Char(face, i, load_flags)) {
             fprintf(stderr, "ERROR: could not load glyph of a character with code %d\n", i);
             exit(1);
         }
@@ -39,7 +40,7 @@ void free_glyph_atlas_init(Free_Glyph_Atlas *atlas, FT_Face face)
 
     int x = 0;
     for (int i = 32; i < 128; ++i) {
-        if (FT_Load_Char(face, i, FT_LOAD_RENDER)) {
+        if (FT_Load_Char(face, i, load_flags)) {
             fprintf(stderr, "ERROR: could not load glyph of a character with code %d\n", i);
             exit(1);
         }