uint8_t app_test_start(void) { app_test_listD = pvPortMalloc(sizeof(GUI_ListItemData)*10); app_test_listD[0] = gui_listItem_create("one", 0, 0, 0, 0); app_test_listD[1] = gui_listItem_create("two", 0, 0, 0, 0); app_test_listD[2] = gui_listItem_create("three", 0, 0, 0, 0); app_test_listD[3] = gui_listItem_create("four", 0, 0, 0, 0); app_test_listD[4] = gui_listItem_create("five", 0, 0, 0, 0); app_test_listD[5] = gui_listItem_create("six", 0, 0, 0, 0); app_test_listD[6] = gui_listItem_create("seven", 0, 0, 0, 0); app_test_listD[7] = gui_listItem_create("eight", 0, 0, 0, 0); app_test_listD[8] = gui_listItem_create("nine", 0, 0, 0, 0); app_test_listD[9] = gui_listItem_create("ten", 0, 0, 0, 0); app_test_list = gui_list_create("lel", 10, app_test_listD, 0, 0, 40, 63-7, 0, 0, 0); slog("test started"); return SYS_OK; }
/* ==================================================================== Build the GUI and everything nescessary for the client chatroom. client_create() installs client_delete() as exit function. ==================================================================== */ void client_create( void ) { #ifdef NETWORK_ENABLED GuiWidget *parent; SDL_Surface *surface; /* users, channels, games */ client_data_create(); /* CONNECT WINDOW */ dlg_connect = gui_box_create( 0, -1,-1, 400, 224, 0, 0 ); parent = dlg_connect; /* hint label */ gui_label_create( parent, 10, 10, parent->width - 20, 100, 1, 0, 4, 0, STK_FONT_ALIGN_LEFT, HINT_CONNECT ); /* server edit */ gui_label_create( parent, 10, 120, 180, 20, 0, 0, 2, 0, STK_FONT_ALIGN_RIGHT, _("Server:") ); edit_server = gui_edit_create( parent, parent->width - 190, 120, 180, 20, 0, 2, 0, 22, config.server ); /* user name */ gui_label_create( parent, 10, 150, 180, 20, 0, 0, 2, 0, STK_FONT_ALIGN_RIGHT, _("Username:"******"Connect") ); gui_button_create( parent, parent->width/2 +20, 180, 140, 24, client_close_connect_window, 0,0,0,0,0, _("Cancel") ); /* INFO */ dlg_info = gui_box_create( 0, -1,-1, 300, 114, 0, 1 ); label_info = gui_label_create( dlg_info, -1,10,276,60,0, 0, 2, 0, STK_FONT_ALIGN_LEFT, _("no info") ); gui_button_create( dlg_info, -1, dlg_info->height - 34, 100, 24, client_close_info, 0,0,0,0,0, _("Close") ); /* CONFIRM */ dlg_confirm = gui_box_create( 0, -1,-1, 300, 160, 0, 1 ); label_confirm = gui_label_create( dlg_confirm, -1,10,276,110,0, 0, 2, 0, STK_FONT_ALIGN_LEFT, _("no info") ); gui_button_create( dlg_confirm, dlg_confirm->width/2-110, dlg_confirm->height - 30, 100, 20, client_confirm, 0,0,0,0,0, _("OK") ); gui_button_create( dlg_confirm, dlg_confirm->width/2+10, dlg_confirm->height - 30, 100, 20, client_cancel, 0,0,0,0,0, _("Cancel") ); /* CHATROOM */ dlg_chatroom = gui_box_create( 0, 0,0,640,480, client_recv_packet, 1 ); gui_widget_enable_event( dlg_chatroom, GUI_TIME_PASSED ); surface = gui_widget_get_surface( dlg_chatroom ); stk_surface_apply_wallpaper( surface, 0,0,-1,-1, cr_wallpaper, STK_OPAQUE ); /* chat window */ list_chatter = gui_list_create( dlg_chatroom, 0,0,470,444, NULL, 0, 1, 14, 20, client_render_chatter, GUI_LIST_NO_SELECT ); /* edit + send/whisper buttons */ gui_button_create( dlg_chatroom, 330,448,60,24, client_send_chatter, 0,0,0,0,0, _("Send") ); gui_button_create( dlg_chatroom, 390,448,80,24, client_whisper_chatter, 0,0,0,0,0, _("Whisper") ); edit_chatter = gui_edit_create( dlg_chatroom, 0,448,327,24, client_send_chatter, 2, 0, MAX_CHATTER_SIZE, "" ); gui_widget_enable_event( edit_chatter, GUI_KEY_RELEASED ); gui_widget_set_default_key_widget( dlg_chatroom, edit_chatter ); /* channel button + users in channel */ label_channel = gui_label_create( dlg_chatroom, 474,0,142,18,1, NULL, 2, 0, STK_FONT_ALIGN_CENTER_X, _("MAIN") ); gui_button_create( dlg_chatroom, 616,0,18,18, client_select_channel, 0,0,0,0,0, _("C") ); list_users = gui_list_create( dlg_chatroom, 474,20,160,142, client_handle_user_list, 1, 1, 14, 20, client_render_user, GUI_LIST_SINGLE_SELECT ); /* levels label, levels, transfer button */ gui_label_create( dlg_chatroom, 474,164,160,18,1, NULL, 2, 0, STK_FONT_ALIGN_CENTER_X, _("Levelsets") ); list_levels = gui_list_create( dlg_chatroom, 474,184,160,120, client_handle_levelset_list, 1, 1, 14, 20, client_render_levelset, GUI_LIST_SINGLE_SELECT ); /* box with level settings */ parent = gui_box_create( dlg_chatroom, 474,306,160,94, NULL, 0 ); gui_label_create( parent, 2,2,102,20,0, NULL, 2, NULL, STK_FONT_ALIGN_LEFT, _("Difficulty:") ); gui_spinbutton_create( parent, 102,2,50,20, client_update_difficulty, 1, 3, 1, config.mp_diff+1 ); gui_label_create( parent, 2,2+22,102,20,0, NULL, 2, NULL, STK_FONT_ALIGN_LEFT, _("Rounds:") ); gui_spinbutton_create( parent, 102,2+22,50,20, client_update_rounds, 1, 3, 1, config.mp_rounds ); gui_label_create( parent, 2,2+44,102,20,0, NULL, 2, NULL, STK_FONT_ALIGN_LEFT, _("Frags:") ); gui_spinbutton_create( parent, 102,2+44,50,20, client_update_frags, 5, 30, 5, config.mp_frags ); gui_label_create( parent, 2,2+66,102,20,0, NULL, 2, NULL, STK_FONT_ALIGN_LEFT, _("Balls:") ); gui_spinbutton_create( parent, 102,2+66,50,20, client_update_balls, 1, 6, 1, config.mp_balls ); /* challenge & disconnect */ gui_button_create( dlg_chatroom, 474,402,160,20, client_challenge, 0,0,0,0,0, _("Challenge") ); gui_button_create( dlg_chatroom, 474,dlg_chatroom->height-44,160,20, client_open_connect_window, 0,0,0,0,0, _("Connect") ); gui_button_create( dlg_chatroom, 534,dlg_chatroom->height-20,100,20, client_quit, 0,0,0,0,0, _("Quit") ); gui_button_create( dlg_chatroom, 474,dlg_chatroom->height-20,50,20, client_popup_help, 0,0,0,0,0, _("Help") ); /* CHANNELS selector */ dlg_channels = gui_box_create( 0, -1,-1, 200, 244, NULL, 1 ); list_channels = gui_list_create( dlg_channels, -1,10, 176,150, client_handle_channel_list, 0, 1, 14, 20, client_render_channel, GUI_LIST_SINGLE_SELECT ); gui_label_create( dlg_channels, -1,160, 176,20,0, NULL, 2, 0, STK_FONT_ALIGN_LEFT, _("Channel:") ); edit_channel = gui_edit_create( dlg_channels, -1,180, 176,20, NULL, 2, 0, 12, "" ); gui_widget_set_default_key_widget( dlg_channels, edit_channel ); gui_edit_set_filter( edit_channel, GUI_EDIT_ALPHANUMERICAL2 ); gui_button_create( dlg_channels, dlg_channels->width/2-90,210,80,20, client_enter_channel, 0,0,0,0,0, _("Enter") ); gui_button_create( dlg_channels, dlg_channels->width/2+10,210,80,20, client_cancel_channel, 0,0,0,0,0, _("Cancel") ); /* STATISTICS */ dlg_stats = gui_box_create( 0, -1,-1,386,260, NULL, 1 ); gui_label_create( dlg_stats, -1,10,360,20,1, NULL, 0, 0, STK_FONT_ALIGN_CENTER_X, _("Statistics") ); label_winner = gui_label_create( dlg_stats, -1,40,360,16,0, NULL, 0, 0, STK_FONT_ALIGN_CENTER_X, "..." ); label_stats = gui_label_create( dlg_stats, -1,62,360,150,0, NULL, 0, 0, STK_FONT_ALIGN_LEFT, _("Awaiting stats...") ); gui_button_create( dlg_stats, -1,220,160,20, client_close_stats, 0,0,0,0,0, _("Close") ); /* PAUSEROOM */ dlg_pauseroom = gui_box_create( 0, -1,-1,480,366, NULL, 1 ); list_pausechatter = gui_list_create( dlg_pauseroom, 0,0,470,300, NULL, 0, 1, 14, 20, client_render_pause_chatter, GUI_LIST_NO_SELECT ); edit_pausechatter = gui_edit_create( dlg_pauseroom, 0,303,470,24, client_send_pausechatter, 2, 0, MAX_CHATTER_SIZE, "" ); gui_widget_enable_event( edit_pausechatter, GUI_KEY_RELEASED ); gui_widget_set_default_key_widget( dlg_pauseroom, edit_pausechatter ); gui_button_create( dlg_pauseroom, -1,334,100,20, client_close_pauseroom, 0,0,0,0,0, _("Close") ); /* HELP */ dlg_help = gui_box_create( 0, -1,-1,548,358, NULL, 1 ); gui_label_create( dlg_help, -1,10,470,20,1, NULL, 0, 0, STK_FONT_ALIGN_CENTER_X, _("Network Quick Help") ); list_topic = gui_list_create( dlg_help, 10,40,160,270, client_handle_topic_list, 0, 1, 14, 20, client_render_topic, GUI_LIST_SINGLE_SELECT ); list_help = gui_list_create( dlg_help, 180,40,350,300, NULL, 0, 1, 14, 20, client_render_help, GUI_LIST_NO_SELECT ); gui_button_create( dlg_help, 10,320,160,20, client_close_help, 0,0,0,0,0, _("Close") ); /* INITS */ /* empty chatter */ memset( chatter, 0, sizeof( chatter ) ); /* update chatboxes */ gui_list_update( list_chatter, CHAT_LINE_COUNT ); gui_list_update( list_pausechatter, CHAT_LINE_COUNT ); gui_list_goto( list_chatter, -1 ); gui_list_goto( list_pausechatter, -1 ); /* set help topics */ gui_list_update( list_topic, client_topic_count ); /* call client_delete at exit */ atexit( client_delete ); #endif }