diff options
author | Piotr Dziwinski <piotrdz@gmail.com> | 2013-11-03 13:04:57 +0100 |
---|---|---|
committer | Piotr Dziwinski <piotrdz@gmail.com> | 2013-11-03 13:04:57 +0100 |
commit | f1c5cd5f82d33d5db5033ea28e1d24a13b2e28a2 (patch) | |
tree | b9e7e75a2138875ffed59772a2a1c7cf82b7aaa4 /src/ui | |
parent | ec38c14ee8293b2dc7436e0c06b0c294652c84cc (diff) | |
parent | d8e50e4eeb2dde3e0d228e2bead29d73494f8874 (diff) | |
download | colobot-f1c5cd5f82d33d5db5033ea28e1d24a13b2e28a2.tar.gz colobot-f1c5cd5f82d33d5db5033ea28e1d24a13b2e28a2.tar.bz2 colobot-f1c5cd5f82d33d5db5033ea28e1d24a13b2e28a2.zip |
Colobot Gold 0.1.1-alpha
Diffstat (limited to 'src/ui')
-rw-r--r-- | src/ui/edit.cpp | 8 | ||||
-rw-r--r-- | src/ui/edit.h | 4 | ||||
-rw-r--r-- | src/ui/interface.cpp | 26 | ||||
-rw-r--r-- | src/ui/maindialog.cpp | 11 |
4 files changed, 18 insertions, 31 deletions
diff --git a/src/ui/edit.cpp b/src/ui/edit.cpp index 6fd1735..a187688 100644 --- a/src/ui/edit.cpp +++ b/src/ui/edit.cpp @@ -1144,7 +1144,7 @@ void CEdit::DrawImage(Math::Point pos, std::string name, float width, float dp; std::string filename; - filename = GetProfile().GetUserBasedPath(name, "diagram") + ".png"; + filename = GetProfile().GetUserBasedPath(name, "../icons") + ".png"; m_engine->SetTexture(filename); m_engine->SetState(Gfx::ENG_RSTATE_NORMAL); @@ -1426,7 +1426,7 @@ void CEdit::FreeImage() for (int i = 0 ; i < m_imageTotal; i++ ) { - filename = GetProfile().GetUserBasedPath(m_image[i].name, "diagram") + ".png"; + filename = GetProfile().GetUserBasedPath(m_image[i].name, "../icons") + ".png"; m_engine->DeleteTexture(filename); } } @@ -1436,7 +1436,7 @@ void CEdit::FreeImage() void CEdit::LoadImage(std::string name) { std::string filename; - filename = GetProfile().GetUserBasedPath(name, "diagram") + ".png"; + filename = GetProfile().GetUserBasedPath(name, "../icons") + ".png"; m_engine->LoadTexture(filename); } @@ -1653,7 +1653,7 @@ bool CEdit::ReadText(std::string filename, int addSize) m_image[iIndex].width = iWidth*0.75f; m_text[j] = static_cast<char>(iIndex++); // as an index into m_image - m_format[j] = static_cast<unsigned char>(Gfx::FONT_MASK_IMAGE); + m_format[j] = Gfx::FONT_MASK_IMAGE; j ++; } } diff --git a/src/ui/edit.h b/src/ui/edit.h index acdf72c..9484fc8 100644 --- a/src/ui/edit.h +++ b/src/ui/edit.h @@ -89,7 +89,7 @@ enum OperUndo struct ImageLine { - //! name of the image (without diagram \) + //! name of the image (without icons/) std::string name; //! vertical offset (v texture) float offset; @@ -101,7 +101,7 @@ struct ImageLine struct HyperLink { - //! text file name (without help \) + //! text file name (without help/) std::string name; //! name of the marker std::string marker; diff --git a/src/ui/interface.cpp b/src/ui/interface.cpp index 845579e..ab2c01b 100644 --- a/src/ui/interface.cpp +++ b/src/ui/interface.cpp @@ -29,7 +29,7 @@ CInterface::CInterface() m_engine = Gfx::CEngine::GetInstancePointer(); m_camera = nullptr; - for (int i = 0; i < MAXCONTROL; i++ ) + for (int i = 0; i < MAXCONTROL; i++) { m_table[i] = nullptr; } @@ -47,9 +47,9 @@ CInterface::~CInterface() void CInterface::Flush() { - for (int i = 0; i < MAXCONTROL; i++ ) + for (int i = 0; i < MAXCONTROL; i++) { - if ( m_table[i] != nullptr ) + if (m_table[i] != nullptr) { delete m_table[i]; m_table[i] = nullptr; @@ -71,16 +71,15 @@ int CInterface::GetNextFreeControl() template <typename T> inline T* CInterface::CreateControl(Math::Point pos, Math::Point dim, int icon, EventType eventMsg) { - T* pc; - int index; if (eventMsg == EVENT_NULL) eventMsg = GetUniqueEventType(); - if ((index = GetNextFreeControl()) < 0) + int index = GetNextFreeControl(); + if (index < 0) return nullptr; m_table[index] = new T(); - pc = static_cast<T *>(m_table[index]); + T* pc = static_cast<T *>(m_table[index]); pc->Create(pos, dim, icon, eventMsg); return pc; } @@ -90,11 +89,10 @@ template <typename T> inline T* CInterface::CreateControl(Math::Point pos, Math: CWindow* CInterface::CreateWindows(Math::Point pos, Math::Point dim, int icon, EventType eventMsg) { - CWindow* pc; - int index; if (eventMsg == EVENT_NULL) eventMsg = GetUniqueEventType(); + int index = -1; switch (eventMsg) { case EVENT_WINDOW0: index = 0; break; @@ -114,8 +112,9 @@ CWindow* CInterface::CreateWindows(Math::Point pos, Math::Point dim, int icon, E if (index < 0) return nullptr; + delete m_table[index]; m_table[index] = new CWindow(); - pc = static_cast<CWindow *>(m_table[index]); + CWindow* pc = static_cast<CWindow *>(m_table[index]); pc->Create(pos, dim, icon, eventMsg); return pc; } @@ -207,16 +206,15 @@ CSlider* CInterface::CreateSlider(Math::Point pos, Math::Point dim, int icon, Ev CList* CInterface::CreateList(Math::Point pos, Math::Point dim, int icon, EventType eventMsg, float expand) { - CList* pc; - int index; if (eventMsg == EVENT_NULL) eventMsg = GetUniqueEventType(); - if ((index = GetNextFreeControl()) < 0) + int index = GetNextFreeControl(); + if (index < 0) return nullptr; m_table[index] = new CList(); - pc = static_cast<CList *>(m_table[index]); + CList* pc = static_cast<CList *>(m_table[index]); pc->Create(pos, dim, icon, eventMsg, expand); return pc; } diff --git a/src/ui/maindialog.cpp b/src/ui/maindialog.cpp index defff84..407f8da 100644 --- a/src/ui/maindialog.cpp +++ b/src/ui/maindialog.cpp @@ -1841,17 +1841,6 @@ pos.y -= 0.048f; pe->SetFontSize(Gfx::FONT_SIZE_SMALL); pe->ReadText(std::string("help/") + m_app->GetLanguageChar() + std::string("/authors.txt")); - pos.x = 80.0f/640.0f; - pos.y = 140.0f/480.0f; - ddim.x = 490.0f/640.0f; - ddim.y = 100.0f/480.0f; - pe = pw->CreateEdit(pos, ddim, 0, EVENT_EDIT2); - pe->SetGenericMode(true); - pe->SetEditCap(false); - pe->SetHighlightCap(false); - pe->SetFontType(Gfx::FONT_COURIER); - pe->SetFontSize(Gfx::FONT_SIZE_SMALL); - pe->ReadText(std::string("help/") + m_app->GetLanguageChar() + std::string("/licences.txt")); // #endif /* TODO: #if _SCHOOL #if _CEEBOTDEMO |