mirror of
https://github.com/rwengine/openrw.git
synced 2024-11-22 02:12:45 +01:00
rwlib+rwengine+rwviewer: address feedback comments
This commit is contained in:
parent
37fcebee40
commit
a15413f997
@ -259,9 +259,9 @@ void TextRenderer::renderText(const TextRenderer::TextInfo& ti,
|
||||
geo.emplace_back(glm::vec2{p.x + ss.x, p.y + ss.y}, glm::vec2{tex.z, tex.w}, colour);
|
||||
}
|
||||
|
||||
if (ti.align == TextInfo::Right) {
|
||||
if (ti.align == TextInfo::TextAlignment::Right) {
|
||||
alignment.x -= maxWidth;
|
||||
} else if (ti.align == TextInfo::Center) {
|
||||
} else if (ti.align == TextInfo::TextAlignment::Center) {
|
||||
alignment.x -= (maxWidth / 2.f);
|
||||
}
|
||||
|
||||
|
@ -30,7 +30,7 @@ public:
|
||||
* @todo Can this be merged with the gamestate text entries?
|
||||
*/
|
||||
struct TextInfo {
|
||||
enum TextAlignment { Left = 0, Right = 1, Center = 2 };
|
||||
enum class TextAlignment { Left = 0, Right = 1, Center = 2 };
|
||||
|
||||
/// Font index @see TextRenderer::setFontTexture
|
||||
font_t font{FONT_PAGER};
|
||||
@ -45,7 +45,7 @@ public:
|
||||
/// Background colour
|
||||
glm::u8vec4 backgroundColour{};
|
||||
/// Horizontal Alignment
|
||||
TextAlignment align = Left;
|
||||
TextAlignment align = TextAlignment::Left;
|
||||
/// Wrap width
|
||||
int wrapX{0};
|
||||
|
||||
|
@ -44,7 +44,7 @@ void drawScriptTimer(GameWorld* world, GameRenderer* render) {
|
||||
TextRenderer::TextInfo ti;
|
||||
ti.font = FONT_PRICEDOWN;
|
||||
ti.size = ui_textSize;
|
||||
ti.align = TextRenderer::TextInfo::Right;
|
||||
ti.align = TextRenderer::TextInfo::TextAlignment::Right;
|
||||
|
||||
{
|
||||
int32_t seconds = *world->state->scriptTimerVariable / 1000;
|
||||
@ -109,7 +109,7 @@ void drawPlayerInfo(PlayerController* player, GameWorld* world,
|
||||
TextRenderer::TextInfo ti;
|
||||
ti.font = FONT_PRICEDOWN;
|
||||
ti.size = ui_textSize;
|
||||
ti.align = TextRenderer::TextInfo::Right;
|
||||
ti.align = TextRenderer::TextInfo::TextAlignment::Right;
|
||||
|
||||
{
|
||||
std::stringstream ss;
|
||||
@ -264,7 +264,7 @@ void drawPlayerInfo(PlayerController* player, GameWorld* world,
|
||||
ti.baseColour = ui_shadowColour;
|
||||
ti.font = FONT_ARIAL;
|
||||
ti.size = ui_ammoSize;
|
||||
ti.align = TextRenderer::TextInfo::Center;
|
||||
ti.align = TextRenderer::TextInfo::TextAlignment::Center;
|
||||
ti.screenPosition = glm::vec2(iconX + ui_weaponSize / 2.f,
|
||||
iconY + ui_weaponSize - ui_ammoHeight);
|
||||
render->text.renderText(ti);
|
||||
@ -299,13 +299,13 @@ void drawOnScreenText(GameWorld* world, GameRenderer* renderer) {
|
||||
ti.screenPosition = (t.position / glm::vec2(640.f, 480.f)) * vp;
|
||||
switch (t.alignment) {
|
||||
case 0:
|
||||
ti.align = TextRenderer::TextInfo::Left;
|
||||
ti.align = TextRenderer::TextInfo::TextAlignment::Left;
|
||||
break;
|
||||
case 1:
|
||||
ti.align = TextRenderer::TextInfo::Center;
|
||||
ti.align = TextRenderer::TextInfo::TextAlignment::Center;
|
||||
break;
|
||||
case 2:
|
||||
ti.align = TextRenderer::TextInfo::Right;
|
||||
ti.align = TextRenderer::TextInfo::TextAlignment::Right;
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -16,7 +16,7 @@ FontMap::FontMap(std::initializer_list<std::reference_wrapper<const gschar_unico
|
||||
m_from_unicode[m.second] = m.first;
|
||||
}
|
||||
}
|
||||
const auto &q = m_from_unicode.find(UNICODE_QUESTION_MARK);
|
||||
const auto &q = m_from_unicode.find(UnicodeValue::UNICODE_QUESTION_MARK);
|
||||
if (q == m_from_unicode.end()) {
|
||||
RW_ERROR("Font does not have a question mark");
|
||||
m_unknown_gschar = ' ';
|
||||
@ -44,7 +44,7 @@ unicode_t FontMap::to_unicode(GameStringChar c) const {
|
||||
}
|
||||
const auto &p = m_to_unicode.find(c);
|
||||
if (p == m_to_unicode.end()) {
|
||||
return UNICODE_REPLACEMENT_CHARACTER;
|
||||
return UnicodeValue::UNICODE_REPLACEMENT_CHARACTER;
|
||||
}
|
||||
return p->second;
|
||||
}
|
||||
|
@ -1,200 +1,200 @@
|
||||
#include "FontMapGta3.hpp"
|
||||
|
||||
static const FontMap::gschar_unicode_map_t map_gta3_font_common = {
|
||||
{0x20, UNICODE_SPACE},
|
||||
{0x21, UNICODE_EXCLAMATION_MARK},
|
||||
{0x24, UNICODE_DOLLAR_SIGN},
|
||||
{0x25, UNICODE_PROCENT_SIGN},
|
||||
{0x26, UNICODE_AMPERSAND},
|
||||
{0x27, UNICODE_APOSTROPHE},
|
||||
{0x28, UNICODE_LEFT_PARENTHESIS},
|
||||
{0x29, UNICODE_RIGHT_PARENTHESIS},
|
||||
{0x2c, UNICODE_COMMA},
|
||||
{0x2d, UNICODE_HYPHEN_MINUS},
|
||||
{0x2e, UNICODE_FULL_STOP},
|
||||
{0x30, UNICODE_DIGIT_0},
|
||||
{0x31, UNICODE_DIGIT_1},
|
||||
{0x32, UNICODE_DIGIT_2},
|
||||
{0x33, UNICODE_DIGIT_3},
|
||||
{0x34, UNICODE_DIGIT_4},
|
||||
{0x35, UNICODE_DIGIT_5},
|
||||
{0x36, UNICODE_DIGIT_6},
|
||||
{0x37, UNICODE_DIGIT_7},
|
||||
{0x38, UNICODE_DIGIT_8},
|
||||
{0x39, UNICODE_DIGIT_9},
|
||||
{0x3a, UNICODE_COLON},
|
||||
{0x3f, UNICODE_QUESTION_MARK},
|
||||
{0x41, UNICODE_CAPITAL_A},
|
||||
{0x42, UNICODE_CAPITAL_B},
|
||||
{0x43, UNICODE_CAPITAL_C},
|
||||
{0x44, UNICODE_CAPITAL_D},
|
||||
{0x45, UNICODE_CAPITAL_E},
|
||||
{0x46, UNICODE_CAPITAL_F},
|
||||
{0x47, UNICODE_CAPITAL_G},
|
||||
{0x48, UNICODE_CAPITAL_H},
|
||||
{0x49, UNICODE_CAPITAL_I},
|
||||
{0x4a, UNICODE_CAPITAL_J},
|
||||
{0x4b, UNICODE_CAPITAL_K},
|
||||
{0x4c, UNICODE_CAPITAL_L},
|
||||
{0x4d, UNICODE_CAPITAL_M},
|
||||
{0x4e, UNICODE_CAPITAL_N},
|
||||
{0x4f, UNICODE_CAPITAL_O},
|
||||
{0x50, UNICODE_CAPITAL_P},
|
||||
{0x51, UNICODE_CAPITAL_Q},
|
||||
{0x52, UNICODE_CAPITAL_R},
|
||||
{0x53, UNICODE_CAPITAL_S},
|
||||
{0x54, UNICODE_CAPITAL_T},
|
||||
{0x55, UNICODE_CAPITAL_U},
|
||||
{0x56, UNICODE_CAPITAL_V},
|
||||
{0x57, UNICODE_CAPITAL_W},
|
||||
{0x58, UNICODE_CAPITAL_X},
|
||||
{0x59, UNICODE_CAPITAL_Y},
|
||||
{0x5a, UNICODE_CAPITAL_Z},
|
||||
{0x61, UNICODE_SMALL_A},
|
||||
{0x62, UNICODE_SMALL_B},
|
||||
{0x63, UNICODE_SMALL_C},
|
||||
{0x64, UNICODE_SMALL_D},
|
||||
{0x65, UNICODE_SMALL_E},
|
||||
{0x66, UNICODE_SMALL_F},
|
||||
{0x67, UNICODE_SMALL_G},
|
||||
{0x68, UNICODE_SMALL_H},
|
||||
{0x69, UNICODE_SMALL_I},
|
||||
{0x6a, UNICODE_SMALL_J},
|
||||
{0x6b, UNICODE_SMALL_K},
|
||||
{0x6c, UNICODE_SMALL_L},
|
||||
{0x6d, UNICODE_SMALL_M},
|
||||
{0x6e, UNICODE_SMALL_N},
|
||||
{0x6f, UNICODE_SMALL_O},
|
||||
{0x70, UNICODE_SMALL_P},
|
||||
{0x71, UNICODE_SMALL_Q},
|
||||
{0x72, UNICODE_SMALL_R},
|
||||
{0x73, UNICODE_SMALL_S},
|
||||
{0x74, UNICODE_SMALL_T},
|
||||
{0x75, UNICODE_SMALL_U},
|
||||
{0x76, UNICODE_SMALL_V},
|
||||
{0x77, UNICODE_SMALL_W},
|
||||
{0x78, UNICODE_SMALL_X},
|
||||
{0x79, UNICODE_SMALL_Y},
|
||||
{0x7a, UNICODE_SMALL_Z},
|
||||
{0x80, UNICODE_CAPITAL_A_GRAVE},
|
||||
{0x81, UNICODE_CAPITAL_A_ACUTE},
|
||||
{0x82, UNICODE_CAPITAL_A_CIRCUMFLEX},
|
||||
{0x83, UNICODE_CAPITAL_A_DIARESIS},
|
||||
{0x84, UNICODE_CAPITAL_AE},
|
||||
{0x85, UNICODE_CAPITAL_C_CEDILLA},
|
||||
{0x86, UNICODE_CAPITAL_E_GRAVE},
|
||||
{0x87, UNICODE_CAPITAL_E_ACUTE},
|
||||
{0x88, UNICODE_CAPITAL_E_CIRCUMFLEX},
|
||||
{0x89, UNICODE_CAPITAL_E_DIARESIS},
|
||||
{0x8a, UNICODE_CAPITAL_I_GRAVE},
|
||||
{0x8b, UNICODE_CAPITAL_I_ACUTE},
|
||||
{0x8c, UNICODE_CAPITAL_I_CIRCUMFLEX},
|
||||
{0x8d, UNICODE_CAPITAL_I_DIARESIS},
|
||||
{0x8e, UNICODE_CAPITAL_O_GRAVE},
|
||||
{0x8f, UNICODE_CAPITAL_O_ACUTE},
|
||||
{0x90, UNICODE_CAPITAL_O_CIRCUMFLEX},
|
||||
{0x91, UNICODE_CAPITAL_O_DIARESIS},
|
||||
{0x92, UNICODE_CAPITAL_U_GRAVE},
|
||||
{0x93, UNICODE_CAPITAL_U_ACUTE},
|
||||
{0x94, UNICODE_CAPITAL_U_CIRCUMFLEX},
|
||||
{0x95, UNICODE_CAPITAL_U_DIARESIS},
|
||||
{0x96, UNICODE_SMALL_SHARP_S},
|
||||
{0x97, UNICODE_SMALL_A_GRAVE},
|
||||
{0x98, UNICODE_SMALL_A_ACUTE},
|
||||
{0x99, UNICODE_SMALL_A_CIRCUMFLEX},
|
||||
{0x9a, UNICODE_SMALL_A_DIARESIS},
|
||||
{0x9b, UNICODE_SMALL_AE},
|
||||
{0x9c, UNICODE_SMALL_C_CEDILLA},
|
||||
{0x9d, UNICODE_SMALL_E_GRAVE},
|
||||
{0x9e, UNICODE_SMALL_E_ACUTE},
|
||||
{0x9f, UNICODE_SMALL_E_CIRCUMFLEX},
|
||||
{0xa0, UNICODE_SMALL_E_DIARESIS},
|
||||
{0xa1, UNICODE_SMALL_I_GRAVE},
|
||||
{0xa2, UNICODE_SMALL_I_ACUTE},
|
||||
{0xa3, UNICODE_SMALL_I_CIRCUMFLEX},
|
||||
{0xa4, UNICODE_SMALL_I_DIARESIS},
|
||||
{0xa5, UNICODE_SMALL_O_GRAVE},
|
||||
{0xa6, UNICODE_SMALL_O_ACUTE},
|
||||
{0xa7, UNICODE_SMALL_O_CIRCUMFLEX},
|
||||
{0xa8, UNICODE_SMALL_O_DIARESIS},
|
||||
{0xa9, UNICODE_SMALL_U_GRAVE},
|
||||
{0xaa, UNICODE_SMALL_U_ACUTE},
|
||||
{0xab, UNICODE_SMALL_U_CIRCUMFLEX},
|
||||
{0xac, UNICODE_SMALL_U_DIARESIS},
|
||||
{0xad, UNICODE_CAPITAL_N_TILDE},
|
||||
{0xae, UNICODE_SMALL_N_TILDE},
|
||||
{0xaf, UNICODE_INVERTED_QUESTION_MARK},
|
||||
{0xb0, UNICODE_INVERTED_EXCLAMATION_MARK}
|
||||
{0x20, UnicodeValue::UNICODE_SPACE},
|
||||
{0x21, UnicodeValue::UNICODE_EXCLAMATION_MARK},
|
||||
{0x24, UnicodeValue::UNICODE_DOLLAR_SIGN},
|
||||
{0x25, UnicodeValue::UNICODE_PROCENT_SIGN},
|
||||
{0x26, UnicodeValue::UNICODE_AMPERSAND},
|
||||
{0x27, UnicodeValue::UNICODE_APOSTROPHE},
|
||||
{0x28, UnicodeValue::UNICODE_LEFT_PARENTHESIS},
|
||||
{0x29, UnicodeValue::UNICODE_RIGHT_PARENTHESIS},
|
||||
{0x2c, UnicodeValue::UNICODE_COMMA},
|
||||
{0x2d, UnicodeValue::UNICODE_HYPHEN_MINUS},
|
||||
{0x2e, UnicodeValue::UNICODE_FULL_STOP},
|
||||
{0x30, UnicodeValue::UNICODE_DIGIT_0},
|
||||
{0x31, UnicodeValue::UNICODE_DIGIT_1},
|
||||
{0x32, UnicodeValue::UNICODE_DIGIT_2},
|
||||
{0x33, UnicodeValue::UNICODE_DIGIT_3},
|
||||
{0x34, UnicodeValue::UNICODE_DIGIT_4},
|
||||
{0x35, UnicodeValue::UNICODE_DIGIT_5},
|
||||
{0x36, UnicodeValue::UNICODE_DIGIT_6},
|
||||
{0x37, UnicodeValue::UNICODE_DIGIT_7},
|
||||
{0x38, UnicodeValue::UNICODE_DIGIT_8},
|
||||
{0x39, UnicodeValue::UNICODE_DIGIT_9},
|
||||
{0x3a, UnicodeValue::UNICODE_COLON},
|
||||
{0x3f, UnicodeValue::UNICODE_QUESTION_MARK},
|
||||
{0x41, UnicodeValue::UNICODE_CAPITAL_A},
|
||||
{0x42, UnicodeValue::UNICODE_CAPITAL_B},
|
||||
{0x43, UnicodeValue::UNICODE_CAPITAL_C},
|
||||
{0x44, UnicodeValue::UNICODE_CAPITAL_D},
|
||||
{0x45, UnicodeValue::UNICODE_CAPITAL_E},
|
||||
{0x46, UnicodeValue::UNICODE_CAPITAL_F},
|
||||
{0x47, UnicodeValue::UNICODE_CAPITAL_G},
|
||||
{0x48, UnicodeValue::UNICODE_CAPITAL_H},
|
||||
{0x49, UnicodeValue::UNICODE_CAPITAL_I},
|
||||
{0x4a, UnicodeValue::UNICODE_CAPITAL_J},
|
||||
{0x4b, UnicodeValue::UNICODE_CAPITAL_K},
|
||||
{0x4c, UnicodeValue::UNICODE_CAPITAL_L},
|
||||
{0x4d, UnicodeValue::UNICODE_CAPITAL_M},
|
||||
{0x4e, UnicodeValue::UNICODE_CAPITAL_N},
|
||||
{0x4f, UnicodeValue::UNICODE_CAPITAL_O},
|
||||
{0x50, UnicodeValue::UNICODE_CAPITAL_P},
|
||||
{0x51, UnicodeValue::UNICODE_CAPITAL_Q},
|
||||
{0x52, UnicodeValue::UNICODE_CAPITAL_R},
|
||||
{0x53, UnicodeValue::UNICODE_CAPITAL_S},
|
||||
{0x54, UnicodeValue::UNICODE_CAPITAL_T},
|
||||
{0x55, UnicodeValue::UNICODE_CAPITAL_U},
|
||||
{0x56, UnicodeValue::UNICODE_CAPITAL_V},
|
||||
{0x57, UnicodeValue::UNICODE_CAPITAL_W},
|
||||
{0x58, UnicodeValue::UNICODE_CAPITAL_X},
|
||||
{0x59, UnicodeValue::UNICODE_CAPITAL_Y},
|
||||
{0x5a, UnicodeValue::UNICODE_CAPITAL_Z},
|
||||
{0x61, UnicodeValue::UNICODE_SMALL_A},
|
||||
{0x62, UnicodeValue::UNICODE_SMALL_B},
|
||||
{0x63, UnicodeValue::UNICODE_SMALL_C},
|
||||
{0x64, UnicodeValue::UNICODE_SMALL_D},
|
||||
{0x65, UnicodeValue::UNICODE_SMALL_E},
|
||||
{0x66, UnicodeValue::UNICODE_SMALL_F},
|
||||
{0x67, UnicodeValue::UNICODE_SMALL_G},
|
||||
{0x68, UnicodeValue::UNICODE_SMALL_H},
|
||||
{0x69, UnicodeValue::UNICODE_SMALL_I},
|
||||
{0x6a, UnicodeValue::UNICODE_SMALL_J},
|
||||
{0x6b, UnicodeValue::UNICODE_SMALL_K},
|
||||
{0x6c, UnicodeValue::UNICODE_SMALL_L},
|
||||
{0x6d, UnicodeValue::UNICODE_SMALL_M},
|
||||
{0x6e, UnicodeValue::UNICODE_SMALL_N},
|
||||
{0x6f, UnicodeValue::UNICODE_SMALL_O},
|
||||
{0x70, UnicodeValue::UNICODE_SMALL_P},
|
||||
{0x71, UnicodeValue::UNICODE_SMALL_Q},
|
||||
{0x72, UnicodeValue::UNICODE_SMALL_R},
|
||||
{0x73, UnicodeValue::UNICODE_SMALL_S},
|
||||
{0x74, UnicodeValue::UNICODE_SMALL_T},
|
||||
{0x75, UnicodeValue::UNICODE_SMALL_U},
|
||||
{0x76, UnicodeValue::UNICODE_SMALL_V},
|
||||
{0x77, UnicodeValue::UNICODE_SMALL_W},
|
||||
{0x78, UnicodeValue::UNICODE_SMALL_X},
|
||||
{0x79, UnicodeValue::UNICODE_SMALL_Y},
|
||||
{0x7a, UnicodeValue::UNICODE_SMALL_Z},
|
||||
{0x80, UnicodeValue::UNICODE_CAPITAL_A_GRAVE},
|
||||
{0x81, UnicodeValue::UNICODE_CAPITAL_A_ACUTE},
|
||||
{0x82, UnicodeValue::UNICODE_CAPITAL_A_CIRCUMFLEX},
|
||||
{0x83, UnicodeValue::UNICODE_CAPITAL_A_DIARESIS},
|
||||
{0x84, UnicodeValue::UNICODE_CAPITAL_AE},
|
||||
{0x85, UnicodeValue::UNICODE_CAPITAL_C_CEDILLA},
|
||||
{0x86, UnicodeValue::UNICODE_CAPITAL_E_GRAVE},
|
||||
{0x87, UnicodeValue::UNICODE_CAPITAL_E_ACUTE},
|
||||
{0x88, UnicodeValue::UNICODE_CAPITAL_E_CIRCUMFLEX},
|
||||
{0x89, UnicodeValue::UNICODE_CAPITAL_E_DIARESIS},
|
||||
{0x8a, UnicodeValue::UNICODE_CAPITAL_I_GRAVE},
|
||||
{0x8b, UnicodeValue::UNICODE_CAPITAL_I_ACUTE},
|
||||
{0x8c, UnicodeValue::UNICODE_CAPITAL_I_CIRCUMFLEX},
|
||||
{0x8d, UnicodeValue::UNICODE_CAPITAL_I_DIARESIS},
|
||||
{0x8e, UnicodeValue::UNICODE_CAPITAL_O_GRAVE},
|
||||
{0x8f, UnicodeValue::UNICODE_CAPITAL_O_ACUTE},
|
||||
{0x90, UnicodeValue::UNICODE_CAPITAL_O_CIRCUMFLEX},
|
||||
{0x91, UnicodeValue::UNICODE_CAPITAL_O_DIARESIS},
|
||||
{0x92, UnicodeValue::UNICODE_CAPITAL_U_GRAVE},
|
||||
{0x93, UnicodeValue::UNICODE_CAPITAL_U_ACUTE},
|
||||
{0x94, UnicodeValue::UNICODE_CAPITAL_U_CIRCUMFLEX},
|
||||
{0x95, UnicodeValue::UNICODE_CAPITAL_U_DIARESIS},
|
||||
{0x96, UnicodeValue::UNICODE_SMALL_SHARP_S},
|
||||
{0x97, UnicodeValue::UNICODE_SMALL_A_GRAVE},
|
||||
{0x98, UnicodeValue::UNICODE_SMALL_A_ACUTE},
|
||||
{0x99, UnicodeValue::UNICODE_SMALL_A_CIRCUMFLEX},
|
||||
{0x9a, UnicodeValue::UNICODE_SMALL_A_DIARESIS},
|
||||
{0x9b, UnicodeValue::UNICODE_SMALL_AE},
|
||||
{0x9c, UnicodeValue::UNICODE_SMALL_C_CEDILLA},
|
||||
{0x9d, UnicodeValue::UNICODE_SMALL_E_GRAVE},
|
||||
{0x9e, UnicodeValue::UNICODE_SMALL_E_ACUTE},
|
||||
{0x9f, UnicodeValue::UNICODE_SMALL_E_CIRCUMFLEX},
|
||||
{0xa0, UnicodeValue::UNICODE_SMALL_E_DIARESIS},
|
||||
{0xa1, UnicodeValue::UNICODE_SMALL_I_GRAVE},
|
||||
{0xa2, UnicodeValue::UNICODE_SMALL_I_ACUTE},
|
||||
{0xa3, UnicodeValue::UNICODE_SMALL_I_CIRCUMFLEX},
|
||||
{0xa4, UnicodeValue::UNICODE_SMALL_I_DIARESIS},
|
||||
{0xa5, UnicodeValue::UNICODE_SMALL_O_GRAVE},
|
||||
{0xa6, UnicodeValue::UNICODE_SMALL_O_ACUTE},
|
||||
{0xa7, UnicodeValue::UNICODE_SMALL_O_CIRCUMFLEX},
|
||||
{0xa8, UnicodeValue::UNICODE_SMALL_O_DIARESIS},
|
||||
{0xa9, UnicodeValue::UNICODE_SMALL_U_GRAVE},
|
||||
{0xaa, UnicodeValue::UNICODE_SMALL_U_ACUTE},
|
||||
{0xab, UnicodeValue::UNICODE_SMALL_U_CIRCUMFLEX},
|
||||
{0xac, UnicodeValue::UNICODE_SMALL_U_DIARESIS},
|
||||
{0xad, UnicodeValue::UNICODE_CAPITAL_N_TILDE},
|
||||
{0xae, UnicodeValue::UNICODE_SMALL_N_TILDE},
|
||||
{0xaf, UnicodeValue::UNICODE_INVERTED_QUESTION_MARK},
|
||||
{0xb0, UnicodeValue::UNICODE_INVERTED_EXCLAMATION_MARK},
|
||||
};
|
||||
|
||||
static const FontMap::gschar_unicode_map_t map_gta3_font_0_priv = {
|
||||
{0x22, UNICODE_QUOTATION_MARK},
|
||||
{0x23, UNICODE_NUMBER_SIGN},
|
||||
{0x2a, UNICODE_HYPHEN_MINUS},
|
||||
/*{0x2b, UNICODE_REPLACEMENT_CHARACTER},*/
|
||||
/*{0x2f, UNICODE_REPLACEMENT_CHARACTER},*/
|
||||
/*{0x3b, UNICODE_REPLACEMENT_CHARACTER},*/
|
||||
/*{0x3c, UNICODE_REPLACEMENT_CHARACTER},*/
|
||||
/*{0x3d, UNICODE_REPLACEMENT_CHARACTER},*/
|
||||
/*{0x3e, UNICODE_REPLACEMENT_CHARACTER},*/
|
||||
/*{0x40, UNICODE_REPLACEMENT_CHARACTER},*/
|
||||
/*{0x5b, UNICODE_REPLACEMENT_CHARACTER},*/
|
||||
/*{0x5c, UNICODE_REPLACEMENT_CHARACTER},*/
|
||||
/*{0x5d, UNICODE_REPLACEMENT_CHARACTER},*/
|
||||
/*{0x5e, UNICODE_REPLACEMENT_CHARACTER},*/
|
||||
/*{0x5f, UNICODE_REPLACEMENT_CHARACTER},*/
|
||||
/*{0x60, UNICODE_REPLACEMENT_CHARACTER},*/
|
||||
/*{0x6b, UNICODE_REPLACEMENT_CHARACTER},*/
|
||||
/*{0x7c, UNICODE_REPLACEMENT_CHARACTER},*/
|
||||
/*{0x7d, UNICODE_REPLACEMENT_CHARACTER},*/
|
||||
/*{0x7f, UNICODE_REPLACEMENT_CHARACTER},*/
|
||||
{0x22, UnicodeValue::UNICODE_QUOTATION_MARK},
|
||||
{0x23, UnicodeValue::UNICODE_NUMBER_SIGN},
|
||||
{0x2a, UnicodeValue::UNICODE_HYPHEN_MINUS},
|
||||
/*{0x2b, UnicodeValue::UNICODE_REPLACEMENT_CHARACTER},*/
|
||||
/*{0x2f, UnicodeValue::UNICODE_REPLACEMENT_CHARACTER},*/
|
||||
/*{0x3b, UnicodeValue::UNICODE_REPLACEMENT_CHARACTER},*/
|
||||
/*{0x3c, UnicodeValue::UNICODE_REPLACEMENT_CHARACTER},*/
|
||||
/*{0x3d, UnicodeValue::UNICODE_REPLACEMENT_CHARACTER},*/
|
||||
/*{0x3e, UnicodeValue::UNICODE_REPLACEMENT_CHARACTER},*/
|
||||
/*{0x40, UnicodeValue::UNICODE_REPLACEMENT_CHARACTER},*/
|
||||
/*{0x5b, UnicodeValue::UNICODE_REPLACEMENT_CHARACTER},*/
|
||||
/*{0x5c, UnicodeValue::UNICODE_REPLACEMENT_CHARACTER},*/
|
||||
/*{0x5d, UnicodeValue::UNICODE_REPLACEMENT_CHARACTER},*/
|
||||
/*{0x5e, UnicodeValue::UNICODE_REPLACEMENT_CHARACTER},*/
|
||||
/*{0x5f, UnicodeValue::UNICODE_REPLACEMENT_CHARACTER},*/
|
||||
/*{0x60, UnicodeValue::UNICODE_REPLACEMENT_CHARACTER},*/
|
||||
/*{0x6b, UnicodeValue::UNICODE_REPLACEMENT_CHARACTER},*/
|
||||
/*{0x7c, UnicodeValue::UNICODE_REPLACEMENT_CHARACTER},*/
|
||||
/*{0x7d, UnicodeValue::UNICODE_REPLACEMENT_CHARACTER},*/
|
||||
/*{0x7f, UnicodeValue::UNICODE_REPLACEMENT_CHARACTER},*/
|
||||
};
|
||||
|
||||
static const FontMap::gschar_unicode_map_t map_gta3_font_1_priv = {
|
||||
{0x22, UNICODE_INCREMENT},
|
||||
{0x23, UNICODE_REGISTERED_SIGN},
|
||||
/*{0x2a, UNICODE_REPLACEMENT_CHARACTER},*/
|
||||
{0x2b, UNICODE_PLUS_SIGN},
|
||||
{0x2f, UNICODE_MULTIPLICATION_SIGN},
|
||||
{0x3b, UNICODE_BLACK_UP_POINTING_TRIANGLE},
|
||||
{0x3c, UNICODE_BLACK_LEFT_POINTING_POINTER},
|
||||
{0x3d, UNICODE_BLACK_DOWN_POINTING_POINTER},
|
||||
{0x3e, UNICODE_BLACK_RIGHT_POINTING_POINTER},
|
||||
{0x40, UNICODE_TRADE_MARK},
|
||||
{0x5b, UNICODE_SHIELD},
|
||||
{0x5c, UNICODE_REVERSE_SOLIDUS},
|
||||
{0x5d, UNICODE_BLACK_STAR},
|
||||
{0x5e, UNICODE_NUMERO_SIGN},
|
||||
{0x5f, UNICODE_DEGREES},
|
||||
{0x60, UNICODE_COPYRIGHT_SIGN},
|
||||
{0x7b, UNICODE_BLACK_HEART_SUIT},
|
||||
{0x7c, UNICODE_WHITE_CIRCLE},
|
||||
/*{0x7d, UNICODE_REPLACEMENT_CHARACTER},*/
|
||||
/*{0x7f, UNICODE_REPLACEMENT_CHARACTER},*/
|
||||
{0x22, UnicodeValue::UNICODE_INCREMENT},
|
||||
{0x23, UnicodeValue::UNICODE_REGISTERED_SIGN},
|
||||
/*{0x2a, UnicodeValue::UNICODE_REPLACEMENT_CHARACTER},*/
|
||||
{0x2b, UnicodeValue::UNICODE_PLUS_SIGN},
|
||||
{0x2f, UnicodeValue::UNICODE_MULTIPLICATION_SIGN},
|
||||
{0x3b, UnicodeValue::UNICODE_BLACK_UP_POINTING_TRIANGLE},
|
||||
{0x3c, UnicodeValue::UNICODE_BLACK_LEFT_POINTING_POINTER},
|
||||
{0x3d, UnicodeValue::UNICODE_BLACK_DOWN_POINTING_POINTER},
|
||||
{0x3e, UnicodeValue::UNICODE_BLACK_RIGHT_POINTING_POINTER},
|
||||
{0x40, UnicodeValue::UNICODE_TRADE_MARK},
|
||||
{0x5b, UnicodeValue::UNICODE_SHIELD},
|
||||
{0x5c, UnicodeValue::UNICODE_REVERSE_SOLIDUS},
|
||||
{0x5d, UnicodeValue::UNICODE_BLACK_STAR},
|
||||
{0x5e, UnicodeValue::UNICODE_NUMERO_SIGN},
|
||||
{0x5f, UnicodeValue::UNICODE_DEGREES},
|
||||
{0x60, UnicodeValue::UNICODE_COPYRIGHT_SIGN},
|
||||
{0x7b, UnicodeValue::UNICODE_BLACK_HEART_SUIT},
|
||||
{0x7c, UnicodeValue::UNICODE_WHITE_CIRCLE},
|
||||
/*{0x7d, UnicodeValue::UNICODE_REPLACEMENT_CHARACTER},*/
|
||||
/*{0x7f, UnicodeValue::UNICODE_REPLACEMENT_CHARACTER},*/
|
||||
};
|
||||
|
||||
static const FontMap::gschar_unicode_map_t map_gta3_font_2_priv = {
|
||||
{0x22, UNICODE_INCREMENT},
|
||||
{0x23, UNICODE_NUMBER_SIGN},
|
||||
{0x2a, UNICODE_ASTERISK},
|
||||
{0x2b, UNICODE_PLUS_SIGN},
|
||||
{0x2f, UNICODE_SOLIDUS},
|
||||
{0x3b, UNICODE_SEMICOLON},
|
||||
{0x3c, UNICODE_BLACK_LEFT_POINTING_POINTER},
|
||||
{0x3d, UNICODE_EQUALS_SIGN},
|
||||
{0x3e, UNICODE_BLACK_RIGHT_POINTING_POINTER},
|
||||
{0x40, UNICODE_TRADE_MARK},
|
||||
{0x5b, UNICODE_LEFT_SQUARE_BRACKET},
|
||||
{0x5c, UNICODE_REVERSE_SOLIDUS},
|
||||
{0x5d, UNICODE_RIGHT_SQUARE_BRACKET},
|
||||
{0x5e, UNICODE_CIRCUMFLEX_ACCENT},
|
||||
{0x5f, UNICODE_DEGREES},
|
||||
{0x60, UNICODE_GRAVE_ACCENT},
|
||||
/*{0x7b, UNICODE_REPLACEMENT_CHARACTER},*/
|
||||
{0x7c, UNICODE_WHITE_CIRCLE},
|
||||
/*{0x7d, UNICODE_REPLACEMENT_CHARACTER},*/
|
||||
/*{0x7f, UNICODE_REPLACEMENT_CHARACTER},*/
|
||||
{0xb1, UNICODE_ACUTE_ACCENT},
|
||||
{0x22, UnicodeValue::UNICODE_INCREMENT},
|
||||
{0x23, UnicodeValue::UNICODE_NUMBER_SIGN},
|
||||
{0x2a, UnicodeValue::UNICODE_ASTERISK},
|
||||
{0x2b, UnicodeValue::UNICODE_PLUS_SIGN},
|
||||
{0x2f, UnicodeValue::UNICODE_SOLIDUS},
|
||||
{0x3b, UnicodeValue::UNICODE_SEMICOLON},
|
||||
{0x3c, UnicodeValue::UNICODE_BLACK_LEFT_POINTING_POINTER},
|
||||
{0x3d, UnicodeValue::UNICODE_EQUALS_SIGN},
|
||||
{0x3e, UnicodeValue::UNICODE_BLACK_RIGHT_POINTING_POINTER},
|
||||
{0x40, UnicodeValue::UNICODE_TRADE_MARK},
|
||||
{0x5b, UnicodeValue::UNICODE_LEFT_SQUARE_BRACKET},
|
||||
{0x5c, UnicodeValue::UNICODE_REVERSE_SOLIDUS},
|
||||
{0x5d, UnicodeValue::UNICODE_RIGHT_SQUARE_BRACKET},
|
||||
{0x5e, UnicodeValue::UNICODE_CIRCUMFLEX_ACCENT},
|
||||
{0x5f, UnicodeValue::UNICODE_DEGREES},
|
||||
{0x60, UnicodeValue::UNICODE_GRAVE_ACCENT},
|
||||
/*{0x7b, UnicodeValue::UNICODE_REPLACEMENT_CHARACTER},*/
|
||||
{0x7c, UnicodeValue::UNICODE_WHITE_CIRCLE},
|
||||
/*{0x7d, UnicodeValue::UNICODE_REPLACEMENT_CHARACTER},*/
|
||||
/*{0x7f, UnicodeValue::UNICODE_REPLACEMENT_CHARACTER},*/
|
||||
{0xb1, UnicodeValue::UNICODE_ACUTE_ACCENT},
|
||||
};
|
||||
|
||||
const FontMap fontmap_gta3_font_common({map_gta3_font_common});
|
||||
|
@ -29,10 +29,10 @@ using GameStringKey = std::string;
|
||||
*/
|
||||
using font_t = size_t;
|
||||
|
||||
static const font_t FONT_PAGER = 0;
|
||||
static const font_t FONT_PRICEDOWN = 1;
|
||||
static const font_t FONT_ARIAL = 2;
|
||||
static const font_t FONTS_COUNT = 3;
|
||||
static constexpr font_t FONT_PAGER = 0;
|
||||
static constexpr font_t FONT_PRICEDOWN = 1;
|
||||
static constexpr font_t FONT_ARIAL = 2;
|
||||
static constexpr font_t FONTS_COUNT = 3;
|
||||
|
||||
namespace GameStringUtil {
|
||||
/**
|
||||
|
@ -22,13 +22,10 @@ size_t unicode_to_utf8(unicode_t unicode, char c[4]) {
|
||||
c[3] = 0x80 | (unicode & 0x3f);
|
||||
return 4;
|
||||
} else {
|
||||
return unicode_to_utf8(UNICODE_REPLACEMENT_CHARACTER, c);
|
||||
return unicode_to_utf8(UnicodeValue::UNICODE_REPLACEMENT_CHARACTER, c);
|
||||
}
|
||||
}
|
||||
|
||||
Utf8UnicodeIterator::Utf8UnicodeIterator() : m_is(nullptr), m_finished(true) {
|
||||
}
|
||||
|
||||
Utf8UnicodeIterator::Utf8UnicodeIterator(std::istream &is) : m_is(&is), m_finished(false) {
|
||||
next_unicode();
|
||||
}
|
||||
@ -55,19 +52,19 @@ void Utf8UnicodeIterator::next_unicode() {
|
||||
unicode = c & 0x07;
|
||||
nb_bytes = 3;
|
||||
} else {
|
||||
unicode = UNICODE_REPLACEMENT_CHARACTER;
|
||||
unicode = UnicodeValue::UNICODE_REPLACEMENT_CHARACTER;
|
||||
nb_bytes = 0;
|
||||
}
|
||||
while (nb_bytes != 0) {
|
||||
c = m_is->get();
|
||||
if (c == EOF) {
|
||||
unicode = UNICODE_REPLACEMENT_CHARACTER;
|
||||
unicode = UnicodeValue::UNICODE_REPLACEMENT_CHARACTER;
|
||||
m_finished = true;
|
||||
break;
|
||||
}
|
||||
cc = static_cast<char>(c);
|
||||
if ((c & 0xc0) != 0x80) {
|
||||
unicode = UNICODE_REPLACEMENT_CHARACTER;
|
||||
unicode = UnicodeValue::UNICODE_REPLACEMENT_CHARACTER;
|
||||
break;
|
||||
}
|
||||
unicode = (unicode << 6) | (c & 0x3f);
|
||||
|
@ -26,12 +26,12 @@ private:
|
||||
/**
|
||||
* @brief m_is Pointer to the utf8 stream to iterate over.
|
||||
*/
|
||||
std::istream *m_is;
|
||||
std::istream *m_is = nullptr;
|
||||
|
||||
/**
|
||||
* @brief m_finished true if the stream is finished/invalid.
|
||||
*/
|
||||
bool m_finished;
|
||||
bool m_finished = true;
|
||||
|
||||
/**
|
||||
* @brief m_unicode Current unicode point.
|
||||
@ -47,7 +47,7 @@ public:
|
||||
/**
|
||||
* @brief Create an empty unicode iterator. The iterator is not good.
|
||||
*/
|
||||
Utf8UnicodeIterator();
|
||||
Utf8UnicodeIterator() = default;
|
||||
/**
|
||||
* @brief Create a unicode iterator that iterates over a utf8 stream.
|
||||
* @param is utf8 stream
|
||||
@ -119,8 +119,8 @@ private:
|
||||
|
||||
/**
|
||||
* Unicode data points used by OpenRW.
|
||||
*/
|
||||
enum UnicodeValue {
|
||||
*/
|
||||
enum UnicodeValue : unicode_t {
|
||||
UNICODE_TAB = 0x09, /* '\t' */
|
||||
UNICODE_NEW_LINE = 0x0a, /* '\n' */
|
||||
UNICODE_CARRIAGE_RETURN = 0x0d, /* '\r' */
|
||||
|
@ -34,14 +34,7 @@ ViewCamera OrbitCamera (const glm::vec2& viewPort, const glm::vec2& viewAngles,
|
||||
|
||||
ViewerWidget::ViewerWidget(QOpenGLContext* context, QWindow* parent)
|
||||
: QWindow(parent)
|
||||
, context(context)
|
||||
, textInfos()
|
||||
, selectedFrame(nullptr)
|
||||
, viewDistance(1.f)
|
||||
, dragging(false)
|
||||
, moveFast(false)
|
||||
, _frameWidgetDraw(nullptr)
|
||||
, _frameWidgetGeom(nullptr) {
|
||||
, context(context) {
|
||||
setSurfaceType(OpenGLSurface);
|
||||
}
|
||||
|
||||
|
@ -91,17 +91,17 @@ protected:
|
||||
quint16 _objectID = 0;
|
||||
|
||||
|
||||
float viewDistance;
|
||||
float viewDistance = 1.f;
|
||||
glm::vec2 viewAngles{};
|
||||
glm::vec3 viewPosition{};
|
||||
|
||||
bool dragging;
|
||||
bool dragging = false;
|
||||
QPointF dstart;
|
||||
glm::vec2 dastart{};
|
||||
bool moveFast;
|
||||
bool moveFast = false;
|
||||
|
||||
DrawBuffer* _frameWidgetDraw;
|
||||
GeometryBuffer* _frameWidgetGeom;
|
||||
DrawBuffer* _frameWidgetDraw = nullptr;
|
||||
GeometryBuffer* _frameWidgetGeom = nullptr;
|
||||
GLuint whiteTex;
|
||||
|
||||
void drawFrameWidget(ModelFrame* f, const glm::mat4& = glm::mat4(1.f));
|
||||
|
@ -4,7 +4,7 @@
|
||||
#include <QBrush>
|
||||
|
||||
TextModel::TextModel(QObject *parent)
|
||||
: QAbstractTableModel(parent), m_font(FONT_PAGER) {
|
||||
: QAbstractTableModel(parent) {
|
||||
|
||||
}
|
||||
|
||||
|
@ -28,7 +28,7 @@ public:
|
||||
public slots:
|
||||
void fontChanged(font_t font);
|
||||
private:
|
||||
font_t m_font;
|
||||
font_t m_font = FONT_PAGER;
|
||||
TextMapType m_textMap;
|
||||
};
|
||||
|
||||
|
@ -50,7 +50,7 @@ class TextViewer : public ViewerInterface {
|
||||
void setGameString(const GameString &gameString);
|
||||
std::vector<std::string> getFontTextureNames();
|
||||
public:
|
||||
TextViewer(QWidget* parent = 0, Qt::WindowFlags f = 0);
|
||||
TextViewer(QWidget* parent = nullptr, Qt::WindowFlags f = nullptr);
|
||||
|
||||
signals:
|
||||
void fontChanged(font_t font);
|
||||
|
Loading…
Reference in New Issue
Block a user