MCPcopy Create free account
hub / github.com/BZFlag-Dev/bzflag / resize

Method resize

src/bzflag/ControlPanel.cpp:892–982  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

890
891
892void ControlPanel::resize() {
893 tabs[MessageDebug]->visible = (debugLevel > 0);
894
895 const int tabStyle = BZDB.evalInt("showtabs");
896 showTabs = (tabStyle != 0);
897 tabsOnRight = (tabStyle == 2);
898
899 float radarSpace, radarSize;
900
901 // get important metrics
902 const float w = (float)window.getWidth();
903 const float h = (float)window.getHeight();
904 const float opacity = RENDERER.getPanelOpacity();
905 radarSize = float(window.getHeight() - window.getViewHeight());
906 if (opacity >= 1.0f) {
907 radarSize = float(window.getHeight() - window.getViewHeight());
908 radarSpace = 0.0f;
909 }
910 else {
911 radarSize = h * (14 + RENDERER.getRadarSize()) / 60.0f;
912 radarSpace = 3.0f * w / MinY;
913 }
914
915 // compute areas in pixels x,y,w,h
916 // leave off 1 pixel for the border
917 radarRect.xpos = radarRect.ypos = (int)radarSpace + 1;
918 radarRect.xsize = radarRect.ysize = (int)(radarSize - (radarSpace * 2.0f)) - 2;
919
920 messageRect.xpos = (int)radarSize + 1; // X coord
921 messageRect.ypos = radarRect.ypos; // Y coord
922 messageRect.xsize = (int)(w - radarSize - radarSpace) - 2; // Width
923 messageRect.ysize = radarRect.ysize; // Height
924 if (!BZDB.isTrue("displayRadar") || (BZDBCache::radarLimit <= 0.0f)) {
925 messageRect.xpos = (int)radarSpace + 1;
926 messageRect.xsize = (int)(w - (radarSpace * 2.0f)) - 2;
927 }
928
929 // if radar connected then resize it
930 if (radarRenderer) {
931 radarRenderer->setShape(radarRect.xpos, radarRect.ypos,
932 radarRect.xsize, radarRect.ysize);
933 }
934
935 FontManager& fm = FontManager::instance();
936 if (!fontFace) {
937 fontFace = LocalFontFace::create("consoleFont");
938 }
939 const int faceID = fontFace->getFMFace();
940
941 FontSizer fs = FontSizer(w, h);
942 fontSize = fs.getFontSize(fontFace, "consoleFontSize");
943
944 // tab widths may have changed
945 totalTabWidth = 0;
946 const float charWidth = fm.getStringWidth(faceID, fontSize, "-");
947 for (int t = 0; t < (int)tabs.size(); t++) {
948 Tab* tab = tabs[t];
949 if (!tab->visible) {

Callers 3

loggingCallbackMethod · 0.45
bzdbCallbackMethod · 0.45
resizeCallbackMethod · 0.45

Calls 15

FontSizerClass · 0.85
evalIntMethod · 0.80
getPanelOpacityMethod · 0.80
getViewHeightMethod · 0.80
getRadarSizeMethod · 0.80
isTrueMethod · 0.80
setShapeMethod · 0.80
getFMFaceMethod · 0.80
getStringWidthMethod · 0.80
getStringHeightMethod · 0.80
breakLinesMethod · 0.80
createFunction · 0.50

Tested by

no test coverage detected