iwSaveLoad::iwSaveLoad(const unsigned short add_height, const std::string& window_title) : IngameWindow(CGI_SAVE, IngameWindow::posLastOrCenter, Extent(600, 400 + add_height), window_title, LOADER.GetImageN("resource", 41)) { AddTable(0, DrawPoint(20, 30), Extent(560, 300), TC_GREEN2, NormalFont, 5, _("Filename"), 270, ctrlTable::SRT_STRING, _("Map"), 250, ctrlTable::SRT_STRING, _("Time"), 250, ctrlTable::SRT_DATE, _("Start GF"), 320, ctrlTable::SRT_NUMBER, "", 0, ctrlTable::SRT_STRING); }
/** Returns a list of parts of a single section that have been referenced. The offsets are relative to the start of the * section. */ ExtentMap SgAsmGenericSection::get_referenced_extents() const { ExtentMap retval; if (0==get_size()) return retval; Extent s(get_offset(), get_size()); const ExtentMap &file_extents = get_file()->get_referenced_extents(); for (ExtentMap::const_iterator i=file_extents.begin(); i!=file_extents.end(); i++) { Extent e = i->first; if (e.contained_in(s)) { retval.insert(Extent(e.first()-get_offset(), e.size())); } else if (e.left_of(s) || e.right_of(s)) { /*void*/ } else if (e.contains(s)) { retval.insert(Extent(0, get_size())); } else if (e.begins_before(s)) { retval.insert(Extent(0, e.first()+e.size()-get_offset())); } else if (e.ends_after(s)) { retval.insert(Extent(e.first()-get_offset(), get_offset()+get_size()-e.first())); } else { assert(!"invalid extent overlap category"); abort(); } } return retval; }
// TODO: Avoid flickering! void MScrollView::UpdateScrollInfo() { MRect rcClient; MScrollView::GetClientRect(&rcClient); SCROLLINFO si; si.cbSize = sizeof(si); si.fMask = SIF_ALL | SIF_DISABLENOSCROLL; si.nMin = 0; si.nMax = Extent().cx; si.nPage = rcClient.Width(); if (static_cast<UINT>(si.nMax) < si.nPage) ScrollPos().x = 0; si.nPos = ScrollPos().x; SetHScrollInfo(&si, TRUE); si.cbSize = sizeof(si); si.fMask = SIF_ALL | SIF_DISABLENOSCROLL; si.nMin = 0; si.nMax = Extent().cy; si.nPage = rcClient.Height(); if (static_cast<UINT>(si.nMax) < si.nPage) ScrollPos().y = 0; si.nPos = ScrollPos().y; SetVScrollInfo(&si, TRUE); ::InvalidateRect(m_hwndParent, NULL, TRUE); }
iwLoad::iwLoad(CreateServerInfo csi) : iwSaveLoad(0, _("Load game!")), csi(std::move(csi)) { AddEdit(1, DrawPoint(20, 350), Extent(510, 22), TC_GREEN2, NormalFont); AddImageButton(2, DrawPoint(540, 346), Extent(40, 40), TC_GREEN2, LOADER.GetImageN("io", 48)); // Tabelle ausfüllen beim Start RefreshTable(); }
iwSurrender::iwSurrender() : IngameWindow(CGI_ENDGAME, IngameWindow::posLastOrCenter, Extent(240, 100), _("Surrender game?"), LOADER.GetImageN("resource", 41)) { // Ok AddImageButton(0, DrawPoint(85, 24), Extent(68, 57), TC_GREEN2, LOADER.GetImageN("io", 32), _("Surrender")); // Ok + Abbrennen AddImageButton(2, DrawPoint(16, 24), Extent(68, 57), TC_GREEN2, LOADER.GetImageN("io", 23), _("Destroy all buildings and surrender")); // Abbrechen AddImageButton(1, DrawPoint(158, 24), Extent(68, 57), TC_RED1, LOADER.GetImageN("io", 40), _("Don't surrender")); }
/** * Zeichenmethode. * * @return @p true bei Erfolg, @p false bei Fehler */ void ctrlPercent::Draw_() { // Wenn der Prozentsatzpointer = 0, dann wird 0 angezeigt und es soll nich abstürzen! unsigned short percentage = (this->percentage_ ? *this->percentage_ : 0); if(percentage > 100) percentage = 100; // Farbe wählen je nachdem wie viel Prozent unsigned color; if(percentage >= 60) color = COLOR_60_PERCENT; else if(percentage >= 30) color = COLOR_30_PERCENT; else if(percentage >= 20) color = COLOR_20_PERCENT; else color = COLOR_0_PERCENT; // Box zeichnen Draw3D(Rect(GetDrawPos(), GetSize()), tc, false); // Fortschritt zeichnen Extent progSize = GetSize() - Extent(8, 8); progSize.x = (progSize.x * percentage) / 100; DrawRectangle(Rect(GetDrawPos() + DrawPoint(4, 4), progSize), color); // Text zeichnen std::string caption = helpers::toString(percentage) + "%"; font->Draw(GetDrawPos() + DrawPoint(GetSize()) / 2, caption, FontStyle::CENTER | FontStyle::VCENTER, text_color); }
InterfaceParticles(const Boundary& boundary, const int& levelMin, const int& levelMax, const Vector& box_offset, const vmg_float& box_size, const int& near_field_cells, const int& coarsening_steps, const vmg_float& alpha) : Interface(boundary, levelMin, levelMax, box_offset, box_size, coarsening_steps, alpha), spl(near_field_cells, Extent(MaxLevel()).MeshWidth().Max()) {}
/** * Konstruktor von @p iwPleaseWait. * * Fenster wird modal geöffnet, damit man ggf. einen "Weiter"-Button nicht * mehrfach betätigen kann. */ iwPleaseWait::iwPleaseWait() : IngameWindow(CGI_PLEASEWAIT, IngameWindow::posLastOrCenter, Extent(300, 60), _("Please wait..."), LOADER.GetImageN("resource", 41), true, false) { GAMEMANAGER.SetCursor(CURSOR_MOON); AddText(0, GetSize() / 2, _("Please wait..."), COLOR_YELLOW, FontStyle::CENTER | FontStyle::VCENTER, NormalFont); }
iwTrade::iwTrade(const nobBaseWarehouse& wh, const GameWorldViewer& gwv, GameCommandFactory& gcFactory) : IngameWindow(wh.CreateGUIID(), IngameWindow::posAtMouse, Extent(400, 194), _("Trade"), LOADER.GetImageN("resource", 41)), wh(wh), gwv(gwv), gcFactory(gcFactory), possibleSrcWarehouses(gwv.GetPlayer().GetWarehousesForTrading(wh)) { // Get title of the player SetTitle((boost::format(_("Trade with %s")) % gwv.GetWorld().GetPlayer(wh.GetPlayer()).name).str()); // Gebäudebild und dessen Schatten AddImage(0, DrawPoint(100, 144), LOADER.GetNationImage(wh.GetNation(), 250 + 5 * wh.GetBuildingType())); const unsigned left_column = 200; AddComboBox(4, DrawPoint(left_column, 84), Extent(160, 18), TC_GREY, NormalFont, 90); // Ware/Figure names AddText(1, DrawPoint(left_column, 30), "Deal in:", COLOR_YELLOW, FontStyle::LEFT, NormalFont); ctrlComboBox* box = this->AddComboBox(2, DrawPoint(left_column, 44), Extent(160, 18), TC_GREY, NormalFont, 200); // Ware or figure? box->AddString(_("Wares")); box->AddString(_("Settlers")); AddText(3, DrawPoint(left_column, 70), "Type:", COLOR_YELLOW, FontStyle::LEFT, NormalFont); // Create possible wares, figures for(unsigned i = 0; i < NUM_WARE_TYPES; ++i) { // Only add one shield type if(GoodType(i) != ConvertShields(GoodType(i))) continue; // Don't add empty water if(i == GD_WATEREMPTY) continue; wares.push_back(GoodType(i)); } for(unsigned i = 0; i < NUM_JOB_TYPES; ++i) { // Can't trade boat carriers if(i == JOB_BOATCARRIER) continue; jobs.push_back(Job(i)); } AddImage(5, DrawPoint(left_column + 20, 130), static_cast<ITexture*>(nullptr), _("Ware you like to trade")); AddEdit(6, DrawPoint(left_column + 34, 120), Extent(39, 20), TC_GREY, NormalFont)->SetNumberOnly(true); AddText(7, DrawPoint(left_column + 75, 125), "/ 20", COLOR_YELLOW, FontStyle::LEFT, NormalFont); AddTextButton(8, DrawPoint(left_column, 150), Extent(150, 22), TC_GREEN2, _("Send"), NormalFont); // Choose wares at first box->SetSelection(0); Msg_ComboSelectItem(2, 0); }
DBRegion DBObjData::Extent(DBObjRecord *record) { DBRegion extent; DBCoordinate coord; DBFloat delta; DBObjTable *items; DBObjTableField *field; if (record == (DBObjRecord *) NULL) return (Extent()); switch (Type()) { case DBTypeVectorPoint: delta = pow((double) 10.0, (double) Precision()); items = TablesPTR->Item(DBrNItems); field = items->Field(DBrNCoord); coord = field->Coordinate(record); extent.Expand(coord + delta); extent.Expand(coord - delta); return (extent); case DBTypeVectorLine: case DBTypeVectorPolygon: items = TablesPTR->Item(DBrNItems); field = items->Field(DBrNRegion); return (field->Region(record)); case DBTypeGridDiscrete: case DBTypeGridContinuous: return (Extent()); case DBTypeNetwork: { DBInt cellID, cellNum; DBObjRecord *cellRec; DBNetworkIF *netIF = new DBNetworkIF(this); cellRec = netIF->MouthCell(record); cellNum = netIF->CellBasinCells(cellRec) + cellRec->RowID(); for (cellID = cellRec->RowID(); cellID < cellNum; ++cellID) { cellRec = netIF->Cell(cellID); extent.Expand(netIF->Center(cellRec) + (netIF->CellSize() / 2.0)); extent.Expand(netIF->Center(cellRec) - (netIF->CellSize() / 2.0)); } delete netIF; } return (extent); case DBTypeTable: default: return (extent); } }
/* Augments superclass to make sure free list and such are adjusted properly */ void SgAsmPEStringSection::set_size(rose_addr_t newsize) { rose_addr_t orig_size = get_size(); SgAsmPESection::set_size(newsize); SgAsmGenericStrtab *strtab = get_strtab(); if (get_size() > orig_size) { /* Add new address space to string table free list */ rose_addr_t n = get_size() - orig_size; strtab->get_freelist().insert(Extent(orig_size, n)); } else if (get_size() < orig_size) { /* Remove deleted address space from string table free list */ rose_addr_t n = orig_size - get_size(); strtab->get_freelist().erase(Extent(get_size(), n)); } }
iwLobbyServerInfo::iwLobbyServerInfo(unsigned serverId) : IngameWindow(CGI_LOBBYSERVERINFO, IngameWindow::posLastOrCenter, Extent(260, 260), _("Server Information"), LOADER.GetImageN("resource", 41)), serverId_(serverId) { AddText(0, DrawPoint(30, 40), _("Map Name:"), COLOR_YELLOW, FontStyle{}, NormalFont); AddEdit(1, DrawPoint(30, 60), Extent(200, 22), TC_GREEN2, NormalFont, 0, false, true); AddText(3, DrawPoint(30, 90), _("Server Name:"), COLOR_YELLOW, FontStyle{}, NormalFont); AddEdit(4, DrawPoint(30, 110), Extent(200, 22), TC_GREEN2, NormalFont, 0, false, true); AddText(5, DrawPoint(30, 140), _("Host:"), COLOR_YELLOW, FontStyle{}, NormalFont); AddEdit(6, DrawPoint(30, 160), Extent(200, 22), TC_GREEN2, NormalFont, 0, false, true); AddText(7, DrawPoint(30, 190), _("Version:"), COLOR_YELLOW, FontStyle{}, NormalFont); AddEdit(8, DrawPoint(30, 210), Extent(200, 22), TC_GREEN2, NormalFont, 0, false, true); LOBBYCLIENT.SendServerInfoRequest(serverId_); AddTimer(9, 5000); }
iwBuildingSite::iwBuildingSite(GameWorldView& gwv, const noBuildingSite* const buildingsite) : IngameWindow(buildingsite->CreateGUIID(), IngameWindow::posAtMouse, Extent(226, 194), _(BUILDING_NAMES[buildingsite->GetBuildingType()]), LOADER.GetImageN("resource", 41)), gwv(gwv), buildingsite(buildingsite) { // Bild des Gebäudes AddImage(0, DrawPoint(113, 130), buildingsite->GetBuildingImage()); // Gebäudename AddText(1, DrawPoint(113, 44), _("Order of building site"), COLOR_YELLOW, FontStyle::CENTER, NormalFont); // Hilfe AddImageButton(2, DrawPoint(16, 147), Extent(30, 32), TC_GREY, LOADER.GetImageN("io", 225), _("Help")); // Gebäude abbrennen AddImageButton(3, DrawPoint(50, 147), Extent(34, 32), TC_GREY, LOADER.GetImageN("io", 23), _("Demolish house")); // "Gehe Zu Ort" AddImageButton(4, DrawPoint(179, 147), Extent(30, 32), TC_GREY, LOADER.GetImageN("io", 107), _("Go to place")); }
dskLAN::dskLAN() : dskMenuBase(LOADER.GetImageN("setup013", 0)), discovery(LAN_DISCOVERY_CFG) { // "Server hinzufügen" AddTextButton(ID_btAddServer, DrawPoint(530, 250), Extent(250, 22), TC_GREEN2, _("Add Server"), NormalFont); // "Verbinden" AddTextButton(ID_btConnect, DrawPoint(530, 280), Extent(250, 22), TC_GREEN2, _("Connect"), NormalFont); // "Zurück" AddTextButton(ID_btBack, DrawPoint(530, 530), Extent(250, 22), TC_RED1, _("Back"), NormalFont); // Gameserver-Tabelle - "ID", "Server", "Karte", "Spieler", "Version" AddTable(ID_tblServer, DrawPoint(20, 20), Extent(500, 530), TC_GREY, NormalFont, 5, _("ID"), 0, ctrlTable::SRT_NUMBER, _("Server"), 300, ctrlTable::SRT_STRING, _("Map"), 300, ctrlTable::SRT_STRING, _("Player"), 200, ctrlTable::SRT_STRING, _("Version"), 100, ctrlTable::SRT_STRING); discovery.Start(); AddTimer(ID_tmrRefreshServers, 60000); // Servers broadcast changes, so force a full update only once a minute AddTimer(ID_tmrRefreshList, 2000); }
FBox FKBoxElem::CalcAABB(const FTransform& BoneTM, float Scale) const { FTransform ElemTM = GetTransform(); ElemTM.ScaleTranslation( FVector(Scale) ); ElemTM *= BoneTM; FVector Extent(0.5f * Scale * X, 0.5f * Scale * Y, 0.5f * Scale * Z); FBox LocalBox(-Extent, Extent); return LocalBox.TransformBy(ElemTM); }
void DwarfLineMapper::visit(SgNode *node) { if (SgAsmDwarfLineList *ll = isSgAsmDwarfLineList(node)) { const SgAsmDwarfLinePtrList &lines = ll->get_line_list(); for (SgAsmDwarfLinePtrList::const_iterator li=lines.begin(); li!=lines.end(); ++li) { SgAsmDwarfLine *line = *li; p_addr2src.insert(Extent(line->get_address()), SrcInfo(line->get_file_id(), line->get_line())); up_to_date = false; } } }
forceinline bool Shape::getExtentAtDepth(int d, Extent& extent) { if (d > depth()) return false; extent = Extent(0,0); for (int i=0; i <= d; i++) { Extent currentExtent = (*this)[i]; extent.l += currentExtent.l; extent.r += currentExtent.r; } return true; }
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(); }
iwSave::iwSave() : iwSaveLoad(40, _("Save game!")) { AddEdit(1, DrawPoint(20, 390), Extent(510, 22), TC_GREEN2, NormalFont); AddImageButton(2, DrawPoint(540, 386), Extent(40, 40), TC_GREEN2, LOADER.GetImageN("io", 47)); // Autospeicherzeug AddText(3, DrawPoint(20, 350), _("Auto-Save every:"), 0xFFFFFF00, FontStyle{}, NormalFont); ctrlComboBox* combo = AddComboBox(4, DrawPoint(270, 345), Extent(130, 22), TC_GREEN2, NormalFont, 100); /// Combobox füllen combo->AddString(_("Disabled")); // deaktiviert // Last entry is only for debugging const unsigned numIntervalls = SETTINGS.global.debugMode ? NUM_AUTO_SAVE_INTERVALS : NUM_AUTO_SAVE_INTERVALS - 1; // Die Intervalle for(unsigned i = 0; i < numIntervalls; ++i) combo->AddString(helpers::toString(AUTO_SAVE_INTERVALS[i]) + " GF"); // Richtigen Eintrag auswählen bool found = false; for(unsigned i = 0; i < numIntervalls; ++i) { if(SETTINGS.interface.autosave_interval == AUTO_SAVE_INTERVALS[i]) { combo->SetSelection(i + 1); found = true; break; } } // Ungültig oder 0 --> Deaktiviert auswählen if(!found) combo->SetSelection(0); // Tabelle ausfüllen beim Start RefreshTable(); }
void iwDiplomacy::Msg_PaintBefore() { // Farben, die zu den 3 Bündnisstates gesetzt werden (0-kein Bündnis, 1-in Arbeit, 2-Bündnis abgeschlossen) const std::array<unsigned, 3> PACT_COLORS = {COLOR_RED, COLOR_YELLOW, COLOR_GREEN}; IngameWindow::Msg_PaintBefore(); // Die farbigen Zeilen malen DrawPoint curPos = GetDrawPos() + DrawPoint(LINE_DISTANCE_TO_MARGINS, FIRST_LINE_Y); Rect curRect(curPos, Extent(GetSize().x - 2 * LINE_DISTANCE_TO_MARGINS, CELL_HEIGHT)); for(unsigned i = 0; i < gwv.GetWorld().GetNumPlayers(); ++i) { // Rechtecke in Spielerfarbe malen mit entsprechender Transparenz DrawRectangle(curRect, SetAlpha(gwv.GetWorld().GetPlayer(i).color, 0x40)); curRect.move(DrawPoint(0, CELL_HEIGHT + SPACE_HEIGHT)); // Farben der Bündnis-Buttons setzen, je nachdem wie der Status ist // Existiert der Button auch? auto* button = GetCtrl<ctrlImageButton>(300 + i); // Bündnisvertrag if(button) // Farbe je nach Bündnisstatus setzen button->SetModulationColor(PACT_COLORS[gwv.GetPlayer().GetPactState(TREATY_OF_ALLIANCE, i)]); // Nicht-Angriffspakt button = GetCtrl<ctrlImageButton>(400 + i); if(button) // Farbe je nach Bündnisstatus setzen button->SetModulationColor(PACT_COLORS[gwv.GetPlayer().GetPactState(NON_AGGRESSION_PACT, i)]); // Ggf. Ping aktualisieren if(auto* pingfield = GetCtrl<ctrlTextDeepening>(200 + i)) pingfield->SetText(helpers::toString(gwv.GetWorld().GetPlayer(i).ping)); // Verbleibende Zeit der Bündnisse in den Text-Ctrls anzeigen if(GetCtrl<ctrlText>(500 + i)) { for(unsigned z = 0; z < 2; ++z) { unsigned duration = gwv.GetPlayer().GetRemainingPactTime(PactType(z), i); // Überhaupt ein Bündnis abgeschlossen und Bündnis nicht für die Ewigkeit? if(duration > 0 && duration != 0xFFFFFFFF) // Dann entsprechende Zeit setzen GetCtrl<ctrlText>(500 + z * 100 + i)->SetText(GAMECLIENT.FormatGFTime(duration)); else // Ansonsten leer GetCtrl<ctrlText>(500 + z * 100 + i)->SetText(""); } } } }
iwSuggestPact::iwSuggestPact(const PactType pt, const GamePlayer& player, GameCommandFactory& gcFactory) : IngameWindow(CGI_SUGGESTPACT, IngameWindow::posLastOrCenter, Extent(320, 215), _(PACT_TITLES[pt]), LOADER.GetImageN("resource", 41)), pt(pt), player(player), gcFactory(gcFactory) { glArchivItem_Bitmap* image; switch(pt) { case TREATY_OF_ALLIANCE: image = LOADER.GetImageN("io", 61); break; case NON_AGGRESSION_PACT: image = LOADER.GetImageN("io", 100); break; default: image = nullptr; } // Bild als Orientierung, welchen Vertrag wir gerade bearbeiten if(image) this->AddImage(0, DrawPoint(55, 100), image); AddText(1, DrawPoint(100, 30), _("Contract type:"), COLOR_YELLOW, FontStyle{}, NormalFont); AddText(2, DrawPoint(100, 45), _(PACT_NAMES[pt]), COLOR_GREEN, FontStyle{}, NormalFont); AddText(3, DrawPoint(100, 70), _("To player:"), COLOR_YELLOW, FontStyle{}, NormalFont); AddText(4, DrawPoint(100, 85), player.name, player.color, FontStyle{}, NormalFont); AddText(5, DrawPoint(100, 110), _("Duration:"), COLOR_YELLOW, FontStyle{}, NormalFont); ctrlComboBox* combo = AddComboBox(6, DrawPoint(100, 125), Extent(190, 22), TC_GREEN2, NormalFont, 100); // Zeiten zur Combobox hinzufügen for(unsigned i = 0; i < NUM_DURATIONS; ++i) { combo->AddString(helpers::format("%s (%s)", DURATION_NAMES[i], GAMECLIENT.FormatGFTime(DURATIONS[i]))); } // Erstes Item in der Combobox vorerst auswählen combo->SetSelection(0); // Option "ewig" noch hinzufügen combo->AddString(_("Eternal")); AddTextButton(7, DrawPoint(110, 170), Extent(100, 22), TC_GREEN2, _("Confirm"), NormalFont); }
void DBObjData::RecalcExtent() { DBRegion extent; switch (Type()) { case DBTypeVectorPoint: case DBTypeVectorLine: case DBTypeVectorPolygon: { DBVectorIF *vectorIF = new DBVectorIF(this); DBInt recordID; for (recordID = 0; recordID < vectorIF->ItemNum(); ++recordID) extent.Expand(Extent(vectorIF->Item(recordID))); delete vectorIF; } break; case DBTypeGridDiscrete: case DBTypeGridContinuous: { DBGridIF *gridIF = new DBGridIF(this); extent.LowerLeft = Extent().LowerLeft; extent.UpperRight.X = extent.LowerLeft.X + gridIF->ColNum() * gridIF->CellWidth(); extent.UpperRight.Y = extent.LowerLeft.Y + gridIF->RowNum() * gridIF->CellHeight(); delete gridIF; } break; case DBTypeNetwork: { DBNetworkIF *netIF = new DBNetworkIF(this); extent.LowerLeft = Extent().LowerLeft; extent.UpperRight.X = extent.LowerLeft.X + netIF->ColNum() * netIF->CellWidth(); extent.UpperRight.Y = extent.LowerLeft.Y + netIF->RowNum() * netIF->CellHeight(); delete netIF; } break; case DBTypeTable: default: return; } Extent(extent); }
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); }
/** Obtains the virtual address of the Hint/Name Table. The Hint/Name Table is an implicit table--the PE file format * specification talks about such a table, but it is not actually defined anywhere in the PE file. Instead, various Import * Lookup Table and Import Address Table entries might point to individual Hint/Name pairs, which collectively form an * implicit Hint/Name Table. There is no requirement that the Hint/Name pairs are contiguous in the address space, and indeed * they often are not. Therefore, the only way to describe the location of the Hint/Name Table is by a list of addresses. * * This function will scan this Import Directory's import items, observe which items make references to Hint/Name pairs that * have known addresses, and add those areas of virtual memory to the specified extent map. This function returns the number * of ILT entries that reference a Hint/Name pair. */ size_t SgAsmPEImportDirectory::hintname_table_extent(ExtentMap &extent/*in,out*/) const { size_t retval = 0; const SgAsmPEImportItemPtrList &imports = get_imports()->get_vector(); for (SgAsmPEImportItemPtrList::const_iterator ii=imports.begin(); ii!=imports.end(); ++ii) { SgAsmPEImportItem *import = *ii; if (!import->get_by_ordinal() && import->get_hintname_rva().get_rva()!=0 && import->get_hintname_nalloc()>0) { size_t nbytes = std::min(import->get_hintname_nalloc(), import->hintname_required_size()); extent.insert(Extent(import->get_hintname_rva().get_va(), nbytes)); ++retval; } } return retval; }
void ExtentStore::add(const Extent& extent) { assert(extent.numPages() > 0); // The new extent is not allowed to be inside an already existing extent for(auto iter : extents) if( (iter.begin().toInteger() <= extent.begin().toInteger() && extent.begin().toInteger() < iter.end().toInteger()) || (iter.begin().toInteger() < extent.end().toInteger() && extent.end().toInteger() <= iter.end().toInteger())) throw util::StupidUserException("extent store: overlapping extents"); // Add extent pageCount += extent.numPages(); if(!extents.empty() && extents.back().end() == extent.begin()) extents.back() = Extent(extents.back().begin(), extent.end()); else // Merge to last extent extents.emplace_back(extent); // Add a new extent }
//--------------------------------------------------------- int CKernel_Density::On_Parameter_Changed(CSG_Parameters *pParameters, CSG_Parameter *pParameter) { if( (!SG_STR_CMP(pParameter->Get_Identifier(), "POINTS") || !SG_STR_CMP(pParameter->Get_Identifier(), "RADIUS")) && pParameters->Get_Parameter("POINTS")->asShapes() ) { CSG_Rect Extent(pParameters->Get_Parameter("POINTS")->asShapes()->Get_Extent()); Extent.Inflate(pParameters->Get_Parameter("RADIUS")->asDouble(), false); m_Grid_Target.Set_User_Defined(pParameters, Extent); } m_Grid_Target.On_Parameter_Changed(pParameters, pParameter); return( CSG_Tool::On_Parameter_Changed(pParameters, pParameter) ); }
void Addon::createGui(Window* window, unsigned id, unsigned short& y, bool /*readonly*/, unsigned /*status*/) const //-V669 { DrawPoint btPos(20, y), txtPos(52, y + 4); auto* button = window->GetCtrl<ctrlButton>(id + 1); if(!button) button = window->AddImageButton(id + 1, btPos, Extent(22, 22), TC_GREY, LOADER.GetImageN("io", 21), description_); button->SetVisible(true); button->SetPos(btPos); auto* text = window->GetCtrl<ctrlText>(id); if(!text) text = window->AddText(id, txtPos, name_, COLOR_YELLOW, FontStyle{}, NormalFont); text->SetVisible(true); text->SetPos(txtPos); }
void AddonBool::createGui(Window* window, unsigned id, unsigned short& y, bool readonly, unsigned status) const { Addon::createGui(window, id, y, readonly, status); DrawPoint cbPos(430, y); auto* check = window->GetCtrl<ctrlCheck>(id + 2); if(!check) { check = window->AddCheckBox(id + 2, DrawPoint(0, 0), Extent(220, 20), TC_GREY, _("Use"), NormalFont, readonly); setGuiStatus(window, id, status); } check->SetVisible(true); check->SetPos(cbPos); y += 30; }
void iwBuildingSite::Msg_PaintAfter() { IngameWindow::Msg_PaintAfter(); // Baukosten zeichnen DrawPoint curPos = GetDrawPos() + DrawPoint(GetSize().x / 2, 60); for(unsigned char i = 0; i < 2; ++i) { unsigned wares_count = 0; unsigned wares_delivered = 0; unsigned wares_used = 0; if(i == 0) { wares_count = BUILDING_COSTS[buildingsite->GetNation()][buildingsite->GetBuildingType()].boards; wares_used = buildingsite->getUsedBoards(); wares_delivered = buildingsite->getBoards() + wares_used; } else { wares_count = BUILDING_COSTS[buildingsite->GetNation()][buildingsite->GetBuildingType()].stones; wares_used = buildingsite->getUsedStones(); wares_delivered = buildingsite->getStones() + wares_used; } if(wares_count == 0) break; // "Schwarzer Rahmen" DrawPoint waresPos = curPos - DrawPoint(24 * wares_count / 2, 0); DrawRectangle(Rect(waresPos, Extent(24 * wares_count, 24)), 0x80000000); waresPos += DrawPoint(12, 12); // Die Waren for(unsigned char z = 0; z < wares_count; ++z) { glArchivItem_Bitmap* bitmap = LOADER.GetMapImageN(2250 + (i == 0 ? GD_BOARDS : GD_STONES)); bitmap->DrawFull(waresPos, (z < wares_delivered ? 0xFFFFFFFF : 0xFF404040)); // Hammer wenn Ware verbaut if(z < wares_used) LOADER.GetMapImageN(2250 + GD_HAMMER)->DrawFull(waresPos); waresPos.x += 24; } curPos.y += 29; } }
iwDistribution::iwDistribution(const GameWorldViewer& gwv, GameCommandFactory& gcFactory) : IngameWindow(CGI_DISTRIBUTION, IngameWindow::posLastOrCenter, Extent(290, 312), _("Distribution of goods"), LOADER.GetImageN("resource", 41)), gwv(gwv), gcFactory(gcFactory), settings_changed(false) { CreateGroups(); // Tab Control ctrlTab* tab = AddTabCtrl(0, DrawPoint(10, 20), 270); DrawPoint txtPos(GetSize().x / 2, 60); DrawPoint progPos(PROGRESS_BORDER_DISTANCE - tab->GetPos().x, txtPos.y); const Extent progSize(GetSize().x - 2 * PROGRESS_BORDER_DISTANCE, 20); for(unsigned groupId = 0; groupId < groups.size(); groupId++) { const DistributionGroup& group = groups[groupId]; ctrlGroup* tabGrp = tab->AddTab(group.img, group.name, groupId); txtPos.y = progPos.y = 60; unsigned curId = 0; for(const std::string& entry : group.entries) { unsigned txtId = group.entries.size() + curId; tabGrp->AddText(txtId, txtPos, entry, COLOR_YELLOW, FontStyle::CENTER | FontStyle::BOTTOM, SmallFont); tabGrp->AddProgress(curId++, progPos, progSize, TC_GREY, 139, 138, 10); txtPos.y = progPos.y += progSize.y * 2; } } // Gruppe auswählen tab->SetSelection(0); // Timer für die Übertragung der Daten via Netzwerk AddTimer(1, 2000); const Extent btSize(32, 32); // Hilfe AddImageButton(2, DrawPoint(15, GetSize().y - 15 - btSize.y), btSize, TC_GREY, LOADER.GetImageN("io", 225), _("Help")); // Standardbelegung AddImageButton(10, GetSize() - DrawPoint::all(15) - btSize, btSize, TC_GREY, LOADER.GetImageN("io", 191), _("Default")); UpdateSettings(); }