mirror of
https://github.com/Lorenzooone/cc3dsfs.git
synced 2025-06-18 16:45:39 -04:00
Add support for SFML utf8 strings
This commit is contained in:
parent
403355ce13
commit
33660b3ef7
@ -321,7 +321,8 @@ private:
|
||||
int get_fullscreen_offset_y(int top_width, int top_height, int bot_width, int bot_height, int separator_contribute);
|
||||
void resize_window_and_out_rects(bool do_work = true);
|
||||
void create_window(bool re_prepare_size, bool reset_text = true);
|
||||
std::string title_factory();
|
||||
std::string _title_factory();
|
||||
sf::String title_factory();
|
||||
void update_view_size();
|
||||
void open();
|
||||
void update_screen_settings();
|
||||
|
@ -153,9 +153,13 @@ void TextRectangle::reset_data(TextData &data) {
|
||||
data.pos_y = 0;
|
||||
}
|
||||
|
||||
static sf::String convert_to_utf8(const std::string &str) {
|
||||
return sf::String::fromUtf8(str.begin(), str.end());
|
||||
}
|
||||
|
||||
void TextRectangle::setTextWithLineWrapping(int x_limit) {
|
||||
if(x_limit == 0) {
|
||||
this->actual_text.setString(this->loaded_data.printed_text);
|
||||
this->actual_text.setString(convert_to_utf8(this->loaded_data.printed_text));
|
||||
return;
|
||||
}
|
||||
bool is_done = false;
|
||||
@ -173,7 +177,7 @@ void TextRectangle::setTextWithLineWrapping(int x_limit) {
|
||||
}
|
||||
for(size_t i = pos; i < space_pos; i++)
|
||||
curr_text += this->loaded_data.printed_text[i];
|
||||
this->actual_text.setString(curr_text);
|
||||
this->actual_text.setString(convert_to_utf8(curr_text));
|
||||
sf::FloatRect globalBounds = this->actual_text.getGlobalBounds();
|
||||
int bounds_width = (int)(globalBounds.size.x + (globalBounds.position.x * 2));
|
||||
if(line_started && (bounds_width > x_limit)) {
|
||||
@ -185,7 +189,7 @@ void TextRectangle::setTextWithLineWrapping(int x_limit) {
|
||||
line_started = true;
|
||||
new_text = curr_text;
|
||||
}
|
||||
this->actual_text.setString(new_text);
|
||||
this->actual_text.setString(convert_to_utf8(new_text));
|
||||
}
|
||||
|
||||
void TextRectangle::setRealSize(int width, int height, bool check_previous) {
|
||||
|
@ -481,13 +481,18 @@ void WindowScreen::window_factory(bool is_main_thread) {
|
||||
this->update_connection();
|
||||
}
|
||||
|
||||
std::string WindowScreen::title_factory() {
|
||||
std::string WindowScreen::_title_factory() {
|
||||
std::string title = this->win_title;
|
||||
if(this->capture_status->connected)
|
||||
title += " - " + get_name_of_device(this->capture_status);
|
||||
return title;
|
||||
}
|
||||
|
||||
sf::String WindowScreen::title_factory() {
|
||||
std::string title = this->_title_factory();
|
||||
return sf::String::fromUtf8(title.begin(), title.end());
|
||||
}
|
||||
|
||||
// These values may be undefined under Windows...
|
||||
#ifndef GL_BGR
|
||||
#define GL_BGR 0x80e0
|
||||
|
@ -109,7 +109,7 @@ const CropData scaled_ds_pokemon_crop = {
|
||||
.bot_x = 0, .bot_y = 0,
|
||||
.allowed_joint = true, .allowed_top = true, .allowed_bottom = false,
|
||||
.allowed_3ds = true, .allowed_ds = false, .is_game_specific = true,
|
||||
.name = "Scaled Pokemon DS"};
|
||||
.name = "Scaled Pokémon DS"};
|
||||
|
||||
const CropData scaled_ds_pmd_brt_crop = {
|
||||
.top_width = TOP_SCALED_DS_WIDTH_3DS, .top_height = HEIGHT_3DS,
|
||||
@ -127,7 +127,7 @@ const CropData native_ds_pokemon_crop = {
|
||||
.bot_x = (BOT_WIDTH_3DS - WIDTH_DS) / 2, .bot_y = HEIGHT_3DS - HEIGHT_DS,
|
||||
.allowed_joint = true, .allowed_top = true, .allowed_bottom = true,
|
||||
.allowed_3ds = true, .allowed_ds = false, .is_game_specific = true,
|
||||
.name = "Native Pokemon DS"};
|
||||
.name = "Native Pokémon DS"};
|
||||
|
||||
const CropData native_ds_pmd_brt_crop = {
|
||||
.top_width = WIDTH_DS, .top_height = HEIGHT_DS,
|
||||
@ -190,7 +190,7 @@ const CropData ds_pokemon_crop = {
|
||||
.bot_x = 0, .bot_y = 0,
|
||||
.allowed_joint = true, .allowed_top = true, .allowed_bottom = true,
|
||||
.allowed_3ds = false, .allowed_ds = true, .is_game_specific = true,
|
||||
.name = "Pokemon DS"};
|
||||
.name = "Pokémon DS"};
|
||||
|
||||
const CropData ds_pmd_brt_crop = {
|
||||
.top_width = WIDTH_DS, .top_height = HEIGHT_DS,
|
||||
|
Loading…
Reference in New Issue
Block a user