| 1 | // This file is part of Dust Racing 2D. |
| 2 | // Copyright (C) 2012 Jussi Lind <[email protected]> |
| 3 | // |
| 4 | // Dust Racing 2D is free software: you can redistribute it and/or modify |
| 5 | // it under the terms of the GNU General Public License as published by |
| 6 | // the Free Software Foundation, either version 3 of the License, or |
| 7 | // (at your option) any later version. |
| 8 | // Dust Racing 2D is distributed in the hope that it will be useful, |
| 9 | // but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 10 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 11 | // GNU General Public License for more details. |
| 12 | // |
| 13 | // You should have received a copy of the GNU General Public License |
| 14 | // along with Dust Racing 2D. If not, see <http://www.gnu.org/licenses/>. |
| 15 | |
| 16 | #include "credits.hpp" |
| 17 | #include "renderer.hpp" |
| 18 | |
| 19 | #include <MCTextureText> |
| 20 | #include <QObject> // For QObject::tr() |
| 21 | |
| 22 | // Note!!: MSVC requires that this file is saved in "UTF-8 with BOM" format |
| 23 | // in order to make all the wide chars work correctly. On Linux/Unix it doesn't |
| 24 | // matter whether there's a BOM or not. |
| 25 | |
| 26 | std::wstring margin(int width) |
| 27 | { |
| 28 | std::wstring m = L""; |
| 29 | for (int i = 0; i < width; i++) |
| 30 | { |
| 31 | m += L" "; |
| 32 | } |
| 33 | return m; |
| 34 | } |
| 35 | |
| 36 | Credits::Credits(std::string id, int width, int height) |
| 37 | : SurfaceMenu("creditsBack", id, width, height, Menu::Style::VerticalList, true) |
| 38 | { |
| 39 | m_texts = { |
| 40 | MCTextureText(margin(8) + QObject::tr("PROGRAMMING").toUpper().toStdWString() + L"\n\n" + L"Jussi Lind <[email protected]>\n\n"), |
| 41 | |
| 42 | MCTextureText(margin(13) + QObject::tr("GRAPHICS").toUpper().toStdWString() + L"\n\n" + L"Jussi Lind\n\n" + L"Ville Mäkiranta (original graphics)\n\n"), |
| 43 | |
| 44 | MCTextureText(margin(5) + QObject::tr("LEVEL DESIGN").toUpper().toStdWString() + L"\n\n" + L"Jussi Lind\n\n" + L"Wuzzy <[email protected]>\n\n"), |
| 45 | |
| 46 | MCTextureText(margin(14) + QObject::tr("TRANSLATIONS").toUpper().toStdWString() + L"\n\n" + L"Pavel Fric <[email protected]> (cs)\n\n" + L"Wuzzy <[email protected]> (de)\n\n" + L"Paolo Straffi <[email protected]> (it)\n\n" + L"Jussi Lind (fi)\n\n" + L"Rémi Verschelde <[email protected]> (fr)\n\n"), |
| 47 | |
| 48 | MCTextureText(margin(14) + QObject::tr("PATCHES").toUpper().toStdWString() + L"\n\n" + L"Markus Rinne\n\n" + L"Paolo Straffi\n\n" + L"Pavel Fric\n\n" + L"Rémi Verschelde\n\n" + L"Pino Toscano <[email protected]>\n\n" + L"David Carlier <[email protected]>\n\n" + L"Dimitriy Marakasov <[email protected]>\n\n" + L"jarssoft <[email protected]>\n\n"), |
| 49 | |
| 50 | MCTextureText(margin(2) + QObject::tr("SPECIAL THANKS").toUpper().toStdWString() + L"\n\n" + L"Tommi Martela\n\n" |
| 51 | L"Alex Rietveld\n\n" |
| 52 | L"Matthias Mailänder\n") |
| 53 | }; |
| 54 | } |
| 55 | |
| 56 | void Credits::render() |
| 57 | { |
| 58 | SurfaceMenu::render(); |
| 59 | |
| 60 | m_time++; |
| 61 | if (m_time > 120) |
| 62 | { |
| 63 | m_time = 0; |
| 64 | m_textIndex++; |
| 65 | m_textIndex = m_textIndex % m_texts.size(); |
| 66 | } |
| 67 | |
| 68 | auto && text = m_texts.at(m_textIndex); |
| 69 | text.setGlyphSize(20, 20 * height() / 640); |
| 70 | text.render( |
| 71 | x() + width() / 2 - text.width(font()) / 2, |
| 72 | y() + height() / 2 + text.height(font()) / 2, nullptr, font()); |
| 73 | } |