void CDisplayText::DisplayText(const char *text, Math::Vector goal, float height, float dist, float time, TextType type) { CObject* toto; CMotion* motion; Ui::CWindow* pw; Ui::CButton* button; Ui::CGroup* group; Ui::CLabel* label; Math::Point pos, ppos, dim; Sound sound; float hLine, hBox; int nLine, icon, i; if ( !m_bEnable ) return; pw = static_cast<CWindow*>(m_interface->SearchControl(EVENT_WINDOW2)); if ( pw == 0 ) { pos.x = 0.0f; pos.y = 0.0f; dim.x = 0.0f; dim.y = 0.0f; pw = m_interface->CreateWindows(pos, dim, 10, EVENT_WINDOW2); } hBox = 0.045f; hLine = m_engine->GetText()->GetHeight(Gfx::FONT_COLOBOT, FONTSIZE); nLine = 0; for ( i=0 ; i<MAXDTLINE ; i++ ) { group = static_cast<CGroup*>(pw->SearchControl(EventType(EVENT_DT_GROUP0+i))); if ( group == 0 ) break; nLine ++; } if ( nLine == MAXDTLINE ) { ClearLastText(); nLine --; } pos.x = 0.10f; pos.y = 0.92f-hBox-hBox*nLine; dim.x = 0.80f; dim.y = hBox; icon = 1; // yellow if ( type == TT_ERROR ) icon = 9; // red if ( type == TT_WARNING ) icon = 10; // blue if ( type == TT_INFO ) icon = 8; // green if ( type == TT_MESSAGE ) icon = 11; // yellow pw->CreateGroup(pos, dim, icon, EventType(EVENT_DT_GROUP0+nLine)); pw->SetTrashEvent(false); ppos = pos; ppos.y -= hLine/2.0f; label = pw->CreateLabel(ppos, dim, -1, EventType(EVENT_DT_LABEL0+nLine), text); if ( label != 0 ) { label->SetFontSize(FONTSIZE); } dim.x = dim.y*0.75f; pos.x -= dim.x; button = pw->CreateButton(pos, dim, 14, EventType(EVENT_DT_VISIT0+nLine)); if ( goal.x == 0.0f && goal.y == 0.0f && goal.z == 0.0f ) { button->ClearState(STATE_ENABLE); } m_bExist[nLine] = true; m_visitGoal[nLine] = goal; m_visitDist[nLine] = dist; m_visitHeight[nLine] = height; m_time[nLine] = time*m_delayFactor; toto = SearchToto(); if ( toto != 0 ) { motion = toto->GetMotion(); if ( motion != 0 ) { if ( type == TT_ERROR ) { motion->SetAction(MT_ERROR, 4.0f); } if ( type == TT_WARNING ) { motion->SetAction(MT_WARNING, 4.0f); } if ( type == TT_INFO ) { motion->SetAction(MT_INFO, 4.0f); } if ( type == TT_MESSAGE ) { motion->SetAction(MT_MESSAGE, 4.0f); } } } if ( m_bHide ) { HideText(m_bHide); // hide all } else { sound = SOUND_CLICK; if ( type == TT_ERROR ) sound = SOUND_ERROR; if ( type == TT_WARNING ) sound = SOUND_WARNING; if ( type == TT_INFO ) sound = SOUND_INFO; if ( type == TT_MESSAGE ) sound = SOUND_MESSAGE; if ( sound != SOUND_CLICK ) { m_sound->Play(sound); } } }
bool CAuto::CreateInterface(bool bSelect) { Ui::CWindow* pw; Math::Point pos, dim, ddim; float ox, oy, sx, sy; pw = static_cast<Ui::CWindow*>(m_interface->SearchControl(EVENT_WINDOW0)); if ( pw != nullptr ) { pw->Flush(); // destroys the window buttons m_interface->DeleteControl(EVENT_WINDOW0); // destroys the window } if ( !bSelect ) return true; pos.x = 0.0f; pos.y = 0.0f; dim.x = 540.0f/640.0f; //? dim.y = 70.0f/480.0f; dim.y = 86.0f/480.0f; m_interface->CreateWindows(pos, dim, 3, EVENT_WINDOW0); pw = static_cast<Ui::CWindow*>(m_interface->SearchControl(EVENT_WINDOW0)); if ( pw == 0 ) return false; std::string name; m_object->GetTooltipName(name); pos.x = 0.0f; pos.y = 64.0f/480.0f; ddim.x = 540.0f/640.0f; ddim.y = 16.0f/480.0f; pw->CreateLabel(pos, ddim, 0, EVENT_LABEL0, name); dim.x = 33.0f/640.0f; dim.y = 33.0f/480.0f; ox = 3.0f/640.0f; oy = 3.0f/480.0f; sx = 33.0f/640.0f; sy = 33.0f/480.0f; pos.x = ox+sx*7.0f; pos.y = oy+sy*0.6f; ddim.x = 160.0f/640.0f; ddim.y = 26.0f/480.0f; pw->CreateGauge(pos, ddim, 0, EVENT_OBJECT_GPROGRESS); if ( m_type != OBJECT_BASE && m_type != OBJECT_SAFE && m_type != OBJECT_HUSTON ) { pos.x = ox+sx*2.1f; pos.y = oy+sy*0; ddim.x = dim.x*0.6f; ddim.y = dim.y*0.6f; pw->CreateButton(pos, ddim, 12, EVENT_OBJECT_DELETE); } #if 0 pos.x = ox+sx*12.4f; pos.y = oy+sy*1; pw->CreateButton(pos, dim, 63, EVENT_OBJECT_BHELP); pos.x = ox+sx*12.4f; pos.y = oy+sy*0; pw->CreateButton(pos, dim, 19, EVENT_OBJECT_HELP); if ( m_main->GetSceneSoluce() ) { pos.x = ox+sx*13.4f; pos.y = oy+sy*1; pw->CreateButton(pos, dim, 20, EVENT_OBJECT_SOLUCE); } pos.x = ox+sx*13.4f; pos.y = oy+sy*0; pw->CreateButton(pos, dim, 10, EVENT_OBJECT_DESELECT); #else pos.x = ox+sx*12.3f; pos.y = oy+sy*-0.1f; ddim.x = dim.x*1.0f; ddim.y = dim.y*2.1f; pw->CreateGroup(pos, ddim, 20, EVENT_NULL); // solid blue background pos.x = ox+sx*12.3f; pos.y = oy+sy*1; pw->CreateGroup(pos, dim, 19, EVENT_NULL); // sign SatCom pos.x = ox+sx*12.4f; pos.y = oy+sy*0.5f; ddim.x = dim.x*0.8f; ddim.y = dim.y*0.5f; pw->CreateButton(pos, ddim, 18, EVENT_OBJECT_BHELP); pos.y = oy+sy*0.0f; pw->CreateButton(pos, ddim, 19, EVENT_OBJECT_HELP); pos.x = ox+sx*13.4f; pos.y = oy+sy*0; pw->CreateButton(pos, dim, 10, EVENT_OBJECT_DESELECT); #endif pos.x = ox+sx*14.9f; pos.y = oy+sy*0; ddim.x = 14.0f/640.0f; ddim.y = 66.0f/480.0f; pw->CreateGauge(pos, ddim, 3, EVENT_OBJECT_GSHIELD); UpdateInterface(); m_lastUpdateTime = 0.0f; UpdateInterface(0.0f); return true; }