/* Copyright (C) 2021-2022 Harry Godden (hgn) - All Rights Reserved */
+#if 0
#ifndef VG_UI_H
#define VG_UI_H
{
if( !vg_shader_compile( &_shader_ui ) ||
!vg_shader_compile( &_shader_ui_image ) )
- vg_fatal_exit_loop( "Failed to compile ui shader" );
+ vg_fatal_error( "Failed to compile ui shader" );
/*
* Vertex buffer
u32 pixels = 0, total = 256*256, data = 0;
u8 image[256*256];
- while( pixels < total )
- {
- for( int b = 31; b >= 0; b-- )
- {
- image[ pixels ++ ] = (compressed[data] & (0x1 << b))? 0xff: 0x00;
+ while( pixels < total ){
+ for( int b = 31; b >= 0; b-- ){
+ image[ pixels ++ ] = (compressed[data] & (0x1u << b))? 0xffu: 0x00u;
- if( pixels >= total )
- {
+ if( pixels >= total ){
total = 0;
break;
}
GL_RED, GL_UNSIGNED_BYTE, image );
VG_CHECK_GL_ERR();
- vg_tex2d_clamp();
- vg_tex2d_nearest();
+ glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE );
+ glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE );
+ glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST );
+ glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST );
}
static struct ui_vert *ui_fill_rect_uv( ui_rect rect, u32 colour, ui_px uv[4] );
text_cursor[2] = 8*scale;
text_cursor[3] = 14*scale;
- while( (c = *(_c ++)) )
- {
- if( c == '\n' )
- {
+ while( (c = *(_c ++)) ){
+ if( c == '\n' ){
text_cursor[1] += 14*scale;
text_cursor[0] = pos[0] + ui_text_line_offset( _c, scale, align );
continue;
}
- else if( c >= 33 )
- {
+ else if( c >= 33 ){
u8 glyph_base[2];
u8 glyph_index = c;
glyph_base[0] = glyph_index & 0xf;
glyph_base[1]+8
});
}
- else if( c == '\x1B' )
- {
+ else if( c == '\x1B' ){
_c ++;
u16 colour_id = 0;
- for( int i = 0; i < 3; i ++ )
- {
- if( _c[i] )
- {
- if( _c[i] == 'm' )
- {
+ for( int i = 0; i < 3; i ++ ){
+ if( _c[i] ){
+ if( _c[i] == 'm' ){
_c = _c + i + 1;
- switch( colour_id )
- {
+ switch( colour_id ){
case '0': current_colour = 0x00ffffff; break;
case '3'|'1'<<8: current_colour = 0x00201fee; break;
case '3'|'2'<<8: current_colour = 0x0037e420; break;
colour_id |= _c[i] << (i*8);
}
- else
- {
+ else{
_c = _c +i;
break;
}
continue;
}
- else if( c == '\t' )
- {
+ else if( c == '\t' ){
text_cursor[0] += UI_GLYPH_SPACING_X*scale*4;
continue;
}
}
#endif /* VG_UI_H */
+#endif