void GfxCanvasItem::moveToParent(GfxCanvasItem *p) { if(p == _parent || !p) return; // We (may) need to adjust x, y, scale and visible qreal x = globalX(); qreal y = globalY(); qreal s = globalScale(); qreal v = globalVisible(); setParent(p); if(x != globalX()) { this->x().setValue((x - _parent->globalX()) / _parent->globalScale()); } if(y != globalY()) { this->y().setValue((y - _parent->globalY()) / _parent->globalScale()); } if(s != globalScale()) { scale().setValue(s / _parent->globalScale()); } if(v != globalVisible()) { qreal pv = _parent->globalVisible(); if(pv) visible().setValue(v / pv); } }
long aListBox::SelectItem(long itemNumber) { if (itemNumber >= itemCount) return ITEM_OUT_OF_RANGE; for ( int i = 0; i < itemCount; i++ ) { items[i]->deselect(); } itemSelected = itemNumber; if ( itemSelected > -1 ) { aListItem* pItem = GetItem( itemNumber ); if ( pItem ) { pItem->setState( aListItem::SELECTED ); if ( !pItem->isShowing() || pItem->globalY() + pItem->height() > globalY() + height() || pItem->globalY() + pItem->height() < globalY() ) { int newPos = (pItem->globalY() + pItem->height() - globalY()) - scrollBar->height() + scrollBar->GetScrollPos(); scrollBar->SetScroll( newPos );// float itemY = pItem->globalY() + pItem->height(); } } } return NO_ERR; }
void ComponentListItem::render() { aListItem::render(); // draw rects, these aren't children outline.moveTo(globalX(), globalY()); outline.setColor(animations[0].getCurrentColor(animations[0].getState())); outline.render(); iconOutline.moveTo(globalX() + s_templateItem->iconOutline.left() , globalY() + s_templateItem->iconOutline.top()); iconOutline.setColor(animations[0].getCurrentColor(animations[0].getState())); iconOutline.render(); for(size_t i = 0; i < 6; i++) { if(pChildAnims[i]) { int32_t color = pChildAnims[i]->getCurrentColor(pChildAnims[i]->getState()); child(i)->setColor(color); } } if(MechLabScreen::instance()->canAddComponent(pComponent)) { icon.setColor(0xff404040); } else icon.setColor(0xffffffff); }
void aAnimButton::update( const aAnimation& animData ) { if ( !isShowing() ) return; long color = animData.getColor(); if ( animateBmp ) setColor( color, 0 ); if ( animateText ) data.textColors[state] = color; long xPos = animData.getXDelta(); long yPos = animData.getYDelta(); move( xPos, yPos ); if ( bAnimateChildren ) { for ( int i = 0; i < numberOfChildren(); i++ ) pChildren[i]->setColor( color ); } float fXcaleX = animData.getScaleX(); float fScaleY = animData.getScaleX(); if ( fXcaleX != 1.0 && fScaleY != 1.0 ) { float oldWidth = width(); float oldHeight = height(); float oldLeft = globalX(); float oldTop = globalY(); float scaleX = .5 * fXcaleX * width(); float scaleY = .5 * fScaleY * height(); float midX = globalX() + .5 * width(); float midY = globalY() + .5 * height(); float newLeft = midX - scaleX; float newTop = midY - scaleY; moveToNoRecurse( newLeft, newTop ); resize( width() * scaleX, height() * scaleY ); aButton::render(); resize( oldWidth, oldHeight ); moveToNoRecurse( oldLeft, oldTop ); } else aButton::render(); }
void aAnimObject::render( ) { if ( !isShowing() ) return; long color = animInfo.getColor(); float xNewOffset = animInfo.getXDelta()+.5f; float yNewOffset = animInfo.getYDelta()+.5f; move( xNewOffset, yNewOffset ); setColor( color ); float fScaleX = animInfo.getScaleX(); float fScaleY = animInfo.getScaleY(); if ( fScaleX != 1.0 || fScaleY != 1.0 ) { float oldWidth = width()+.5f; float oldHeight = height()+.5f;; float oldLeft = globalX(); float oldTop = globalY(); float scaleX = .5 * fScaleX * width(); float scaleY = .5 * fScaleY * height(); float midX = globalX() + .5 * width(); float midY = globalY() + .5 * height(); float newLeft = midX - scaleX; float newTop = midY - scaleY; moveToNoRecurse( newLeft, newTop ); resize( fScaleX * width(), fScaleY * height() ); aObject::render(); resize( oldWidth, oldHeight ); moveToNoRecurse( oldLeft, oldTop ); } else aObject::render(); move( -xNewOffset, -yNewOffset ); }
bool GameApp::notify(QObject* object, QEvent* event) { if(console.Update(event)) return true; auto eventType(event->type()); switch(eventType) { case QEvent::KeyPress: case QEvent::KeyRelease: { auto keyEvent((QKeyEvent*)event); inputManager.KeyPress(keyEvent->key(), eventType == QEvent::KeyPress); break; } case QEvent::MouseMove: { auto mouseEvent((QMouseEvent*)event); inputManager.MouseMove(mouseEvent->globalX(), mouseEvent->globalY()); break; } case QEvent::MouseButtonPress: case QEvent::MouseButtonRelease: { auto mouseEvent((QMouseEvent*)event); inputManager.MouseButtonPress(mouseEvent->button(), eventType == QEvent::MouseButtonPress); break; } } return QApplication::notify(object, event); }
void mcScrollBar::resize(long w, long h) { aScrollBar::resize(w, h); bottomButton.moveTo( bottomButton.globalX(), globalY() + h - bottomButton.height() - 2 ); scrollTab.moveTo( scrollTab.globalX(), topButton.globalY() + topButton.height() + 1 ); ResizeAreas(); }
void LogisticsScreen::moveTo(int32_t xPos, int32_t yPos) { int32_t xOffset = xPos - globalX(); int32_t yOffset = yPos - globalY(); aObject::init(xPos, yPos, 800, 600); move(xOffset, yOffset); }
void mcScrollButton::render() { if ( isShowing() && state != DISABLED ) { setColor( regularColor ); aButton::render(); GUI_RECT rect = { globalX(), globalY(), globalRight()-1, globalBottom()-1 }; drawEmptyRect( rect, lightEdge, darkEdge ); } }
QPoint GfxCanvasItem::mapTo(GfxCanvasItem *i, const QPoint &p) { qreal x = globalX(); qreal y = globalY(); qreal ix = i->globalX(); qreal iy = i->globalY(); QPoint rv = p; rv.setX(int(rv.x() - ix + x)); rv.setY(int(rv.y() - iy + y)); return rv; }
void ScrollX::ResizeAreas(void) { float range, position; if (scrollMax == 0) return; range = width() - buttons[0]->width() - buttons[1]->width() - buttons[2]->width() - 4.f; // one scrollwidth for buttons, one for tab. 2 for lines at either end. position = range * scrollPos / scrollMax; // center of scroll tab; buttons[2]->moveTo( globalX() + position + buttons[0]->width() + 2, globalY() + 1); }
void DeadPilotListItem::render() { if ( !showWindow ) return; GUI_RECT tmp; tmp.left = globalX(); tmp.right = globalX() + width(); tmp.top = globalY(); tmp.bottom = globalY() + height(); aObject::render(); drawEmptyRect( tmp, s_area->getColor(), s_area->getColor() ); liveIcon->render( globalX() + s_liveIconRect->left(), globalY() + s_liveIconRect->top(), globalX() + s_liveIconRect->left() + s_liveIconRect->width(), globalY() + s_liveIconRect->top() + s_liveIconRect->height() ); tmp.left = globalX() + s_liveIconRect->left(); tmp.top = globalY() + s_liveIconRect->top(); tmp.right = globalX() + s_liveIconRect->left() + s_liveIconRect->width(); tmp.bottom = globalY() + s_liveIconRect->top() + s_liveIconRect->height(); drawEmptyRect( tmp, s_liveIconRect->getColor(), s_liveIconRect->getColor() ); deadIcon->render( globalX() + s_deadIconRect->left(), globalY() + s_deadIconRect->top(), globalX() + s_deadIconRect->left() + s_deadIconRect->width(), globalY() + s_deadIconRect->top() + s_deadIconRect->height() ); tmp.left = globalX() + s_deadIconRect->left(); tmp.top = globalY() + s_deadIconRect->top(); tmp.right = globalX() + s_deadIconRect->left() + s_deadIconRect->width(); tmp.bottom = globalY() + s_deadIconRect->top() + s_deadIconRect->height(); drawEmptyRect( tmp, s_deadIconRect->getColor(), s_deadIconRect->getColor() ); }
void aListBox::scroll( int amount ) { if ( !items || !itemCount ) return; if ( amount < 0 && items[0]->globalY() > globalY() ) // no need to scroll return; else if ( amount > 0 && (items[itemCount-1]->globalY() + items[itemCount-1]->height()) < (globalY() + height() ) ) return; for ( int i = 0; i < itemCount; i++ ) { items[i]->move( 0, -amount ); } }
long aListBox::AddItem(aListItem* add) { if (itemCount >= MAX_LIST_ITEMS) return TOO_MANY_ITEMS; float lastX = globalX() + add->globalX(); float lastY = globalY() + topSkip; if ( itemCount ) { lastY = items[itemCount-1]->globalY() + items[itemCount-1]->height() + skipAmount; } items[itemCount++] = add; add->moveTo( lastX, lastY ); if ( add->globalRight() > globalRight() ) // can't have it hanging over the edge { float shrink = globalRight() - add->globalRight(); add->resize( add->width() + shrink, add->height() ); } if ( scrollBar ) { int itemsTotalHeight = 0; if ( items ) itemsTotalHeight = items[itemCount-1]->bottom() - items[0]->top() + skipAmount; if ( itemsTotalHeight > scrollBar->height() ) scrollBar->SetScrollMax( itemsTotalHeight - scrollBar->height() ); else { scrollBar->SetScroll( 0 ); scrollBar->SetScrollMax( 0 ); } } return itemCount - 1; }
void DockItem::showMenu(const QPoint &menuPos) { if (getMenuContent().isEmpty()) return; hidePreview(true); if (m_dbusMenuManager == nullptr) { m_dbusMenuManager = new DBusMenuManager(this); } QDBusPendingReply<QDBusObjectPath> pr = m_dbusMenuManager->RegisterMenu(); pr.waitForFinished(); if (pr.isValid()) { QDBusObjectPath op = pr.value(); if (m_dbusMenu != nullptr) { m_dbusMenu->deleteLater(); } m_dbusMenu = new DBusMenu(op.path(), this); connect(m_dbusMenu, &DBusMenu::ItemInvoked, this, &DockItem::invokeMenuItem); connect(m_dbusMenu, &DBusMenu::MenuUnregistered, [=] { setHoverable(true); }); QPoint pos = menuPos.isNull() ? QPoint(globalX() + width() / 2, globalY()) : menuPos; QJsonObject targetObj; targetObj.insert("x", QJsonValue(pos.x())); targetObj.insert("y", QJsonValue(pos.y())); targetObj.insert("isDockMenu", QJsonValue(true)); targetObj.insert("menuJsonContent", QJsonValue(getMenuContent())); m_dbusMenu->ShowMenu(QString(QJsonDocument(targetObj).toJson())); setHoverable(false); } }
void DockItem::showPreview(const QPoint &previewPos) { //make sure parentWidget() is valuable befor init hightlight if (!m_highlight && parentWidget()) { initHighlight(); } if (!m_titlePreview->isHidden()) { m_titlePreview->resizeWithContent(); return; } QPoint pos = previewPos.isNull() ? QPoint(globalX() + width() / 2, globalY() - DOCK_PREVIEW_MARGIN) : previewPos; if (getApplet() == NULL) { QString title = getTitle(); if (!title.isEmpty()) { m_titleLabel->setTitle(title); m_titlePreview->setArrowX(-1); //reset position m_titlePreview->setContent(m_titleLabel); m_titlePreview->showPreview(pos.x(), pos.y() + DOCK_PREVIEW_MARGIN - 2 - //minute adjustment m_titlePreview->shadowYOffset() + m_titlePreview->shadowBlurRadius() + m_titlePreview->shadowDistance(), CONTENT_PREVIEW_INTERVAL); } } else { m_titleLabel->setParent(NULL); emit needPreviewShow(pos); } }
void aDropList::render() { if ( showWindow ) { for ( int i = 0; i < pNumberOfChildren; i++ ) { pChildren[i]->render(); } if (0 <= selectionIndex) { aListItem *pListItem = ListBox().GetItem(selectionIndex); if ( pListItem ) { float l, t, w, h; l = pListItem->globalLeft(); t = pListItem->globalTop(); w = pListItem->width(); h = pListItem->height(); float availableWidth = (expandButton.globalLeft() - 1) - (globalLeft() + 1); if ((0 < availableWidth) && (w > availableWidth)) { pListItem->resize(availableWidth, h); } bool bShowing = pListItem->isShowing(); pListItem->moveTo( globalX() + textLeft, globalY() + textTop ); pListItem->showGUIWindow( true ); pListItem->render(); pListItem->moveTo(l, t); pListItem->showGUIWindow( bShowing ); if ((0 < availableWidth) && (w > availableWidth)) { pListItem->resize(w, h); } } } } }
void aButton::init( FitIniFile& buttonFile, const char* str, HGOSFONT3D font ) { textureHandle = 0; long result = buttonFile.seekBlock( str ); if ( result != NO_ERR ) { char errorStr[256]; sprintf( errorStr, "couldn't find button %s", str ); Assert( 0, 0, errorStr ); return; } buttonFile.readIdLong( "ID", data.ID ); buttonFile.readIdString("FileName", data.fileName, 32 ); buttonFile.readIdLong( "HelpCaption", helpHeader ); buttonFile.readIdLong( "HelpDesc", helpID ); buttonFile.readIdLong( "TextID", data.textID ); buttonFile.readIdLong( "TextNormal", data.textColors[0] ); buttonFile.readIdLong( "TextPressed", data.textColors[1] ); buttonFile.readIdLong( "TextDisabled", data.textColors[2] ); buttonFile.readIdBoolean( "Toggle", toggleButton ); buttonFile.readIdBoolean( "outline", data.outline ); long fontID; buttonFile.readIdLong( "Font", fontID ); if ( fontID ) data.textFont = aFont::loadFont( fontID, data.textSize ); else data.textFont = 0; long x, y, width, height; buttonFile.readIdLong( "XLocation", x ); buttonFile.readIdLong( "YLocation", y ); buttonFile.readIdLong( "Width", width ); buttonFile.readIdLong( "Height", height ); buttonFile.readIdLong( "HelpCaption", helpHeader ); buttonFile.readIdLong( "HelpDesc", helpID ); buttonFile.readIdBoolean( "texturesRotated", data.textureRotated ); if ( NO_ERR != buttonFile.readIdLong( "Alignment", data.textAlign ) ) data.textAlign = 2; location[0].x = location[1].x = x; location[0].y = location[3].y = y; location[2].x = location[3].x = x + width; location[1].y = location[2].y = y + height; for ( int j = 0; j < 4; j++ ) { location[j].argb = 0xffffffff; location[j].frgb = 0; location[j].rhw = .5; location[j].u = 0.f; location[j].v = 0.f; location[j].z = 0.f; } if ( 0 == textureHandle && data.fileName && strlen( data.fileName ) ) { char file[256]; strcpy( file, artPath ); strcat( file, data.fileName ); _strlwr( file ); if ( !strstr( data.fileName, ".tga" ) ) strcat( file, ".tga" ); int ID = mcTextureManager->loadTexture( file, gos_Texture_Alpha, 0, 0, 0x2 ); int gosID = mcTextureManager->get_gosTextureHandle( ID ); TEXTUREPTR textureData; gos_LockTexture( gosID, 0, 0, &textureData ); gos_UnLockTexture( gosID ); textureHandle = ID; data.fileWidth = textureData.Width; data.fileHeight = data.fileWidth; } if ( NO_ERR != buttonFile.readIdLong( "UNormal", data.stateCoords[0][0] ) ) data.stateCoords[0][0] = -1.f; if ( NO_ERR != buttonFile.readIdLong( "VNormal", data.stateCoords[0][1] ) ) data.stateCoords[0][1] = -1.f; if ( NO_ERR != buttonFile.readIdLong( "UPressed", data.stateCoords[1][0] ) ) data.stateCoords[1][0] = -1.f; if ( NO_ERR != buttonFile.readIdLong( "VPressed", data.stateCoords[1][1] ) ) data.stateCoords[1][1] = -1.f; if ( NO_ERR != buttonFile.readIdLong( "UDisabled", data.stateCoords[2][0] ) ) data.stateCoords[2][0] = -1.f; if ( NO_ERR != buttonFile.readIdLong( "VDisabled", data.stateCoords[2][1] ) ) data.stateCoords[2][1] = -1.f; if ( NO_ERR != buttonFile.readIdLong( "UAmbiguous", data.stateCoords[3][0] ) ) data.stateCoords[3][0] = -1.f; if ( NO_ERR != buttonFile.readIdLong( "VAmbiguous", data.stateCoords[3][1] ) ) data.stateCoords[3][1] = -1.f; if ( NO_ERR != buttonFile.readIdLong( "UHighlight", data.stateCoords[4][0] ) ) { data.stateCoords[4][0] = data.stateCoords[0][0]; } if ( NO_ERR != buttonFile.readIdLong( "VHighlight", data.stateCoords[4][1] ) ) { data.stateCoords[4][1] = data.stateCoords[0][1]; } buttonFile.readIdLong( "UWidth", data.textureWidth ); buttonFile.readIdLong( "VHeight", data.textureHeight ); if ( data.textID ) buttonFile.readIdBoolean( "TextOutline", data.outlineText ); if ( NO_ERR == buttonFile.readIdLong( "XTextLocation", data.textRect.left ) ) { buttonFile.readIdLong( "YTextLocation", data.textRect.top ); buttonFile.readIdLong( "TextWidth", width ); buttonFile.readIdLong( "TextHeight", height ); data.textRect.right = data.textRect.left + width; data.textRect.bottom = data.textRect.top + height; buttonFile.readIdBoolean( "TextOutline", data.outlineText ); } else { data.textRect.left = x; data.textRect.right = x + width; data.textRect.top = y; data.textRect.bottom = y + height; } char bmpName[256]; strcpy( bmpName, str ); strcat( bmpName, "Bmp" ); char finalName[256]; int counter = 0; while(true) { sprintf( finalName, "%s%ld", bmpName, counter ); if ( NO_ERR != buttonFile.seekBlock( finalName) ) break; aObject* pObject = new aObject; pObject->init( &buttonFile, finalName ); // Dorje is doing this in global coords pObject->move( -globalX(), -globalY() ); addChild( pObject ); counter++; } buttonFile.seekBlock( str ); disable( 0 ); press( 0 ); }
void ActivePilotListItem::render() { if ( !showWindow ) return; float timeOffset = 0; if ( pilot->killedIcons.Count() ) timeOffset += 1.5 + .5 * pilot->killedIcons.Count(); if ( currentTime - timeOffset > 0 ) { medalAwardedText.setColor( s_medalAwardedAnim->getColor( currentTime - timeOffset ) ); if ( currentTime - timeOffset > 1.5 ) { float tmpTime = currentTime - timeOffset - 1.5; for ( int i = 0; i < medalCount; i++ ) { if ( tmpTime > 0.f ) { if ( !medalIcons[i]->isShowing() ) // play sound when it shows up { soundSystem->playDigitalSample( LOG_PILOTMEDAL ); } medalIcons[i]->showGUIWindow( true ); medalTexts[i]->showGUIWindow( true ); } tmpTime -= .5f; } } } else { medalAwardedText.setColor( 0 ); for ( int i = 0; i < medalCount; i++ ) { medalIcons[i]->showGUIWindow( 0 ); medalTexts[i]->showGUIWindow( 0 ); } } if ( medalCount ) timeOffset += (1.5 + .5 * medalCount); if ( currentTime - timeOffset > 0 ) { if ( promotionText.getColor() == 0 && currentTime - timeOffset < .3 && pilot->promotePilot() ) { soundSystem->playDigitalSample( LOG_PROMOTED ); } promotionText.setColor( s_pilotPromotedAnim->getColor( currentTime -timeOffset ) ); } else { promotionText.setColor( 0 ); } bool bCanBeDone = currentTime > flashTime(); aObject::render(); GUI_RECT tmp; tmp.left = s_area->left(); tmp.top = globalY() + s_area->top(); tmp.right = tmp.left + s_area->width(); tmp.bottom = tmp.top + s_area->height(); drawEmptyRect( tmp, s_area->getColor(), s_area->getColor() ); // now do same thing with line.... tmp.right = tmp.left + s_totalWidth; tmp.top -= 12; tmp.bottom = tmp.top + 2; drawRect( tmp, 0xff002f55 ); pilotIcon->render( globalX() + s_iconRect->left(), globalY() + s_iconRect->top(), globalX() + s_iconRect->right(), globalY() + s_iconRect->bottom() ); long color = s_skillAnim->getColor( currentTime ); for ( int i = 0; i < 4; i++ ) { attributeMeters[i].setAddedColorMax( color ); attributeMeters[i].setAddedColorMin( color ); attributeMeters[i].render(globalX(), globalY()); } //for ( i = 0; i < 5; i++ ) for ( i = 0; i < 9; i++ ) //magic 12042011 { tmp = s_outline[i]->getGUI_RECT(); tmp.left += globalX(); tmp.top += globalY(); tmp.right += globalX(); tmp.bottom += globalY(); drawEmptyRect( tmp, s_outline[i]->getColor(), s_outline[i]->getColor() ); } long x = globalX() + s_killIconRect->left(); long y = globalY() + s_killIconRect->top(); int counter = 0; int oldPossible = 2.0 * (currentTime - frameLength - 1.5); int numPossible = 2.0 * (currentTime - 1.5); if ( currentTime - 1.5 < 0 ) numPossible = -1; if (currentTime - 1.5 - frameLength < 0 ) oldPossible = -1; if ( numPossible > 0 && promotionShown && bCanBeDone ) // finish when all of the dead guys are rendered bDone = true; // when adding a new icon, play sound if ( oldPossible != numPossible && numPossible < pilot->killedIcons.Count() ) { soundSystem->playDigitalSample( LOG_KILLMARKER, Stuff::Vector3D(-9999.0f,-9999.0,-9999.0f), true ); } for ( EList< ForceGroupIcon*, ForceGroupIcon* >::EIterator iter = pilot->killedIcons.Begin(); !iter.IsDone(); iter++ ) { if ( counter > numPossible ) break; if ( counter && !(counter % 8) ) { y += s_killIconRect->height() + 1; x = globalX() + s_killIconRect->left(); } (*iter)->renderUnitIcon( x, y, x + s_killIconRect->width(), y + s_killIconRect->height() ); x += s_killIconRect->width() + 1; counter++; } }
void OptionsGraphics::init(long xOffset, long yOffset) { FullPathFileName path; path.init( artPath, "mcl_options_combobox0", ".fit" ); FitIniFile file; if ( NO_ERR !=file.open( path ) ) { char error[256]; sprintf( error, "couldn't open file %s", path ); Assert( 0, 0, error ); return; } getButton( MSG_RESET )->setMessageOnRelease(); resolutionList.init( &file, "PlayerNameComboBox" ); resolutionList.move( globalX(), globalY() ); resolutionList.move( xOffset, yOffset ); resolutionList.ListBox().setOrange( true ); for ( int i = IDS_RESOLUTION0; i < IDS_RESOLUTION9 + 1; i++ ) { if ( 1!=gos_GetMachineInformation( gos_Info_ValidMode, Environment.FullScreenDevice, resModes[i-IDS_RESOLUTION0].xRes, resModes[i-IDS_RESOLUTION0].yRes, resModes[i-IDS_RESOLUTION0].bitDepth) ) { availableMode[i-IDS_RESOLUTION0] = false; } else { char cstr[256]; cLoadString (i, cstr, 255 ); resolutionList.AddItem( cstr, 0xffffffff ); } } file.close(); path.init( artPath, "mcl_options_combobox2", ".fit" ); if ( NO_ERR !=file.open( path ) ) { char error[256]; sprintf( error, "couldn't open file %s", path ); Assert( 0, 0, error ); return; } getButton( MSG_RESET )->setMessageOnRelease(); cardList.init( &file, "PlayerNameComboBox" ); cardList.move( globalX(), globalY() ); cardList.move( xOffset, yOffset ); cardList.ListBox().setOrange( true ); DWORD numDevices = 0; numDevices = gos_GetMachineInformation( gos_Info_NumberDevices ); //Theoretically impossible but config would probably like to know if it happens! if (numDevices <= 0) STOP(("GameOS said there were no video cards in the system!")); long usableCardCount = 0; for (i=0;i<numDevices;i++) { DWORD minTextureRam = 6291456; //If we are a Voodoo 2, we may be a 4/8 or a 4/4. Try allowing a 4/4 to run // and see what happens!! NO good has come of this! /* if ((gos_GetMachineInformation(gos_Info_GetDeviceVendorID,i) == 0x121a) && (gos_GetMachineInformation(gos_Info_GetDeviceDeviceID,i) == 0x0002)) minTextureRam = 4096000; */ if (gos_GetMachineInformation(gos_Info_GetDeviceLocalMemory, i) >= minTextureRam) { char *deviceName = (char*)gos_GetMachineInformation( gos_Info_GetDeviceName, i); //Save name to other string here. cardList.AddItem( deviceName, 0xffffffff ); if ( Environment.FullScreenDevice == i ) cardList.SelectItem( usableCardCount ); usableCardCount++; } } //ALL of this is a lie. Code is now correct but I would ignore this. // Sorry Heidi! // -fs //Turns out, its the same for both. //Environment.Renderer tells you what device you are currently using as follows: // If the value is 0 or 1 you are using the default device or the primary display adapter (One and the same always) // If the value is 2 you are using the second video card. // If the value is 3 you are using BLADE software renderer. //If you set the values to any of the above, you will switch to that device. for ( i = 0; i < buttonCount; i++ ) { buttons[i].setPressFX( LOG_VIDEOBUTTONS ); buttons[i].setHighlightFX( LOG_DIGITALHIGHLIGHT ); buttons[i].setDisabledFX( LOG_WRONGBUTTON ); } move( xOffset, yOffset ); helpTextArrayID = 1; }
int32_t aObject::globalBottom(void) const { return globalY() + (int32_t)height(); }
void aListBox::render() { if ( showWindow ) { bool bTop =0; bool bBottom = 0; gos_SetRenderState( gos_State_Texture, 0 ); gos_SetRenderState(gos_State_Filter, gos_FilterNone); gos_SetRenderState( gos_State_AlphaMode, gos_Alpha_AlphaInvAlpha ); gos_SetRenderState( gos_State_ZCompare, 0 ); gos_SetRenderState( gos_State_ZWrite, 0 ); gos_DrawQuads( location, 4 ); long topHeight = 0; long bottomHeight = 0; bool bItemOutOfRange = 0; for ( int i = 0; i < itemCount; i++ ) { if ( items[i]->globalBottom() > globalTop() && items[i]->globalTop() < globalBottom() ) { items[i]->render(); if ( items[i]->globalTop() < globalTop() ) { topHeight = items[i]->height(); bTop = 1; bItemOutOfRange = true; } if ( items[i]->globalBottom() >= globalBottom() ) { bBottom = 1; if ( !bottomHeight ) bottomHeight = items[i]->height(); bItemOutOfRange = true; } } else { bItemOutOfRange = true; } } // draw black box above this if ( bTop || bBottom ) { GUI_RECT rect = { globalX(), globalY() - topHeight, globalX() + width(), globalY() }; if ( bTop ) drawRect( rect, 0xff000000 ); rect.top = globalY() + height()+1; rect.bottom =globalY() + height() + bottomHeight+2; if ( bBottom ) drawRect( rect, 0xff000000 ); } if ( scrollBar ) { if ( bItemOutOfRange ) { scrollBar->Enable( 1 ); } else scrollBar->Enable( 0 ); scrollBar->render(); } } }