|
Re: Imgui Lite-c Development
[Re: Emre]
#479607
04/10/20 11:34
04/10/20 11:34
|
Joined: Feb 2003
Posts: 146 RP China
20BN
Member
|
Member
Joined: Feb 2003
Posts: 146
RP China
|
@Emre
Thank you! And how to display CHS / CHT text and change any font in this imgui demo? You are welcome. i've changed/updated the link yesterday. Now the rar file contain source code. You can change anything you want. OK! I'm use imgui_add_ttf_from_file("zz.ttf", 16, 0); change any font. But, not support display Simplified Chinese or Japanese text.(error show: ?????? ) What should I script?
|
|
|
Re: Imgui Lite-c Development
[Re: 20BN]
#479608
04/10/20 12:50
04/10/20 12:50
|
Joined: Jun 2007
Posts: 1,337 Hiporope and its pain
txesmi
Serious User
|
Serious User
Joined: Jun 2007
Posts: 1,337
Hiporope and its pain
|
Hi, The last parameter of 'imgui_add_ttf_from_file' is a ImGui preset of ranges of glyphs. For full chinesse should be 1, and for simplified 2. You can find the defines at 'imgui_helpers.h'. You can build yor own glyph ranges with 'imgui_add_ttf_from_file_ranged' where the last parameter is an array of shorts with all the ranges from unicode table ended with a null entry. The array should look something like this:
short myGlyphRanges[7] = {
30, 127, // Latin1 basic
2087, 3048, // Imaginary range as example
16524, 16524, // A single character range
0 // array ended with a null entry
}
...
imgui_add_ttf_from_file_ranged("myFont.ttf", 16, myGlyphRanges);
I did not try with chinesse, but cyrillic was working perfectly. The glyph range of my main project looks like the following. I included all the latin characters, some of the symbols and a piece of the private area:
short glyphRanges[23] = {
// 0x0000, 0x001F, // Control characters
0x0020, 0x007F, // Basic Latin
// 0x0080, 0x00FF, // Latin supplement
0x00A0, 0x00FF,
0x0100, 0x017F, // Latin extended-A
0x0180, 0x024F, // Latin extended-B
// 0x02B0, 0x02FF, // Spacing modifier letters
0x02C0, 0x02DF,
// 0x2000, 0x206F, // General punctuation
0x2010, 0x2027,
0x2030, 0x205E,
// 0x20A0, 0x20CF, // Currency symbols
0x20AC, 0x20AC,
// 0x2100, 0x214F, // Letterlike symbols
0x2122, 0x2122,
// 0x2600, 0x26FF, // Miscellaneous symbols
0x2600, 0x2647,
// 0xE800, 0xE8FF, // Private use area
0xE800, 0xE808,
0
};
I used hexadecimal notation because it is the common way to refer to unicode characters I hope it helps, Salud!
|
|
|
Re: Imgui Lite-c Development
[Re: Evo]
#479830
04/28/20 16:20
04/28/20 16:20
|
Joined: May 2009
Posts: 5,370 Caucasus
3run
Senior Expert
|
Senior Expert
Joined: May 2009
Posts: 5,370
Caucasus
|
Hey guys! Do any of you know, how to disable filtering for images? Also, is there any way to set custom 'flag' (check?) image for checkboxes: I couldn't really find anything about this over the web... Greets
Last edited by 3run; 04/28/20 16:20.
|
|
|
Re: Imgui Lite-c Development
[Re: 3run]
#479832
04/28/20 23:20
04/28/20 23:20
|
Joined: Jul 2007
Posts: 619 Turkey, Izmir
Emre
User
|
User
Joined: Jul 2007
Posts: 619
Turkey, Izmir
|
Also, is there any way to set custom 'flag' (check?) image for checkboxes:
You mean custom checkmark? Afaik imgui has no such an option. This is the function which draw checkmarks; void ImGui::RenderCheckMark(ImVec2 pos, ImU32 col, float sz)
{
ImGuiContext& g = *GImGui;
ImGuiWindow* window = g.CurrentWindow;
float thickness = ImMax(sz / 5.0f, 1.0f);
sz -= thickness*0.5f;
pos += ImVec2(thickness*0.25f, thickness*0.25f);
float third = sz / 3.0f;
float bx = pos.x + third;
float by = pos.y + sz -third * 0.5f;
window->DrawList->PathLineTo(ImVec2(bx - third, by - third));
window->DrawList->PathLineTo(ImVec2(bx, by));
window->DrawList->PathLineTo(ImVec2(bx + third*2, by - third*2));
window->DrawList->PathStroke(col, false, thickness);
} You can change the shape for sure. I don't know if there is a way to load a custom image. Maybe you can try to use "window->DrawList->AddImage" instead of "window->DrawList->PathLineTo" but i'm not sure if this is safe and will work. in any case, you'll have to create your own dll to do something like this.
|
|
|
Re: Imgui Lite-c Development
[Re: Evo]
#479834
04/29/20 09:30
04/29/20 09:30
|
Joined: May 2009
Posts: 5,370 Caucasus
3run
Senior Expert
|
Senior Expert
Joined: May 2009
Posts: 5,370
Caucasus
|
Thank you! I also read that in previous versions imgui used square instead of a checkmark, maybe I could try to find older version. What about image filtering, what do you think? Will that also require building own dll? Edit: I think I found old version of RenderCheckMark function (if someone interested)Nope, it doesn't work... So I left the checkmark as it is, tried to draw X but failed And for disabling linear filtering, indeed, changing D3DTEXF_LINEAR to D3DTEXF_NONE in imgui_impl_dx9.cpp works.
g_pd3dDevice->SetSamplerState(0, D3DSAMP_MINFILTER, D3DTEXF_NONE);
g_pd3dDevice->SetSamplerState(0, D3DSAMP_MAGFILTER, D3DTEXF_NONE);
Last edited by 3run; 04/29/20 15:37. Reason: compiled my own .dll
|
|
|
|