ded

Dramatic EDitor
Index Commits Files Refs README LICENSE
commit e28ae5449f71eeaf5e0af1ff06e438c5484e4f8d
parent 5ee1d16c136e3265987912676d20336518386e5d
Author: rexim <reximkut@gmail.com>
Date:   Thu, 16 Feb 2023 15:09:04 +0700

Merge branch 'master' into cursor_offset

Diffstat:
ACONTRIBUTING.md | 12++++++++++++
MREADME.md | 8+++++++-
Mshaders/simple_epic.frag | 5++++-
Mshaders/simple_text.frag | 5++++-
Msrc/free_glyph.c | 5+++--
5 files changed, 30 insertions(+), 5 deletions(-)
diff --git a/CONTRIBUTING.md b/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!
diff --git a/README.md b/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
diff --git a/shaders/simple_epic.frag b/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);
 }
diff --git a/shaders/simple_text.frag b/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);
 }
diff --git a/src/free_glyph.c b/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);
         }