ResidualVM logo ResidualVM website - Forums - Contact us BuildBot - Doxygen - Wiki curved edge

rendermode.cpp

Go to the documentation of this file.
00001 /* ScummVM - Graphic Adventure Engine
00002  *
00003  * ScummVM is the legal property of its developers, whose names
00004  * are too numerous to list here. Please refer to the COPYRIGHT
00005  * file distributed with this source distribution.
00006  *
00007  * This program is free software; you can redistribute it and/or
00008  * modify it under the terms of the GNU General Public License
00009  * as published by the Free Software Foundation; either version 2
00010  * of the License, or (at your option) any later version.
00011  *
00012  * This program is distributed in the hope that it will be useful,
00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015  * GNU General Public License for more details.
00016  *
00017  * You should have received a copy of the GNU General Public License
00018  * along with this program; if not, write to the Free Software
00019  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00020  *
00021  */
00022 
00023 #include "common/rendermode.h"
00024 
00025 #include "common/gui_options.h"
00026 #include "common/str.h"
00027 #include "common/translation.h"
00028 
00029 
00030 namespace Common {
00031 
00032 
00033 const RenderModeDescription g_renderModes[] = {
00034     // I18N: Hercules is graphics card name
00035     { "hercGreen", _s("Hercules Green"), kRenderHercG },
00036     { "hercAmber", _s("Hercules Amber"), kRenderHercA },
00037     { "cga", "CGA", kRenderCGA },
00038     { "ega", "EGA", kRenderEGA },
00039     { "vga", "VGA", kRenderVGA },
00040     { "amiga", "Amiga", kRenderAmiga },
00041     { "fmtowns", "FM-TOWNS", kRenderFMTowns },
00042     { "pc9821", _s("PC-9821 (256 Colors)"), kRenderPC9821 },
00043     { "pc9801", _s("PC-9801 (16 Colors)"), kRenderPC9801 },
00044     { "2gs", "Apple IIgs", kRenderApple2GS },
00045     { "atari", "Atari ST", kRenderAtariST },
00046     { "macintosh", "Macintosh", kRenderMacintosh },
00047     {nullptr, nullptr, kRenderDefault}
00048 };
00049 
00050 struct RenderGUIOMapping {
00051     RenderMode id;
00052     const char *guio;
00053 };
00054 
00055 // TODO: Merge s_renderGUIOMapping into g_renderModes? the kRenderDefault
00056 // could be used to indicate "any" mode when passed to renderMode2GUIO (if
00057 // we wanted to merge allRenderModesGUIOs back into)
00058 static const RenderGUIOMapping s_renderGUIOMapping[] = {
00059     { kRenderHercG,     GUIO_RENDERHERCGREEN },
00060     { kRenderHercA,     GUIO_RENDERHERCAMBER },
00061     { kRenderCGA,       GUIO_RENDERCGA },
00062     { kRenderEGA,       GUIO_RENDEREGA },
00063     { kRenderVGA,       GUIO_RENDERVGA },
00064     { kRenderAmiga,     GUIO_RENDERAMIGA },
00065     { kRenderFMTowns,   GUIO_RENDERFMTOWNS },
00066     { kRenderPC9821,    GUIO_RENDERPC9821 },
00067     { kRenderPC9801,    GUIO_RENDERPC9801 },
00068     { kRenderApple2GS,  GUIO_RENDERAPPLE2GS },
00069     { kRenderAtariST,   GUIO_RENDERATARIST },
00070     { kRenderMacintosh, GUIO_RENDERMACINTOSH }
00071 };
00072 
00073 DECLARE_TRANSLATION_ADDITIONAL_CONTEXT("Hercules Green", "lowres")
00074 DECLARE_TRANSLATION_ADDITIONAL_CONTEXT("Hercules Amber", "lowres")
00075 
00076 RenderMode parseRenderMode(const String &str) {
00077     if (str.empty())
00078         return kRenderDefault;
00079 
00080     const RenderModeDescription *l = g_renderModes;
00081     for (; l->code; ++l) {
00082         if (str.equalsIgnoreCase(l->code))
00083             return l->id;
00084     }
00085 
00086     return kRenderDefault;
00087 }
00088 
00089 const char *getRenderModeCode(RenderMode id) {
00090     const RenderModeDescription *l = g_renderModes;
00091     for (; l->code; ++l) {
00092         if (l->id == id)
00093             return l->code;
00094     }
00095     return nullptr;
00096 }
00097 
00098 const char *getRenderModeDescription(RenderMode id) {
00099     const RenderModeDescription *l = g_renderModes;
00100     for (; l->code; ++l) {
00101         if (l->id == id)
00102             return l->description;
00103     }
00104     return nullptr;
00105 }
00106 
00107 String renderMode2GUIO(RenderMode id) {
00108     String res;
00109 
00110     for (int i = 0; i < ARRAYSIZE(s_renderGUIOMapping); i++) {
00111         if (id == s_renderGUIOMapping[i].id)
00112             res += s_renderGUIOMapping[i].guio;
00113     }
00114 
00115     return res;
00116 }
00117 
00118 String allRenderModesGUIOs() {
00119     String res;
00120 
00121     for (int i = 0; i < ARRAYSIZE(s_renderGUIOMapping); i++) {
00122         res += s_renderGUIOMapping[i].guio;
00123     }
00124 
00125     return res;
00126 }
00127 
00128 } // End of namespace Common


Generated on Sat Mar 23 2019 05:02:00 for ResidualVM by doxygen 1.7.1
curved edge   curved edge