#include "world.h"
#include "world_sfd.h"
#include "world_routes.h"
-#include "vg/vg_imgui.h"
+#include "vg/vg_ui/imgui.h"
#include "gui.h"
#include "ent_region.h"
#include "vg/vg_loader.h"
-#include <sys/socket.h>
-#include <sys/types.h>
-#include <netdb.h>
+#ifdef _WIN32
+ #include <winsock2.h>
+ #include <ws2tcpip.h>
+#else
+ #include <sys/socket.h>
+ #include <sys/types.h>
+ #include <netdb.h>
+#endif
struct network_client network_client =
{
void render_server_status_gui(void)
{
- render_fb_bind( gpipeline.fb_workshop_preview, 0 );
+ vg_framebuffer_bind( g_render.fb_network_status, 1.0f );
+
+ vg_ui_set_screen( 128, 48 );
+ ui_context *ctx = &vg_ui.ctx;
/* HACK */
- vg_ui.cur_vert = 0;
- vg_ui.cur_indice = 0;
- vg_ui.vert_start = 0;
- vg_ui.indice_start = 0;
+ ctx->cur_vert = 0;
+ ctx->cur_indice = 0;
+ ctx->vert_start = 0;
+ ctx->indice_start = 0;
ui_rect r = { 0, 0, 128, 48 };
u32 bg = 0xff000000;
network_status_string( &str, &bg );
- ui_fill( r, bg );
- ui_text( r, buf, 1, k_ui_align_center, 0 );
- ui_flush( k_ui_shader_colour, 128, 48 );
+ ui_fill( ctx, r, bg );
+ ui_text( ctx, r, buf, 1, k_ui_align_center, 0 );
+ ui_flush( ctx, k_ui_shader_colour, NULL );
skaterift.rt_textures[ k_skaterift_rt_server_status ] =
- gpipeline.fb_workshop_preview->attachments[0].id;
+ g_render.fb_network_status->attachments[0].id;
}
static void on_server_connect_status( CallbackMsg_t *msg ){
&hints, &result);
if( s != 0 )
{
+#ifndef _WIN32
vg_error( "getaddrinfo: %s\n", gai_strerror(s) );
+#endif
+
+ if( !strcmp( network_client.host_adress, "skaterift.com" ) )
+ {
+ vg_warn( "getaddrinfo failed for skaterift.com;\n "
+ "falling back to a hardcoded IPv4\n" );
+ strcpy( network_client.host_adress, "46.101.34.155" );
+ SteamAPI_SteamNetworkingIPAddr_ParseString(
+ &network_client.ip,
+ network_client.host_adress );
+ network_client.ip.m_port = NETWORK_PORT;
+ *status = 1;
+ }
+
goto end;
}