skaterift_end_op();
}
-struct workshop_loadpreview_info {
- char abs_preview_image[ 1024 ];
-};
-
/*
* Load the image located at ./workshop_preview.jpg into our framebuffer
*/
VG_STATIC void _workshop_load_preview_thread( void *data )
{
- struct workshop_loadpreview_info *info = data;
-
- stbi_set_flip_vertically_on_load(1);
- int x, y, nc;
- u8 *rgb = stbi_load( info->abs_preview_image, &x, &y, &nc, 3 );
-
- if( rgb ){
- if( (x == WORKSHOP_PREVIEW_WIDTH) && (y == WORKSHOP_PREVIEW_HEIGHT) ){
- vg_async_call( workshop_form_async_imageload, rgb, x*y*3 );
+ char path_buf[ 4096 ];
+ vg_str path;
+ vg_strnull( &path, path_buf, 4096 );
+ vg_strcat( &path, "boards/" );
+ vg_strcat( &path, workshop_form.addon_folder );
+ vg_strcat( &path, "/preview.jpg" );
+
+ if( vg_strgood( &path ) ){
+ stbi_set_flip_vertically_on_load(1);
+ int x, y, nc;
+ u8 *rgb = stbi_load( path.buffer, &x, &y, &nc, 3 );
+
+ if( rgb ){
+ if( (x == WORKSHOP_PREVIEW_WIDTH) && (y == WORKSHOP_PREVIEW_HEIGHT) ){
+ vg_async_call( workshop_form_async_imageload, rgb, x*y*3 );
+ }
+ else{
+ vg_error( "Resolution does not match framebuffer, so we can't"
+ " show it\n" );
+ stbi_image_free( rgb );
+ vg_async_call( workshop_form_async_imageload, NULL, 0 );
+ }
}
else{
- vg_error( "Resolution does not match framebuffer, so we can't"
- " show it\n" );
- stbi_image_free( rgb );
+ vg_error( "Failed to load workshop_preview.jpg: '%s'\n",
+ stbi_failure_reason() );
vg_async_call( workshop_form_async_imageload, NULL, 0 );
}
}
else{
- vg_error( "Failed to load workshop_preview.jpg: '%s'\n",
- stbi_failure_reason() );
vg_async_call( workshop_form_async_imageload, NULL, 0 );
}
}
+#if 0
/*
* Reciever for the preview download result
*/
skaterift_end_op();
}
}
+#endif
/*
* Entry point to view operation
}
}
- vg_error( "m_hPreviewFile is 0\n" );
render_fb_bind( gpipeline.fb_workshop_preview, 0 );
glClearColor( 0.2f, 0.0f, 0.0f, 1.0f );
glClear( GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT );
glBindFramebuffer( GL_FRAMEBUFFER, 0 );
glViewport( 0,0, vg.window_x, vg.window_y );
- skaterift_end_op();
+ vg_loader_start( _workshop_load_preview_thread, NULL );
#if 0
if( details.m_hPreviewFile == 0 ){
return;
}
+ if( workshop_form.submission.type == k_workshop_file_type_world ){
+ ui_rect box;
+ rect_copy( content, box );
+ box[3] = 128;
+ box[2] = (box[2]*2)/3;
+ ui_rect_center( content, box );
+
+ ui_rect row;
+ ui_split( box, k_ui_axis_h, 28, 0, row, box );
+ ui_text( row, "World submissions are currently not ready, sorry.",
+ 1, k_ui_align_middle_center,0);
+ ui_split( box, k_ui_axis_h, 8, 0, row, box );
+ ui_split( box, k_ui_axis_h, 28, 0, row, box );
+
+ ui_rect button;
+ rect_copy( row, button );
+ button[2] = 128;
+ ui_rect_center( row, button );
+ if( ui_button_text( button, "OK", 1 ) ){
+ workshop_form.page = k_workshop_form_open;
+ workshop_form.file_intent = k_workshop_form_file_intent_none;
+ }
+
+ return;
+ }
+
ui_rect image_plane;
ui_split( content, k_ui_axis_h, 300, 0, image_plane, content );
ui_fill( image_plane, ui_colour( k_ui_bg+0 ) );