mirror of
https://github.com/glest/glest-source.git
synced 2025-02-24 11:42:31 +01:00
fonts can be scaled from options menu and more switches are in glest.ini
helvetica is used for linux fire fix for blacksmith persian elephant chaged a little bit for balance ( I think he is still too strong )
This commit is contained in:
parent
39ea3d4583
commit
d5a55f6a83
@ -27,14 +27,21 @@ FocusArrows=true
|
||||
FogOfWar=true
|
||||
FogOfWarSmoothing=true
|
||||
FogOfWarSmoothingFrameSkip=3
|
||||
FontConsoleBaseSize=18
|
||||
FontConsolePostfix=-*-*-*-*-*-*-*
|
||||
FontConsolePrefix=-*-*-*-*-*-*-
|
||||
FontConsolePrefix=-*-helvetica-*-r-*-*-
|
||||
FontDisplayBaseSize=12
|
||||
FontDisplayPostfix=-*-*-*-*-*-*-*
|
||||
FontDisplayPrefix=-*-*-*-*-*-*-
|
||||
FontDisplayPrefix=-*-helvetica-*-r-*-*-
|
||||
FontDisplaySmallBaseSize=12
|
||||
FontMenuBigBaseSize=20
|
||||
FontMenuBigPostfix=-*-*-*-*-*-*-*
|
||||
FontMenuBigPrefix=-*-*-bold-*-*-*-
|
||||
FontMenuBigPrefix=-*-helvetica-*-r-*-*-
|
||||
FontMenuNormalBaseSize=14
|
||||
FontMenuNormalPostfix=-*-*-*-*-*-*-*
|
||||
FontMenuNormalPrefix=-*-*-*-*-*-*-
|
||||
FontMenuNormalPrefix=-*-helvetica-*-r-*-*-
|
||||
FontMenuVeryBigBaseSize=25
|
||||
FontSizeAdjustment=0
|
||||
Lang=english
|
||||
MaxLights=8
|
||||
NetPlayerName=unknown
|
||||
|
@ -83,25 +83,25 @@ void CoreData::load(){
|
||||
Config &config= Config::getInstance();
|
||||
string displayFontNamePrefix=config.getString("FontDisplayPrefix");
|
||||
string displayFontNamePostfix=config.getString("FontDisplayPostfix");
|
||||
int displayFontSize=computeFontSize(12);
|
||||
int displayFontSize=computeFontSize(config.getInt("FontDisplayBaseSize"));
|
||||
string displayFontName=displayFontNamePrefix+intToStr(displayFontSize)+displayFontNamePostfix;
|
||||
displayFont= renderer.newFont(rsGlobal);
|
||||
displayFont->setType(displayFontName);
|
||||
displayFont->setSize(displayFontSize);
|
||||
|
||||
//menu fonts
|
||||
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->setType(menuFontNameSmall);
|
||||
menuFontSmall->setSize(menuFontNameSmallSize);
|
||||
string displayFontNameSmallPrefix= config.getString("FontDisplayPrefix");
|
||||
string displayFontNameSmallPostfix= config.getString("FontDisplayPostfix");
|
||||
int displayFontNameSmallSize=computeFontSize(config.getInt("FontDisplaySmallBaseSize"));
|
||||
string displayFontNameSmall=displayFontNameSmallPrefix+intToStr(displayFontNameSmallSize)+displayFontNameSmallPostfix;
|
||||
displayFontSmall= renderer.newFont(rsGlobal);
|
||||
displayFontSmall->setType(displayFontNameSmall);
|
||||
displayFontSmall->setSize(displayFontNameSmallSize);
|
||||
|
||||
|
||||
string menuFontNameNormalPrefix= config.getString("FontMenuNormalPrefix");
|
||||
string menuFontNameNormalPostfix= config.getString("FontMenuNormalPostfix");
|
||||
int menuFontNameNormalSize=computeFontSize(14);
|
||||
int menuFontNameNormalSize=computeFontSize(config.getInt("FontMenuNormalBaseSize"));
|
||||
string menuFontNameNormal= menuFontNameNormalPrefix+intToStr(menuFontNameNormalSize)+menuFontNameNormalPostfix;
|
||||
menuFontNormal= renderer.newFont(rsGlobal);
|
||||
menuFontNormal->setType(menuFontNameNormal);
|
||||
@ -111,7 +111,7 @@ void CoreData::load(){
|
||||
|
||||
string menuFontNameBigPrefix= config.getString("FontMenuBigPrefix");
|
||||
string menuFontNameBigPostfix= config.getString("FontMenuBigPostfix");
|
||||
int menuFontNameBigSize=computeFontSize(20);
|
||||
int menuFontNameBigSize=computeFontSize(config.getInt("FontMenuBigBaseSize"));
|
||||
string menuFontNameBig= menuFontNameBigPrefix+intToStr(menuFontNameBigSize)+menuFontNameBigPostfix;
|
||||
menuFontBig= renderer.newFont(rsGlobal);
|
||||
menuFontBig->setType(menuFontNameBig);
|
||||
@ -119,7 +119,7 @@ void CoreData::load(){
|
||||
|
||||
string menuFontNameVeryBigPrefix= config.getString("FontMenuBigPrefix");
|
||||
string menuFontNameVeryBigPostfix= config.getString("FontMenuBigPostfix");
|
||||
int menuFontNameVeryBigSize=computeFontSize(25);
|
||||
int menuFontNameVeryBigSize=computeFontSize(config.getInt("FontMenuVeryBigBaseSize"));
|
||||
string menuFontNameVeryBig= menuFontNameVeryBigPrefix+intToStr(menuFontNameVeryBigSize)+menuFontNameVeryBigPostfix;
|
||||
menuFontVeryBig= renderer.newFont(rsGlobal);
|
||||
menuFontVeryBig->setType(menuFontNameVeryBig);
|
||||
@ -128,7 +128,7 @@ void CoreData::load(){
|
||||
//console font
|
||||
string consoleFontNamePrefix= config.getString("FontConsolePrefix");
|
||||
string consoleFontNamePostfix= config.getString("FontConsolePostfix");
|
||||
int consoleFontNameSize=computeFontSize(12);
|
||||
int consoleFontNameSize=computeFontSize(config.getInt("FontConsoleBaseSize"));
|
||||
string consoleFontName= consoleFontNamePrefix+intToStr(consoleFontNameSize)+consoleFontNamePostfix;
|
||||
consoleFont= renderer.newFont(rsGlobal);
|
||||
consoleFont->setType(consoleFontName);
|
||||
@ -151,13 +151,15 @@ void CoreData::load(){
|
||||
}
|
||||
|
||||
int CoreData::computeFontSize(int size){
|
||||
int screenH= Config::getInstance().getInt("ScreenHeight");
|
||||
Config &config= Config::getInstance();
|
||||
int screenH= config.getInt("ScreenHeight");
|
||||
int rs= size*screenH/1024;
|
||||
if(rs<12){
|
||||
rs= 12;
|
||||
//FontSizeAdjustment
|
||||
rs=rs+config.getInt("FontSizeAdjustment");
|
||||
if(rs<10){
|
||||
rs= 10;
|
||||
}
|
||||
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] fontsize orginal %d calculated:%d \n",__FILE__,__FUNCTION__,__LINE__,size,rs);
|
||||
if(rs==16) rs=15; // 16 is invisible in linux, nobody knows why!?!
|
||||
return rs;
|
||||
}
|
||||
|
||||
|
98
source/glest_game/global/core_data.h
Normal file
98
source/glest_game/global/core_data.h
Normal file
@ -0,0 +1,98 @@
|
||||
// ==============================================================
|
||||
// This file is part of Glest (www.glest.org)
|
||||
//
|
||||
// Copyright (C) 2001-2008 Marti<74>o Figueroa
|
||||
//
|
||||
// You can redistribute this code and/or modify it under
|
||||
// the terms of the GNU General Public License as published
|
||||
// by the Free Software Foundation; either version 2 of the
|
||||
// License, or (at your option) any later version
|
||||
// ==============================================================
|
||||
|
||||
#ifndef _GLEST_GAME_COREDATA_H_
|
||||
#define _GLEST_GAME_COREDATA_H_
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "sound.h"
|
||||
#include "font.h"
|
||||
#include "texture.h"
|
||||
#include "sound_container.h"
|
||||
|
||||
namespace Glest{ namespace Game{
|
||||
|
||||
using Shared::Graphics::Texture2D;
|
||||
using Shared::Graphics::Texture3D;
|
||||
using Shared::Graphics::Font2D;
|
||||
using Shared::Sound::StrSound;
|
||||
using Shared::Sound::StaticSound;
|
||||
|
||||
// =====================================================
|
||||
// class CoreData
|
||||
//
|
||||
/// Data shared ammont all the ProgramStates
|
||||
// =====================================================
|
||||
|
||||
class CoreData{
|
||||
private:
|
||||
StrSound introMusic;
|
||||
StrSound menuMusic;
|
||||
StaticSound clickSoundA;
|
||||
StaticSound clickSoundB;
|
||||
StaticSound clickSoundC;
|
||||
SoundContainer waterSounds;
|
||||
|
||||
Texture2D *logoTexture;
|
||||
Texture2D *backgroundTexture;
|
||||
Texture2D *fireTexture;
|
||||
Texture2D *snowTexture;
|
||||
Texture2D *waterSplashTexture;
|
||||
Texture2D *customTexture;
|
||||
Texture2D *buttonSmallTexture;
|
||||
Texture2D *buttonBigTexture;
|
||||
|
||||
Font2D *displayFont;
|
||||
Font2D *menuFontNormal;
|
||||
Font2D *displayFontSmall;
|
||||
Font2D *menuFontBig;
|
||||
Font2D *menuFontVeryBig;
|
||||
Font2D *consoleFont;
|
||||
|
||||
public:
|
||||
static CoreData &getInstance();
|
||||
~CoreData();
|
||||
|
||||
void load();
|
||||
|
||||
Texture2D *getBackgroundTexture() const {return backgroundTexture;}
|
||||
Texture2D *getFireTexture() const {return fireTexture;}
|
||||
Texture2D *getSnowTexture() const {return snowTexture;}
|
||||
Texture2D *getLogoTexture() const {return logoTexture;}
|
||||
Texture2D *getWaterSplashTexture() const {return waterSplashTexture;}
|
||||
Texture2D *getCustomTexture() const {return customTexture;}
|
||||
Texture2D *getButtonSmallTexture() const {return buttonSmallTexture;}
|
||||
Texture2D *getButtonBigTexture() const {return buttonBigTexture;}
|
||||
|
||||
StrSound *getIntroMusic() {return &introMusic;}
|
||||
StrSound *getMenuMusic() {return &menuMusic;}
|
||||
StaticSound *getClickSoundA() {return &clickSoundA;}
|
||||
StaticSound *getClickSoundB() {return &clickSoundB;}
|
||||
StaticSound *getClickSoundC() {return &clickSoundC;}
|
||||
StaticSound *getWaterSound() {return waterSounds.getRandSound();}
|
||||
|
||||
Font2D *getDisplayFont() const {return displayFont;}
|
||||
Font2D *getDisplayFontSmall() const {return displayFontSmall;}
|
||||
Font2D *getMenuFontNormal() const {return menuFontNormal;}
|
||||
Font2D *getMenuFontBig() const {return menuFontBig;}
|
||||
Font2D *getMenuFontVeryBig() const {return menuFontVeryBig;}
|
||||
Font2D *getConsoleFont() const {return consoleFont;}
|
||||
|
||||
private:
|
||||
CoreData(){};
|
||||
|
||||
int computeFontSize(int size);
|
||||
};
|
||||
|
||||
}} //end namespace
|
||||
|
||||
#endif
|
@ -773,7 +773,7 @@ void Renderer::renderResourceStatus(){
|
||||
glDisable(GL_TEXTURE_2D);
|
||||
|
||||
renderTextShadow(
|
||||
str, CoreData::getInstance().getMenuFontSmall(),
|
||||
str, CoreData::getInstance().getDisplayFontSmall(),
|
||||
j*100+220, metrics.getVirtualH()-30, false);
|
||||
++j;
|
||||
}
|
||||
@ -1747,7 +1747,7 @@ void Renderer::renderDisplay(){
|
||||
display->getProgressBar(),
|
||||
metrics.getDisplayX(),
|
||||
metrics.getDisplayY() + metrics.getDisplayH()-50,
|
||||
coreData.getMenuFontSmall());
|
||||
coreData.getDisplayFontSmall());
|
||||
}
|
||||
|
||||
//up images
|
||||
|
68
source/glest_game/menu/menu_state_graphic_info.cpp
Normal file
68
source/glest_game/menu/menu_state_graphic_info.cpp
Normal file
@ -0,0 +1,68 @@
|
||||
// ==============================================================
|
||||
// This file is part of Glest (www.glest.org)
|
||||
//
|
||||
// Copyright (C) 2001-2005 Marti<74>o Figueroa
|
||||
//
|
||||
// You can redistribute this code and/or modify it under
|
||||
// the terms of the GNU General Public License as published
|
||||
// by the Free Software Foundation; either version 2 of the
|
||||
// License, or (at your option) any later version
|
||||
// ==============================================================
|
||||
|
||||
#include "menu_state_graphic_info.h"
|
||||
|
||||
#include "renderer.h"
|
||||
#include "sound_renderer.h"
|
||||
#include "core_data.h"
|
||||
#include "menu_state_options.h"
|
||||
|
||||
#include "leak_dumper.h"
|
||||
|
||||
namespace Glest{ namespace Game{
|
||||
|
||||
// =====================================================
|
||||
// class MenuStateGraphicInfo
|
||||
// =====================================================
|
||||
|
||||
MenuStateGraphicInfo::MenuStateGraphicInfo(Program *program, MainMenu *mainMenu):
|
||||
MenuState(program, mainMenu, "info")
|
||||
{
|
||||
buttonReturn.init(387, 100, 125);
|
||||
labelInfo.init(100, 700);
|
||||
labelMoreInfo.init(100, 500);
|
||||
labelMoreInfo.setFont(CoreData::getInstance().getDisplayFontSmall());
|
||||
|
||||
Renderer &renderer= Renderer::getInstance();
|
||||
glInfo= renderer.getGlInfo();
|
||||
glMoreInfo= renderer.getGlMoreInfo();
|
||||
}
|
||||
|
||||
void MenuStateGraphicInfo::mouseClick(int x, int y, MouseButton mouseButton){
|
||||
CoreData &coreData= CoreData::getInstance();
|
||||
SoundRenderer &soundRenderer= SoundRenderer::getInstance();
|
||||
|
||||
if(buttonReturn.mouseClick(x,y)){
|
||||
soundRenderer.playFx(coreData.getClickSoundA());
|
||||
mainMenu->setState(new MenuStateOptions(program, mainMenu));
|
||||
}
|
||||
}
|
||||
|
||||
void MenuStateGraphicInfo::mouseMove(int x, int y, const MouseState *ms){
|
||||
buttonReturn.mouseMove(x, y);
|
||||
}
|
||||
|
||||
void MenuStateGraphicInfo::render(){
|
||||
|
||||
Renderer &renderer= Renderer::getInstance();
|
||||
Lang &lang= Lang::getInstance();
|
||||
|
||||
buttonReturn.setText(lang.get("Return"));
|
||||
labelInfo.setText(glInfo);
|
||||
labelMoreInfo.setText(glMoreInfo);
|
||||
|
||||
renderer.renderButton(&buttonReturn);
|
||||
renderer.renderLabel(&labelInfo);
|
||||
renderer.renderLabel(&labelMoreInfo);
|
||||
}
|
||||
|
||||
}}//end namespace
|
@ -108,6 +108,17 @@ MenuStateOptions::MenuStateOptions(Program *program, MainMenu *mainMenu):
|
||||
labelPlayerName.setText(config.getString("NetPlayerName",Socket::getHostName().c_str()));
|
||||
leftline-=30;
|
||||
|
||||
//FontSizeAdjustment
|
||||
labelFontSizeAdjustment.init(leftLabelStart,leftline);
|
||||
labelFontSizeAdjustment.setText(lang.get("FontSizeAdjustment"));
|
||||
|
||||
listFontSizeAdjustment.init(leftColumnStart, leftline, 80);
|
||||
for(int i=-5; i<=5; i+=1){
|
||||
listFontSizeAdjustment.pushBackItem(intToStr(i));
|
||||
}
|
||||
listFontSizeAdjustment.setSelectedItem(intToStr(config.getInt("FontSizeAdjustment")));
|
||||
|
||||
leftline-=30;
|
||||
// server port
|
||||
labelServerPortLabel.init(leftLabelStart,leftline);
|
||||
labelServerPortLabel.setText(lang.get("ServerPort"));
|
||||
@ -259,6 +270,15 @@ void MenuStateOptions::mouseClick(int x, int y, MouseButton mouseButton){
|
||||
showMessageBox(lang.get("RestartNeeded"), lang.get("ResolutionChanged"), false);
|
||||
return;
|
||||
}
|
||||
string currentFontSizeAdjustment=config.getString("FontSizeAdjustment");
|
||||
string selectedFontSizeAdjustment=listFontSizeAdjustment.getSelectedItem();
|
||||
if(currentFontSizeAdjustment!=selectedFontSizeAdjustment){
|
||||
mainMessageBoxState=1;
|
||||
Lang &lang= Lang::getInstance();
|
||||
showMessageBox(lang.get("RestartNeeded"), lang.get("FontSizeAdjustmentChanged"), false);
|
||||
return;
|
||||
}
|
||||
|
||||
saveConfig();
|
||||
mainMenu->setState(new MenuStateRoot(program, mainMenu));
|
||||
}
|
||||
@ -287,6 +307,7 @@ void MenuStateOptions::mouseClick(int x, int y, MouseButton mouseButton){
|
||||
listBoxVolumeAmbient.mouseClick(x, y);
|
||||
listBoxVolumeMusic.mouseClick(x, y);
|
||||
listBoxScreenModes.mouseClick(x, y);
|
||||
listFontSizeAdjustment.mouseClick(x, y);
|
||||
}
|
||||
}
|
||||
|
||||
@ -308,6 +329,7 @@ void MenuStateOptions::mouseMove(int x, int y, const MouseState *ms){
|
||||
listBoxUnitParticles.mouseMove(x, y);
|
||||
listBoxLights.mouseMove(x, y);
|
||||
listBoxScreenModes.mouseMove(x, y);
|
||||
listFontSizeAdjustment.mouseMove(x, y);
|
||||
}
|
||||
|
||||
void MenuStateOptions::keyDown(char key){
|
||||
@ -378,6 +400,8 @@ void MenuStateOptions::render(){
|
||||
renderer.renderListBox(&listBoxScreenModes);
|
||||
renderer.renderLabel(&labelServerPortLabel);
|
||||
renderer.renderLabel(&labelServerPort);
|
||||
renderer.renderListBox(&listFontSizeAdjustment);
|
||||
renderer.renderLabel(&labelFontSizeAdjustment);
|
||||
}
|
||||
}
|
||||
|
||||
@ -403,6 +427,7 @@ void MenuStateOptions::saveConfig(){
|
||||
config.setInt("MaxLights", listBoxLights.getSelectedItemIndex()+1);
|
||||
config.setString("SoundVolumeFx", listBoxVolumeFx.getSelectedItem());
|
||||
config.setString("SoundVolumeAmbient", listBoxVolumeAmbient.getSelectedItem());
|
||||
config.setString("FontSizeAdjustment", listFontSizeAdjustment.getSelectedItem());
|
||||
CoreData::getInstance().getMenuMusic()->setVolume(strToInt(listBoxVolumeMusic.getSelectedItem())/100.f);
|
||||
config.setString("SoundVolumeMusic", listBoxVolumeMusic.getSelectedItem());
|
||||
|
||||
|
@ -59,6 +59,8 @@ private:
|
||||
GraphicLabel labelAudioSection;
|
||||
GraphicLabel labelMiscSection;
|
||||
|
||||
GraphicLabel labelFontSizeAdjustment;
|
||||
GraphicListBox listFontSizeAdjustment;
|
||||
|
||||
GraphicMessageBox mainMessageBox;
|
||||
int mainMessageBoxState;
|
||||
|
Loading…
x
Reference in New Issue
Block a user