コード例 #1
0
ファイル: autoradar.cpp プロジェクト: DanielVartanov/colobot
bool CAutoRadar::CreateInterface(bool bSelect)
{
    Ui::CWindow*    pw;
    Math::Point     pos, dim, ddim;
    float       ox, oy, sx, sy;

    CAuto::CreateInterface(bSelect);

    if ( !bSelect )  return true;

    pw = static_cast< Ui::CWindow* >(m_interface->SearchControl(EVENT_WINDOW0));
    if ( pw == 0 )  return false;

    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;
    dim.x = 160.0f/640.0f;
    dim.y =  26.0f/480.0f;
    pw->CreateGauge(pos, dim, 1, EVENT_OBJECT_GRADAR);

    pos.x = ox+sx*0.0f;
    pos.y = oy+sy*0;
    ddim.x = 66.0f/640.0f;
    ddim.y = 66.0f/480.0f;
    pw->CreateGroup(pos, ddim, 105, EVENT_OBJECT_TYPE);

    UpdateInterface();
    return true;
}
コード例 #2
0
ファイル: autostation.cpp プロジェクト: ManuelBlanc/colobot
bool CAutoStation::CreateInterface(bool bSelect)
{
    Ui::CWindow*    pw;
    Math::Point     pos, ddim;
    float       ox, oy, sx, sy;

    CAuto::CreateInterface(bSelect);

    if ( !bSelect )  return true;

    pw = static_cast< Ui::CWindow* >(m_interface->SearchControl(EVENT_WINDOW0));
    if ( pw == 0 )  return false;

    ox = 3.0f/640.0f;
    oy = 3.0f/480.0f;
    sx = 33.0f/640.0f;
    sy = 33.0f/480.0f;

    pos.x = ox+sx*14.5f;
    pos.y = oy+sy*0;
    ddim.x = 14.0f/640.0f;
    ddim.y = 66.0f/480.0f;
    pw->CreateGauge(pos, ddim, 0, EVENT_OBJECT_GENERGY);

    pos.x = ox+sx*0.0f;
    pos.y = oy+sy*0;
    ddim.x = 66.0f/640.0f;
    ddim.y = 66.0f/480.0f;
    pw->CreateGroup(pos, ddim, 104, EVENT_OBJECT_TYPE);

    return true;
}
コード例 #3
0
ファイル: auto.cpp プロジェクト: ManuelBlanc/colobot
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;
}
コード例 #4
0
ファイル: autoresearch.cpp プロジェクト: 2asoft/colobot
bool CAutoResearch::CreateInterface(bool bSelect)
{
    Ui::CWindow*    pw;
    Math::Point     pos, dim, ddim;
    float       ox, oy, sx, sy;

    CAuto::CreateInterface(bSelect);

    if ( !bSelect )  return true;

    pw = static_cast< Ui::CWindow* >(m_interface->SearchControl(EVENT_WINDOW0));
    if ( pw == nullptr )  return false;

    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*1.0f;
    pw->CreateButton(pos, dim, 64+0, EVENT_OBJECT_RTANK);

    pos.x = ox+sx*8.0f;
    pos.y = oy+sy*1.0f;
    pw->CreateButton(pos, dim, 64+1, EVENT_OBJECT_RFLY);

    pos.x = ox+sx*9.0f;
    pos.y = oy+sy*1.0f;
    pw->CreateButton(pos, dim, 64+3, EVENT_OBJECT_RCANON);

    pos.x = ox+sx*10.0f;
    pos.y = oy+sy*1.0f;
    pw->CreateButton(pos, dim, 64+4, EVENT_OBJECT_RTOWER);

    pos.x = ox+sx*7.0f;
    pos.y = oy+sy*0.0f;
    pw->CreateButton(pos, dim, 64+7, EVENT_OBJECT_RATOMIC);

    pos.x = ox+sx*8.0f;
    pos.y = oy+sy*0.0f;
    pw->CreateButton(pos, dim, 64+2, EVENT_OBJECT_RTHUMP);

    pos.x = ox+sx*9.0f;
    pos.y = oy+sy*0.0f;
    pw->CreateButton(pos, dim, 64+6, EVENT_OBJECT_RSHIELD);

    pos.x = ox+sx*10.0f;
    pos.y = oy+sy*0.0f;
    pw->CreateButton(pos, dim, 64+5, EVENT_OBJECT_RPHAZER);

    pos.x = ox+sx*14.5f;
    pos.y = oy+sy*0;
    ddim.x = 14.0f/640.0f;
    ddim.y = 66.0f/480.0f;
    pw->CreateGauge(pos, ddim, 0, EVENT_OBJECT_GENERGY);

    pos.x = ox+sx*0.0f;
    pos.y = oy+sy*0;
    ddim.x = 66.0f/640.0f;
    ddim.y = 66.0f/480.0f;
    pw->CreateGroup(pos, ddim, 102, EVENT_OBJECT_TYPE);

    UpdateInterface();

    return true;
}