summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/app/app.cpp18
-rw-r--r--src/app/app.h13
-rw-r--r--src/app/main.cpp7
-rw-r--r--src/graphics/engine/engine.cpp153
-rw-r--r--src/graphics/engine/engine.h12
-rw-r--r--src/graphics/opengl/gldevice.cpp58
-rw-r--r--src/object/auto/autobase.cpp6
-rw-r--r--src/ui/edit.cpp10
-rw-r--r--src/ui/key.cpp2
-rw-r--r--src/ui/label.cpp4
-rw-r--r--src/ui/list.cpp8
-rw-r--r--src/ui/list.h2
-rw-r--r--src/ui/maindialog.cpp38
-rw-r--r--src/ui/slider.cpp2
-rw-r--r--src/ui/studio.cpp8
15 files changed, 141 insertions, 200 deletions
diff --git a/src/app/app.cpp b/src/app/app.cpp
index 610cdbb..ab02b11 100644
--- a/src/app/app.cpp
+++ b/src/app/app.cpp
@@ -144,7 +144,7 @@ CApplication::~CApplication()
DestroyTimeStamp(m_lastTimeStamp);
}
-bool CApplication::ParseArguments(int argc, char *argv[])
+ParseArgsStatus CApplication::ParseArguments(int argc, char *argv[])
{
bool waitDataDir = false;
bool waitLogLevel = false;
@@ -178,7 +178,7 @@ bool CApplication::ParseArguments(int argc, char *argv[])
else if (arg == "none")
GetLogger()->SetLogLevel(LOG_NONE);
else
- return false;
+ return PARSE_ARGS_FAIL;
continue;
}
@@ -194,7 +194,7 @@ bool CApplication::ParseArguments(int argc, char *argv[])
else if (arg == "pl")
m_language = LANG_POLISH;
else
- return false;
+ return PARSE_ARGS_FAIL;
continue;
}
@@ -216,7 +216,8 @@ bool CApplication::ParseArguments(int argc, char *argv[])
}
else if (arg == "-help")
{
- GetLogger()->Message("COLOBOT\n");
+ GetLogger()->Message("\n");
+ GetLogger()->Message("COLOBOT GOLD pre-alpha\n");
GetLogger()->Message("\n");
GetLogger()->Message("List of available options:\n");
GetLogger()->Message(" -help this help\n");
@@ -224,20 +225,20 @@ bool CApplication::ParseArguments(int argc, char *argv[])
GetLogger()->Message(" -debug enable debug mode (more info printed in logs)\n");
GetLogger()->Message(" -loglevel level set log level to level (one of: trace, debug, info, warn, error, none)\n");
GetLogger()->Message(" -language lang set language (one of: en, de, fr, pl)\n");
- return true;
+ return PARSE_ARGS_HELP;
}
else
{
m_exitCode = 1;
- return false;
+ return PARSE_ARGS_FAIL;
}
}
// Args not given?
if (waitDataDir || waitLogLevel || waitLanguage)
- return false;
+ return PARSE_ARGS_FAIL;
- return true;
+ return PARSE_ARGS_OK;
}
bool CApplication::Create()
@@ -280,6 +281,7 @@ bool CApplication::Create()
break;
}
+ setenv("LANGUAGE", locale.c_str(), 1);
setlocale(LC_ALL, locale.c_str());
std::string trPath = m_dataPath + std::string("/i18n");
diff --git a/src/app/app.h b/src/app/app.h
index 849f441..8848be1 100644
--- a/src/app/app.h
+++ b/src/app/app.h
@@ -146,6 +146,17 @@ struct InputBinding
}
};
+/**
+ * \enum ParseArgsStatus
+ * \brief State of parsing commandline arguments
+ */
+enum ParseArgsStatus
+{
+ PARSE_ARGS_OK = 1, //! < all ok
+ PARSE_ARGS_FAIL = 2, //! < invalid syntax
+ PARSE_ARGS_HELP = 3 //! < -help requested
+};
+
struct ApplicationPrivate;
/**
@@ -201,7 +212,7 @@ public:
public:
//! Parses commandline arguments
- bool ParseArguments(int argc, char *argv[]);
+ ParseArgsStatus ParseArguments(int argc, char *argv[]);
//! Initializes the application
bool Create();
//! Main event loop
diff --git a/src/app/main.cpp b/src/app/main.cpp
index 0d885f7..084ca30 100644
--- a/src/app/main.cpp
+++ b/src/app/main.cpp
@@ -78,11 +78,16 @@ int main(int argc, char *argv[])
CApplication app; // single instance of the application
- if (! app.ParseArguments(argc, argv))
+ ParseArgsStatus status = app.ParseArguments(argc, argv);
+ if (status == PARSE_ARGS_FAIL)
{
SystemDialog(SDT_ERROR, "COLOBOT - Fatal Error", "Invalid commandline arguments!\n");
return app.GetExitCode();
}
+ else if (status == PARSE_ARGS_HELP)
+ {
+ return app.GetExitCode();
+ }
int code = 0;
diff --git a/src/graphics/engine/engine.cpp b/src/graphics/engine/engine.cpp
index af209bd..bd5f60f 100644
--- a/src/graphics/engine/engine.cpp
+++ b/src/graphics/engine/engine.cpp
@@ -139,7 +139,7 @@ Gfx::CEngine::CEngine(CInstanceManager *iMan, CApplication *app)
m_backgroundCloudUp = Gfx::Color();
m_backgroundCloudDown = Gfx::Color();
m_backgroundFull = false;
- m_backgroundQuarter = false;
+ m_backgroundScale = Math::Point(1.0f, 1.0f);
m_overFront = true;
m_overColor = Gfx::Color();
m_overMode = ENG_RSTATE_TCOLOR_BLACK;
@@ -330,24 +330,6 @@ bool Gfx::CEngine::ProcessEvent(const Event &event)
int index = static_cast<int>(m_mouseType);
m_mouseType = static_cast<Gfx::EngineMouseType>( (index + 1) % Gfx::ENG_MOUSE_COUNT );
}
- else if (event.key.key == KEY(F3))
- {
- bool bq = !m_backgroundQuarter;
- SetBackground(bq ? "geneda.png" : "", Gfx::Color(), Gfx::Color(), Gfx::Color(), Gfx::Color(), true, bq);
- }
- else if (event.key.key == KEY(F4))
- {
- m_skyMode = !m_skyMode;
- if (! m_skyMode)
- {
- m_backgroundColorDown = Gfx::Color(0.2f, 0.2f, 0.2f);
- m_backgroundColorUp = Gfx::Color(0.8f, 0.8f, 0.8f);
- }
- else
- {
- m_backgroundColorDown = m_backgroundColorUp = Gfx::Color(0.0f, 0.0f, 0.0f);
- }
- }
}
// By default, pass on all events
@@ -2148,26 +2130,10 @@ bool Gfx::CEngine::LoadAllTextures()
LoadTexture("effect02.png");
LoadTexture("map.png");
- if (m_backgroundQuarter) // image into 4 pieces?
- {
- if (! m_backgroundName.empty())
- {
- for (int i = 0; i < 4; i++)
- m_backgroundQuarterTexs[i] = LoadTexture(m_backgroundQuarterNames[i]);
- }
- else
- {
- for (int i = 0; i < 4; i++)
- m_backgroundQuarterTexs[i].SetInvalid();
- }
- }
+ if (! m_backgroundName.empty())
+ m_backgroundTex = LoadTexture(m_backgroundName);
else
- {
- if (! m_backgroundName.empty())
- m_backgroundFullTex = LoadTexture(m_backgroundName);
- else
- m_backgroundFullTex.SetInvalid();
- }
+ m_backgroundTex.SetInvalid();
if (! m_foregroundName.empty())
m_foregroundTex = LoadTexture(m_foregroundName);
@@ -2446,29 +2412,14 @@ float Gfx::CEngine::GetFogStart(int rank)
return m_fogStart[rank];
}
-std::string QuarterName(const std::string& name, int quarter)
-{
- size_t pos = name.find('.');
- if (pos == std::string::npos)
- return name;
-
- return name.substr(0, pos) + std::string(1, static_cast<char>('a' + quarter)) + name.substr(pos);
-}
-
void Gfx::CEngine::SetBackground(const std::string& name, Gfx::Color up, Gfx::Color down,
Gfx::Color cloudUp, Gfx::Color cloudDown,
- bool full, bool quarter)
+ bool full, Math::Point scale)
{
- if (m_backgroundFullTex.Valid())
+ if (m_backgroundTex.Valid())
{
- DeleteTexture(m_backgroundFullTex);
- m_backgroundFullTex.SetInvalid();
- }
-
- for (int i = 0; i < 4; i++)
- {
- DeleteTexture(m_backgroundQuarterTexs[i]);
- m_backgroundQuarterTexs[i].SetInvalid();
+ DeleteTexture(m_backgroundTex);
+ m_backgroundTex.SetInvalid();
}
m_backgroundName = name;
@@ -2477,28 +2428,15 @@ void Gfx::CEngine::SetBackground(const std::string& name, Gfx::Color up, Gfx::Co
m_backgroundCloudUp = cloudUp;
m_backgroundCloudDown = cloudDown;
m_backgroundFull = full;
- m_backgroundQuarter = quarter;
+ m_backgroundScale = scale;
if (! m_backgroundName.empty())
- {
- if (m_backgroundQuarter)
- {
- for (int i = 0; i < 4; i++)
- {
- m_backgroundQuarterNames[i] = QuarterName(name, i);
- m_backgroundQuarterTexs[i] = LoadTexture(m_backgroundQuarterNames[i]);
- }
- }
- else
- {
- m_backgroundFullTex = LoadTexture(m_backgroundName);
- }
- }
+ m_backgroundTex = LoadTexture(m_backgroundName);
}
void Gfx::CEngine::GetBackground(std::string& name, Gfx::Color& up, Gfx::Color& down,
Gfx::Color& cloudUp, Gfx::Color& cloudDown,
- bool &full, bool &quarter)
+ bool &full, Math::Point& scale)
{
name = m_backgroundName;
up = m_backgroundColorUp;
@@ -2506,7 +2444,7 @@ void Gfx::CEngine::GetBackground(std::string& name, Gfx::Color& up, Gfx::Color&
cloudUp = m_backgroundCloudUp;
cloudDown = m_backgroundCloudDown;
full = m_backgroundFull;
- quarter = m_backgroundQuarter;
+ scale = m_backgroundScale;
}
void Gfx::CEngine::SetForegroundName(const std::string& name)
@@ -3477,10 +3415,16 @@ void Gfx::CEngine::DrawBackgroundGradient(const Gfx::Color& up, const Gfx::Color
AddStatisticTriangle(2);
}
-// Status: PART_TESTED
-void Gfx::CEngine::DrawBackgroundImageQuarter(Math::Point p1, Math::Point p2, const Gfx::Texture &tex)
+// Status: TESTED, VERIFIED
+void Gfx::CEngine::DrawBackgroundImage()
{
- Math::Vector n = Math::Vector(0.0f, 0.0f, -1.0f); // normal
+ Math::Point p1, p2;
+ p1.x = 0.0f;
+ p1.y = 0.0f;
+ p2.x = 1.0f;
+ p2.y = 1.0f;
+
+Math::Vector n = Math::Vector(0.0f, 0.0f, -1.0f); // normal
float u1, u2, v1, v2;
if (m_backgroundFull)
@@ -3489,14 +3433,6 @@ void Gfx::CEngine::DrawBackgroundImageQuarter(Math::Point p1, Math::Point p2, co
v1 = 0.0f;
u2 = 1.0f;
v2 = 1.0f;
-
- if (m_backgroundQuarter)
- {
- u1 += 0.5f/512.0f;
- v1 += 0.5f/384.0f;
- u2 -= 0.5f/512.0f;
- v2 -= 0.5f/384.0f;
- }
}
else
{
@@ -3513,7 +3449,10 @@ void Gfx::CEngine::DrawBackgroundImageQuarter(Math::Point p1, Math::Point p2, co
v2 = v1+h;
}
- SetTexture(tex);
+ u2 *= m_backgroundScale.x;
+ v2 *= m_backgroundScale.y;
+
+ SetTexture(m_backgroundTex);
SetState(Gfx::ENG_RSTATE_OPAQUE_TEXTURE | Gfx::ENG_RSTATE_WRAP);
m_device->SetTransform(Gfx::TRANSFORM_VIEW, m_matViewInterface);
@@ -3532,48 +3471,6 @@ void Gfx::CEngine::DrawBackgroundImageQuarter(Math::Point p1, Math::Point p2, co
AddStatisticTriangle(2);
}
-// Status: TESTED, VERIFIED
-void Gfx::CEngine::DrawBackgroundImage()
-{
- Math::Point p1, p2;
- std::string name;
-
- if (m_backgroundQuarter)
- {
- p1.x = 0.0f;
- p1.y = 0.5f;
- p2.x = 0.5f;
- p2.y = 1.0f;
- DrawBackgroundImageQuarter(p1, p2, m_backgroundQuarterTexs[0]);
-
- p1.x = 0.5f;
- p1.y = 0.5f;
- p2.x = 1.0f;
- p2.y = 1.0f;
- DrawBackgroundImageQuarter(p1, p2, m_backgroundQuarterTexs[1]);
-
- p1.x = 0.0f;
- p1.y = 0.0f;
- p2.x = 0.5f;
- p2.y = 0.5f;
- DrawBackgroundImageQuarter(p1, p2, m_backgroundQuarterTexs[2]);
-
- p1.x = 0.5f;
- p1.y = 0.0f;
- p2.x = 1.0f;
- p2.y = 0.5f;
- DrawBackgroundImageQuarter(p1, p2, m_backgroundQuarterTexs[3]);
- }
- else
- {
- p1.x = 0.0f;
- p1.y = 0.0f;
- p2.x = 1.0f;
- p2.y = 1.0f;
- DrawBackgroundImageQuarter(p1, p2, m_backgroundFullTex);
- }
-}
-
void Gfx::CEngine::DrawPlanet()
{
if (! m_planet->PlanetExist()) return;
diff --git a/src/graphics/engine/engine.h b/src/graphics/engine/engine.h
index 1ce93a3..01a1dee 100644
--- a/src/graphics/engine/engine.h
+++ b/src/graphics/engine/engine.h
@@ -991,10 +991,10 @@ public:
//! Management of the background image to use
void SetBackground(const std::string& name, Gfx::Color up = Gfx::Color(), Gfx::Color down = Gfx::Color(),
Gfx::Color cloudUp = Gfx::Color(), Gfx::Color cloudDown = Gfx::Color(),
- bool full = false, bool quarter = false);
+ bool full = false, Math::Point scale = Math::Point(1.0f, 1.0f));
void GetBackground(std::string& name, Gfx::Color& up, Gfx::Color& down,
Gfx::Color& cloudUp, Gfx::Color& cloudDown,
- bool& full, bool& quarter);
+ bool& full, Math::Point& scale);
//@}
//! Specifies the name of foreground texture
@@ -1154,8 +1154,6 @@ protected:
void DrawBackground();
//! Draws the gradient background
void DrawBackgroundGradient(const Gfx::Color& up, const Gfx::Color& down);
- //! Draws a portion of the image background
- void DrawBackgroundImageQuarter(Math::Point p1, Math::Point p2, const Gfx::Texture &tex);
//! Draws the image background
void DrawBackgroundImage();
//! Draws all the planets
@@ -1290,11 +1288,9 @@ protected:
bool m_firstGroundSpot;
int m_secondTexNum;
bool m_backgroundFull;
- bool m_backgroundQuarter;
+ Math::Point m_backgroundScale;
std::string m_backgroundName;
- std::string m_backgroundQuarterNames[4];
- Gfx::Texture m_backgroundFullTex;
- Gfx::Texture m_backgroundQuarterTexs[4];
+ Gfx::Texture m_backgroundTex;
Gfx::Color m_backgroundColorUp;
Gfx::Color m_backgroundColorDown;
Gfx::Color m_backgroundCloudUp;
diff --git a/src/graphics/opengl/gldevice.cpp b/src/graphics/opengl/gldevice.cpp
index 09efeb3..881e273 100644
--- a/src/graphics/opengl/gldevice.cpp
+++ b/src/graphics/opengl/gldevice.cpp
@@ -436,7 +436,10 @@ Gfx::Texture Gfx::CGLDevice::CreateTexture(ImageData *data, const Gfx::TextureCr
else
glTexParameteri(GL_TEXTURE_2D, GL_GENERATE_MIPMAP, GL_FALSE);
+
+ bool convert = false;
GLenum sourceFormat = 0;
+
if (params.format == Gfx::TEX_IMG_RGB)
{
sourceFormat = GL_RGB;
@@ -461,26 +464,26 @@ Gfx::Texture Gfx::CGLDevice::CreateTexture(ImageData *data, const Gfx::TextureCr
{
if (data->surface->format->Amask != 0)
{
- if ((data->surface->format->Rmask == 0xFF000000) &&
- (data->surface->format->Gmask == 0x00FF0000) &&
- (data->surface->format->Bmask == 0x0000FF00) &&
- (data->surface->format->Amask == 0x000000FF))
+ if ((data->surface->format->Amask == 0xFF000000) &&
+ (data->surface->format->Rmask == 0x00FF0000) &&
+ (data->surface->format->Gmask == 0x0000FF00) &&
+ (data->surface->format->Bmask == 0x000000FF))
{
sourceFormat = GL_BGRA;
result.alpha = true;
}
- else if ((data->surface->format->Bmask == 0xFF000000) &&
- (data->surface->format->Gmask == 0x00FF0000) &&
- (data->surface->format->Rmask == 0x0000FF00) &&
- (data->surface->format->Amask == 0x000000FF))
+ else if ((data->surface->format->Amask == 0xFF000000) &&
+ (data->surface->format->Bmask == 0x00FF0000) &&
+ (data->surface->format->Gmask == 0x0000FF00) &&
+ (data->surface->format->Rmask == 0x000000FF))
{
sourceFormat = GL_RGBA;
result.alpha = true;
}
else
{
- GetLogger()->Error("Auto texture format failed\n");
- return Gfx::Texture(); // other format?
+ sourceFormat = GL_RGBA;
+ convert = true;
}
}
else
@@ -501,16 +504,43 @@ Gfx::Texture Gfx::CGLDevice::CreateTexture(ImageData *data, const Gfx::TextureCr
}
else
{
- GetLogger()->Error("Auto texture format failed\n");
- return Gfx::Texture(); // other format?
+ sourceFormat = GL_RGBA;
+ convert = true;
}
}
}
else
assert(false);
- glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, data->surface->w, data->surface->h,
- 0, sourceFormat, GL_UNSIGNED_BYTE, data->surface->pixels);
+ SDL_Surface* actualSurface = data->surface;
+ SDL_Surface* convertedSurface = nullptr;
+
+ if (convert)
+ {
+ SDL_PixelFormat format;
+ format.BytesPerPixel = 4;
+ format.BitsPerPixel = 32;
+ format.alpha = 0;
+ format.colorkey = 0;
+ format.Aloss = format.Bloss = format.Gloss = format.Rloss = 0;
+ format.Amask = 0xFF000000;
+ format.Ashift = 24;
+ format.Bmask = 0x00FF0000;
+ format.Bshift = 16;
+ format.Gmask = 0x0000FF00;
+ format.Gshift = 8;
+ format.Rmask = 0x000000FF;
+ format.Rshift = 0;
+ format.palette = nullptr;
+ convertedSurface = SDL_ConvertSurface(data->surface, &format, SDL_SWSURFACE);
+ if (convertedSurface != nullptr)
+ actualSurface = convertedSurface;
+ }
+
+ glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, actualSurface->w, actualSurface->h,
+ 0, sourceFormat, GL_UNSIGNED_BYTE, actualSurface->pixels);
+
+ SDL_FreeSurface(convertedSurface);
// Restore the previous state of 1st stage
diff --git a/src/object/auto/autobase.cpp b/src/object/auto/autobase.cpp
index f354f28..d7b3ca1 100644
--- a/src/object/auto/autobase.cpp
+++ b/src/object/auto/autobase.cpp
@@ -1387,8 +1387,6 @@ Error CAutoBase::CheckCloseDoor()
void CAutoBase::BeginTransit()
{
- bool bFull, bQuarter;
-
if ( m_param == PARAM_TRANSIT2 )
{
m_bgBack = "back01.png"; // clouds orange / blue
@@ -1410,7 +1408,9 @@ void CAutoBase::BeginTransit()
m_engine->SetDeepView(2000.0f); // we see very far
m_engine->ApplyChange();
- m_engine->GetBackground(m_bgName, m_bgUp, m_bgDown, m_bgCloudUp, m_bgCloudDown, bFull, bQuarter);
+ Math::Point scale;
+ bool full;
+ m_engine->GetBackground(m_bgName, m_bgUp, m_bgDown, m_bgCloudUp, m_bgCloudDown, full, scale);
m_engine->DeleteTexture(m_bgName);
m_engine->SetBackground(m_bgBack, Gfx::Color(0.0f, 0.0f, 0.0f, 0.0f),
diff --git a/src/ui/edit.cpp b/src/ui/edit.cpp
index f25a77f..8c875b6 100644
--- a/src/ui/edit.cpp
+++ b/src/ui/edit.cpp
@@ -941,7 +941,7 @@ void CEdit::Draw()
for ( j=0 ; j<m_lineIndent[i] ; j++ )
{
char s = '\t'; // line | dotted
- m_engine->GetText()->DrawText(&s, m_fontType, m_fontSize, pos, 1.0f, Gfx::TEXT_ALIGN_RIGHT, 0);
+ m_engine->GetText()->DrawText(&s, m_fontType, m_fontSize, pos, 1.0f, Gfx::TEXT_ALIGN_LEFT, 0);
pos.x += indentLength;
}
}
@@ -1063,7 +1063,7 @@ void CEdit::Draw()
if ( !m_bMulti || !m_bDisplaySpec ) eol = 0;
if ( m_format.size() == 0 )
{
- m_engine->GetText()->DrawText(std::string(m_text+beg), m_fontType, size, ppos, m_dim.x, Gfx::TEXT_ALIGN_RIGHT, eol);
+ m_engine->GetText()->DrawText(std::string(m_text+beg), m_fontType, size, ppos, m_dim.x, Gfx::TEXT_ALIGN_LEFT, eol);
}
else
{
@@ -1072,7 +1072,7 @@ void CEdit::Draw()
size,
ppos,
m_dim.x,
- Gfx::TEXT_ALIGN_RIGHT,
+ Gfx::TEXT_ALIGN_LEFT,
eol);
}
@@ -1104,14 +1104,14 @@ void CEdit::Draw()
if ( m_format.size() == 0 )
{
m_engine->GetText()->SizeText(std::string(m_text+m_lineOffset[i]), m_fontType,
- size, pos, Gfx::TEXT_ALIGN_RIGHT,
+ size, pos, Gfx::TEXT_ALIGN_LEFT,
start, end);
}
else
{
m_engine->GetText()->SizeText(std::string(m_text+m_lineOffset[i]),
std::vector<Gfx::FontMetaChar>(m_format.begin()+m_lineOffset[i], m_format.end()),
- size, pos, Gfx::TEXT_ALIGN_RIGHT,
+ size, pos, Gfx::TEXT_ALIGN_LEFT,
start, end);
}
diff --git a/src/ui/key.cpp b/src/ui/key.cpp
index b38b2f4..ea1b964 100644
--- a/src/ui/key.cpp
+++ b/src/ui/key.cpp
@@ -215,7 +215,7 @@ void CKey::Draw()
pos.x = m_pos.x + (214.0f / 640.0f);
pos.y = m_pos.y + m_dim.y * 0.5f;
pos.y -= h;
- m_engine->GetText()->DrawText(std::string(m_name), m_fontType, m_fontSize, pos, m_dim.x, Gfx::TEXT_ALIGN_RIGHT, 0);
+ m_engine->GetText()->DrawText(std::string(m_name), m_fontType, m_fontSize, pos, m_dim.x, Gfx::TEXT_ALIGN_LEFT, 0);
}
diff --git a/src/ui/label.cpp b/src/ui/label.cpp
index c5da211..d7b9cbe 100644
--- a/src/ui/label.cpp
+++ b/src/ui/label.cpp
@@ -69,9 +69,9 @@ void CLabel::Draw()
pos.y = m_pos.y + m_dim.y / 2.0f;
switch (m_textAlign) {
- case Gfx::TEXT_ALIGN_RIGHT: pos.x = m_pos.x; break;
+ case Gfx::TEXT_ALIGN_LEFT: pos.x = m_pos.x; break;
case Gfx::TEXT_ALIGN_CENTER: pos.x = m_pos.x + m_dim.x / 2.0f; break;
- case Gfx::TEXT_ALIGN_LEFT: pos.x = m_pos.x + m_dim.x; break;
+ case Gfx::TEXT_ALIGN_RIGHT: pos.x = m_pos.x + m_dim.x; break;
}
m_engine->GetText()->DrawText(std::string(m_name), m_fontType, m_fontSize, pos, m_dim.x, m_textAlign, 0);
diff --git a/src/ui/list.cpp b/src/ui/list.cpp
index 68a87b8..5ecebf3 100644
--- a/src/ui/list.cpp
+++ b/src/ui/list.cpp
@@ -43,7 +43,7 @@ CList::CList() : CControl()
for (int i = 0; i < 10; i++) {
m_tabs[i] = 0.0f;
- m_justifs[i] = Gfx::TEXT_ALIGN_RIGHT;
+ m_justifs[i] = Gfx::TEXT_ALIGN_LEFT;
}
m_totalLine = 0;
@@ -128,7 +128,7 @@ bool CList::MoveAdjust()
for (int i = 0; i < m_displayLine; i++) {
m_button[i] = new CButton();
m_button[i]->Create(ppos, ddim, -1, EVENT_NULL);
- m_button[i]->SetTextAlign(Gfx::TEXT_ALIGN_RIGHT);
+ m_button[i]->SetTextAlign(Gfx::TEXT_ALIGN_LEFT);
m_button[i]->SetState(STATE_SIMPLY);
m_button[i]->SetFontType(m_fontType);
m_button[i]->SetFontSize(m_fontSize);
@@ -414,7 +414,7 @@ void CList::Draw()
ppos.y = pos.y + dim.y * 0.5f;
ppos.y -= m_engine->GetText()->GetHeight(m_fontType, m_fontSize) / 2.0f;
ddim.x = dim.x-dim.y;
- DrawCase(m_text[i + m_firstLine], ppos, ddim.x, Gfx::TEXT_ALIGN_RIGHT);
+ DrawCase(m_text[i + m_firstLine], ppos, ddim.x, Gfx::TEXT_ALIGN_LEFT);
} else {
ppos.x = pos.x + dim.y * 0.5f;
ppos.y = pos.y + dim.y * 0.5f;
@@ -504,7 +504,7 @@ void CList::DrawCase(char *text, Math::Point pos, float width, Gfx::TextAlign ju
{
if (justif == Gfx::TEXT_ALIGN_CENTER)
pos.x += width / 2.0f;
- else if (justif == Gfx::TEXT_ALIGN_LEFT)
+ else if (justif == Gfx::TEXT_ALIGN_RIGHT)
pos.x += width;
m_engine->GetText()->DrawText(std::string(text), m_fontType, m_fontSize, pos, width, justif, 0);
}
diff --git a/src/ui/list.h b/src/ui/list.h
index b0bc65b..2408111 100644
--- a/src/ui/list.h
+++ b/src/ui/list.h
@@ -78,7 +78,7 @@ class CList : public CControl
void SetEnable(int i, bool bEnable);
bool GetEnable(int i);
- void SetTabs(int i, float pos, Gfx::TextAlign justif=Gfx::TEXT_ALIGN_CENTER);
+ void SetTabs(int i, float pos, Gfx::TextAlign justif=Gfx::TEXT_ALIGN_LEFT);
float GetTabs(int i);
void ShowSelect(bool bFixed);
diff --git a/src/ui/maindialog.cpp b/src/ui/maindialog.cpp
index e3d1b0a..a2fc733 100644
--- a/src/ui/maindialog.cpp
+++ b/src/ui/maindialog.cpp
@@ -56,7 +56,7 @@ const int KEY_TOTAL = 13; // total number of keys redefinable
#else*/
const int KEY_TOTAL = 21; // total number of keys redefinable
-const int WELCOME_LENGTH = 2.0f;
+const float WELCOME_LENGTH = 2.0f;
@@ -413,12 +413,12 @@ void CMainDialog::ChangePhase(Phase phase)
pl->SetFontType(Gfx::FONT_COURIER);
pl->SetFontSize(8.0f);
- m_engine->SetBackground("inter01.png",
+ m_engine->SetBackground("interface.png",
Gfx::Color(0.0f, 0.0f, 0.0f, 0.0f),
Gfx::Color(0.0f, 0.0f, 0.0f, 0.0f),
Gfx::Color(0.0f, 0.0f, 0.0f, 0.0f),
Gfx::Color(0.0f, 0.0f, 0.0f, 0.0f),
- true, true);
+ true, Math::Point(1.0f, 768.0f / 1024.0f));
m_engine->SetBackForce(true);
}
@@ -535,12 +535,12 @@ void CMainDialog::ChangePhase(Phase phase)
UpdateNameControl();
UpdateNameFace();
- m_engine->SetBackground("inter01.png",
+ m_engine->SetBackground("interface.png",
Gfx::Color(0.0f, 0.0f, 0.0f, 0.0f),
Gfx::Color(0.0f, 0.0f, 0.0f, 0.0f),
Gfx::Color(0.0f, 0.0f, 0.0f, 0.0f),
Gfx::Color(0.0f, 0.0f, 0.0f, 0.0f),
- true, true);
+ true, Math::Point(1.0f, 768.0f / 1024.0f));
m_engine->SetBackForce(true);
}
@@ -987,12 +987,12 @@ void CMainDialog::ChangePhase(Phase phase)
pb = pw->CreateButton(pos, ddim, -1, EVENT_INTERFACE_BACK);
pb->SetState(STATE_SHADOW);
- m_engine->SetBackground("inter01.png",
+ m_engine->SetBackground("interface.png",
Gfx::Color(0.0f, 0.0f, 0.0f, 0.0f),
Gfx::Color(0.0f, 0.0f, 0.0f, 0.0f),
Gfx::Color(0.0f, 0.0f, 0.0f, 0.0f),
Gfx::Color(0.0f, 0.0f, 0.0f, 0.0f),
- true, true);
+ true, Math::Point(1.0f, 768.0f / 1024.0f));
m_engine->SetBackForce(true);
}
@@ -1186,12 +1186,12 @@ void CMainDialog::ChangePhase(Phase phase)
if ( !m_bSimulSetup )
{
- m_engine->SetBackground("inter01.png",
+ m_engine->SetBackground("interface.png",
Gfx::Color(0.0f, 0.0f, 0.0f, 0.0f),
Gfx::Color(0.0f, 0.0f, 0.0f, 0.0f),
Gfx::Color(0.0f, 0.0f, 0.0f, 0.0f),
Gfx::Color(0.0f, 0.0f, 0.0f, 0.0f),
- true, true);
+ true, Math::Point(1.0f, 768.0f / 1024.0f));
m_engine->SetBackForce(true);
}
}
@@ -1728,12 +1728,12 @@ void CMainDialog::ChangePhase(Phase phase)
if ( m_phase == PHASE_READ )
{
- m_engine->SetBackground("inter01.png",
+ m_engine->SetBackground("interface.png",
Gfx::Color(0.0f, 0.0f, 0.0f, 0.0f),
Gfx::Color(0.0f, 0.0f, 0.0f, 0.0f),
Gfx::Color(0.0f, 0.0f, 0.0f, 0.0f),
Gfx::Color(0.0f, 0.0f, 0.0f, 0.0f),
- true, true);
+ true, Math::Point(1.0f, 768.0f / 1024.0f));
m_engine->SetBackForce(true);
}
}
@@ -1778,12 +1778,12 @@ void CMainDialog::ChangePhase(Phase phase)
pl->SetFontSize(12.0f);
pl->SetTextAlign(Gfx::TEXT_ALIGN_CENTER);
- m_engine->SetBackground("inter01.png",
+ m_engine->SetBackground("interface.png",
Gfx::Color(0.0f, 0.0f, 0.0f, 0.0f),
Gfx::Color(0.0f, 0.0f, 0.0f, 0.0f),
Gfx::Color(0.0f, 0.0f, 0.0f, 0.0f),
Gfx::Color(0.0f, 0.0f, 0.0f, 0.0f),
- true, true);
+ true, Math::Point(1.0f, 768.0f / 1024.0f));
m_engine->SetBackForce(true);
m_loadingCounter = 1; // enough time to display!
@@ -1808,7 +1808,7 @@ void CMainDialog::ChangePhase(Phase phase)
Gfx::Color(0.0f, 0.0f, 0.0f, 0.0f),
Gfx::Color(0.0f, 0.0f, 0.0f, 0.0f),
Gfx::Color(0.0f, 0.0f, 0.0f, 0.0f),
- true, false);
+ true, Math::Point(861.0f / 1024.0f, 646.0f / 1024.0f));
m_engine->SetBackForce(true);
}
if ( m_phase == PHASE_WELCOME2 )
@@ -1830,7 +1830,7 @@ void CMainDialog::ChangePhase(Phase phase)
Gfx::Color(0.0f, 0.0f, 0.0f, 0.0f),
Gfx::Color(0.0f, 0.0f, 0.0f, 0.0f),
Gfx::Color(0.0f, 0.0f, 0.0f, 0.0f),
- true, false);
+ true, Math::Point(640.0f / 1024.0f, 480.0f / 512.0f));
m_engine->SetBackForce(true);
}
if ( m_phase == PHASE_WELCOME3 )
@@ -1844,12 +1844,12 @@ void CMainDialog::ChangePhase(Phase phase)
m_engine->SetOverColor(Gfx::Color(0.0f, 0.0f, 0.0f, 0.0f), Gfx::ENG_RSTATE_TCOLOR_WHITE); // TODO: color ok?
m_engine->SetOverFront(true);
- m_engine->SetBackground("epsitece.png",
+ m_engine->SetBackground("epsitec.png",
Gfx::Color(0.0f, 0.0f, 0.0f, 0.0f),
Gfx::Color(0.0f, 0.0f, 0.0f, 0.0f),
Gfx::Color(0.0f, 0.0f, 0.0f, 0.0f),
Gfx::Color(0.0f, 0.0f, 0.0f, 0.0f),
- true, false);
+ true, Math::Point(640.0f / 1024.0f, 480.0f / 512.0f));
m_engine->SetBackForce(true);
}
@@ -1980,12 +1980,12 @@ void CMainDialog::ChangePhase(Phase phase)
pb->SetState(STATE_SHADOW);
// #endif
- m_engine->SetBackground("genere.png",
+ m_engine->SetBackground("generic.png",
Gfx::Color(0.0f, 0.0f, 0.0f, 0.0f),
Gfx::Color(0.0f, 0.0f, 0.0f, 0.0f),
Gfx::Color(0.0f, 0.0f, 0.0f, 0.0f),
Gfx::Color(0.0f, 0.0f, 0.0f, 0.0f),
- true, true);
+ true, Math::Point(1.0f, 768.0f / 1024.0f));
m_engine->SetBackForce(true);
}
diff --git a/src/ui/slider.cpp b/src/ui/slider.cpp
index e32bb96..185ee35 100644
--- a/src/ui/slider.cpp
+++ b/src/ui/slider.cpp
@@ -471,7 +471,7 @@ void CSlider::Draw()
h = m_engine->GetText()->GetHeight(m_fontType, m_fontSize);
pos.x = m_pos.x+m_dim.x+(10.0f/640.0f);
pos.y = m_pos.y+(m_dim.y-h)/2.0f;
- m_engine->GetText()->DrawText(text, m_fontType, m_fontSize, pos, m_dim.x, Gfx::TEXT_ALIGN_RIGHT, 0);
+ m_engine->GetText()->DrawText(text, m_fontType, m_fontSize, pos, m_dim.x, Gfx::TEXT_ALIGN_LEFT, 0);
}
else
{
diff --git a/src/ui/studio.cpp b/src/ui/studio.cpp
index 4bfbb12..809ed0c 100644
--- a/src/ui/studio.cpp
+++ b/src/ui/studio.cpp
@@ -1085,14 +1085,14 @@ void CStudio::StartDialog(StudioDialog type)
{
GetResource(RES_TEXT, RT_IO_LIST, name);
pla = pw->CreateLabel(pos, dim, 0, EVENT_DIALOG_LABEL1, name);
- pla->SetTextAlign(Gfx::TEXT_ALIGN_RIGHT);
+ pla->SetTextAlign(Gfx::TEXT_ALIGN_LEFT);
pli = pw->CreateList(pos, dim, 0, EVENT_DIALOG_LIST);
pli->SetState(STATE_SHADOW);
GetResource(RES_TEXT, RT_IO_NAME, name);
pla = pw->CreateLabel(pos, dim, 0, EVENT_DIALOG_LABEL2, name);
- pla->SetTextAlign(Gfx::TEXT_ALIGN_RIGHT);
+ pla->SetTextAlign(Gfx::TEXT_ALIGN_LEFT);
pe = pw->CreateEdit(pos, dim, 0, EVENT_DIALOG_EDIT);
pe->SetState(STATE_SHADOW);
@@ -1103,7 +1103,7 @@ void CStudio::StartDialog(StudioDialog type)
GetResource(RES_TEXT, RT_IO_DIR, name);
pla = pw->CreateLabel(pos, dim, 0, EVENT_DIALOG_LABEL3, name);
- pla->SetTextAlign(Gfx::TEXT_ALIGN_RIGHT);
+ pla->SetTextAlign(Gfx::TEXT_ALIGN_LEFT);
pc = pw->CreateCheck(pos, dim, 0, EVENT_DIALOG_CHECK1);
GetResource(RES_TEXT, RT_IO_PRIVATE, name);
@@ -1228,7 +1228,7 @@ void CStudio::AdjustDialog()
pli->SetPos(ppos);
pli->SetDim(ddim);
pli->SetTabs(0, ddim.x-(50.0f+130.0f+16.0f)/640.0f);
- pli->SetTabs(1, 50.0f/640.0f, Gfx::TEXT_ALIGN_LEFT);
+ pli->SetTabs(1, 50.0f/640.0f, Gfx::TEXT_ALIGN_RIGHT);
pli->SetTabs(2, 130.0f/640.0f);
//? pli->ShowSelect();
}