{
vg_console_reg_var( "skip_starter_menu", &menu.skip_starter,
k_var_dtype_i32, VG_VAR_PERSISTENT );
+ vg_tex2d_load_qoi_async_file( "textures/prem.qoi",
+ VG_TEX2D_CLAMP|VG_TEX2D_NOMIP|VG_TEX2D_NEAREST,
+ &menu.prem_tex );
}
void menu_open( enum menu_page page )
(menu.main_index == k_menu_main_map);
}
-static void menu_decor_select( ui_rect rect )
+static void menu_decor_select( ui_context *ctx, ui_rect rect )
{
- ui_px b = vg_ui.font->sx, hb = b/2;
+ ui_px b = ctx->font->sx, hb = b/2;
ui_rect a0 = { rect[0] - 20 - hb, rect[1] + rect[3]/2 - hb, b,b },
a1 = { rect[0] + rect[2] + 20 + hb, rect[1] + rect[3]/2 - hb, b,b };
- ui_text( a0, "\x95", 1, k_ui_align_middle_center, 0 );
- ui_text( a1, "\x93", 1, k_ui_align_middle_center, 0 );
+ ui_text( ctx, a0, "\x95", 1, k_ui_align_middle_center, 0 );
+ ui_text( ctx, a1, "\x93", 1, k_ui_align_middle_center, 0 );
}
-static void menu_standard_widget( ui_rect inout_panel, ui_rect rect, ui_px s )
+static void menu_standard_widget( ui_context *ctx,
+ ui_rect inout_panel, ui_rect rect, ui_px s )
{
- ui_split( inout_panel, k_ui_axis_h, vg_ui.font->sy*s*2,
+ ui_split( inout_panel, k_ui_axis_h, ctx->font->sy*s*2,
8, rect, inout_panel );
}
-static bool menu_slider( ui_rect inout_panel, bool select, const char *label,
+static bool menu_slider( ui_context *ctx,
+ ui_rect inout_panel, bool select, const char *label,
const f32 disp_min, const f32 disp_max, f32 *value,
const char *format )
{
ui_rect rect, box;
- menu_standard_widget( inout_panel, rect, 1 );
- ui_label( rect, label, 1, 8, box );
+ menu_standard_widget( ctx, inout_panel, rect, 1 );
+ ui_label( ctx, rect, label, 1, 8, box );
f32 t;
- enum ui_button_state state = ui_slider_base( box, 0, 1, value, &t ),
+ enum ui_button_state state = ui_slider_base( ctx, box, 0, 1, value, &t ),
mask_using =
k_ui_button_holding_inside |
k_ui_button_holding_outside |
*value = vg_clampf( *value, 0, 1 );
}
- menu_decor_select( rect );
+ menu_decor_select( ctx, rect );
state |= k_ui_button_hover;
}
+ else
+ state = k_ui_button_none;
}
ui_rect line = { box[0], box[1], t * (f32)box[2], box[3] };
- ui_fill( line, state&mask_brighter? GUI_COL_ACTIVE: GUI_COL_NORM );
- ui_fill( (ui_rect){ box[0]+line[2], box[1], box[2]-line[2], box[3] },
+ ui_fill( ctx, line, state&mask_brighter? GUI_COL_ACTIVE: GUI_COL_NORM );
+ ui_fill( ctx, (ui_rect){ box[0]+line[2], box[1], box[2]-line[2], box[3] },
GUI_COL_DARK );
- ui_outline( box, 1, state? GUI_COL_HI: GUI_COL_ACTIVE, 0 );
- ui_slider_text( box, format, disp_min + (*value)*( disp_max-disp_min ) );
+ ui_outline( ctx, box, 1, state? GUI_COL_HI: GUI_COL_ACTIVE, 0 );
+ ui_slider_text( ctx, box,
+ format, disp_min + (*value)*( disp_max-disp_min ) );
return (state & mask_using) && 1;
}
-static bool menu_button( ui_rect inout_panel, bool select, const char *text )
+static bool menu_button( ui_context *ctx,
+ ui_rect inout_panel, bool select, const char *text )
{
ui_rect rect;
- menu_standard_widget( inout_panel, rect, 1 );
+ menu_standard_widget( ctx, inout_panel, rect, 1 );
enum ui_button_state state = k_ui_button_none;
{
if( select )
{
- menu_decor_select( rect );
+ menu_decor_select( ctx, rect );
if( button_down( k_srbind_maccept ) )
state = k_ui_button_click;
}
else
{
- state = ui_button_base( rect );
+ state = ui_button_base( ctx, rect );
select = 0;
}
if( state == k_ui_button_click )
{
- ui_fill( rect, GUI_COL_DARK );
+ ui_fill( ctx, rect, GUI_COL_DARK );
}
else if( state == k_ui_button_holding_inside )
{
- ui_fill( rect, GUI_COL_DARK );
+ ui_fill( ctx, rect, GUI_COL_DARK );
}
else if( state == k_ui_button_holding_outside )
{
- ui_fill( rect, GUI_COL_DARK );
- ui_outline( rect, 1, GUI_COL_CLICK, 0 );
+ ui_fill( ctx, rect, GUI_COL_DARK );
+ ui_outline( ctx, rect, 1, GUI_COL_CLICK, 0 );
}
else if( state == k_ui_button_hover )
{
- ui_fill( rect, GUI_COL_ACTIVE );
- ui_outline( rect, 1, GUI_COL_CLICK, 0 );
+ ui_fill( ctx, rect, GUI_COL_ACTIVE );
+ ui_outline( ctx, rect, 1, GUI_COL_CLICK, 0 );
}
else
{
- ui_fill( rect, select? GUI_COL_ACTIVE: GUI_COL_NORM );
+ ui_fill( ctx, rect, select? GUI_COL_ACTIVE: GUI_COL_NORM );
if( select )
- ui_outline(rect, 1, GUI_COL_HI, 0 );
+ ui_outline( ctx, rect, 1, GUI_COL_HI, 0 );
}
- ui_text( rect, text, 1, k_ui_align_middle_center, 0 );
+ ui_text( ctx, rect, text, 1, k_ui_align_middle_center, 0 );
if( state == k_ui_button_click )
{
else return 0;
}
-static bool menu_checkbox( ui_rect inout_panel, bool select,
+static bool menu_checkbox( ui_context *ctx, ui_rect inout_panel, bool select,
const char *str_label, i32 *data )
{
ui_rect rect, label, box;
- menu_standard_widget( inout_panel, rect, 1 );
+ menu_standard_widget( ctx, inout_panel, rect, 1 );
ui_split( rect, k_ui_axis_v, -rect[3], 0, label, box );
- ui_text( label, str_label, k_ui_scale, k_ui_align_middle_left, 0 );
+ ui_text( ctx, label, str_label, ctx->scale, k_ui_align_middle_left, 0 );
enum ui_button_state state = k_ui_button_none;
{
if( select )
{
- menu_decor_select( rect );
+ menu_decor_select( ctx, rect );
if( button_down( k_srbind_maccept ) )
{
}
else
{
- state = ui_checkbox_base( box, data );
+ state = ui_checkbox_base( ctx, box, data );
select = 0;
}
if( state == k_ui_button_holding_inside )
{
- ui_fill( box, GUI_COL_ACTIVE );
- ui_outline( box, 1, GUI_COL_CLICK, 0 );
+ ui_fill( ctx, box, GUI_COL_ACTIVE );
+ ui_outline( ctx, box, 1, GUI_COL_CLICK, 0 );
}
else if( state == k_ui_button_holding_outside )
{
- ui_fill( box, GUI_COL_DARK );
- ui_outline( box, 1, GUI_COL_CLICK, 0 );
+ ui_fill( ctx, box, GUI_COL_DARK );
+ ui_outline( ctx, box, 1, GUI_COL_CLICK, 0 );
}
else if( state == k_ui_button_hover )
{
- ui_fill( box, GUI_COL_ACTIVE );
- ui_outline( box, 1, GUI_COL_HI, 0 );
+ ui_fill( ctx, box, GUI_COL_ACTIVE );
+ ui_outline( ctx, box, 1, GUI_COL_HI, 0 );
}
else
{
- ui_fill( box, select? GUI_COL_ACTIVE: GUI_COL_DARK );
- ui_outline( box, 1, select? GUI_COL_HI: GUI_COL_NORM, 0 );
+ ui_fill( ctx, box, select? GUI_COL_ACTIVE: GUI_COL_DARK );
+ ui_outline( ctx, box, 1, select? GUI_COL_HI: GUI_COL_NORM, 0 );
}
if( *data )
{
ui_rect_pad( box, (ui_px[2]){8,8} );
- ui_fill( box, GUI_COL_HI );
+ ui_fill( ctx, box, GUI_COL_HI );
}
if( state == k_ui_button_click )
else return 0;
}
-static void menu_heading( ui_rect inout_panel, const char *label, u32 colour )
+static void menu_heading( ui_context *ctx,
+ ui_rect inout_panel, const char *label, u32 colour )
{
ui_rect rect;
- menu_standard_widget( inout_panel, rect, 1 );
+ menu_standard_widget( ctx, inout_panel, rect, 1 );
rect[0] -= 8;
rect[2] += 16;
u32 c0 = ui_opacity( GUI_COL_DARK, 0.36f ),
c1 = ui_opacity( GUI_COL_DARK, 0.5f );
- struct ui_vert *vs = ui_fill( rect, c0 );
+ struct ui_vert *vs = ui_fill( ctx, rect, c0 );
vs[0].colour = c1;
vs[1].colour = c1;
rect[1] += 4;
- ui_text( rect, label, 1, k_ui_align_middle_center, 1 );
+ ui_text( ctx, rect, label, 1, k_ui_align_middle_center, 1 );
rect[0] += 1;
rect[1] -= 1;
- ui_text( rect, label, 1, k_ui_align_middle_center, colour? colour:
- ui_colour(k_ui_blue+k_ui_brighter) );
+ ui_text( ctx, rect, label, 1, k_ui_align_middle_center, colour? colour:
+ ui_colour(ctx, k_ui_blue+k_ui_brighter) );
}
-static u32 medal_colour( u32 flags )
+static u32 medal_colour( ui_context *ctx, u32 flags )
{
if( flags & k_ent_route_flag_achieve_gold )
- return ui_colour( k_ui_yellow );
+ return ui_colour( ctx, k_ui_yellow );
else if( flags & k_ent_route_flag_achieve_silver )
- return ui_colour( k_ui_fg );
+ return ui_colour( ctx, k_ui_fg );
else return 0;
}
}
}
-void menu_gui(void)
+static void menu_link_modal( const char *url )
+{
+ menu.web_link = url;
+
+ /* Only reset the choice of browser if 'No' was selected. */
+ if( menu.web_choice == 2 )
+ menu.web_choice = 0;
+}
+
+void menu_gui( ui_context *ctx )
{
if( button_down( k_srbind_mopen ) )
{
/* get buttons inputs
* -------------------------------------------------------------------*/
- int ml = button_down( k_srbind_mleft ),
- mr = button_down( k_srbind_mright ),
- mu = button_down( k_srbind_mup ),
- md = button_down( k_srbind_mdown ),
+ int ml = button_press( k_srbind_mleft ),
+ mr = button_press( k_srbind_mright ),
+ mu = button_press( k_srbind_mup ),
+ md = button_press( k_srbind_mdown ),
mh = ml-mr,
mv = mu-md,
enter = button_down( k_srbind_maccept );
+ /* TAB CONTROL */
+ u8 lb_down = 0, rb_down = 0;
+ vg_exec_input_program( k_vg_input_type_button_u8,
+ (vg_input_op[]){
+ vg_joy_button, SDL_CONTROLLER_BUTTON_RIGHTSHOULDER, vg_end
+ }, &rb_down );
+ vg_exec_input_program( k_vg_input_type_button_u8,
+ (vg_input_op[]){
+ vg_joy_button, SDL_CONTROLLER_BUTTON_LEFTSHOULDER, vg_end
+ }, &lb_down );
+
+ int mtab = (i32)rb_down - (i32)lb_down;
+
+ if( menu.repeater > 0.0f )
+ {
+ menu.repeater -= vg_minf( vg.time_frame_delta, 0.5f );
+ mv = 0;
+ mh = 0;
+ mtab = 0;
+ }
+ else
+ {
+ if( mv || mh || mtab )
+ menu.repeater += 0.2f;
+ }
+
if( vg_input.display_input_method == k_input_method_kbm )
{
- vg_ui.wants_mouse = 1;
+ ui_capture_mouse(ctx, 1);
}
if( skaterift.activity != k_skaterift_menu ) return;
+
+ if( menu.web_link )
+ {
+ menu_try_find_cam( 3 );
+
+ ui_rect panel = { 0,0, 800, 200 },
+ screen = { 0,0, vg.window_x,vg.window_y };
+ ui_rect_center( screen, panel );
+ ui_fill( ctx, panel, GUI_COL_DARK );
+ ui_outline( ctx, panel, 1, GUI_COL_NORM, 0 );
+ ui_rect_pad( panel, (ui_px[]){8,8} );
+
+ ui_rect title;
+ ui_split( panel, k_ui_axis_h, 28*2, 0, title, panel );
+ ctx->font = &vgf_default_title;
+ ui_text( ctx, title, "Open Link?", 1, k_ui_align_middle_center, 0 );
+
+ ui_split( panel, k_ui_axis_h, 28, 0, title, panel );
+ ctx->font = &vgf_default_large;
+ ui_text( ctx, title, menu.web_link, 1, k_ui_align_middle_center, 0 );
+
+ ui_rect end = { panel[0], panel[1] + panel[3] - 48, panel[2], 48 };
+
+ ui_rect a,b,c;
+ ui_split_ratio( end, k_ui_axis_v, 2.0/3.0, 2, a, c );
+ ui_split_ratio( a, k_ui_axis_v, 1.0/2.0, 2, a, b );
+
+ i32 R = menu_nav( &menu.web_choice, mh, 2 );
+
+ if( menu_button( ctx, a, R==0, "Steam Overlay" ) )
+ {
+ if( steam_ready )
+ {
+ ISteamFriends *hSteamFriends = SteamAPI_SteamFriends();
+ SteamAPI_ISteamFriends_ActivateGameOverlayToWebPage( hSteamFriends,
+ menu.web_link,
+ k_EActivateGameOverlayToWebPageMode_Default );
+ menu.web_link = NULL;
+ }
+ }
+
+ if( menu_button( ctx, b, R==1, "Web Browser" ) )
+ {
+ char buf[512];
+ vg_str str;
+ vg_strnull( &str, buf, sizeof(buf) );
+#ifdef _WIN32
+ vg_strcat( &str, "start " );
+#else
+ vg_strcat( &str, "xdg-open " );
+#endif
+ vg_strcat( &str, menu.web_link );
+
+ if( vg_strgood(&str) )
+ system( buf );
+
+ menu.web_link = NULL;
+ }
+
+ if( menu_button( ctx, c, R==2, "No" ) || button_down( k_srbind_mback ) )
+ {
+ audio_lock();
+ audio_oneshot( &audio_ui[3], 1.0f, 0.0f );
+ audio_unlock();
+ menu.web_link = NULL;
+ }
+
+ goto menu_draw;
+ }
+
+
if( vg.settings_open )
{
if( button_down( k_srbind_mback ) )
ui_rect panel = { 0,0, 600, 400 },
screen = { 0,0, vg.window_x,vg.window_y };
ui_rect_center( screen, panel );
- ui_fill( panel, GUI_COL_DARK );
- ui_outline( panel, 1, GUI_COL_NORM, 0 );
+ ui_fill( ctx, panel, GUI_COL_DARK );
+ ui_outline( ctx, panel, 1, GUI_COL_NORM, 0 );
ui_rect_pad( panel, (ui_px[]){8,8} );
ui_rect title;
ui_split( panel, k_ui_axis_h, 28*2, 0, title, panel );
- ui_font_face( &vgf_default_title );
- ui_text( title, "Skate Rift - Credits", 1, k_ui_align_middle_center, 0 );
+ ctx->font = &vgf_default_title;
+ ui_text( ctx, title, "Skate Rift - Credits",
+ 1, k_ui_align_middle_center, 0 );
ui_split( panel, k_ui_axis_h, 28, 0, title, panel );
- ui_font_face( &vgf_default_large );
- ui_text( title, "Mt.Zero Software", 1, k_ui_align_middle_center, 0 );
+ ctx->font = &vgf_default_large;
+ ui_text( ctx, title,
+ "Mt.Zero Software", 1, k_ui_align_middle_center, 0 );
ui_split( panel, k_ui_axis_h, 8, 0, title, panel );
ui_split( panel, k_ui_axis_h, 28*2, 0, title, panel );
- ui_font_face( &vgf_default_title );
- ui_text( title, "Free Software", 1, k_ui_align_middle_center, 0 );
+ ctx->font = &vgf_default_title;
+ ui_text( ctx, title, "Free Software", 1, k_ui_align_middle_center, 0 );
ui_split( panel, k_ui_axis_h, 8, 0, title, panel );
- ui_font_face( &vgf_default_large );
- ui_text( panel,
+ ctx->font = &vgf_default_large;
+ ui_text( ctx, panel,
"Sam Lantinga - SDL2 - libsdl.org\n"
"Hunter WB - Anyascii\n"
"David Herberth - GLAD\n"
ui_rect end = { panel[0], panel[1] + panel[3] - 64, panel[2], 64 };
- if( menu_button( end, 1, "Back" ) || button_down( k_srbind_mback ) )
+ if( menu_button( ctx, end, 1, "Back" ) || button_down( k_srbind_mback ) )
{
menu.page = k_menu_page_main;
}
ui_rect panel = { 0,0, 600, 400 },
screen = { 0,0, vg.window_x,vg.window_y };
ui_rect_center( screen, panel );
- ui_fill( panel, ui_opacity( GUI_COL_DARK, 0.35f ) );
- ui_outline( panel, 1, GUI_COL_NORM, 0 );
+ ui_fill( ctx, panel, ui_opacity( GUI_COL_DARK, 0.35f ) );
+ ui_outline( ctx, panel, 1, GUI_COL_NORM, 0 );
ui_rect_pad( panel, (ui_px[]){8,8} );
ui_rect title;
ui_split( panel, k_ui_axis_h, 28*2, 0, title, panel );
- ui_font_face( &vgf_default_title );
- ui_text( title, "Welcome to Skate Rift", 1, k_ui_align_middle_center, 0 );
+ ctx->font = &vgf_default_title;
+ ui_text( ctx, title,
+ "Welcome to Skate Rift", 1, k_ui_align_middle_center, 0 );
ui_split( panel, k_ui_axis_h, 28, 0, title, panel );
- ui_font_face( &vgf_default_large );
+ ctx->font = &vgf_default_large;
- menu_checkbox( panel, R == 0,
+ menu_checkbox( ctx, panel, R == 0,
"Show controls overlay (good for new players)",
&control_overlay.enabled );
- menu_checkbox( panel, R == 1, "Auto connect to global server",
+ menu_checkbox( ctx, panel, R == 1, "Auto connect to global server",
&network_client.auto_connect );
ui_rect end = { panel[0], panel[1] + panel[3] - 100, panel[2], 100 };
- menu_checkbox( end, R == 2, "Don't show this again", &menu.skip_starter );
- if( menu_button( end, R == 3, "OK" ) )
+ menu_checkbox( ctx, end, R == 2,
+ "Don't show this again", &menu.skip_starter );
+ if( menu_button( ctx, end, R == 3, "OK" ) )
{
menu.page = k_menu_page_main;
skaterift.activity = k_skaterift_default;
menu_try_find_cam( 3 );
goto menu_draw;
}
+ else if( menu.page == k_menu_page_premium )
+ {
+ i32 R = menu_nav( &menu.prem_row, mh, 1 );
+ ui_rect panel = { 0,0, 600, 400+240 },
+ screen = { 0,0, vg.window_x,vg.window_y };
+ ui_rect_center( screen, panel );
+ ui_fill( ctx, panel, ui_opacity( GUI_COL_DARK, 0.35f ) );
+ ui_outline( ctx, panel, 1, GUI_COL_NORM, 0 );
+ ui_rect_pad( panel, (ui_px[]){8,8} );
+
+ ui_rect title;
+ ui_split( panel, k_ui_axis_h, 28*2, 0, title, panel );
+ ctx->font = &vgf_default_title;
+ ui_text( ctx, title, "Content is in the full game.",
+ 1, k_ui_align_middle_center, 0 );
+
+ ui_split( panel, k_ui_axis_h, 28, 0, title, panel );
+ ctx->font = &vgf_default_large;
+
+ ui_rect img;
+ ui_split( panel, k_ui_axis_h, 456, 0, img, panel );
+ ui_image( ctx, img, &menu.prem_tex );
+
+ ui_rect end = { panel[0], panel[1] + panel[3] - 48, panel[2], 48 }, a,b;
+ ui_split_ratio( end, k_ui_axis_v, 0.5f, 2, a, b );
+
+ if( menu_button( ctx, a, R == 0, "Store Page" ) )
+ {
+ if( steam_ready )
+ SteamAPI_ISteamFriends_ActivateGameOverlayToStore(
+ SteamAPI_SteamFriends(), 2103940, k_EOverlayToStoreFlag_None);
+ }
+
+ if( menu_button( ctx, b, R == 1, "Nah" ) || button_down( k_srbind_mback ) )
+ {
+ audio_lock();
+ audio_oneshot( &audio_ui[3], 1.0f, 0.0f );
+ audio_unlock();
+ skaterift.activity = k_skaterift_default;
+ return;
+ }
+
+ goto menu_draw;
+ }
/* TOP BAR
* -------------------------------------------------------------------*/
- ui_font_face( &vgf_default_title );
- ui_px height = vg_ui.font->ch + 16;
+ ctx->font = &vgf_default_title;
+ ui_px height = ctx->font->ch + 16;
ui_rect topbar = { 0, 0, vg.window_x, height };
const char *opts[] = {
[k_menu_main_guide ] = "Guides"
};
- /* TAB CONTROL */
- u8 lb_down = 0, rb_down = 0;
- vg_exec_input_program( k_vg_input_type_button_u8,
- (vg_input_op[]){
- vg_joy_button, SDL_CONTROLLER_BUTTON_RIGHTSHOULDER, vg_end
- }, &rb_down );
- vg_exec_input_program( k_vg_input_type_button_u8,
- (vg_input_op[]){
- vg_joy_button, SDL_CONTROLLER_BUTTON_LEFTSHOULDER, vg_end
- }, &lb_down );
-
- if( menu.repeater > 0.0f )
+ if( mtab )
{
- menu.repeater -= vg_minf( vg.time_frame_delta, 0.5f );
- }
- else
- {
- if( lb_down != rb_down )
- {
- menu.main_index += rb_down;
- menu.main_index -= lb_down;
- menu.repeater += 0.2f;
+ menu.main_index += mtab;
- if( menu.main_index == -1 )
- menu.main_index ++;
+ if( menu.main_index == -1 )
+ menu.main_index ++;
- if( menu.main_index == vg_list_size(opts) )
- menu.main_index --;
+ if( menu.main_index == vg_list_size(opts) )
+ menu.main_index --;
- audio_lock();
- audio_oneshot( &audio_ui[3], 1.0f, 0.0f );
- audio_unlock();
- }
+ audio_lock();
+ audio_oneshot( &audio_ui[3], 1.0f, 0.0f );
+ audio_unlock();
}
ui_px x = 0, spacer = 8;
if( draw )
{
ui_rect inf_lb = { x, 0, 32, height };
- ui_fill( inf_lb, lb_down? GUI_COL_NORM: GUI_COL_NORM );
- ui_text( inf_lb, "\x91", 1, k_ui_align_middle_center, 0 );
+ ui_fill( ctx, inf_lb, lb_down? GUI_COL_NORM: GUI_COL_NORM );
+ ui_text( ctx, inf_lb, "\x91", 1, k_ui_align_middle_center, 0 );
}
x += 32 + spacer;
}
for( i32 i=0; i<vg_list_size(opts); i ++ )
{
- ui_rect box = { x, 0, ui_text_line_width(opts[i]) + 32, height };
+ ui_rect box = { x, 0, ui_text_line_width(ctx, opts[i]) + 32, height };
if( draw )
{
- enum ui_button_state state = ui_button_base( box );
+ enum ui_button_state state = ui_button_base( ctx, box );
if( state == k_ui_button_click )
{
- ui_fill( box, GUI_COL_DARK );
+ ui_fill( ctx, box, GUI_COL_DARK );
menu.main_index = i;
}
else if( state == k_ui_button_holding_inside )
{
- ui_fill( box, GUI_COL_DARK );
+ ui_fill( ctx, box, GUI_COL_DARK );
}
else if( state == k_ui_button_holding_outside )
{
- ui_fill( box, GUI_COL_DARK );
- ui_outline( box, 1, GUI_COL_CLICK, 0 );
+ ui_fill( ctx, box, GUI_COL_DARK );
+ ui_outline( ctx, box, 1, GUI_COL_CLICK, 0 );
}
else if( state == k_ui_button_hover )
{
- ui_fill( box, GUI_COL_NORM );
- ui_outline( box, 1, GUI_COL_ACTIVE, 0 );
+ ui_fill( ctx, box, GUI_COL_NORM );
+ ui_outline( ctx, box, 1, GUI_COL_ACTIVE, 0 );
}
else
- ui_fill( box, i==menu.main_index? GUI_COL_ACTIVE: GUI_COL_NORM );
+ ui_fill( ctx, box,
+ i==menu.main_index? GUI_COL_ACTIVE: GUI_COL_NORM );
- ui_text( box, opts[i], 1, k_ui_align_middle_center, 0 );
+ ui_text( ctx, box, opts[i], 1, k_ui_align_middle_center, 0 );
}
x += box[2] + spacer;
if( draw )
{
ui_rect inf_rb = { x, 0, 32, height };
- ui_fill( inf_rb, rb_down? GUI_COL_NORM: GUI_COL_NORM );
- ui_text( inf_rb, "\x92", 1, k_ui_align_middle_center, 0 );
+ ui_fill( ctx, inf_rb, rb_down? GUI_COL_NORM: GUI_COL_NORM );
+ ui_text( ctx, inf_rb, "\x92", 1, k_ui_align_middle_center, 0 );
}
x += 32;
}
if( draw )
- ui_fill( (ui_rect){ x+8,0, vg.window_x-(x+8),height }, GUI_COL_NORM );
+ ui_fill( ctx,
+ (ui_rect){ x+8,0, vg.window_x-(x+8),height }, GUI_COL_NORM );
else
{
x = vg.window_x/2 - x/2;
- ui_fill( (ui_rect){ 0, 0, x-8, height }, GUI_COL_NORM );
+ ui_fill( ctx,
+ (ui_rect){ 0, 0, x-8, height }, GUI_COL_NORM );
}
}
if( menu.main_index == k_menu_main_map )
{
menu.bg_blur = 0;
- ui_font_face( &vgf_default_large );
- ui_rect title = { vg.window_x/2 - 512/2, height+8, 512, 64 };
+ ctx->font = &vgf_default_large;
+ ui_rect title = { vg.window_x/2- 512/2, height+8, 512, 64 };
ui_px x = 8,
y = height+8;
struct ui_vert *vs =
- ui_fill( (ui_rect){ x,y, 0,height },
+ ui_fill( ctx, (ui_rect){ x,y, 0,height },
world_static.active_instance? GUI_COL_DARK: GUI_COL_ACTIVE );
char buf[64];
vg_strcat( &str, "\x1B[0m)" );
}
- ui_px w = ui_text( (ui_rect){ x+8, y, 1000, height }, buf, 1,
+ ui_px w = ui_text( ctx, (ui_rect){ x+8, y, 1000, height }, buf, 1,
k_ui_align_middle_left, 0 );
- w *= vg_ui.font->sx;
+ w *= ctx->font->sx;
x += w + 16;
vs[1].co[0] = x + 8;
vg_strcat( &str, "\x1B[0m)" );
}
- vs = ui_fill( (ui_rect){ x,y, 1000,height },
+ vs = ui_fill( ctx, (ui_rect){ x,y, 1000,height },
world_static.active_instance? GUI_COL_ACTIVE: GUI_COL_DARK );
- w = ui_text( (ui_rect){ x+16,y, 1000,height }, buf,
+ w = ui_text( ctx, (ui_rect){ x+16,y, 1000,height }, buf,
1, k_ui_align_middle_left, 0 );
- w = w*vg_ui.font->sx + 8*3;
+ w = w*ctx->font->sx + 8*3;
x += w;
if( button_down( k_srbind_mhub ) ||
- ui_button_base( (ui_rect){0,y,x,height} ) == k_ui_button_click )
+ ui_button_base( ctx, (ui_rect){0,y,x,height} ) == k_ui_button_click )
{
world_switch_instance( world_static.active_instance ^ 0x1 );
skaterift.activity = k_skaterift_default;
{
ui_rect stat_panel = { x,y, 256,vg.window_y-y };
u32 c0 = ui_opacity( GUI_COL_DARK, 0.36f );
- struct ui_vert *vs = ui_fill( stat_panel, c0 );
+ struct ui_vert *vs = ui_fill( ctx, stat_panel, c0 );
ui_rect_pad( stat_panel, (ui_px[2]){8,0} );
continue;
const char *title = mdl_pstr( &world->meta, region->pstr_title );
- ui_font_face( &vgf_default_large );
+ ctx->font = &vgf_default_large;
ui_rect title_box;
- menu_standard_widget( stat_panel, title_box, 1 );
+ menu_standard_widget( ctx, stat_panel, title_box, 1 );
stat_panel[0] += 16;
stat_panel[2] -= 16;
- ui_font_face( &vgf_default_small );
+ ctx->font = &vgf_default_small;
ent_volume *volume = mdl_arritm(&world->ent_volume,
mdl_entity_id_id(region->zone_volume));
vg_strcat( &str, "\xb3");
ui_rect r;
- ui_standard_widget( stat_panel, r, 1 );
- ui_text( r, buf, 1, k_ui_align_middle_left,
- medal_colour(route->flags) );
+ ui_standard_widget( ctx, stat_panel, r, 1 );
+ ui_text( ctx, r, buf, 1, k_ui_align_middle_left,
+ medal_colour( ctx, route->flags ) );
}
for( u32 j=0; j<mdl_arrcount(&world->ent_challenge); j ++ )
combined &= flags;
ui_rect r;
- ui_standard_widget( stat_panel, r, 1 );
- ui_text( r, buf, 1, k_ui_align_middle_left, medal_colour(flags) );
+ ui_standard_widget( ctx, stat_panel, r, 1 );
+ ui_text( ctx, r, buf, 1,
+ k_ui_align_middle_left, medal_colour( ctx, flags ) );
}
stat_panel[0] -= 16;
u32 title_col = 0;
if( combined & k_ent_route_flag_achieve_gold )
- title_col = ui_colour( k_ui_yellow );
+ title_col = ui_colour( ctx, k_ui_yellow );
else if( combined & k_ent_route_flag_achieve_silver )
- title_col = ui_colour( k_ui_fg );
+ title_col = ui_colour( ctx, k_ui_fg );
- menu_heading( title_box, title, title_col );
+ menu_heading( ctx, title_box, title, title_col );
}
vs[2].co[1] = stat_panel[1];
{
i32 R = menu_nav( &menu.main_row, mv, 2 );
- if( menu_button( list, R == 0, "Resume" ) )
+ if( menu_button( ctx, list, R == 0, "Resume" ) )
{
skaterift.activity = k_skaterift_default;
return;
}
- if( menu_button( list, R == 1, "Credits" ) )
+ if( menu_button( ctx, list, R == 1, "Credits" ) )
{
menu.page = k_menu_page_credits;
}
ui_rect end = { list[0], list[1]+list[3]-64, list[2], 72 };
- if( menu_button( end, R == 2, "Quit Game" ) )
+ if( menu_button( ctx, end, R == 2, "Quit Game" ) )
{
vg.window_should_close = 1;
}
}
else if( menu.main_index == k_menu_main_settings )
{
- ui_fill( list0, ui_opacity( GUI_COL_DARK, 0.36f ) );
- ui_outline( list0, 1, GUI_COL_NORM, 0 );
+ ui_fill( ctx, list0, ui_opacity( GUI_COL_DARK, 0.36f ) );
+ ui_outline( ctx, list0, 1, GUI_COL_NORM, 0 );
i32 R = menu_nav( &menu.settings_row, mv, 8 );
- ui_font_face( &vgf_default_large );
+ ctx->font = &vgf_default_large;
list[1] -= 8;
- menu_heading( list, "Game", 0 );
- menu_checkbox( list, R == 0, "Show controls overlay",
+ menu_heading( ctx, list, "Game", 0 );
+ menu_checkbox( ctx, list, R == 0, "Show controls overlay",
&control_overlay.enabled );
- menu_checkbox( list, R == 1, "Auto connect to global server",
+ menu_checkbox( ctx, list, R == 1, "Auto connect to global server",
&network_client.auto_connect );
- menu_heading( list, "Audio/Video", 0 );
- menu_slider( list, R == 2, "Volume", 0, 100,
+ menu_heading( ctx, list, "Audio/Video", 0 );
+ menu_slider( ctx, list, R == 2, "Volume", 0, 100,
&vg_audio.external_global_volume, "%.f%%" );
- menu_slider( list, R == 3, "Resolution", 0, 100,
+ menu_slider( ctx, list, R == 3, "Resolution", 0, 100,
&k_render_scale, "%.f%%" );
- menu_checkbox( list, R == 4, "Motion Blur", &k_blur_effect );
+ menu_checkbox( ctx, list, R == 4, "Motion Blur", &k_blur_effect );
- menu_heading( list, "Camera", 0 );
- menu_slider( list, R == 5, "Fov", 97, 135,
+ menu_heading( ctx, list, "Camera", 0 );
+ menu_slider( ctx, list, R == 5, "Fov", 97, 135,
&k_fov, "%.1f\xb0" );
- menu_slider( list, R == 6, "Cam Height", -0.4f, +1.4f,
+ menu_slider( ctx, list, R == 6, "Cam Height", -0.4f, +1.4f,
&k_cam_height, vg_lerpf(-0.4f,1.4f,k_cam_height)>=0.0f?
"+%.2fm": "%.2fm" );
- menu_checkbox( list, R == 7, "Invert Y Axis", &k_invert_y );
+ menu_checkbox( ctx, list, R == 7, "Invert Y Axis", &k_invert_y );
ui_rect end = { list[0], list[1]+list[3]-64, list[2], 72 };
- ui_font_face( &vgf_default_small );
- menu_heading( end, "Advanced", 0 );
- if( menu_button( end, R == 8, "Open Engine Settings" ) )
+ ctx->font = &vgf_default_small;
+ menu_heading( ctx, end, "Advanced", 0 );
+ if( menu_button( ctx, end, R == 8, "Open Engine Settings" ) )
{
vg_settings_open();
}
list0[0] = 8;
list[0] = 16;
- ui_fill( list0, ui_opacity( GUI_COL_DARK, 0.36f ) );
- ui_outline( list0, 1, GUI_COL_NORM, 0 );
- i32 R = menu_nav( &menu.guides_row, mv, 7 );
+ ui_px w = 700,
+ marg = list0[0]+list0[2],
+ pw = vg.window_x - marg,
+ infx = pw/2 - w/2 + marg;
+ ui_rect inf = { infx, height +32, w, 800 };
- ui_font_face( &vgf_default_large );
- list[1] -= 8;
- menu_heading( list, "Info", 0 );
- if( R == 0 ) menu_try_find_cam( 1 );
- if( menu_button( list, R == 0, "Where to go" ) )
+ struct ui_vert *vs = NULL;
+
+ if( menu.guide_sel && (menu.guide_sel <= 3) )
{
+ vs = ui_fill( ctx, inf, ui_opacity( GUI_COL_DARK, 0.20f ) );
+ ui_rect_pad( inf, (ui_px[]){8,8} );
}
- if( R == 1 ) menu_try_find_cam( 0 );
- if( menu_button( list, R == 1, "Finding worlds" ) )
+ ui_fill( ctx, list0, ui_opacity( GUI_COL_DARK, 0.36f ) );
+ ui_outline( ctx, list0, 1, GUI_COL_NORM, 0 );
+ i32 R = menu_nav( &menu.guides_row, mv, 6 );
+
+ ctx->font = &vgf_default_large;
+ list[1] -= 8;
+ menu_heading( ctx, list, "Info", 0 );
+ if( menu.guide_sel == 1 )
{
+ menu_try_find_cam( 1 );
+
+ ui_rect title;
+ ui_split( inf, k_ui_axis_h, 28*2, 0, title, inf );
+ ctx->font = &vgf_default_title;
+ ui_text( ctx,
+ title, "Where to go", 1, k_ui_align_middle_center, 0 );
+
+ ui_split( inf, k_ui_axis_h, 28, 0, title, inf );
+ ctx->font = &vgf_default_large;
+ ui_text( ctx, inf,
+ "Visit the sandcastles built by John Cockroach to be\n"
+ "transported into the real location. Use the map in the\n"
+ "menu to return back this hub island.\n"
+ "\n"
+ "You can begin training at the Volcano Island, where you\n"
+ "can learn movement skills. Then travel to Mt.Zero Island\n"
+ "or Bort Downtown to test them out. Finally the most\n"
+ "challenging course can be taken on at the Valley.\n"
+ "\n"
+ "Also visit the Steam Workshop for community made\n"
+ "locations to skate!"
+ , 1, k_ui_align_left, 0 );
+
+ vs[2].co[1] = vs[0].co[1] + 84 + vgf_default_large.sy*11 + 16;
+ vs[3].co[1] = vs[2].co[1];
}
+ if( menu_button( ctx, list, R == 0, "Where to go" ) )
+ menu.guide_sel = 1;
- if( R == 2 ) menu_try_find_cam( 2 );
- if( menu_button( list, R == 2, "Playing Online" ) )
+ if( menu.guide_sel == 3 )
{
+ menu_try_find_cam( 2 );
+
+ ui_rect title;
+ ui_split( inf, k_ui_axis_h, 28*2, 0, title, inf );
+ ctx->font = &vgf_default_title;
+ ui_text( ctx, title, "Online", 1, k_ui_align_middle_center, 0 );
+
+ ui_split( inf, k_ui_axis_h, 28, 0, title, inf );
+ ctx->font = &vgf_default_large;
+ ui_text( ctx, inf,
+ "Connection to the global server is managed by this radar\n"
+ "dish in the hub island. Come back here to turn the\n"
+ "connection on or off.\n"
+ "\n"
+ "You'll then see other players or your friends if you go\n"
+ "to the same location, and your highscores will be saved\n"
+ "onto the scoreboards."
+ , 1, k_ui_align_left, 0 );
+
+ vs[2].co[1] = vs[0].co[1] + 84 + vgf_default_large.sy*7 + 16;
+ vs[3].co[1] = vs[2].co[1];
}
+ if( menu_button( ctx, list, R == 1, "Playing Online" ) )
+ menu.guide_sel = 3;
- menu_heading( list, "Controls", 0 );
- if( R >= 3 ) menu_try_find_cam( 3 );
- if( menu_button( list, R == 3, "Skating \xb2" ) )
+ menu_heading( ctx, list, "Controls", 0 );
+ if( menu_button( ctx, list, R == 2, "Skating \xb2" ) )
{
+ menu.guide_sel = 0;
+ menu_link_modal(
+ "https://skaterift.com/index.php?page=movement" );
}
- if( menu_button( list, R == 4, "Tricks \xb2" ) )
+ if( menu.guide_sel == 0 || menu.guide_sel > 3 ) menu_try_find_cam( 3 );
+
+ if( menu_button( ctx, list, R == 3, "Tricks \xb2" ) )
{
+ menu.guide_sel = 0;
+ menu_link_modal(
+ "https://skaterift.com/index.php?page=tricks" );
}
- menu_heading( list, "Workshop", 0 );
- if( menu_button( list, R == 5, "Create a Board \xb2" ) )
+ menu_heading( ctx, list, "Workshop", 0 );
+ if( menu_button( ctx, list, R == 4, "Create a Board \xb2" ) )
{
+ menu.guide_sel = 0;
+ menu_link_modal(
+ "https://skaterift.com/index.php?page=workshop_board" );
}
- if( menu_button( list, R == 6, "Create a World \xb2" ) )
+ if( menu_button( ctx, list, R == 5, "Create a World \xb2" ) )
{
+ menu.guide_sel = 0;
+ menu_link_modal(
+ "https://skaterift.com/index.php?page=workshop_world" );
}
- if( menu_button( list, R == 7, "Create a Playermodel \xb2" ) )
+ if( menu_button( ctx, list, R == 6, "Create a Playermodel \xb2" ) )
{
+ menu.guide_sel = 0;
+ menu_link_modal(
+ "https://skaterift.com/index.php?page=workshop_player" );
}
}
-
}
menu_draw:
vg_ui.frosting = 0.015f;
- ui_flush( k_ui_shader_colour, vg.window_x, vg.window_y );
+ ui_flush( ctx, k_ui_shader_colour, NULL );
vg_ui.frosting = 0.0f;
-
- ui_font_face( &vgf_default_small );
+ ctx->font = &vgf_default_small;
}