Prechádzať zdrojové kódy

Specify UTF-8 on demo sample on MSVC to fix garbled emojis

Michael Ragazzon 1 rok pred
rodič
commit
5b3ece45a2

+ 5 - 0
Samples/basic/demo/CMakeLists.txt

@@ -14,3 +14,8 @@ set_common_target_options(${TARGET_NAME})
 target_link_libraries(${TARGET_NAME} PRIVATE rmlui_shell)
 
 install_sample_target(${TARGET_NAME})
+
+if(MSVC)
+	# Set UTF-8 on MSVC to properly encode emoji characters.
+	target_compile_options(${TARGET_NAME} PRIVATE /utf-8)
+endif()

+ 1 - 2
Samples/basic/demo/src/DemoEventListener.cpp

@@ -128,8 +128,7 @@ void DemoEventListener::ProcessEvent(Rml::Event& event)
 		if (el_rating && el_rating_emoji)
 		{
 			enum { Sad, Mediocre, Exciting, Celebrate, Champion, CountEmojis };
-			static const Rml::String emojis[CountEmojis] = {(const char*)u8"😢", (const char*)u8"😐", (const char*)u8"😮", (const char*)u8"😎",
-				(const char*)u8"🏆"};
+			static const char* emojis[CountEmojis] = {"😢", "😐", "😮", "😎", "🏆"};
 			int value = event.GetParameter("value", 50);
 
 			Rml::String emoji;