| 11 | { |
| 12 | |
| 13 | TextDrawerSoft::TextDrawerSoft( |
| 14 | const RenderingContextSoft& rendering_context, |
| 15 | const GameResources& game_resources ) |
| 16 | : rendering_context_(rendering_context) |
| 17 | { |
| 18 | const Vfs::FileContent font_file= game_resources.vfs->ReadFile( FontParams::font_file_name ); |
| 19 | const CelTextureHeader* const cel_header= reinterpret_cast<const CelTextureHeader*>( font_file.data() ); |
| 20 | const unsigned char* const font_data= font_file.data() + sizeof(CelTextureHeader); |
| 21 | |
| 22 | const unsigned int pixel_count= cel_header->size[0] * cel_header->size[1]; |
| 23 | |
| 24 | for( unsigned int c= 0u; c < FontParams::colors_variations; c++ ) |
| 25 | { |
| 26 | unsigned char* const font_data_shifted= font_texture_data_ + FontParams::atlas_width * FontParams::atlas_height * c; |
| 27 | |
| 28 | ColorShift( |
| 29 | FontParams::start_inner_color, FontParams::end_inner_color, |
| 30 | FontParams::color_shifts[c], |
| 31 | pixel_count, |
| 32 | font_data, |
| 33 | font_data_shifted ); |
| 34 | |
| 35 | // Hack. Move "slider" letter from code '\0'; |
| 36 | for( unsigned int y= 0; y < FontParams::letter_place_height; y++ ) |
| 37 | std::memcpy( |
| 38 | font_data_shifted + FontParams::atlas_width * y + FontParams::letter_place_width * ( c_slider_back_letter_code & 15u ) + FontParams::atlas_width * FontParams::letter_place_height * ( c_slider_back_letter_code >> 4u ), |
| 39 | font_data_shifted + FontParams::atlas_width * y, |
| 40 | FontParams::letter_place_width ); |
| 41 | } |
| 42 | |
| 43 | CalculateLettersWidth( |
| 44 | font_data, |
| 45 | letters_width_ ); |
| 46 | |
| 47 | letters_width_[ c_slider_back_letter_code ]= letters_width_[0]; // Move slider letter. |
| 48 | } |
| 49 | |
| 50 | TextDrawerSoft::~TextDrawerSoft() |
| 51 | {} |
nothing calls this directly
no test coverage detected