@@ -99,28 +99,29 @@ protected void init() {
9999 public void render (DrawContext context , int mouseX , int mouseY , float delta ) {
100100 super .render (context , mouseX , mouseY , delta );
101101
102- Identifier MainText = Identifier .of ("spmhelper" , "titles/spmhelpertextmain.png" );
103- int originalWidth = 932 / 4 ;
104- int originalHeight = 152 / 4 ;
102+ Identifier MainText = Identifier .of ("spmhelper" , "titles/spmhelpertextmain.png" );
103+ int originalWidth = 932 / 4 ;
104+ int originalHeight = 152 / 4 ;
105105
106- // Рассчитываем размер изображения
107- int availableWidth = width - 2 * SCREEN_PADDING ;
108- int imageWidth = Math .min (originalWidth , availableWidth );
109- float scale = (float ) imageWidth / originalWidth ;
110- int imageHeight = (int ) (originalHeight * scale );
106+ // Рассчитываем размер изображения
107+ int availableWidth = width - 2 * SCREEN_PADDING ;
108+ int imageWidth = Math .min (originalWidth , availableWidth );
109+ float scale = (float ) imageWidth / originalWidth ;
110+ int imageHeight = (int ) (originalHeight * scale );
111111
112- // Позиционируем изображение по центру сверху
113- int totalRows = (int ) Math .ceil ((double ) BUTTON_COUNT /
114- Math .max (1 , Math .min (BUTTON_COUNT ,
115- availableWidth / (MIN_BUTTON_WIDTH + HORIZONTAL_SPACING ))));
116- int totalButtonsHeight = totalRows * BUTTON_HEIGHT + (totalRows - 1 ) * VERTICAL_SPACING ;
117- int totalBlockHeight = imageHeight + IMAGE_BOTTOM_MARGIN + totalButtonsHeight ;
118- int startY = (height - totalBlockHeight ) / 2 ;
112+ // Позиционируем изображение по центру сверху
113+ int totalRows = (int ) Math .ceil ((double ) BUTTON_COUNT /
114+ Math .max (1 , Math .min (BUTTON_COUNT ,
115+ availableWidth / (MIN_BUTTON_WIDTH + HORIZONTAL_SPACING ))));
116+ int totalButtonsHeight = totalRows * BUTTON_HEIGHT + (totalRows - 1 ) * VERTICAL_SPACING ;
117+ int totalBlockHeight = imageHeight + IMAGE_BOTTOM_MARGIN + totalButtonsHeight ;
118+ int startY = (height - totalBlockHeight ) / 2 ;
119+
120+ int imageX = (width - imageWidth ) / 2 ;
121+ int imageY = startY ;
119122
120- int imageX = (width - imageWidth ) / 2 ;
121- int imageY = startY ;
123+ context .drawTexture (MainText , imageX , imageY , 0 , 0 , imageWidth , imageHeight , imageWidth , imageHeight );
122124
123- context .drawTexture (MainText , imageX , imageY , 0 , 0 , imageWidth , imageHeight , imageWidth , imageHeight );
124125 }
125126
126127 private void handleButtonClick (int buttonLabel ) {
0 commit comments