/*
* 3) [fov,nearz,farz] -> projection matrix
*/
-void vg_camera_update_projection( vg_camera *cam )
+void vg_camera_update_projection( vg_camera *cam, f32 vw, f32 vh )
{
m4x4_copy( cam->mtx.p, cam->mtx_prev.p );
- m4x4_projection( cam->mtx.p, cam->fov,
- (float)vg.window_x / (float)vg.window_y,
- cam->nearz, cam->farz );
+ m4x4_projection( cam->mtx.p, cam->fov, (float)vw / (float)vh, cam->nearz, cam->farz );
}
/*
/*
* 3) [fov,nearz,farz] -> projection matrix
*/
-void vg_camera_update_projection( vg_camera *cam );
+void vg_camera_update_projection( vg_camera *cam, f32 vw, f32 vh );
/*
* 4) [projection matrix, view matrix] -> previous pv, new pv
if( !w || !h )
{
- vg_warn( "Got a invalid framebuffer size: "
- "%dx%d... ignoring\n", w, h );
+ vg_warn( "Got a invalid framebuffer size: %dx%d... ignoring\n", w, h );
}
else
{
_vg_magi_area_change( delta );
vg.window_x = w;
vg.window_y = h;
-
+
vg_framebuffer_update_sizes();
+ vg_framebuffer_resize( vg.window_x, vg.window_y );
}
}
else if( event.window.event == SDL_WINDOWEVENT_CLOSE )
opacity *= opacity;
glUseProgram( _shader_loader.id );
- glUniform1f( glGetUniformLocation( _shader_loader.id, "uTime" ), vg.time );
+ glUniform1f( glGetUniformLocation( _shader_loader.id, "uTime" ), vg.time_real );
f32 ratio = (f32)vg.window_x / (f32)vg.window_y;
glUniform1f( glGetUniformLocation( _shader_loader.id, "uRatio"), ratio );
glUniform1f( glGetUniformLocation( _shader_loader.id, "uOpacity"), opacity );
vg_recompile_shader( shader );
}
+#ifdef VG_CUSTOM_SHADERS
+ vg_auto_shader_link();
+#endif
+
return 0;
}
const char *_c = str;
u8 c;
- while( (c = *(_c ++)) ){
+ while( (c = *(_c ++)) )
+ {
+ /* skip vt colour codes */
+ if( c == '\x1B' )
+ {
+ while( (c = *(_c ++)) )
+ {
+ if( c == 'm' )
+ break;
+ }
+
+ if( c == 0 ) break;
+ else continue;
+ }
+
if( c >= 32 ) length ++;
else if( c == '\n' ) break;
}
ui_rect rect, const char *string, ui_px scale,
enum ui_scheme_colour colour );
-enum ui_button_state ui_button_text( ui_context *ctx, ui_rect rect,
- const char *string, ui_px scale );
-enum ui_button_state ui_button( ui_context *ctx,
- ui_rect inout_panel, const char *string );
+enum ui_button_state ui_button_text( ui_context *ctx, ui_rect rect, const char *string, ui_px scale );
+enum ui_button_state ui_button( ui_context *ctx, ui_rect inout_panel, const char *string );
void ui_postrender( ui_context *ctx, f32 delta_time );
enum ui_button_state ui_checkbox_base( ui_context *ctx,
ui_rect box, i32 *data );