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?