예제 #1
0
bool IngameWindow::Draw_()
{
    if(isModal_)
    {
        SetActive(true);
        Close(false);
    }

    // Linkes oberes Teil
    glArchivItem_Bitmap* leftUpperImg = LOADER.GetImageN("resource", 36);
    leftUpperImg->Draw(pos_);
    // Rechtes oberes Teil
    glArchivItem_Bitmap* rightUpperImg = LOADER.GetImageN("resource", 37);
    rightUpperImg->Draw(pos_ + DrawPoint(width_ - rightUpperImg->getWidth(), 0));

    // Die beiden Buttons oben
    static const unsigned short ids[2][3] =
    {
        {47, 55, 50},
        {48, 56, 52}
    };

    // Titelleiste
    if(closeOnRightClick_ || !IsModal())
        LOADER.GetImageN("resource", ids[0][button_state[0]])->Draw(pos_);
    if(!IsModal())
        LOADER.GetImageN("resource", ids[1][button_state[1]])->Draw(pos_ + DrawPoint(width_ - 16, 0));


    // Breite berechnen
    unsigned title_width = width_ - leftUpperImg->getWidth() - rightUpperImg->getWidth();

    unsigned short title_index;
    if(active_)
        title_index = isMoving ? 44 : 43;
    else
        title_index = 42;

    glArchivItem_Bitmap& titleImg = *LOADER.GetImageN("resource", title_index);
    DrawPoint titleImgPos = pos_ + DrawPoint(leftUpperImg->getWidth(), 0);
    // Wieviel mal nebeneinanderzeichnen?
    unsigned short title_count = title_width / titleImg.getWidth();
    for(unsigned short i = 0; i < title_count; ++i)
    {
        titleImg.Draw(titleImgPos);
        titleImgPos.x += titleImg.getWidth();
    }

    // Rest zeichnen
    unsigned short rest = title_width % titleImg.getWidth();

    if(rest)
        titleImg.Draw(titleImgPos, rest, 0, 0, 0, rest, 0);

    // Text auf die Leiste
    NormalFont->Draw(pos_ + DrawPoint(width_, titleImg.getHeight()) / 2, title_, glArchivItem_Font::DF_CENTER | glArchivItem_Font::DF_VCENTER, COLOR_YELLOW);

    if(!isMinimized_)
    {
        // Seitenleisten

        // Höhe
        glArchivItem_Bitmap* bottomBorderSideImg = LOADER.GetImageN("resource", 45);
        unsigned side_height = height_ - leftUpperImg->getHeight() - bottomBorderSideImg->getHeight();

        // Wieviel mal nebeneinanderzeichnen?
        glArchivItem_Bitmap* leftSideImg = LOADER.GetImageN("resource", 38);
        glArchivItem_Bitmap* rightSideImg = LOADER.GetImageN("resource", 39);
        title_count = side_height / leftSideImg->getHeight();
        DrawPoint leftImgPos = pos_ + DrawPoint(0, leftUpperImg->getHeight());
        DrawPoint rightImgPos = leftImgPos + DrawPoint(width_ - leftSideImg->getWidth(), 0);
        for(unsigned short i = 0; i < title_count; ++i)
        {
            leftSideImg->Draw(leftImgPos);
            rightSideImg->Draw(rightImgPos);
            rightImgPos.y = leftImgPos.y += leftSideImg->getHeight();    
        }

        // Rest zeichnen
        rest = side_height % leftSideImg->getHeight();

        if(rest)
        {
            leftSideImg->Draw(leftImgPos, 0, rest, 0, 0, 0, rest);
            rightSideImg->Draw(rightImgPos, 0, rest, 0, 0, 0, rest);
        }

        // Untere Leiste

        unsigned side_width = width_ - bottomBorderSideImg->getWidth() * 2;

        // Wieviel mal nebeneinanderzeichnen?
        glArchivItem_Bitmap* bottomBarImg = LOADER.GetImageN("resource", 40);
        title_count = side_width / bottomBarImg->getWidth();
        DrawPoint bottomImgPos = pos_ + DrawPoint(bottomBorderSideImg->getWidth(), GetIwBottomBoundary());
        for(unsigned short i = 0; i < title_count; ++i)
        {
            bottomBarImg->Draw(bottomImgPos);
            bottomImgPos.x += bottomBarImg->getWidth();
        }

        rest = side_width % bottomBarImg->getWidth();

        if(rest)
            bottomBarImg->Draw(bottomImgPos, rest, 0, 0, 0, rest, 0);

        // Clientbereich

        // überhaupt ne Clienttexture gewnscht?
        if(background)
            background->Draw(pos_ + contentOffset, GetIwWidth(), iwHeight, 0, 0, GetIwWidth(), iwHeight);

        // Msg_PaintBefore aufrufen vor den Controls
        Msg_PaintBefore();

        DrawControls();

        // Links und rechts unten die 2 kleinen Knäufe
        bottomBorderSideImg->Draw(pos_ + DrawPoint(0, height_ - bottomBorderSideImg->getHeight()));
        bottomBorderSideImg->Draw(pos_ + DrawPoint(width_ - bottomBorderSideImg->getWidth(), height_ - bottomBorderSideImg->getHeight()));
    }
    else
    {
        glArchivItem_Bitmap* bottomBorderSideImg = LOADER.GetImageN("resource", 45);
        glArchivItem_Bitmap* bottomBarImg = LOADER.GetImageN("resource", 40);
        unsigned side_width = width_ - bottomBorderSideImg->getWidth() * 2;
        title_count = side_width / bottomBarImg->getWidth();

        DrawPoint bottomImgPos = pos_ + DrawPoint(bottomBorderSideImg->getWidth(), 20);
        for(unsigned short i = 0; i < title_count; ++i)
        {
            bottomBarImg->Draw(bottomImgPos);
            bottomImgPos.x += bottomBarImg->getWidth();
        }

        rest = side_width % bottomBarImg->getWidth();

        if(rest)
            bottomBarImg->Draw(bottomImgPos, rest, 0, 0, 0, rest, 0);

        bottomBorderSideImg->Draw(pos_ + DrawPoint(0, bottomBorderSideImg->getHeight()));
        bottomBorderSideImg->Draw(pos_ + DrawPoint(width_ - bottomBorderSideImg->getWidth(), bottomBorderSideImg->getHeight()));
    }

    return true;
}
예제 #2
0
bool IngameWindow::Draw_()
{
    if(modal)
    {
        SetActive(true);
        Close(false);
    }

    // Linkes oberes Teil
    LOADER.GetImageN("resource", 36)->Draw(x, y, 0, 0, 0, 0, 0, 0);
    // Rechtes oberes Teil
    LOADER.GetImageN("resource", 37)->Draw(x + width - LOADER.GetImageN("resource", 37)->getWidth(), y, 0, 0, 0, 0, 0, 0);

    // Die beiden Buttons oben
    static const unsigned short ids[2][3] =
    {
        {47, 55, 50},
        {48, 56, 52}
    };

    // Titelleiste
    if(!modal)
        LOADER.GetImageN("resource", ids[0][button_state[0]])->Draw(x, y, 0, 0, 0, 0, 0, 0);

    LOADER.GetImageN("resource", ids[1][button_state[1]])->Draw(x + width - 16, y, 0, 0, 0, 0, 0, 0);


    // Breite berechnen
    unsigned title_width = width - LOADER.GetImageN("resource", 36)->getWidth() - LOADER.GetImageN("resource", 37)->getWidth();

    // Wieviel mal nebeneinanderzeichnen?
    unsigned short title_count = title_width / LOADER.GetImageN("resource", 43)->getWidth();

    unsigned short title_index = 42;
    if(active)
    {
        if(move)
            title_index = 44;
        else
            title_index = 43;
    }

    for(unsigned short i = 0; i < title_count; ++i)
        LOADER.GetImageN("resource", title_index)->Draw(x + LOADER.GetImageN("resource", 36)->getWidth() + i * LOADER.GetImageN("resource", title_index)->getWidth(), y, 0, 0, 0, 0, 0, 0);

    // Rest zeichnen
    unsigned short rest = title_width % LOADER.GetImageN("resource", title_index)->getWidth();

    if(rest)
        LOADER.GetImageN("resource", title_index)->Draw(x + LOADER.GetImageN("resource", 36)->getWidth() + title_count * LOADER.GetImageN("resource", title_index)->getWidth(), y, rest, 0, 0, 0, rest, 0);

    // Text auf die Leiste
    NormalFont->Draw( x + width / 2, y + LOADER.GetImageN("resource", 43)->getHeight() / 2, title, glArchivItem_Font::DF_CENTER | glArchivItem_Font::DF_VCENTER, COLOR_YELLOW);

    if(!minimized)
    {
        // Seitenleisten

        // Höhe
        unsigned side_height = height - LOADER.GetImageN("resource", 36)->getHeight() - LOADER.GetImageN("resource", 45)->getHeight();

        // Wieviel mal nebeneinanderzeichnen?
        title_count = side_height / LOADER.GetImageN("resource", 38)->getHeight();

        for(unsigned short i = 0; i < title_count; ++i)
        {
            LOADER.GetImageN("resource", 38)->Draw(x, y + LOADER.GetImageN("resource", 36)->getHeight() + i * LOADER.GetImageN("resource", 38)->getHeight(), 0, 0, 0, 0, 0, 0);
            LOADER.GetImageN("resource", 39)->Draw(x + width - LOADER.GetImageN("resource", 38)->getWidth(), y + LOADER.GetImageN("resource", 36)->getHeight() + i * LOADER.GetImageN("resource", 38)->getHeight(), 0, 0, 0, 0, 0, 0);
            //LOADER.GetImageN("resource", 43)->Draw(x+width-LOADER.GetImageN("resource", 38)->getWidth(),y);
        }

        // Rest zeichnen
        rest = side_height % LOADER.GetImageN("resource", 38)->getHeight();

        if(rest)
        {
            LOADER.GetImageN("resource", 38)->Draw(x, y + height - rest - LOADER.GetImageN("resource", 45)->getHeight(), 0, rest, 0, 0, 0, rest);
            LOADER.GetImageN("resource", 39)->Draw(x + width - LOADER.GetImageN("resource", 38)->getWidth(), y + LOADER.GetImageN("resource", 36)->getHeight() + title_count * LOADER.GetImageN("resource", 38)->getHeight(), 0, rest, 0, 0, 0, rest);
        }

        // Untere Leiste

        unsigned side_width = width - LOADER.GetImageN("resource", 45)->getWidth() * 2;

        // Wieviel mal nebeneinanderzeichnen?
        title_count = side_width / LOADER.GetImageN("resource", 40)->getWidth();

        for(unsigned short i = 0; i < title_count; ++i)
            LOADER.GetImageN("resource", 40)->Draw(x + LOADER.GetImageN("resource", 45)->getWidth() + i * LOADER.GetImageN("resource", 40)->getWidth(), y + iwHeight - LOADER.GetImageN("resource", 40)->getHeight(), 0, 0, 0, 0, 0, 0);

        rest = side_width % LOADER.GetImageN("resource", 40)->getWidth();

        if(rest)
            LOADER.GetImageN("resource", 40)->Draw(x + LOADER.GetImageN("resource", 45)->getWidth() + title_count * LOADER.GetImageN("resource", 40)->getWidth(), y + iwHeight - LOADER.GetImageN("resource", 40)->getHeight(), rest, 0, 0, 0, rest, 0);

        // Clientbereich

        // überhaupt ne Clienttexture gewnscht?
        if(background)
        {
            // Bereich ausrechnen
            unsigned client_width = width - 20;
            unsigned client_height = iwHeight - 31;

            background->Draw(this->x + LOADER.GetImageN("resource", 38)->getWidth(), this->y + LOADER.GetImageN("resource", 36)->getHeight(), client_width, client_height, 0, 0, client_width, client_height);
        }

        // Links und rechts unten die 2 kleinen Knäufe
        LOADER.GetImageN("resource", 45)->Draw(x, y + iwHeight - LOADER.GetImageN("resource", 45)->getHeight(), 0, 0, 0, 0, 0, 0);
        LOADER.GetImageN("resource", 45)->Draw(x + width - LOADER.GetImageN("resource", 45)->getWidth(), y + iwHeight - LOADER.GetImageN("resource", 45)->getHeight(), 0, 0, 0, 0, 0, 0);

        // Msg_PaintBefore aufrufen vor den Controls
        Msg_PaintBefore();

        DrawControls();
    }
    else
    {
        unsigned side_width = width - LOADER.GetImageN("resource", 45)->getWidth() * 2;
        title_count = side_width / LOADER.GetImageN("resource", 40)->getWidth();

        for(unsigned short i = 0; i < title_count; ++i)
            LOADER.GetImageN("resource", 40)->Draw(x + LOADER.GetImageN("resource", 45)->getWidth() + i * LOADER.GetImageN("resource", 40)->getWidth(), y + 20, 0, 0, 0, 0, 0, 0);

        rest = side_width % LOADER.GetImageN("resource", 40)->getWidth();

        if(rest)
            LOADER.GetImageN("resource", 40)->Draw(x + LOADER.GetImageN("resource", 45)->getWidth() + title_count * LOADER.GetImageN("resource", 40)->getWidth(), y + 20, rest, 0, 0, 0, rest, 0);

        LOADER.GetImageN("resource", 45)->Draw(x, y + 16, 0, 0, 0, 0, 0, 0);
        LOADER.GetImageN("resource", 45)->Draw(x + width - 16, y + 16, 0, 0, 0, 0, 0, 0);
    }

    return true;
}