mirror of
https://github.com/glest/glest-source.git
synced 2025-09-02 20:42:34 +02:00
global:reformat source
indent -i2 -nut -bl -bli0 -ppi3 -nce -npsl
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -34,7 +34,10 @@
|
||||
# include <SDL.h>
|
||||
# include "leak_dumper.h"
|
||||
|
||||
namespace Glest{ namespace Game{
|
||||
namespace Glest
|
||||
{
|
||||
namespace Game
|
||||
{
|
||||
|
||||
using Shared::Util::Properties;
|
||||
|
||||
@@ -44,7 +47,8 @@ using Shared::Util::Properties;
|
||||
// Game configuration
|
||||
// =====================================================
|
||||
|
||||
enum ConfigType {
|
||||
enum ConfigType
|
||||
{
|
||||
cfgMainGame,
|
||||
cfgUserGame,
|
||||
cfgTempGame,
|
||||
@@ -53,7 +57,8 @@ enum ConfigType {
|
||||
cfgTempKeys
|
||||
};
|
||||
|
||||
class Config {
|
||||
class Config
|
||||
{
|
||||
private:
|
||||
|
||||
std::pair < Properties, Properties > properties;
|
||||
@@ -85,43 +90,70 @@ public:
|
||||
protected:
|
||||
|
||||
Config ();
|
||||
Config(std::pair<ConfigType,ConfigType> type, std::pair<string,string> file, std::pair<bool,bool> fileMustExist,string custom_path="");
|
||||
bool tryCustomPath(std::pair<ConfigType,ConfigType> &type, std::pair<string,string> &file, string custom_path);
|
||||
Config (std::pair < ConfigType, ConfigType > type, std::pair < string,
|
||||
string > file, std::pair < bool, bool > fileMustExist,
|
||||
string custom_path = "");
|
||||
bool tryCustomPath (std::pair < ConfigType, ConfigType > &type,
|
||||
std::pair < string, string > &file,
|
||||
string custom_path);
|
||||
static void CopyAll (Config * src, Config * dest);
|
||||
vector<pair<string,string> > getPropertiesFromContainer(const Properties &propertiesObj) const;
|
||||
static bool replaceFileWithLocalFile(const vector<string> &dirList, string fileNamePart, string &resultToReplace);
|
||||
vector < pair < string,
|
||||
string >
|
||||
>getPropertiesFromContainer (const Properties & propertiesObj) const;
|
||||
static bool replaceFileWithLocalFile (const vector < string > &dirList,
|
||||
string fileNamePart,
|
||||
string & resultToReplace);
|
||||
|
||||
public:
|
||||
|
||||
static Config &getInstance(std::pair<ConfigType,ConfigType> type = std::make_pair(cfgMainGame,cfgUserGame) ,
|
||||
std::pair<string,string> file = std::make_pair(glest_ini_filename,glestuser_ini_filename) ,
|
||||
std::pair<bool,bool> fileMustExist = std::make_pair(true,false),string custom_path="" );
|
||||
static Config & getInstance (std::pair < ConfigType, ConfigType > type =
|
||||
std::make_pair (cfgMainGame, cfgUserGame),
|
||||
std::pair < string, string > file =
|
||||
std::make_pair (glest_ini_filename,
|
||||
glestuser_ini_filename),
|
||||
std::pair < bool, bool > fileMustExist =
|
||||
std::make_pair (true, false),
|
||||
string custom_path = "");
|
||||
void save (const string & path = "");
|
||||
void reload ();
|
||||
|
||||
int getInt(const string &key,const char *defaultValueIfNotFound=NULL) const;
|
||||
bool getBool(const string &key,const char *defaultValueIfNotFound=NULL) const;
|
||||
float getFloat(const string &key,const char *defaultValueIfNotFound=NULL) const;
|
||||
const string getString(const string &key,const char *defaultValueIfNotFound=NULL) const;
|
||||
int getInt (const string & key, const char *defaultValueIfNotFound =
|
||||
NULL) const;
|
||||
bool getBool (const string & key, const char *defaultValueIfNotFound =
|
||||
NULL) const;
|
||||
float getFloat (const string & key, const char *defaultValueIfNotFound =
|
||||
NULL) const;
|
||||
const string getString (const string & key,
|
||||
const char *defaultValueIfNotFound =
|
||||
NULL) const;
|
||||
|
||||
int getInt(const char *key,const char *defaultValueIfNotFound=NULL) const;
|
||||
bool getBool(const char *key,const char *defaultValueIfNotFound=NULL) const;
|
||||
float getFloat(const char *key,const char *defaultValueIfNotFound=NULL) const;
|
||||
const string getString(const char *key,const char *defaultValueIfNotFound=NULL) const;
|
||||
int getInt (const char *key, const char *defaultValueIfNotFound =
|
||||
NULL) const;
|
||||
bool getBool (const char *key, const char *defaultValueIfNotFound =
|
||||
NULL) const;
|
||||
float getFloat (const char *key, const char *defaultValueIfNotFound =
|
||||
NULL) const;
|
||||
const string getString (const char *key,
|
||||
const char *defaultValueIfNotFound =
|
||||
NULL) const;
|
||||
//char getCharKey(const char *key) const;
|
||||
SDL_Keycode getSDLKey (const char *key) const;
|
||||
|
||||
void setInt (const string & key, int value, bool tempBuffer = false);
|
||||
void setBool (const string & key, bool value, bool tempBuffer = false);
|
||||
void setFloat(const string &key, float value, bool tempBuffer=false);
|
||||
void setString(const string &key, const string &value, bool tempBuffer=false);
|
||||
void setFloat (const string & key, float value, bool tempBuffer =
|
||||
false);
|
||||
void setString (const string & key, const string & value,
|
||||
bool tempBuffer = false);
|
||||
|
||||
vector<string> getPathListForType(PathType type, string scenarioDir = "");
|
||||
vector < string > getPathListForType (PathType type,
|
||||
string scenarioDir = "");
|
||||
|
||||
vector < pair < string, string > >getMergedProperties () const;
|
||||
vector < pair < string, string > >getMasterProperties () const;
|
||||
vector < pair < string, string > >getUserProperties () const;
|
||||
void setUserProperties(const vector<pair<string,string> > &valueList);
|
||||
void setUserProperties (const vector < pair < string,
|
||||
string > >&valueList);
|
||||
|
||||
string getFileName (bool userFilename) const;
|
||||
|
||||
@@ -129,12 +161,19 @@ public:
|
||||
|
||||
string toString ();
|
||||
|
||||
static string getCustomRuntimeProperty(string key) { return customRuntimeProperties[key]; }
|
||||
static void setCustomRuntimeProperty(string key, string value) { customRuntimeProperties[key] = value; }
|
||||
static string getCustomRuntimeProperty (string key)
|
||||
{
|
||||
return customRuntimeProperties[key];
|
||||
}
|
||||
static void setCustomRuntimeProperty (string key, string value)
|
||||
{
|
||||
customRuntimeProperties[key] = value;
|
||||
}
|
||||
|
||||
static string findValidLocalFileFromPath (string fileName);
|
||||
|
||||
static string getMapPath(const string &mapName, string scenarioDir="", bool errorOnNotFound=true);
|
||||
static string getMapPath (const string & mapName, string scenarioDir =
|
||||
"", bool errorOnNotFound = true);
|
||||
};
|
||||
|
||||
}} //end namespace
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -33,7 +33,10 @@
|
||||
# include "sound_container.h"
|
||||
# include "leak_dumper.h"
|
||||
|
||||
namespace Glest{ namespace Game{
|
||||
namespace Glest
|
||||
{
|
||||
namespace Game
|
||||
{
|
||||
|
||||
using::Shared::Graphics::Texture2D;
|
||||
using::Shared::Graphics::Texture3D;
|
||||
@@ -53,7 +56,8 @@ using ::Shared::Sound::StaticSound;
|
||||
|
||||
class GameSettings;
|
||||
|
||||
class CoreData {
|
||||
class CoreData
|
||||
{
|
||||
private:
|
||||
std::map < int, bool > itemLoadAttempted;
|
||||
|
||||
@@ -123,10 +127,13 @@ private:
|
||||
string battleEndLoseVideoFilenameFallback;
|
||||
string battleEndLoseMusicFilename;
|
||||
|
||||
std::map<std::string,std::vector<FontChangedCallbackInterface *> > registeredFontChangedCallbacks;
|
||||
std::map < std::string,
|
||||
std::vector <
|
||||
FontChangedCallbackInterface * >>registeredFontChangedCallbacks;
|
||||
public:
|
||||
|
||||
enum TextureSystemType {
|
||||
enum TextureSystemType
|
||||
{
|
||||
tsyst_NONE,
|
||||
tsyst_logoTexture,
|
||||
tsyst_backgroundTexture,
|
||||
@@ -210,42 +217,107 @@ public:
|
||||
StaticSound *getWaterSound ();
|
||||
|
||||
// Fonts
|
||||
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;}
|
||||
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;
|
||||
}
|
||||
|
||||
Font3D *getDisplayFont3D() const {return displayFont3D;}
|
||||
Font3D *getDisplayFontSmall3D() const {return displayFontSmall3D;}
|
||||
Font3D *getMenuFontNormal3D() const {return menuFontNormal3D;}
|
||||
Font3D *getMenuFontBig3D() const {return menuFontBig3D;}
|
||||
Font3D *getMenuFontVeryBig3D() const {return menuFontVeryBig3D;}
|
||||
Font3D *getConsoleFont3D() const {return consoleFont3D;}
|
||||
Font3D *getDisplayFont3D () const
|
||||
{
|
||||
return displayFont3D;
|
||||
}
|
||||
Font3D *getDisplayFontSmall3D () const
|
||||
{
|
||||
return displayFontSmall3D;
|
||||
}
|
||||
Font3D *getMenuFontNormal3D () const
|
||||
{
|
||||
return menuFontNormal3D;
|
||||
}
|
||||
Font3D *getMenuFontBig3D () const
|
||||
{
|
||||
return menuFontBig3D;
|
||||
}
|
||||
Font3D *getMenuFontVeryBig3D () const
|
||||
{
|
||||
return menuFontVeryBig3D;
|
||||
}
|
||||
Font3D *getConsoleFont3D () const
|
||||
{
|
||||
return consoleFont3D;
|
||||
}
|
||||
|
||||
// Helper functions
|
||||
string getMainMenuVideoFilename() const { return mainMenuVideoFilename; }
|
||||
string getMainMenuVideoFilename () const
|
||||
{
|
||||
return mainMenuVideoFilename;
|
||||
}
|
||||
bool hasMainMenuVideoFilename () const;
|
||||
string getMainMenuVideoFilenameFallback() const { return mainMenuVideoFilenameFallback; }
|
||||
string getMainMenuVideoFilenameFallback () const
|
||||
{
|
||||
return mainMenuVideoFilenameFallback;
|
||||
}
|
||||
bool hasMainMenuVideoFilenameFallback () const;
|
||||
|
||||
string getIntroVideoFilename() const { return introVideoFilename; }
|
||||
string getIntroVideoFilename () const
|
||||
{
|
||||
return introVideoFilename;
|
||||
}
|
||||
bool hasIntroVideoFilename () const;
|
||||
string getIntroVideoFilenameFallback() const { return introVideoFilenameFallback; }
|
||||
string getIntroVideoFilenameFallback () const
|
||||
{
|
||||
return introVideoFilenameFallback;
|
||||
}
|
||||
bool hasIntroVideoFilenameFallback () const;
|
||||
|
||||
string getBattleEndVideoFilename(bool won) const { return won == true ? battleEndWinVideoFilename : battleEndLoseVideoFilename; }
|
||||
string getBattleEndVideoFilename (bool won) const
|
||||
{
|
||||
return won ==
|
||||
true ? battleEndWinVideoFilename : battleEndLoseVideoFilename;
|
||||
}
|
||||
//bool hasBattleEndVideoFilename(bool won) const;
|
||||
string getBattleEndVideoFilenameFallback(bool won) const { return won == true ? battleEndWinVideoFilenameFallback : battleEndLoseVideoFilenameFallback; }
|
||||
string getBattleEndVideoFilenameFallback (bool won) const
|
||||
{
|
||||
return won ==
|
||||
true ? battleEndWinVideoFilenameFallback :
|
||||
battleEndLoseVideoFilenameFallback;
|
||||
}
|
||||
bool hasBattleEndVideoFilenameFallback (bool won) const;
|
||||
|
||||
string getBattleEndMusicFilename(bool won) const { return won == true ? battleEndWinMusicFilename : battleEndLoseMusicFilename; }
|
||||
string getBattleEndMusicFilename (bool won) const
|
||||
{
|
||||
return won ==
|
||||
true ? battleEndWinMusicFilename : battleEndLoseMusicFilename;
|
||||
}
|
||||
|
||||
void saveGameSettingsToFile(std::string fileName, GameSettings *gameSettings,int advancedIndex=0);
|
||||
bool loadGameSettingsFromFile(std::string fileName, GameSettings *gameSettings);
|
||||
void saveGameSettingsToFile (std::string fileName,
|
||||
GameSettings * gameSettings,
|
||||
int advancedIndex = 0);
|
||||
bool loadGameSettingsFromFile (std::string fileName,
|
||||
GameSettings * gameSettings);
|
||||
|
||||
void registerFontChangedCallback(std::string entityName, FontChangedCallbackInterface *cb);
|
||||
void registerFontChangedCallback (std::string entityName,
|
||||
FontChangedCallbackInterface * cb);
|
||||
void unRegisterFontChangedCallback (std::string entityName);
|
||||
private:
|
||||
|
||||
@@ -262,8 +334,9 @@ private:
|
||||
|
||||
string getDataPath ();
|
||||
void loadTextureIfRequired (Texture2D ** tex, string data_path,
|
||||
string uniqueFilePath, int texSystemId, bool setMipMap,
|
||||
bool setAlpha, bool loadUniqueFilePath,
|
||||
string uniqueFilePath, int texSystemId,
|
||||
bool setMipMap, bool setAlpha,
|
||||
bool loadUniqueFilePath,
|
||||
bool compressionDisabled = false);
|
||||
|
||||
void loadLogoTextureExtraIfRequired ();
|
||||
@@ -272,8 +345,14 @@ private:
|
||||
void loadWaterSoundsIfRequired ();
|
||||
void loadMusicIfRequired ();
|
||||
|
||||
void triggerFontChangedCallbacks(std::string fontUniqueId, Font *font);
|
||||
template<typename T> T * loadFont(Font *menuFontNormal, string menuFontNameNormal, int menuFontNameNormalSize, string fontType, string fontTypeFamily, string fontUniqueKey);
|
||||
void triggerFontChangedCallbacks (std::string fontUniqueId,
|
||||
Font * font);
|
||||
template < typename T > T * loadFont (Font * menuFontNormal,
|
||||
string menuFontNameNormal,
|
||||
int menuFontNameNormalSize,
|
||||
string fontType,
|
||||
string fontTypeFamily,
|
||||
string fontUniqueKey);
|
||||
};
|
||||
|
||||
}} //end namespace
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -20,7 +20,10 @@
|
||||
# include "properties.h"
|
||||
# include "leak_dumper.h"
|
||||
|
||||
namespace Glest{ namespace Game{
|
||||
namespace Glest
|
||||
{
|
||||
namespace Game
|
||||
{
|
||||
|
||||
using Shared::Util::Properties;
|
||||
|
||||
@@ -30,7 +33,8 @@ using Shared::Util::Properties;
|
||||
// String table
|
||||
// =====================================================
|
||||
|
||||
class Lang {
|
||||
class Lang
|
||||
{
|
||||
private:
|
||||
|
||||
bool is_utf8_language;
|
||||
@@ -42,46 +46,71 @@ private:
|
||||
Properties tilesetStrings;
|
||||
Properties tilesetStringsDefault;
|
||||
|
||||
std::map<string, std::map<string, Properties> > techTreeStringsAllLanguages;
|
||||
std::map < string, std::map < string,
|
||||
Properties > >techTreeStringsAllLanguages;
|
||||
string techNameLoaded;
|
||||
bool allowNativeLanguageTechtree;
|
||||
|
||||
private:
|
||||
Lang ();
|
||||
void loadGameStringProperties(string language, Properties &properties, bool fileMustExist,bool fallbackToDefault=false);
|
||||
bool fileMatchesISO630Code(string uselanguage, string testLanguageFile);
|
||||
string getNativeLanguageName(string uselanguage, string testLanguageFile);
|
||||
void loadGameStringProperties (string language, Properties & properties,
|
||||
bool fileMustExist,
|
||||
bool fallbackToDefault = false);
|
||||
bool fileMatchesISO630Code (string uselanguage,
|
||||
string testLanguageFile);
|
||||
string getNativeLanguageName (string uselanguage,
|
||||
string testLanguageFile);
|
||||
|
||||
string parseResult (const string & key, const string & value);
|
||||
|
||||
public:
|
||||
static Lang & getInstance ();
|
||||
|
||||
string getTechNameLoaded() const { return techNameLoaded; }
|
||||
bool getAllowNativeLanguageTechtree() const { return allowNativeLanguageTechtree; }
|
||||
void setAllowNativeLanguageTechtree(bool value) { allowNativeLanguageTechtree = value; }
|
||||
string getTechNameLoaded () const
|
||||
{
|
||||
return techNameLoaded;
|
||||
}
|
||||
bool getAllowNativeLanguageTechtree () const
|
||||
{
|
||||
return allowNativeLanguageTechtree;
|
||||
}
|
||||
void setAllowNativeLanguageTechtree (bool value)
|
||||
{
|
||||
allowNativeLanguageTechtree = value;
|
||||
}
|
||||
|
||||
void loadGameStrings(string uselanguage, bool loadFonts=true, bool fallbackToDefault=false);
|
||||
void loadScenarioStrings(string scenarioDir, string scenarioName, bool isTutorial);
|
||||
void loadGameStrings (string uselanguage, bool loadFonts =
|
||||
true, bool fallbackToDefault = false);
|
||||
void loadScenarioStrings (string scenarioDir, string scenarioName,
|
||||
bool isTutorial);
|
||||
bool loadTechTreeStrings (string techTree, bool forceLoad = false);
|
||||
void loadTilesetStrings (string tileset);
|
||||
|
||||
string getString(const string &s,string uselanguage="", bool fallbackToDefault=false);
|
||||
bool hasString(const string &s, string uselanguage="", bool fallbackToDefault=false);
|
||||
string getString (const string & s, string uselanguage =
|
||||
"", bool fallbackToDefault = false);
|
||||
bool hasString (const string & s, string uselanguage =
|
||||
"", bool fallbackToDefault = false);
|
||||
|
||||
string getScenarioString (const string & s);
|
||||
bool hasScenarioString (const string & s);
|
||||
|
||||
string getTechTreeString(const string &s, const char *defaultValue=NULL);
|
||||
string getTilesetString(const string &s, const char *defaultValue=NULL);
|
||||
string getTechTreeString (const string & s, const char *defaultValue =
|
||||
NULL);
|
||||
string getTilesetString (const string & s, const char *defaultValue =
|
||||
NULL);
|
||||
|
||||
string getLanguage() const { return language; }
|
||||
string getLanguage () const
|
||||
{
|
||||
return language;
|
||||
}
|
||||
bool isLanguageLocal (string compareLanguage) const;
|
||||
//bool isUTF8Language() const;
|
||||
string getDefaultLanguage () const;
|
||||
|
||||
map<string,string> getDiscoveredLanguageList(bool searchKeyIsLangName=false);
|
||||
pair<string,string> getNavtiveNameFromLanguageName(string langName);
|
||||
map < string,
|
||||
string > getDiscoveredLanguageList (bool searchKeyIsLangName = false);
|
||||
pair < string,
|
||||
string > getNavtiveNameFromLanguageName (string langName);
|
||||
|
||||
string getLanguageFile (string uselanguage);
|
||||
};
|
||||
|
@@ -16,38 +16,48 @@
|
||||
|
||||
using namespace std;
|
||||
|
||||
namespace Glest{ namespace Game{
|
||||
namespace Glest
|
||||
{
|
||||
namespace Game
|
||||
{
|
||||
|
||||
|
||||
// =====================================================
|
||||
// class Metrics
|
||||
// =====================================================
|
||||
|
||||
Metrics::Metrics() {
|
||||
Metrics::Metrics ()
|
||||
{
|
||||
reloadData ();
|
||||
}
|
||||
|
||||
void Metrics::reload(int resWidth, int resHeight) {
|
||||
void Metrics::reload (int resWidth, int resHeight)
|
||||
{
|
||||
Metrics *metrics = getInstancePtr ();
|
||||
metrics->reloadData (resWidth, resHeight);
|
||||
}
|
||||
|
||||
void Metrics::reloadData(int resWidth, int resHeight) {
|
||||
void Metrics::reloadData (int resWidth, int resHeight)
|
||||
{
|
||||
Config & config = Config::getInstance ();
|
||||
|
||||
virtualW = 1000;
|
||||
virtualH = 750;
|
||||
|
||||
if(resWidth > 0) {
|
||||
if (resWidth > 0)
|
||||
{
|
||||
screenW = resWidth;
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
screenW = config.getInt ("ScreenWidth");
|
||||
}
|
||||
if(resHeight > 0) {
|
||||
if (resHeight > 0)
|
||||
{
|
||||
screenH = resHeight;
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
screenH = config.getInt ("ScreenHeight");
|
||||
}
|
||||
|
||||
@@ -62,32 +72,40 @@ void Metrics::reloadData(int resWidth, int resHeight) {
|
||||
displayH = 480;
|
||||
}
|
||||
|
||||
Metrics * Metrics::getInstancePtr() {
|
||||
Metrics *Metrics::getInstancePtr ()
|
||||
{
|
||||
static Metrics metrics;
|
||||
return &metrics;
|
||||
}
|
||||
|
||||
const Metrics &Metrics::getInstance(){
|
||||
const Metrics & Metrics::getInstance ()
|
||||
{
|
||||
Metrics *metrics = getInstancePtr ();
|
||||
return *metrics;
|
||||
}
|
||||
|
||||
float Metrics::getAspectRatio() const{
|
||||
if(screenH == 0) {
|
||||
float Metrics::getAspectRatio () const
|
||||
{
|
||||
if (screenH == 0)
|
||||
{
|
||||
throw megaglest_runtime_error ("div by 0 screenH == 0");
|
||||
}
|
||||
return static_cast < float >(screenW) / screenH;
|
||||
}
|
||||
|
||||
int Metrics::toVirtualX(int w) const{
|
||||
if(screenW == 0) {
|
||||
int Metrics::toVirtualX (int w) const
|
||||
{
|
||||
if (screenW == 0)
|
||||
{
|
||||
throw megaglest_runtime_error ("div by 0 screenW == 0");
|
||||
}
|
||||
return w * virtualW / screenW;
|
||||
}
|
||||
|
||||
int Metrics::toVirtualY(int h) const{
|
||||
if(screenH == 0) {
|
||||
int Metrics::toVirtualY (int h) const
|
||||
{
|
||||
if (screenH == 0)
|
||||
{
|
||||
throw megaglest_runtime_error ("div by 0 screenH == 0");
|
||||
}
|
||||
|
||||
@@ -96,20 +114,19 @@ int Metrics::toVirtualY(int h) const{
|
||||
return h * virtualH / screenH;
|
||||
}
|
||||
|
||||
bool Metrics::isInDisplay(int x, int y) const{
|
||||
bool Metrics::isInDisplay (int x, int y) const
|
||||
{
|
||||
return
|
||||
x > displayX &&
|
||||
y > displayY &&
|
||||
x < displayX+displayW &&
|
||||
y < displayY+displayH;
|
||||
y > displayY && x < displayX + displayW && y < displayY + displayH;
|
||||
}
|
||||
|
||||
bool Metrics::isInMinimap(int x, int y) const{
|
||||
bool Metrics::isInMinimap (int x, int y) const
|
||||
{
|
||||
return
|
||||
x > minimapX &&
|
||||
y > minimapY &&
|
||||
x < minimapX+minimapW &&
|
||||
y < minimapY+minimapH;
|
||||
y > minimapY && x < minimapX + minimapW && y < minimapY + minimapH;
|
||||
}
|
||||
|
||||
}}// end namespace
|
||||
}
|
||||
} // end namespace
|
||||
|
@@ -20,13 +20,17 @@
|
||||
# include "config.h"
|
||||
# include "leak_dumper.h"
|
||||
|
||||
namespace Glest{ namespace Game{
|
||||
namespace Glest
|
||||
{
|
||||
namespace Game
|
||||
{
|
||||
|
||||
// =====================================================
|
||||
// class Metrics
|
||||
// =====================================================
|
||||
|
||||
class Metrics{
|
||||
class Metrics
|
||||
{
|
||||
private:
|
||||
int virtualW;
|
||||
int virtualH;
|
||||
@@ -49,18 +53,54 @@ private:
|
||||
public:
|
||||
static const Metrics & getInstance ();
|
||||
|
||||
int getVirtualW() const {return virtualW;}
|
||||
int getVirtualH() const {return virtualH;}
|
||||
int getScreenW() const {return screenW;}
|
||||
int getScreenH() const {return screenH;}
|
||||
int getMinimapX() const {return minimapX;}
|
||||
int getMinimapY() const {return minimapY;}
|
||||
int getMinimapW() const {return minimapW;}
|
||||
int getMinimapH() const {return minimapH;}
|
||||
int getDisplayX() const {return displayX;}
|
||||
int getDisplayY() const {return displayY;}
|
||||
int getDisplayH() const {return displayH;}
|
||||
int getDisplayW() const {return displayW;}
|
||||
int getVirtualW () const
|
||||
{
|
||||
return virtualW;
|
||||
}
|
||||
int getVirtualH () const
|
||||
{
|
||||
return virtualH;
|
||||
}
|
||||
int getScreenW () const
|
||||
{
|
||||
return screenW;
|
||||
}
|
||||
int getScreenH () const
|
||||
{
|
||||
return screenH;
|
||||
}
|
||||
int getMinimapX () const
|
||||
{
|
||||
return minimapX;
|
||||
}
|
||||
int getMinimapY () const
|
||||
{
|
||||
return minimapY;
|
||||
}
|
||||
int getMinimapW () const
|
||||
{
|
||||
return minimapW;
|
||||
}
|
||||
int getMinimapH () const
|
||||
{
|
||||
return minimapH;
|
||||
}
|
||||
int getDisplayX () const
|
||||
{
|
||||
return displayX;
|
||||
}
|
||||
int getDisplayY () const
|
||||
{
|
||||
return displayY;
|
||||
}
|
||||
int getDisplayH () const
|
||||
{
|
||||
return displayH;
|
||||
}
|
||||
int getDisplayW () const
|
||||
{
|
||||
return displayW;
|
||||
}
|
||||
float getAspectRatio () const;
|
||||
|
||||
int toVirtualX (int w) const;
|
||||
|
Reference in New Issue
Block a user