Author Topic: megaglest source code question?Game Panel problem  (Read 886 times)

小丑遊戲

  • Archer
  • *
  • Posts: 23
    • View Profile
megaglest source code question?Game Panel problem
« on: 21 August 2021, 17:35:26 »
Can I ask questions?
It’s about the Megaglest source code
I modified:
source>glest_game>global>metrics.cpp

void Metrics::reloadData(int resWidth, int resHeight) {

    minimapX= 128;
   minimapY= 10;
   minimapW= 128;
   minimapH= 128;

   displayX= 270;
   displayY= 10;
   displayW= 128;
   displayH= 482;   

source>glest_game>graphics>renderer.cpp

void Renderer::renderDisplay() {

      //   單位名字字串
      renderTextShadow3D(
         display->getTitle().c_str(),
         coreData.getDisplayFont3D(),
         display->getColor(),
         metrics.getDisplayX() + 40,
         metrics.getDisplayY() + metrics.getDisplayH() - 360);

      //   單位基本資訊文字字串
      renderTextShadow3D(
         display->getText().c_str(),
         coreData.getDisplayFont3D(),
         display->getColor(),
         metrics.getDisplayX() +128,
         metrics.getDisplayY() + metrics.getDisplayH() -360);

      //   單位指令資訊文字字串
      renderTextShadow3D(
         display->getInfoText().c_str(),
         coreData.getDisplayFont3D(),
         display->getColor(),
         metrics.getDisplayX()+512,
         metrics.getDisplayY() + Display::infoStringY);

      //   進度條
      if(display->getProgressBar() != -1) {
         renderProgressBar3D(
            display->getProgressBar(),
            metrics.getDisplayX(),
            metrics.getDisplayY() + metrics.getDisplayH()-50,
            coreData.getDisplayFontSmall3D(), 175);
      }
   }
   else {

      //   單位名字字串
      renderTextShadow3D(
         display->getTitle().c_str(),
         coreData.getDisplayFont3D(),
         display->getColor(),
         metrics.getDisplayX()+40,
         metrics.getDisplayY() + metrics.getDisplayH() - 360);

      //   單位基本資訊文字字串
      renderTextShadow3D(
         display->getText().c_str(),
         coreData.getDisplayFont3D(),
         display->getColor(),
         metrics.getDisplayX() +128,
         metrics.getDisplayY() + metrics.getDisplayH() -360);

      //   單位指令資訊文字字串
      renderTextShadow3D(
         display->getInfoText().c_str(),
         coreData.getDisplayFont3D(),
         display->getColor(),
         metrics.getDisplayX()+512,
         metrics.getDisplayY()+Display::infoStringY);

      //   進度條
      if(display->getProgressBar() != -1) {
         renderProgressBar3D(
            display->getProgressBar(),
            metrics.getDisplayX(),
            metrics.getDisplayY() + metrics.getDisplayH()-50,
            coreData.getDisplayFontSmall3D(), 175);
      }
   }

   //   單位圖標
   glEnable(GL_TEXTURE_2D);

   glColor3f(1.f, 1.f, 1.f);
   for(int i=0; i<Display::upCellCount; ++i){
      if(display->getUpImage(i)!=NULL){
         renderQuad(
            metrics.getDisplayX() + display->computeUpX(i),
            metrics.getDisplayY() + display->computeUpY(i)-360,
            display->getUpImageSize(), display->getUpImageSize(), display->getUpImage(i));
      }
   }

    //   單位指令圖標
   for(int i=0; i<Display::downCellCount; ++i){
      if(display->getDownImage(i)!=NULL){
         Vec3f c=display->getDownImageColor(i);
         glColor3f(c.x,c.y,c.z );

         //   dy = 10
         int x= metrics.getDisplayX()+display->computeDownX(i)+300;
         int y= metrics.getDisplayY()+display->computeDownY(i)-160;
         int size= Display::imageSize;

         //   向下選定位置
         if(display->getDownSelectedPos()==i){
            x-= 3;
            y-= 3;
            size+= 6;
         }

         renderQuad(x, y, size, size, display->getDownImage(i));
      }
   }

   //   單位指令圖標位置
   int downPos= display->getDownSelectedPos();
   if(downPos!=Display::invalidPos){
      const Texture2D *texture= display->getDownImage(downPos);
      if(texture!=NULL){
         int x= metrics.getDisplayX()+display->computeDownX(downPos)+303;
         int y= metrics.getDisplayY()+display->computeDownY(downPos)-163;
         int size= Display::imageSize+6;
         renderQuad(x, y, size, size, display->getDownImage(downPos));
      }
    }

The result is like the picture below
The location of the trigger option remains the same.
Which block of code should I start with?




titi

  • MegaGlest Team
  • Airship
  • ********
  • Posts: 4,239
    • View Profile
    • http://www.titusgames.de
Re: megaglest source code question?Game Panel problem
« Reply #1 on: 21 October 2021, 22:45:21 »
Uh I missed this question. I dont understand what you are trying to do. what is the problem?
Try Megaglest! Improved Engine / New factions / New tilesets / New maps / New scenarios

 

anything