Example #1
0
void client_run( void )
{
#ifdef NETWORK_ENABLED
	/* init UDP socket */
	sys_printf = client_printf_info;
	net_init( atoi(config.local_port) );
	sys_printf = printf;
	client_add_chatter( _("Press 'Connect' to connect to a game server."), 1 );

	client_state = CLIENT_NONE;
	client_recv_limit = config.recv_limit;

	gui_enable_event_filter();
	gui_widget_show( dlg_chatroom );
	stk_display_fade( STK_FADE_IN, STK_FADE_DEFAULT_TIME );
	gui_run( dlg_chatroom );
	stk_display_fade( STK_FADE_OUT, STK_FADE_DEFAULT_TIME );
	gui_disable_event_filter();

	if ( client_is_connected ) {
		/* tell server we are off */
		client_disconnect();
		/* finalize UDP socket */
		socket_print_stats( &client );
	}
	net_shutdown();
#endif
}
Example #2
0
/*
====================================================================
Popup confirm dialogue and _keep_ status.
====================================================================
*/
void client_popup_confirm( char *format, ... )
{
	char buffer[256];
	va_list args;
	va_start( args, format );
	vsnprintf( buffer, 256, format, args );
	va_end( args );
	gui_label_set_text( label_confirm, buffer );
	gui_widget_show( dlg_confirm );
}
Example #3
0
/*
====================================================================
Popup info dialogue and set status to INFO.
====================================================================
*/
void client_popup_info( char *format, ... )
{
	char buffer[256];
	va_list args;
	va_start( args, format );
	vsnprintf( buffer, 256, format, args );
	va_end( args );
	gui_label_set_text( label_info, buffer );
	gui_widget_show( dlg_info );
	client_state = CLIENT_INFO;
}
Example #4
0
/*
====================================================================
Open channel selector
====================================================================
*/
void client_select_channel( GuiWidget *widget, GuiEvent *event )
{
    if ( event->type != GUI_CLICKED ) return;
    /* select first channel (we always have MAIN) */
    gui_list_update( list_channels, client_channels->count );
    if ( client_channels->count > 0 ) {
        gui_edit_set_text( edit_channel, list_first( client_channels ) );
        gui_list_select( list_channels, 0,0, 1 );
    }
    gui_widget_show( dlg_channels );
    client_state = CLIENT_SELECT_CHANNEL;
}
Example #5
0
int main(int argc, char **argv) //@ : main
    //@ requires 0 <= argc &*& [_]argv(argv, argc, _);
    //@ ensures true;
{
    struct widget *window = 0;
       
    gui_init();
    
    window = gui_window_new();
    gui_widget_show(window);
       
    gui_main();
    
    return 0;
}
Example #6
0
void open_pause_chat( char *text )
{
	set_state( CS_PAUSE );
	
	/* clear pause_chatter */
	memset( pause_chatter, 0, sizeof( pause_chatter ) );
	/* clear global gui widgets */
	gui_focused_widget = 0;
	gui_clicked_widget = 0;
	gui_key_widget = 0;
	/* use 'text' as initial chatter */
	client_add_pausechatter( text, 1 );
	/* gray screen */
	stk_surface_gray( stk_display, 0,0,-1,-1, 1 );
	/* show pauseroom */
	gui_widget_show( dlg_pauseroom );
	stk_display_update( STK_UPDATE_ALL );

	/* disable event filter */
	SDL_SetEventFilter( 0 );
	/* disable client_recv which is called as time event */
	gui_widget_disable_event( dlg_chatroom, GUI_TIME_PASSED );
}
Example #7
0
/*
====================================================================
Popup help dialogue.
====================================================================
*/
void client_popup_help( GuiWidget *widget, GuiEvent *event )
{
	if ( event->type != GUI_CLICKED ) return;
	gui_widget_show( dlg_help );
	client_state = CLIENT_HELP;
}
Example #8
0
/*
====================================================================
Open/close the connection window.
====================================================================
*/
void client_open_connect_window( 
    GuiWidget *widget, GuiEvent *event )
{
	if ( event->type == GUI_CLICKED )
		gui_widget_show( dlg_connect );
}