new glest ini, font handling changed!!!

"dynamic" fonts for linux ( maybe an error fallback should be added in gl_wrap.cpp if font is not available )
better option menu layout
This commit is contained in:
Titus Tscharntke 2010-04-01 18:59:05 +00:00
parent 05a031cc0e
commit c678d35bdb
4 changed files with 54 additions and 28 deletions

View File

@ -27,12 +27,14 @@ FocusArrows=true
FogOfWar=true FogOfWar=true
FogOfWarSmoothing=true FogOfWarSmoothing=true
FogOfWarSmoothingFrameSkip=3 FogOfWarSmoothingFrameSkip=3
FontConsole=-*-*-*-*-*-*-12-*-*-*-*-*-*-* FontConsolePostfix=-*-*-*-*-*-*-*
FontDisplay=-*-*-*-*-*-*-12-*-*-*-*-*-*-* FontConsolePrefix=-*-*-*-*-*-*-
FontMenuBig=-*-*-bold-*-*-*-16-*-*-*-*-*-*-* FontDisplayPostfix=-*-*-*-*-*-*-*
FontMenuNormal=-*-*-*-*-*-*-12-*-*-*-*-*-*-* FontDisplayPrefix=-*-*-*-*-*-*-
FontMenuSmall=-*-*-*-*-*-*-10-*-*-*-*-*-*-* FontMenuBigPostfix=-*-*-*-*-*-*-*
FontMenuVeryBig=-*-*-bold-*-*-*-20-*-*-*-*-*-*-* FontMenuBigPrefix=-*-*-bold-*-*-*-
FontMenuNormalPostfix=-*-*-*-*-*-*-*
FontMenuNormalPrefix=-*-*-*-*-*-*-
Lang=english Lang=english
MaxLights=3 MaxLights=3
NetPlayerName=SoftCoder NetPlayerName=SoftCoder

View File

@ -81,41 +81,64 @@ void CoreData::load(){
//display font //display font
Config &config= Config::getInstance(); Config &config= Config::getInstance();
string displayFontName= config.getString("FontDisplay"); string displayFontNamePrefix=config.getString("FontDisplayPrefix");
string displayFontNamePostfix=config.getString("FontDisplayPostfix");
int displayFontSize=computeFontSize(15);
string displayFontName=displayFontNamePrefix+intToStr(displayFontSize)+displayFontNamePostfix;
displayFont= renderer.newFont(rsGlobal); displayFont= renderer.newFont(rsGlobal);
displayFont->setType(displayFontName); displayFont->setType(displayFontName);
displayFont->setSize(computeFontSize(15)); displayFont->setSize(displayFontSize);
menuFontSmall=displayFont;
menuFontNormal=displayFont;
menuFontBig=displayFont;
menuFontVeryBig=displayFont;
consoleFont=displayFont;
//menu fonts //menu fonts
string menuFontNameSmall= config.getString("FontMenuSmall"); string menuFontNameSmallPrefix= config.getString("FontMenuNormalPrefix");
string menuFontNameSmallPostfix= config.getString("FontMenuNormalPostfix");
int menuFontNameSmallSize=computeFontSize(12);
string menuFontNameSmall=menuFontNameSmallPrefix+intToStr(menuFontNameSmallSize)+menuFontNameSmallPostfix;
menuFontSmall= renderer.newFont(rsGlobal); menuFontSmall= renderer.newFont(rsGlobal);
menuFontSmall->setType(menuFontNameSmall); menuFontSmall->setType(menuFontNameSmall);
menuFontSmall->setSize(computeFontSize(10)); menuFontSmall->setSize(menuFontNameSmallSize);
string menuFontNameNormal= config.getString("FontMenuNormal");
string menuFontNameNormalPrefix= config.getString("FontMenuNormalPrefix");
string menuFontNameNormalPostfix= config.getString("FontMenuNormalPostfix");
int menuFontNameNormalSize=computeFontSize(13);
string menuFontNameNormal= menuFontNameNormalPrefix+intToStr(menuFontNameNormalSize)+menuFontNameNormalPostfix;
menuFontNormal= renderer.newFont(rsGlobal); menuFontNormal= renderer.newFont(rsGlobal);
menuFontNormal->setType(menuFontNameNormal); menuFontNormal->setType(menuFontNameNormal);
menuFontNormal->setSize(computeFontSize(12)); menuFontNormal->setSize(menuFontNameNormalSize);
menuFontNormal->setWidth(Font::wBold); menuFontNormal->setWidth(Font::wBold);
string menuFontNameBig= config.getString("FontMenuBig");
string menuFontNameBigPrefix= config.getString("FontMenuBigPrefix");
string menuFontNameBigPostfix= config.getString("FontMenuBigPostfix");
int menuFontNameBigSize=computeFontSize(20);
string menuFontNameBig= menuFontNameBigPrefix+intToStr(menuFontNameBigSize)+menuFontNameBigPostfix;
menuFontBig= renderer.newFont(rsGlobal); menuFontBig= renderer.newFont(rsGlobal);
menuFontBig->setType(menuFontNameBig); menuFontBig->setType(menuFontNameBig);
menuFontBig->setSize(computeFontSize(16)); menuFontBig->setSize(menuFontNameBigSize);
string menuFontNameVeryBig= config.getString("FontMenuVeryBig"); string menuFontNameVeryBigPrefix= config.getString("FontMenuBigPrefix");
string menuFontNameVeryBigPostfix= config.getString("FontMenuBigPostfix");
int menuFontNameVeryBigSize=computeFontSize(25);
string menuFontNameVeryBig= menuFontNameVeryBigPrefix+intToStr(menuFontNameVeryBigSize)+menuFontNameVeryBigPostfix;
menuFontVeryBig= renderer.newFont(rsGlobal); menuFontVeryBig= renderer.newFont(rsGlobal);
menuFontVeryBig->setType(menuFontNameVeryBig); menuFontVeryBig->setType(menuFontNameVeryBig);
menuFontVeryBig->setSize(computeFontSize(20)); menuFontVeryBig->setSize(menuFontNameVeryBigSize);
//console font //console font
string consoleFontName= Config::getInstance().getString("FontConsole"); string consoleFontNamePrefix= config.getString("FontConsolePrefix");
string consoleFontNamePostfix= config.getString("FontConsolePostfix");
int consoleFontNameSize=computeFontSize(16);
string consoleFontName= consoleFontNamePrefix+intToStr(consoleFontNameSize)+consoleFontNamePostfix;
consoleFont= renderer.newFont(rsGlobal); consoleFont= renderer.newFont(rsGlobal);
consoleFont->setType(consoleFontName); consoleFont->setType(consoleFontName);
consoleFont->setSize(computeFontSize(16)); consoleFont->setSize(consoleFontNameSize);
//sounds //sounds
clickSoundA.load(dir+"/menu/sound/click_a.wav"); clickSoundA.load(dir+"/menu/sound/click_a.wav");
@ -135,10 +158,11 @@ void CoreData::load(){
int CoreData::computeFontSize(int size){ int CoreData::computeFontSize(int size){
int screenH= Config::getInstance().getInt("ScreenHeight"); int screenH= Config::getInstance().getInt("ScreenHeight");
int rs= size*screenH/750; int rs= size*screenH/1024;
if(rs<12){ if(rs<12){
rs= 12; rs= 12;
} }
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] fontsize orginal %d calculated:%d \n",__FILE__,__FUNCTION__,__LINE__,size,rs);
return rs; return rs;
} }

View File

@ -37,18 +37,17 @@ MenuStateOptions::MenuStateOptions(Program *program, MainMenu *mainMenu):
Shared::Platform::getFullscreenVideoModes(&modeInfos); Shared::Platform::getFullscreenVideoModes(&modeInfos);
activeInputLabel=NULL; activeInputLabel=NULL;
int leftline=640; int leftline=670;
int rightline=640; int rightline=670;
int leftLabelStart=50; int leftLabelStart=250;
int leftColumnStart=leftLabelStart+150; int leftColumnStart=leftLabelStart+150;
int rightLabelStart=500; int rightLabelStart=500;
int rightColumnStart=rightLabelStart+150; int rightColumnStart=rightLabelStart+150;
int buttonRowPos=20; int buttonRowPos=80;
int captionOffset=75; int captionOffset=75;
leftline-=30;
labelAudioSection.init(leftLabelStart+captionOffset, leftline); labelAudioSection.init(leftLabelStart+captionOffset, leftline);
labelAudioSection.setFont(CoreData::getInstance().getMenuFontVeryBig()); labelAudioSection.setFont(CoreData::getInstance().getMenuFontVeryBig());
labelAudioSection.setText(lang.get("Audio")); labelAudioSection.setText(lang.get("Audio"));

View File

@ -88,6 +88,7 @@ void createGlFontBitmaps(uint32 &base, const string &type, int size, int width,
if(display == 0) { if(display == 0) {
throw std::runtime_error("Couldn't create font: display is 0"); throw std::runtime_error("Couldn't create font: display is 0");
} }
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] trying to load font %s\n",__FILE__,__FUNCTION__,__LINE__,type.c_str());
XFontStruct* fontInfo = XLoadQueryFont(display, type.c_str()); XFontStruct* fontInfo = XLoadQueryFont(display, type.c_str());
if(!fontInfo) { if(!fontInfo) {
throw std::runtime_error("Font not found."); throw std::runtime_error("Font not found.");