StDiagnosticsGUI::StDiagnosticsGUI(StDiagnostics* thePlugin) : StGLRootWidget(thePlugin->myResMgr), myPlugin(thePlugin), myLangMap(new StTranslations(thePlugin->myResMgr, StDiagnostics::ST_DRAWER_PLUGIN_NAME)), myGeomWidget(NULL), myFpsWidget(NULL), myCntWidgetLT(NULL), myCntWidgetBR(NULL), myFrameCounter(0) { myGeomWidget = new StGeometryTest(this); // FPS widget myFpsWidget = new StGLFpsLabel(this); myFpsWidget->signals.onBtnClick.connect(myPlugin, &StDiagnostics::doFpsClick); // counters myCntWidgetLT = new StGLTextArea(this, 32, 32, StGLCorner(ST_VCORNER_TOP, ST_HCORNER_LEFT), 128, 32); myCntWidgetBR = new StGLTextArea(this, -32, -32, StGLCorner(ST_VCORNER_BOTTOM, ST_HCORNER_RIGHT), 128, 32); myCntWidgetLT->setupAlignment(StGLTextFormatter::ST_ALIGN_X_CENTER, StGLTextFormatter::ST_ALIGN_Y_CENTER); myCntWidgetBR->setupAlignment(StGLTextFormatter::ST_ALIGN_X_CENTER, StGLTextFormatter::ST_ALIGN_Y_CENTER); myCntWidgetLT->setBorder(true); myCntWidgetBR->setBorder(true); myCntWidgetLT->setBackColor(StGLVec3(0.77f, 0.77f, 0.77f)); myCntWidgetBR->setBackColor(StGLVec3(0.77f, 0.77f, 0.77f)); myCntWidgetLT->setText("0000"); myCntWidgetBR->setText("0000"); }
StGLTableItem::StGLTableItem(StGLTable* theParent) : StGLWidget(theParent, theParent->getItemMargins().left, theParent->getItemMargins().top, StGLCorner(ST_VCORNER_TOP, ST_HCORNER_LEFT), theParent->getRoot()->scale(32), theParent->getRoot()->scale(32)), myColSpan(1), myRowSpan(1) { // }
bool StGLRangeFieldFloat32::stglInit() { if(myValueText != NULL) { return true; } myValueText = new StGLTextArea(this, 0, 0, StGLCorner(ST_VCORNER_CENTER, ST_HCORNER_LEFT), -myRoot->scale(1), myRoot->scale(10)); onValueChange(0.0f); myValueText->setTextColor(StGLVec3(1.0f, 1.0f, 1.0f)); myValueText->setVisibility(true, true); if(!myValueText->stglInitAutoHeightWidth()) { delete myValueText; myValueText = NULL; return false; } myValueText->changeRectPx().right() += myRoot->scale(10); myValueText->setTextWidth(myValueText->getRectPx().width()); myValueText->setupAlignment(StGLTextFormatter::ST_ALIGN_X_RIGHT, StGLTextFormatter::ST_ALIGN_Y_TOP); onValueChange(myTrackValue->getValue()); const GLint aHeight = myValueText->getRectPx().height(); StGLButton* aButDec = new StGLButton(this, 0, 0, "-"); aButDec->setCorner(StGLCorner(ST_VCORNER_CENTER, ST_HCORNER_LEFT)); aButDec->setHeight(aHeight); aButDec->setWidth(myRoot->scale(15)); aButDec->setVisibility(true, true); aButDec->signals.onBtnClick += stSlot(this, &StGLRangeFieldFloat32::doDecrement); myValueText->changeRectPx().moveLeftTo(aButDec->getRectPx().right() - myRoot->scale(5)); StGLButton* aButInc = new StGLButton(this, myValueText->getRectPx().right() + myRoot->scale(5), 0, "+"); aButInc->setCorner(StGLCorner(ST_VCORNER_CENTER, ST_HCORNER_LEFT)); aButInc->setHeight(aHeight); aButInc->setWidth(myRoot->scale(15)); aButInc->setVisibility(true, true); aButInc->signals.onBtnClick += stSlot(this, &StGLRangeFieldFloat32::doIncrement); changeRectPx().right() = getRectPx().left() + aButInc->getRectPx().right(); changeRectPx().bottom() = getRectPx().top() + aHeight; return StGLWidget::stglInit(); }
bool StGLScrollArea::stglInit() { if(!StGLWidget::stglInit()) { return false; } stglResize(); // extend text area to fit whole text StGLTextArea* aText = dynamic_cast<StGLTextArea*> (myChildren.getStart()); if(aText != NULL) { aText->changeRectPx().bottom() = aText->getRectPx().top() + aText->getTextHeight(); if(aText->getRectPx().height() < getRectPx().height()) { aText->setCorner(StGLCorner(ST_VCORNER_CENTER, ST_HCORNER_LEFT)); } } return true; }
StGLRootWidget::StGLRootWidget(const StHandle<StResourceManager>& theResMgr) : StGLWidget(NULL, 0, 0, StGLCorner(ST_VCORNER_TOP, ST_HCORNER_LEFT)), myShareArray(new StGLSharePointer*[10]), myShareSize(10), myResMgr(theResMgr), myScrDispX(0.0f), myLensDist(0.0f), myScrDispXPx(0), myMenuProgram(new StGLMenuProgram()), myTextProgram(new StGLTextProgram()), myTextBorderProgram(new StGLTextBorderProgram()), myIsMobile(false), myScaleGlX(1.0), myScaleGlY(1.0), myScaleGUI(1.0f), myResolution(72), cursorZo(0.0, 0.0), myFocusWidget(NULL), myIsMenuPressed(false), myMenuIconSize(IconSize_16), myClickThreshold(3) { // unify access StGLWidget::myRoot = this; myViewport[0] = 0; myViewport[1] = 0; myViewport[2] = 1; myViewport[3] = 1; // allocate shared resources array for(size_t aResId = 0; aResId < myShareSize; ++aResId) { myShareArray[aResId] = new StGLSharePointer(); } myGlFontMgr = new StGLFontManager(myResolution); myColors[Color_Menu] = StGLVec4(0.855f, 0.855f, 0.855f, 1.0f); myColors[Color_MenuHighlighted] = StGLVec4(0.765f, 0.765f, 0.765f, 1.0f); myColors[Color_MenuClicked] = StGLVec4(0.500f, 0.500f, 0.500f, 1.0f); myColors[Color_MenuText] = StGLVec4(0.000f, 0.000f, 0.000f, 1.0f); myColors[Color_MenuIcon] = StGLVec4(0.000f, 0.000f, 0.000f, 0.8f); myColors[Color_MessageBox] = StGLVec4(0.060f, 0.060f, 0.060f, 1.0f); myColors[Color_MessageText] = StGLVec4(1.000f, 1.000f, 1.000f, 1.0f); myColors[Color_ScrollBar] = StGLVec4(0.765f, 0.765f, 0.765f, 0.8f); myColors[Color_IconActive] = StGLVec4(1.000f, 1.000f, 1.000f, 1.0f); setupTextures(); }
StGLMenu::StGLMenu(StGLWidget* theParent, const int theLeft, const int theTop, const int theOrient, const bool theIsRootMenu) : StGLWidget(theParent, theLeft, theTop, StGLCorner(ST_VCORNER_TOP, ST_HCORNER_LEFT), theParent->getRoot()->scale(32), theParent->getRoot()->scale(32)), myColorVec(getRoot()->getColorForElement(StGLRootWidget::Color_Menu)), myOrient(theOrient), myItemHeight(theParent->getRoot()->scale(theParent->getRoot()->isMobile() ? 40 : 32)), myWidthMin(0), myWidth(0), myIsRootMenu(theIsRootMenu), myIsContextual(false), myIsActive(!theIsRootMenu), myKeepActive(false), myIsInitialized(false), myToDrawBounds(false) { myOpacity = theIsRootMenu || (myOrient == StGLMenu::MENU_ZERO) ? 1.0f : 0.0f; }