|
|
@@ -11,7 +11,6 @@
|
|
|
#include "shader.h"
|
|
|
#include "gl_util.h"
|
|
|
#include "free_glyph.h"
|
|
|
-#include "cursor.h"
|
|
|
#include "util_macro.h"
|
|
|
|
|
|
#include <stdio.h>
|
|
|
@@ -30,10 +29,9 @@
|
|
|
#include FT_FREETYPE_H
|
|
|
|
|
|
|
|
|
-void handle_events(struct app *app, struct cursor_render *cr);
|
|
|
+void handle_events(struct app *app);
|
|
|
|
|
|
void render_buffer_into_fgr(struct free_glyph_render *fgr,
|
|
|
- struct cursor_render *cr,
|
|
|
struct simple_render *sr,
|
|
|
struct app *app);
|
|
|
|
|
|
@@ -95,17 +93,12 @@ main(int32_t argc, char **argv)
|
|
|
"./shaders/free_font.vert",
|
|
|
"./shaders/free_font.frag");
|
|
|
|
|
|
- struct cursor_render cr = cursor_render_create(
|
|
|
- "./shaders/cur.vert",
|
|
|
- "./shaders/cur.frag");
|
|
|
-
|
|
|
struct simple_render sr = sr_create(
|
|
|
"./shaders/simple.vert",
|
|
|
"./shaders/simple.frag");
|
|
|
(void) sr;
|
|
|
|
|
|
app.fgr = &fgr;
|
|
|
- app.cr = &cr;
|
|
|
|
|
|
uint32_t frame_target_dur = (uint32_t)(1000 / app.target_fps);
|
|
|
|
|
|
@@ -119,7 +112,7 @@ main(int32_t argc, char **argv)
|
|
|
while ( app.running ) {
|
|
|
fr_start = SDL_GetTicks();
|
|
|
|
|
|
- handle_events(&app, &cr);
|
|
|
+ handle_events(&app);
|
|
|
|
|
|
if ( app.show_fps == true ) {
|
|
|
fps_text_size = (size_t) snprintf(fps_text, 128,
|
|
|
@@ -133,7 +126,7 @@ main(int32_t argc, char **argv)
|
|
|
glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
|
|
|
glClear(GL_COLOR_BUFFER_BIT);
|
|
|
|
|
|
- render_buffer_into_fgr(&fgr, &cr, &sr, &app);
|
|
|
+ render_buffer_into_fgr(&fgr, &sr, &app);
|
|
|
|
|
|
SDL_GL_SwapWindow(app.win.ptr);
|
|
|
|
|
|
@@ -149,9 +142,8 @@ main(int32_t argc, char **argv)
|
|
|
}
|
|
|
|
|
|
void
|
|
|
-handle_events(struct app *app, struct cursor_render *cr)
|
|
|
+handle_events(struct app *app)
|
|
|
{
|
|
|
- (void) cr;
|
|
|
SDL_Event e = {0};
|
|
|
bool done = false;
|
|
|
while ( SDL_PollEvent(&e) ) {
|
|
|
@@ -201,11 +193,10 @@ handle_events(struct app *app, struct cursor_render *cr)
|
|
|
}
|
|
|
|
|
|
void
|
|
|
-render_buffer_into_fgr(struct free_glyph_render *fgr, struct cursor_render *cr,
|
|
|
- struct simple_render *sr, struct app *app)
|
|
|
+render_buffer_into_fgr(struct free_glyph_render *fgr, struct simple_render *sr,
|
|
|
+ struct app *app)
|
|
|
{
|
|
|
(void) fgr;
|
|
|
- (void) cr;
|
|
|
(void) app;
|
|
|
uint32_t ticks = SDL_GetTicks();
|
|
|
float cur_row = (float)(buffer_calc_cur_row(&app->buf)
|
|
|
@@ -239,21 +230,6 @@ render_buffer_into_fgr(struct free_glyph_render *fgr, struct cursor_render *cr,
|
|
|
(int32_t) fgr->glyphs.size);
|
|
|
}
|
|
|
|
|
|
- /* cursor_render_use(*cr); */
|
|
|
- /* { */
|
|
|
- /* glUniform1f(cr->uniforms.time, ((float) ticks) / 1000.0f); */
|
|
|
- /* glUniform2f(cr->uniforms.camera, (float)cpos.x, (float)cpos.y); */
|
|
|
- /* glUniform2f(cr->uniforms.resolution, */
|
|
|
- /* (float) app->win.w, */
|
|
|
- /* (float) app->win.h); */
|
|
|
- /* glUniform1f(cr->uniforms.h, (float) 32); */
|
|
|
- /* glUniform1f(cr->uniforms.w, (float) 3); */
|
|
|
-
|
|
|
- /* struct vec2 c_pos = vec2(cur_pos.x, cur_pos.y); */
|
|
|
- /* cursor_render_mv_to(*cr, vec2_to_f(c_pos)); */
|
|
|
- /* cursor_render_draw(*cr); */
|
|
|
- /* } */
|
|
|
-
|
|
|
sr_use(sr);
|
|
|
{
|
|
|
glUniform1f(sr_get_uniform(sr, "time"), time);
|