Hi, I will be eternally grateful of sharing your work, to both of you. I would never be able to introduce myself into such a great tool. It has openend many doors for my personal evolution. Thank you very much!

Originally Posted by jenGs
@20BN Imgui can display unicode, but the problem is Lite-C. I don't know what _chr(STRING) gives back with an unicode STRING. Can't promise anything, but I will look into it. I think I have to decode the characters, because ImGui uses normal char* not wchars to display unicode (If i am not mistaken)


One of the things I feel like a must is the mutilanguaje support. I have been investigating and it seems that ImGui uses ANSI or UTF8 encoded and NULL ended char strings. The problem here is that acknex does not correctly interpret UTF8 so there must be some sort of recoding work in order to show unicode characters. As a newby in C++, I found windows 'WideCharToMultiByte' function and its inverse been the key for character arrays transformations.

Code
namespace imgui_helpers {
	typedef char utf8;
	typedef wchar_t unicode;

	#define UTF8_MAX 1024
}

using namespace imgui_helpers;

DLLFUNC utf8 *imgui_h_UnicodeToUtf8(unicode *_text) {
	static utf8 _utf8Text[UTF8_MAX];
	WideCharToMultiByte(CP_UTF8, NULL, _text, -1, _utf8Text, UTF8_MAX, NULL, NULL);
	return _utf8Text;
}


In tandem, I wrote a little helper function in LiteC in order to transform ANSI texts to unicode.

Code
typedef char utf8;
typedef short unicode;

#define UNICODE_MAX 1024

unicode *ansi_to_unicode(char *_chrT) {
	static unicode _unicode[UNICODE_MAX];
	unicode *_sT = _unicode;
	int _count = 0;
	for(; *_chrT!=NULL && _count<UNICODE_MAX-2; _chrT+=1, _sT+=1, _count+=1)
		*_sT = *_chrT;
	*_sT = NULL;
	return _unicode;
}


Another needed thing is imgui font installation and usage functions. Their are pretty straight so there is nothing to worry about.

Code
namespace imgui_fonts {
	enum GLYPH_RANGE {
		GLYPH_RANGE_Default,
		GLYPH_RANGE_ChineseFull,
		GLYPH_RANGE_ChineseSimplified,
		GLYPH_RANGE_Cyrillic,
		GLYPH_RANGE_Japanese,
		GLYPH_RANGE_Korean,
		GLYPH_RANGE_Thai,
		GLYPH_RANGE_COUNT
	};
};

using namespace imgui_fonts;

DLLFUNC ImFont *imgui_add_ttf_from_file(char *_chrFont, float _size, var _glyph_range) {
	const ImWchar *_glyphRange = NULL;

	ImGuiIO& io = ImGui::GetIO();

	switch (_INT(_glyph_range)) {
		case GLYPH_RANGE_ChineseFull:       _glyphRange = io.Fonts->GetGlyphRangesChineseFull(); break;
		case GLYPH_RANGE_ChineseSimplified: _glyphRange = io.Fonts->GetGlyphRangesChineseSimplifiedCommon(); break;
		case GLYPH_RANGE_Cyrillic:          _glyphRange = io.Fonts->GetGlyphRangesCyrillic(); break;
		case GLYPH_RANGE_Japanese:          _glyphRange = io.Fonts->GetGlyphRangesJapanese(); break;
		case GLYPH_RANGE_Korean:            _glyphRange = io.Fonts->GetGlyphRangesKorean(); break;
		case GLYPH_RANGE_Thai:              _glyphRange = io.Fonts->GetGlyphRangesThai(); break;
		default:                            _glyphRange = io.Fonts->GetGlyphRangesDefault();
	}
	
	return io.Fonts->AddFontFromFileTTF(_chrFont, _size, NULL, _glyphRange);
}

DLLFUNC void imgui_push_font(ImFont* _font) {
	ImGui::PushFont(_font);
}

DLLFUNC void imgui_pop_font() {
	ImGui::PopFont();
}


So in combination, they can be used to show unicode strings with imgui and liteC.

Code
typedef ImFont void;

#define GLYPH_RANGE_Default               0
#define GLYPH_RANGE_ChineseFull           1
#define GLYPH_RANGE_ChineseSimplified     2
#define GLYPH_RANGE_Cyrillic              3
#define GLYPH_RANGE_Japanese              4
#define GLYPH_RANGE_Korean                5
#define GLYPH_RANGE_Thai                  6
#define GLYPH_RANGE_COUNT                 7

...

STRING *strUnicode = str_createw(ansi_to_unicode("My ansi text"));
STRING *strUTF8 = str_create(imgui_h_UnicodeToUtf8(strUnicode->chars));

ImFont *ImFont01 = imgui_add_ttf_from_file("c:\\Windows\\Fonts\\Arial-unicode-ms.ttf", 18, GLYPH_RANGE_Default);
ImFont *ImFont02 = imgui_add_ttf_from_file("c:\\Windows\\Fonts\\Arial-unicode-ms.ttf", 24, GLYPH_RANGE_Default);

...

imgui_begin(....
   imgui_push_font(ImFont01);
   imgui_text(strUTF8->chars);
   imgui_pop_font();

   imgui_push_font(ImFont02);
   imgui_text(strUTF8->chars);
   imgui_pop_font();
...


Here is the result of buiilding a single string with cyrillic and japanese character codes, converted to UTF8 and shown with two different fonts created with their corresponding glyph ranges.
[Linked Image]

I wrote all this stuff in order to create some helper fuctions so I can build an in-game file explorer with unicode, so it will come in a near future, I hope laugh

Salud!