#include "vg_graphics.h"
#include "console_system.h"
#include "vg_engine.h"
+#include "vg_ui.h"
#include <unistd.h>
return;
_audio_lock();
- i16 panel[4] = {0,0,_engine.w,_engine.h};
+ i16 panel[4] = {0,0,_engine_ui.w,_engine_ui.h};
/* Draw audio stack */
for( i32 id=1; id<=AUDIO_CHANNELS; id ++ )
}
SDL_RaiseWindow( _engine.window_handle );
- SDL_SetWindowMinimumSize( _engine.window_handle, 1280, 720 );
- SDL_SetWindowMaximumSize( _engine.window_handle, 1920, 1080 );
+ SDL_SetWindowMinimumSize( _engine.window_handle, 800, 600 );
+ SDL_SetWindowMaximumSize( _engine.window_handle, 1920*2, 1080*2 );
/*
* OpenGL loading
else if( e.type == SDL_EVENT_MOUSE_MOTION )
{
SDL_MouseMotionEvent *ev = (SDL_MouseMotionEvent *)&e;
- _ui_set_mouse( ev->x, ev->y );
+ _ui_set_mouse( ev->x / _engine_ui.divisor, ev->y / _engine_ui.divisor );
}
else if( e.type == SDL_EVENT_TEXT_INPUT )
{
#include "vg_render.h"
#include "vg_opengl.h"
#include "vg_shader.h"
+#include "vg_ui.h"
struct graphics_target _ui_surface =
{
.mode = k_graphics_mode_software,
.size = { 1920, 1080 },
};
+struct _engine_ui _engine_ui;
static GLuint _ui_surface_texture;
void _engine_ui_pre_render(void)
{
- ASSERT_CRITICAL( _engine.w <= 1920 );
- ASSERT_CRITICAL( _engine.h <= 1080 );
+ _engine_ui.w = _engine.w;
+ _engine_ui.h = _engine.h;
+ _engine_ui.divisor = 1;
+
+ if( (_engine_ui.w > 1920) || (_engine_ui.h > 1080) )
+ {
+ _engine_ui.divisor = 2;
+ _engine_ui.w /= 2;
+ _engine_ui.h /= 2;
+ ASSERT_CRITICAL( _engine_ui.w <= 1920 );
+ ASSERT_CRITICAL( _engine_ui.h <= 1080 );
+ }
_ui_update();
_graphics_set_target( &_ui_surface );
- _graphics_viewport( 0, 0, _engine.w, _engine.h );
+ _graphics_viewport( 0, 0, _engine_ui.w, _engine_ui.h );
//_graphics_fill_rect( (i16[]){ 0, 0, _engine.w, _engine.h }, (union colour){{0,0,0,255}} );
}
_shader_bind( k_shader_blit );
_shader_blit_uTexMain( 0 );
_shader_blit_uFlip( 1 );
- _shader_blit_uInverseRatio( (f32[2]){ (f64)_engine.w/1920.0, (f64)_engine.h/1080.0 } );
+ _shader_blit_uInverseRatio( (f32[2]){ (f64)_engine_ui.w/1920.0, (f64)_engine_ui.h/1080.0 } );
_render_fullscreen_quad();
glDisable( GL_BLEND );