Example #1
0
void iwObservate::Msg_ButtonClick(const unsigned int ctrl_id)
{
    switch (ctrl_id)
    {
        case 1:
            break;
        case 2:
            break;
        case 3:
            view->GetGameWorldViewer().MoveToMapObject(
                MapPoint(view->GetLastPt() - (view->GetLastPt() - view->GetFirstPt()) / 2)
                );
            break;
        case 4:
            int diff = width_;

            if (width_ == 260)
            {
                SetWidth(300);
                SetIwHeight(250);
            }
            else if (width_ == 300)
            {
                SetWidth(340);
                SetIwHeight(310);
                GetCtrl<ctrlImageButton>(4)->SetImage(LOADER.GetImageN("io", 108));
            }
            else
            {
                SetWidth(260);
                SetIwHeight(190);
                GetCtrl<ctrlImageButton>(4)->SetImage(LOADER.GetImageN("io", 109));
            }

            diff -= width_;
            diff /= 2;

            view->Resize(width_ - 20, height_ - 20);

            for (unsigned i = 1; i <= 4; ++i)
                GetCtrl<ctrlImageButton>(i)->Move(GetCtrl<ctrlImageButton>(i)->GetX(false) - diff, GetHeight() - 50);

            if (x_ + width_ >= VIDEODRIVER.GetScreenWidth())
            {
                Move(VIDEODRIVER.GetScreenWidth() - width_ - 1, y_);
            }

            if (y_ + height_ >= VIDEODRIVER.GetScreenHeight())
            {
                Move(x_, VIDEODRIVER.GetScreenHeight() - height_ - 1);
            }
    }
}
Example #2
0
void iwObservate::Msg_ButtonClick(const unsigned int ctrl_id)
{
    switch (ctrl_id)
    {
    case 1:
        break;
    case 2:
        break;
    case 3:
        view->GetGameWorldViewer()->MoveToMapObject(view->GetLastX() - (view->GetLastX() - view->GetFirstX()) / 2, view->GetLastY() - (view->GetLastY() - view->GetFirstY()) / 2);
        break;
    case 4:
        int diff = width;

        if (width == 260)
        {
            SetWidth(300);
            SetIwHeight(250);
        } else if (width == 300)
        {
            SetWidth(340);
            SetIwHeight(310);
            GetCtrl<ctrlImageButton>(4)->SetImage(LOADER.GetImageN("io", 108));
        } else
        {
            SetWidth(260);
            SetIwHeight(190);
            GetCtrl<ctrlImageButton>(4)->SetImage(LOADER.GetImageN("io", 109));
        }

        diff -= width;
        diff /= 2;

        view->Resize(width - 20, height - 20);

        for (unsigned i = 1; i <= 4; ++i)
            GetCtrl<ctrlImageButton>(i)->Move(GetCtrl<ctrlImageButton>(i)->GetX(false) - diff, GetHeight() - 50);

        if (x + width >= VideoDriverWrapper::inst().GetScreenWidth())
        {
            Move(VideoDriverWrapper::inst().GetScreenWidth() - width - 1, y);
        }

        if (y + height >= VideoDriverWrapper::inst().GetScreenHeight())
        {
            Move(x, VideoDriverWrapper::inst().GetScreenHeight() - height - 1);
        }
    }
}
Example #3
0
iwHelp::iwHelp(const GUI_ID gui_id, const std::string& title, const std::string& content)
    : IngameWindow(gui_id, 0xFFFE, 0xFFFE, HELP_WINDOW_WIDTH, 480, title, LOADER.GetImageN("resource", 41))
{
    glArchivItem_Font::WrapInfo wi = NormalFont->GetWrapInfo(content, HELP_WINDOW_WIDTH - 28, HELP_WINDOW_WIDTH - 28);

    // Mehr Linien benötigt als die maximalen? Dann kommt ja noch die Scrollbar dran und der ganze Spaß muss
    // umgebrochen werden, also nochmal mit geringerer Breite berechnen
    if(wi.positions.size() > MAX_LINES)
    {
        wi = NormalFont->GetWrapInfo(content,
            HELP_WINDOW_WIDTH - 28 - ctrlMultiline::SCROLLBAR_WIDTH,
            HELP_WINDOW_WIDTH - 24 - ctrlMultiline::SCROLLBAR_WIDTH);
    }

    unsigned int show_lines = std::min( (unsigned int)wi.positions.size(), MAX_LINES);

    unsigned short text_height = show_lines * NormalFont->getHeight();

    // Höhe setzen
    SetIwHeight(text_height + 40);
    // Fenster neben die Maus schieben
    MoveNextToMouse();

    // Größe des Fensters und des Controls nach der Anzahl der Zeilen
    ctrlMultiline* text = AddMultiline(2, 10, 20, HELP_WINDOW_WIDTH - 20, text_height + 4, TC_GREEN1, NormalFont, glArchivItem_Font::DF_LEFT | glArchivItem_Font::DF_TOP);
    text->EnableBox(false);

    std::vector<std::string> lines = wi.CreateSingleStrings(content);
    for(std::vector<std::string>::const_iterator it = lines.begin(); it != lines.end(); ++it)
        text->AddString(*it, COLOR_YELLOW, false);

}
Example #4
0
void iwAction::Msg_Group_TabChange(const unsigned  /*group_id*/, const unsigned int ctrl_id, const unsigned short tab_id)
{
    switch(ctrl_id)
    {
        case 1: // Gebäudetabs
        {
            SetIwHeight(building_tab_heights[tab_id]);
        } break;
    }
}
Example #5
0
void iwAction::Msg_TabChange(const unsigned int ctrl_id, const unsigned short tab_id)
{
    switch(ctrl_id)
    {
        case 0: // Haupttabs
        {
            unsigned short height = 0;
            switch(tab_id)
            {
                case TAB_FLAG:    height = 138; break;
                case TAB_CUTROAD: height = 138; break;
                case TAB_BUILD:
                {
                    // unterschiedliche Höhe, je nachdem welches Gebäude
                    switch(GetCtrl<ctrlTab>(0)->GetGroup(TAB_BUILD)->GetCtrl<ctrlTab>(1)->GetCurrentTab())
                    {
                        case Tabs::BT_HUT:    height = 222; break;
                        case Tabs::BT_HOUSE:  height = 258; break;
                        case Tabs::BT_CASTLE: height = 186; break;
                        case Tabs::BT_MINE:   height = 186; break;
                    }
                } break;
                case TAB_SETFLAG: height = 138; break;
                case TAB_ATTACK:
                {
                    if(available_soldiers_count > 0)
                        height = 178;
                    else
                        height = 130;
                } break;
                case TAB_SEAATTACK:
                {
                    if(available_soldiers_count_sea > 0)
                        height = 178;
                    else
                        height = 130;
                } break;
                case TAB_WATCH:   height = 138; break;
            }


            SetIwHeight(height);
        } break;
    }

}
Example #6
0
void iwAction::Msg_TabChange(const unsigned int ctrl_id, const unsigned short tab_id)
{
    switch(ctrl_id)
    {
        case 0: // Haupttabs
        {
            unsigned short height = 0;
            switch(tab_id)
            {
                case TAB_FLAG:    height = 138; break;
                case TAB_CUTROAD: height = 138; break;
                case TAB_BUILD:
                {
                    height = building_tab_heights[GetCtrl<ctrlTab>(0)->GetGroup(TAB_BUILD)->GetCtrl<ctrlTab>(1)->GetCurrentTab()];
                } break;
                case TAB_SETFLAG: height = 138; break;
                case TAB_ATTACK:
                {
                    if(available_soldiers_count > 0)
                        height = 178;
                    else
                        height = 130;
                } break;
                case TAB_SEAATTACK:
                {
                    if(available_soldiers_count_sea > 0)
                        height = 178;
                    else
                        height = 130;
                } break;
                case TAB_WATCH:   height = 138; break;
            }


            SetIwHeight(height);
        } break;
    }

}
Example #7
0
void IngameWindow::Resize(unsigned short width, unsigned short height)
{
    SetIwWidth(std::max(0, width - contentOffset.x - contentOffsetEnd.x));
    SetIwHeight(std::max(0, height - contentOffset.y - contentOffsetEnd.y));
}