LoginView::LoginView(CL_GUIManager *gui_manager) : CL_GUIComponent(gui_manager, get_toplevel_description()) { set_class_name("login"); label_info = new CL_Label(this); label_info->set_geometry(CL_RectPS(15, 10, 370, 27)); label_info->set_class_name("header"); label_info->set_text("Enter connection information"); label_player_nick = new CL_Label(this); label_player_nick->set_geometry(CL_RectPS(15, 50, 370, 27)); label_player_nick->set_text("Player nick:"); edit_player_nick = new CL_LineEdit(this); edit_player_nick->set_geometry(CL_RectPS(15, 77, 370, 23)); edit_player_nick->func_after_edit_changed().set(this, &LoginView::on_edit_player_nick_changed); #ifdef _DEBUG edit_player_nick->set_text("Player"); #endif label_server = new CL_Label(this); label_server->set_geometry(CL_RectPS(15, 120, 370, 27)); label_server->set_text("Server information:"); edit_server = new CL_LineEdit(this); edit_server->set_geometry(CL_RectPS(15, 147, 300, 23)); edit_server->set_text("localhost"); edit_port = new CL_LineEdit(this); edit_port->set_geometry(CL_RectPS(320, 147, 65, 23)); edit_port->set_text("4558"); button_ok = new CL_PushButton(this); button_ok->set_geometry(CL_RectPS(15, 205, 75, 23)); button_ok->set_text("OK"); button_ok->func_clicked().set(this, &LoginView::on_button_ok_clicked); update_button_states(); button_cancel = new CL_PushButton(this); button_cancel->set_geometry(CL_RectPS(245, 205, 75, 23)); button_cancel->set_text("Cancel"); button_cancel->func_clicked().set(this, &LoginView::on_button_cancel_clicked); }
CMoneyLabel::CMoneyLabel(): CAbstractGUIItem(0.0f,0.0f,0.0f,0.0f,0.0f) { set_class_name(MONEY_LABEL); char *NUMBER_TEXTURE = strdup(NUMBER_TEXTURE_0); /* get the number textures. BEWARE: map object must already exist */ for (GLint i=0; i<10; i++) { NUMBER_TEXTURE[strlen(NUMBER_TEXTURE)-1]=(char)(i+(GLint)'0'); number_texture[i]=GLOBAL_TEXTURE_LIST->get_texture_by_name(NUMBER_TEXTURE); } delete NUMBER_TEXTURE; value=12345; string_value=NULL; check_updated_value=true; }
MainMenuScene::MainMenuScene(CL_GUIComponent *p_parent) : GuiScene(p_parent), m_controller(this), m_serverLabel(this), m_serverLineEdit(this), m_okButton(this), m_findServersButton(this), m_errorLabel(this), m_quitButton(this), m_optionButton(this), m_authorsButton(this), m_editorButton(this), m_messageBox(this) { set_class_name("MainMenuScene"); static const int START_X = 200; static const int START_Y = 300; int x = START_X; int y = START_Y; m_serverLabel.set_geometry(CL_Rect(x, y, x + LABEL_WIDTH, y + LABEL_HEIGHT)); m_serverLabel.set_text(_("Server addr")); x += LABEL_WIDTH + H_MARGIN; m_serverLineEdit.set_geometry(CL_Rect(x, y, x + EDIT_WIDTH, y + EDIT_HEIGHT)); x += EDIT_WIDTH; y += V_MARGIN; m_okButton.set_geometry(CL_Rect(x - BUTTON_WIDTH, y, x, y + BUTTON_HEIGHT)); m_okButton.set_text(_("Start Race")); int x2 = x + BUTTON_WIDTH + 10; m_findServersButton.set_geometry(CL_Rect(x2 - BUTTON_WIDTH, y, x2, y + BUTTON_HEIGHT)); m_findServersButton.set_text(_("Find servers")); y += V_MARGIN; m_optionButton.set_text(_("Options")); m_optionButton.set_geometry(CL_Rect(x - BUTTON_WIDTH, y, x, y + BUTTON_HEIGHT)); y += V_MARGIN; m_authorsButton.set_text(_("Authors")); m_authorsButton.set_geometry(CL_Rect(x - BUTTON_WIDTH, y, x, y + BUTTON_HEIGHT)); y += V_MARGIN; m_editorButton.set_text(_("Map editor")); m_editorButton.set_geometry(CL_Rect(x - BUTTON_WIDTH, y, x, y + BUTTON_HEIGHT)); y += V_MARGIN; m_quitButton.set_geometry(CL_Rect(x - BUTTON_WIDTH, y, x, y + LABEL_HEIGHT)); m_quitButton.set_text(_("Quit")); x = START_X; y = m_okButton.get_geometry().top; m_errorLabel.set_geometry(CL_Rect(x, y, x + ERROR_LABEL_WIDTH, y + ERROR_LABEL_HEIGHT)); m_okButton.func_clicked().set(this, &MainMenuScene::onOkClicked); m_quitButton.func_clicked().set(this, &MainMenuScene::onQuitClicked); m_optionButton.func_clicked().set(this, &MainMenuScene::onOptionClicked); m_authorsButton.func_clicked().set(this, &MainMenuScene::onAuthorsClicked); m_editorButton.func_clicked().set(this, &MainMenuScene::onEditorClicked); m_findServersButton.func_clicked().set(this, &MainMenuScene::onFindServersClicked); m_serverLineEdit.set_text(Properties::getString(CG_LAST_HOSTNAME, "")); }