コード例 #1
0
iwDiplomacy::iwDiplomacy(const GameWorldViewer& gwv, GameCommandFactory& gcFactory)
    : IngameWindow(CGI_DIPLOMACY, IngameWindow::posLastOrCenter,
                   Extent(500, FIRST_LINE_Y + gwv.GetWorld().GetNumPlayers() * (CELL_HEIGHT + SPACE_HEIGHT) + 20), _("Diplomacy"),
                   LOADER.GetImageN("resource", 41)),
      gwv(gwv), gcFactory(gcFactory)
{
    // "Header" der Tabelle
    AddText(0, DrawPoint(LINE_DISTANCE_TO_MARGINS + PING_FIELD_POS, HEADER_Y), _("Ping"), COLOR_YELLOW, FontStyle::CENTER, NormalFont);
    AddText(1, DrawPoint(LINE_DISTANCE_TO_MARGINS + TREATIES_POS, HEADER_Y), _("Treaties"), COLOR_YELLOW, FontStyle::CENTER, NormalFont);

    DrawPoint curTxtPos(LINE_DISTANCE_TO_MARGINS + 10, FIRST_LINE_Y + CELL_HEIGHT / 2 - CELL_HEIGHT - SPACE_HEIGHT);
    for(unsigned i = 0; i < gwv.GetWorld().GetNumPlayers(); ++i)
    {
        const GamePlayer& player = gwv.GetWorld().GetPlayer(i);
        curTxtPos.y += CELL_HEIGHT + SPACE_HEIGHT;
        if(!player.isUsed())
            continue;
        // Einzelne Spielernamen
        AddText(100 + i, curTxtPos, player.name, player.color, FontStyle::VCENTER, NormalFont);

        if(player.ps == PS_OCCUPIED)
        {
            // Ping
            DrawPoint pingPos(LINE_DISTANCE_TO_MARGINS + PING_FIELD_POS - PING_FIELD_SIZE.x / 2, curTxtPos.y);
            AddTextDeepening(200 + i, pingPos, PING_FIELD_SIZE, TC_GREY, "0", NormalFont, COLOR_YELLOW);
        }

        // An sich selber braucht man keine Bündnisse zu schließen
        if(gwv.GetPlayerId() == i)
            continue;
        // Bündnisvertrag-Button
        glArchivItem_Bitmap* image = LOADER.GetImageN("io", 61);
        Extent btSize(40, 40);
        DrawPoint btPos(LINE_DISTANCE_TO_MARGINS + TREATIES_POS - TREATIE_BUTTON_SPACE / 2 - (image->getWidth() + 8),
                        curTxtPos.y - btSize.y / 2);
        ctrlButton* button = AddImageButton(300 + i, btPos, btSize, TC_GREY, image, _("Treaty of alliance"));

        // Verbleibende Zeit unter dem Button
        DrawPoint remainingTimePos = button->GetPos() + DrawPoint(btSize.x / 2, btSize.y + 4);
        AddText(500 + i, remainingTimePos, "", COLOR_YELLOW, FontStyle::CENTER, SmallFont);

        // Nichtangriffspakt
        image = LOADER.GetImageN("io", 100);
        btPos.x = LINE_DISTANCE_TO_MARGINS + TREATIES_POS + TREATIE_BUTTON_SPACE / 2;
        button = AddImageButton(400 + i, btPos, btSize, TC_GREY, image, _("Non-aggression pact"));

        // Verbleibende Zeit unter dem Button
        remainingTimePos = button->GetPos() + DrawPoint(btSize.x / 2, btSize.y + 4);
        AddText(600 + i, remainingTimePos, "", COLOR_YELLOW, FontStyle::CENTER, SmallFont);
    }
    // Farben festlegen
    Msg_PaintAfter();
}
コード例 #2
0
//---------------------------------------------------------------------------------------
void GrpTopLevel::create_controls_in_group(wxBoxSizer* pMainSizer)
{
    //create the buttons for the group

    ToolButtonData cButtons[] =
    {
        { k_tool_text,          _("Text"),                  "symbols_text" },
        { k_tool_lines,         _("Lines and arrows"),      "symbols_line" },
        { k_tool_textbox,       _("Text boxes"),            "symbols_textbox" },
    };

    int nNumButtons = sizeof(cButtons) / sizeof(ToolButtonData);

    set_group_title(_("Text and graphics"));
    wxBoxSizer* pCtrolsSizer = create_main_sizer_for_group(pMainSizer);

    SetFont(wxFont(8, wxSWISS, wxNORMAL, wxNORMAL, false, "Tahoma"));

    wxBoxSizer* pButtonsSizer;
    wxSize btSize(24, 24);
	for (int iB=0; iB < nNumButtons; iB++)
	{
		//if (iB % 9 == 0) {
			pButtonsSizer = new wxBoxSizer(wxHORIZONTAL);
			pCtrolsSizer->Add(pButtonsSizer);
		//}

		wxString sBtName = cButtons[iB].sBitmapName;
		m_pButton[iB] = new CheckButton(this, lmID_BT_Symbols+iB, wxBitmap(24, 24),
                                        wxDefaultPosition, wxSize(24, 24));
        m_pButton[iB]->SetBitmapUp(sBtName, "", btSize);
        m_pButton[iB]->SetBitmapDown(sBtName, "button_selected_flat", btSize);
        m_pButton[iB]->SetBitmapOver(sBtName, "button_over_flat", btSize);
        m_pButton[iB]->SetBitmapDisabled(sBtName + "_dis", "", btSize);
		m_pButton[iB]->SetToolTip(cButtons[iB].sToolTip);
		pButtonsSizer->Add(m_pButton[iB], wxSizerFlags(0).Border(wxALL, 0) );
		pButtonsSizer->Add( new wxStaticText(this, wxID_ANY, cButtons[iB].sToolTip),
                            wxSizerFlags(0).Border(wxLEFT|wxTOP|wxBOTTOM, 5) );
	}

	this->Layout();

	SelectButton(0);	//select text button
}
コード例 #3
0
//---------------------------------------------------------------------------------------
void GrpHarmony::create_controls_in_group(wxBoxSizer* pMainSizer)
{
    //create the buttons for the group

    ToolButtonData cButtons[] =
    {
        { k_tool_figured_bass,  _("Figured bass"),          "harmony_figured_bass" },
        { k_tool_fb_line,       _("'Hold chord' line"),     "harmony_fb_line" },
    };

    int nNumButtons = sizeof(cButtons) / sizeof(ToolButtonData);

    set_group_title(_("Harmony"));
    wxBoxSizer* pCtrolsSizer = create_main_sizer_for_group(pMainSizer);

    SetFont(wxFont(8, wxSWISS, wxNORMAL, wxNORMAL, false, "Tahoma"));

    wxBoxSizer* pButtonsSizer;
    wxSize btSize(24, 24);
	for (int iB=0; iB < nNumButtons; iB++)
	{
		pButtonsSizer = new wxBoxSizer(wxHORIZONTAL);
		pCtrolsSizer->Add(pButtonsSizer);

		wxString sBtName = cButtons[iB].sBitmapName;
		m_pButton[iB] = new CheckButton(this, lmID_BT_Harmony+iB, wxBitmap(24, 24),
                                        wxDefaultPosition, wxSize(24, 24));
        m_pButton[iB]->SetBitmapUp(sBtName, "", btSize);
        m_pButton[iB]->SetBitmapDown(sBtName, "button_selected_flat", btSize);
        m_pButton[iB]->SetBitmapOver(sBtName, "button_over_flat", btSize);
        m_pButton[iB]->SetBitmapDisabled(sBtName + "_dis", "", btSize);
		m_pButton[iB]->SetToolTip(cButtons[iB].sToolTip);
		pButtonsSizer->Add(m_pButton[iB], wxSizerFlags(0).Border(wxALL, 0) );
		pButtonsSizer->Add( new wxStaticText(this, wxID_ANY, cButtons[iB].sToolTip),
                            wxSizerFlags(0).Border(wxLEFT|wxTOP|wxBOTTOM, 5) );
	}

	this->Layout();

	SelectButton(0);	//select figured bass button
}
コード例 #4
0
iwAddons::iwAddons(GlobalGameSettings& ggs, Window* parent, ChangePolicy policy, std::vector<AddonId> addonIds)
    : IngameWindow(CGI_ADDONS, IngameWindow::posLastOrCenter, Extent(700, 500), _("Addon Settings"), LOADER.GetImageN("resource", 41), true,
                   false, parent),
      ggs(ggs), policy(policy), addonIds(std::move(addonIds))
{
    AddText(0, DrawPoint(20, 30), _("Additional features:"), COLOR_YELLOW, FontStyle{}, NormalFont);

    Extent btSize(200, 22);
    if(policy != READONLY)
        AddTextButton(1, DrawPoint(20, GetSize().y - 40), btSize, TC_GREEN2, _("Apply"), NormalFont, _("Apply Changes"));

    AddTextButton(2, DrawPoint(250, GetSize().y - 40), btSize, TC_RED1, _("Abort"), NormalFont, _("Close Without Saving"));

    if(policy != READONLY)
        AddTextButton(3, DrawPoint(480, GetSize().y - 40), btSize, TC_GREY, _("Default"), NormalFont, _("Use S2 Defaults"));

    // Kategorien
    ctrlOptionGroup* optiongroup = AddOptionGroup(5, ctrlOptionGroup::CHECK);
    btSize = Extent(120, 22);
    // "Alle"
    optiongroup->AddTextButton(ADDONGROUP_ALL, DrawPoint(20, 50), btSize, TC_GREEN2, _("All"), NormalFont);
    // "Militär"
    optiongroup->AddTextButton(ADDONGROUP_MILITARY, DrawPoint(150, 50), btSize, TC_GREEN2, _("Military"), NormalFont);
    // "Wirtschaft"
    optiongroup->AddTextButton(ADDONGROUP_ECONOMY, DrawPoint(290, 50), btSize, TC_GREEN2, _("Economy"), NormalFont);
    // "Spielverhalten"
    optiongroup->AddTextButton(ADDONGROUP_GAMEPLAY, DrawPoint(430, 50), btSize, TC_GREEN2, _("Gameplay"), NormalFont);
    // "Sonstiges"
    optiongroup->AddTextButton(ADDONGROUP_OTHER, DrawPoint(560, 50), btSize, TC_GREEN2, _("Other"), NormalFont);

    ctrlScrollBar* scrollbar =
      AddScrollBar(6, DrawPoint(GetSize().x - SCROLLBAR_WIDTH - 20, 90), Extent(SCROLLBAR_WIDTH, GetSize().y - 140), SCROLLBAR_WIDTH,
                   TC_GREEN2, (GetSize().y - 140) / 30 - 1);
    scrollbar->SetRange(ggs.getNumAddons());

    optiongroup->SetSelection(ADDONGROUP_ALL, true);
}
コード例 #5
0
//---------------------------------------------------------------------------------------
void GrpRhythmicDictation::create_controls_in_group(wxBoxSizer* pMainSizer)
{
    //create the common controls for a group
    set_group_title(_("Rhythmic dictation tools"));
    wxBoxSizer* pCtrolsSizer = create_main_sizer_for_group(pMainSizer);

    //create the specific controls for this group

    //buttons for adding notes
        //whole note/rest
	wxBoxSizer* pRow1Sizer = new wxBoxSizer( wxHORIZONTAL );

    wxSize btSize(24, 24);
    CheckButton* pButton;
	pButton = new CheckButton(this, k_id_button_note, wxBitmap(24,24),
                              wxDefaultPosition, wxSize(24, 24));
    pButton->SetBitmapUp("tie", "", btSize);
    pButton->SetBitmapDown("tie", "button_selected_flat", btSize);
    pButton->SetBitmapOver("tie", "button_over_flat", btSize);
    pButton->SetBitmapDisabled("tie_dis", "", btSize);
    pButton->SetToolTip(_("Add/remove a tie to/from selected notes"));
	pRow1Sizer->Add( pButton, wxSizerFlags(0).Border(wxALL, 2) );

        //half note/rest
	pButton = new CheckButton(this, k_id_button_note+1, wxBitmap(24,24),
                              wxDefaultPosition, wxSize(24, 24));
    pButton->SetBitmapUp("tuplet", "", btSize);
    pButton->SetBitmapDown("tuplet", "button_selected_flat", btSize);
    pButton->SetBitmapOver("tuplet", "button_over_flat", btSize);
    pButton->SetBitmapDisabled("tuplet_dis", "", btSize);
    pButton->SetToolTip(_("Add/remove tuplet to/from selected notes"));
	pRow1Sizer->Add( pButton, wxSizerFlags(0).Border(wxALL, 2) );

        //quarter note/rest
	pButton = new CheckButton(this, k_id_button_note+2, wxBitmap(24,24),
                              wxDefaultPosition, wxSize(24, 24));
    pButton->SetBitmapUp("toggle_stem", "", btSize);
    pButton->SetBitmapDown("toggle_stem", "button_selected_flat", btSize);
    pButton->SetBitmapOver("toggle_stem", "button_over_flat", btSize);
    pButton->SetBitmapDisabled("toggle_stem_dis", "", btSize);
    pButton->SetToolTip(_("Toggle stem in selected notes"));
	pRow1Sizer->Add( pButton, wxSizerFlags(0).Border(wxALL, 2) );

    pCtrolsSizer->Add( pRow1Sizer, 0, wxEXPAND, 5 );
    //    wxButton* pButton;
    //    for (int i=0; i < 4; ++i)
    //    {
    //        pButton = LENMUS_NEW wxButton(this, k_id_button_0 + i, _("11"));
    //    //        m_clefs[i] = LENMUS_NEW wxBitmapButton(this, k_id_button+i, create_bitmap(i),
    //    //                                               wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW );
    //        pCtrolsSizer->Add( pButton, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
    //    }

	//buttons for moving cursor
	wxBoxSizer* pRow2Sizer = new wxBoxSizer( wxHORIZONTAL );

	pButton = new CheckButton(this, k_id_button_cursor, wxBitmap(24,24),
                              wxDefaultPosition, wxSize(24, 24));
    pButton->SetBitmapUp("toggle_stem", "", btSize);
    pButton->SetBitmapDown("toggle_stem", "button_selected_flat", btSize);
    pButton->SetBitmapOver("toggle_stem", "button_over_flat", btSize);
    pButton->SetBitmapDisabled("toggle_stem_dis", "", btSize);
    pButton->SetToolTip(_("Toggle stem in selected notes"));
	pRow2Sizer->Add( pButton, wxSizerFlags(0).Border(wxALL, 2) );

    pCtrolsSizer->Add( pRow2Sizer, 0, wxEXPAND, 5 );

	//other commands: backdelete, delete & insert barline

	//push button for dots

	this->Layout();
}