1 registered members (SBGuy),
652
guests, and 3
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
Imgui Lite-c Development
#478265
09/26/19 19:43
09/26/19 19:43
|
Joined: Feb 2013
Posts: 122 Maysville, Ga
Evo
OP
Member
|
OP
Member
Joined: Feb 2013
Posts: 122
Maysville, Ga
|
New IMGUI Template Version 2 The original imgui/lite-c contribution can be found at https://github.com/pjen/imgui-Lite-C-integrationTxesmi's File Browser Plugin : https://github.com/txesmi/imgui-Lite-C-integrationCustom v2 Template Includes : * Template source code * 4 Plug and Play Icon Kits for images and buttons. (Includes Font Awesome PNG Image Collection and 3 Magicon PNG Icon Kits) * Custom Imgui Window "Style Script" to customize and create your own theme. (style.h) * All examples are now divided within their on script file for easier management and editing. * Integrated Txesmi's File Browser Plugin. * Also now includes a few new examples for Menubars, Tabs, Histogram, imgui built-in style editor, Grid Examples, tree nodes, progress bar, and a few other new features. I hope the template can help others that may be wanting to use imgui in their projects. Template v2 : New Imgui Template v2Original Template v1 Imgui Template v1
Last edited by Evo; 04/03/20 14:52. Reason: New Version
|
|
|
Re: Imgui Lite-c Development
[Re: Evo]
#478267
09/26/19 21:44
09/26/19 21:44
|
Joined: Jul 2007
Posts: 619 Turkey, Izmir
Emre
User
|
User
Joined: Jul 2007
Posts: 619
Turkey, Izmir
|
Good work! Your style script is wonderful! i'm also add some features to dll; like fonts, tabs, digits, built in stylecolor. i'll send it to JenGs, when all functions are ready. So you guys update it from github. btw: i discovered that we can use "imgui_slider_var" for engine variables directly. e.g: imgui_slider_var("##Rotation", &mdl_example->pan, set_ent_pan_min, set_ent_pan_max);
|
|
|
Re: Imgui Lite-c Development
[Re: jenGs]
#478274
09/27/19 08:24
09/27/19 08:24
|
Joined: Jul 2007
Posts: 619 Turkey, Izmir
Emre
User
|
User
Joined: Jul 2007
Posts: 619
Turkey, Izmir
|
I went through most of the demo (official imgui demo) and converted a lot of the code to lite_c. I made a lot of improvements to my DLL (structure) and added a lot of features. If you wait until this weekend, I will update the DLL. Great news! @Emre I welcome the tabs and font addition, because they are indeed still missing Tabs are here: SDK DLLFUNC var imgui_begintabbar(char* str_id, long flags)
{
bool res = ImGui::BeginTabBar(str_id, flags);
return res ? _VAR(1) : _VAR(0);
}
DLLFUNC void imgui_endtabbar()
{
ImGui::EndTabBar();
}
DLLFUNC var imgui_begintabitem(char* label,void* state,long flags)
{
bool* dirty = (bool*)state;
bool res = ImGui::BeginTabItem(label, dirty,flags);
return res ? _VAR(1) : _VAR(0);
}
DLLFUNC void imgui_endtabitem()
{
ImGui::EndTabItem();
} Lite-c var imgui_begintabbar(char* str_id, long flags);
void imgui_endtabbar();
var imgui_begintabitem(char* label,void* state,long flags);
void imgui_endtabitem(); Example: void window_func()
{
imgui_set_next_window_pos(1, 50, ImGuiCond_Once);
imgui_set_next_window_size(400, 400, ImGuiCond_Once);
if(imgui_begin("Window1", NULL, ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoMove ))
{
if(imgui_begintabbar("Tabs",ImGuiTabBarFlags_None))
{
if(imgui_begintabitem("Tab 1",0,0))
{
imgui_text("Tab 1 Text");
imgui_endtabitem();
}
if(imgui_begintabitem("TAB 2",0,0))
{
imgui_text("Tab 2 Text");
imgui_endtabitem();
}
imgui_endtabbar();
}
imgui_end();
}
} There is an issue about my font method. I'm storing the imgui fonts(ImFont*) in the acknex font(FONT*). i don't know if it may be cause a problem. (Right now it works without problem.) I sent a message to Superku for help/guide. I'm waiting for response. After that, i'll sharet it too.
|
|
|
Re: Imgui Lite-c Development
[Re: Evo]
#478291
09/28/19 17:25
09/28/19 17:25
|
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
|
Thank you. That it is. Same as I did. I did not change events because there were not any. Also, no changes on Linker/additional dependencies because is correctly set to "adll.lib". I checked everything again but I don't get what happens.
I decided to copy it because it did not find the file at its original path at first instance and, at the same time, I like to mantain every VS dependency holding from the same folder, but yes, I know it is not necessary, thank you anyway.
EDITED___________________
Ok, I found the problem. I mixed up things with the VS tools version. It compiles now. Thank you for your time!
Last edited by txesmi; 09/28/19 17:52.
|
|
|
Re: Imgui Lite-c Development
[Re: txesmi]
#478292
09/28/19 18:03
09/28/19 18:03
|
Joined: Jul 2010
Posts: 283 Germany
jenGs
Member
|
Member
Joined: Jul 2010
Posts: 283
Germany
|
Hello evryone, I have updated my project and the dll. * Reordered methods, deleted unneeded header * Added a lot of features * put a part of the Demo in example.c * Tabs are now available * drawlist_image is now available * and a lot more, some of it crap, because I needed it for the demo Sadly the official Imgui Demo is massive and does a lot of things that are not possible in Lite-C syntax, so it takes a lot of time to find workaround especially with char on the fly declarations. In my header you will find an "typedef interface". I only did that, so I hadn't to replace every method in the demo. Don't use this at home You may have struct member functions, but it makes the code more ugly. I have automated my workflow a bit. A crappy Java Programm prases with regex and generates now my headers and "interface" struct. imgui has hundreds of features, I will try to put more of them in.
|
|
|
Re: Imgui Lite-c Development
[Re: txesmi]
#478294
09/28/19 18:21
09/28/19 18:21
|
Joined: Jul 2007
Posts: 619 Turkey, Izmir
Emre
User
|
User
Joined: Jul 2007
Posts: 619
Turkey, Izmir
|
Ok, I found the problem. I mixed up things with the VS tools version. It compiles now. Glad to hear that! Edit: @Jengs: I checked it and got syntax error: "imgui_drawlist_add_polygon" line 41. (imgui_methods.h)
Last edited by Emre; 09/28/19 19:10.
|
|
|
Re: Imgui Lite-c Development
[Re: Emre]
#478298
09/28/19 19:46
09/28/19 19:46
|
Joined: Jul 2010
Posts: 283 Germany
jenGs
Member
|
Member
Joined: Jul 2010
Posts: 283
Germany
|
Edit: @Jengs: I checked it and got syntax error: "imgui_drawlist_add_polygon" line 41. (imgui_methods.h) That's strange, that's an rather old error, that I fixed last week.
|
|
|
Re: Imgui Lite-c Development
[Re: jenGs]
#478301
09/28/19 19:58
09/28/19 19:58
|
Joined: Jul 2010
Posts: 283 Germany
jenGs
Member
|
Member
Joined: Jul 2010
Posts: 283
Germany
|
One moment, I make the demo runnable. I tested with the wrong script Now it should work
|
|
|
Re: Imgui Lite-c Development
[Re: jenGs]
#478338
10/06/19 07:07
10/06/19 07:07
|
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, 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! @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.
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.
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.
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.
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. 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 Salud!
|
|
|
Re: Imgui Lite-c Development
[Re: txesmi]
#478390
10/11/19 16:42
10/11/19 16:42
|
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
|
I have got working a basic file explorer in UTF8. It is not ready to use but maybe someone wants to keep an eye on it. You can find the source code at GitHub, forked from jenGs's repository, all my functions are included in two new files: imgui_dll_fonts.cpp and imgui_dll_helpers.cpp. The main work has been around a function that prepares the folder data to be shown in an imgui list box: an array of char*. I tried different methods and finally ended up with a function that fills a buffer owned by the caller instead of the dynamic allocation I tried first, so at the end it can happen that the folder content names are longer that the space available and will result in a clipped content list. I do all the stuff with experimental::filesystem. The function can inject a prefix to folders. In the example I used one of the private ucodes (E800-E8FF) to show that folder icon I inserted into the ttf file (with Type Light). The file explorer behaviour is in liteC with the help of some helper functions included in the dll. It desplegates a combo in root drives and a button per folder in the path. It rebuilds the data when clicking over a subfolder and activates the selection button when clicking over a file. The fonts implementation is pretty choppy. I have no idea how to easily implement the custom glyph ranges.
|
|
|
Re: Imgui Lite-c Development
[Re: Evo]
#478397
10/13/19 09:40
10/13/19 09:40
|
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, I have just seen the other ImGui::ListBox implementation that uses a label getter function for each list item. I think it is the key to not get lost on char* arrays allocations by using engines native methods. It allows to a 3dgs user the use of TEXT structs to hold arrays of char arrays. It can use any custom data struct at the end.
// C++
DLLFUNC var imgui_h_list_box (const char* label, int* current_item, bool(*items_getter)(void*, int, const char**), void* data, int items_count, int height_in_items) {
bool res = ImGui::ListBox(label, current_item, items_getter, data, items_count, height_in_items);
return res ? _VAR(1) : _VAR(0);
}
// liteC
var imgui_h_list_box (char* label, int* current_item, void *items_getter, void* data, int items_count, int height_in_items);
...
TEXT *txtList = {
string = (
"eoeoeo 1"
"eoeoeo 2"
"eoeoeo 3"
"eoeoeo 4"
"eoeoeo 5"
"eoeoeo 6"
);
}
BOOL _label_for_text(TEXT *_txt, int _index, char **_label) {
*_label = (_txt->pstring)[_index]->chars;
return TRUE;
}
...
static int _currentItem = -1;
imgui_h_list_box ("##TEXT list box", &_currentItem, _label_for_text, txtList, (int)txtList->strings, 10);
------------- I have got another newby question related to the memory and dynamic libraries. As far as I read last days the executable binary and the dinamic library use two different memory areas. I read that the main law is that the allocator have to be the releaser. In the case of using the engine functions into a dll, the allocated memory shall be into the memory asigned to the engines dll, so it is managed same as it would be allocated in liteC, isn't it? I did some test and I do not receive any errors, so, my question is: Is it safe to add newly created STRINGs into a dll to a TEXT struct passed from liteC and realease them all in liteC?
|
|
|
Re: Imgui Lite-c Development
[Re: txesmi]
#478459
10/24/19 07:53
10/24/19 07:53
|
Joined: Jul 2007
Posts: 619 Turkey, Izmir
Emre
User
|
User
Joined: Jul 2007
Posts: 619
Turkey, Izmir
|
Thank you txesmi! And one for frome me. There is a member of ImGuiIO, named "FontGlobalScale". I use it for scaling everything. You guys can use it too if you need it. //DLL (i'm still using first version of dll.)
DLLFUNC void imgui_set_global_fontscale(float scalefactor)
{
ImGuiIO& io = ImGui::GetIO();
io.FontGlobalScale = scalefactor;
}
//Lite-c
void imgui_set_global_fontscale(float scalefactor);
float global_font_scale=1.0;
void window_func() //loop
{
...
imgui_set_global_fontscale(global_font_scale);
...
}
You can use "global_font_scale", wherever you wish. This way, you can scale everything. void window_func() //loop
{
...
imgui_begin_child("ChildVideo", vector(272*global_font_scale,272*global_font_scale,0), 4,ImGuiWindowFlags_NoScrollWithMouse);
imgui_push_item_width(200*global_font_scale);
imgui_input_text("", _chr(klasor_name), MAX_PATH, ImGuiInputTextFlags_ReadOnly);
...
} and result is here: https://www.youtube.com/watch?v=AISuErDfPOU&feature=youtu.be
|
|
|
Re: Imgui Lite-c Development
[Re: Evo]
#478949
01/23/20 15:03
01/23/20 15:03
|
Joined: May 2009
Posts: 5,370 Caucasus
3run
Senior Expert
|
Senior Expert
Joined: May 2009
Posts: 5,370
Caucasus
|
@txesmi hey! just looked into your git example, can you tell me how and were you created that 'Debug' window, I can't find it myself... It has to be somewhere before void ShowDemoWindowWidgets()
{
if (!ImGui->CollapsingHeader("Widgets", NULL, 0))
return; But where? I'm a bit lost... Want to create same, resizeable window but without close button at the upper right corner. Plus, can you guys tell me how to make button resize itself with it's parent (f.e. I have collapsing_header and inside of a button, how to make it fill the width of the collapsing_header)? Thank you all for this awesome contribution and examples, this really makes life easier! Edit: ok, I found out that debug window will appear automatically, when you create any item without a window for it.. as for the buttons, it seems that it has something to do with imgui_push_item_width(xq), but I didn't figure out yet how. Edit2: also, would be great to know, how to align text to center (f.e. of a button, or other elements as well), it has to do something with styles I guess..
Last edited by 3run; 01/23/20 17:11.
|
|
|
Re: Imgui Lite-c Development
[Re: Evo]
#478950
01/23/20 17:15
01/23/20 17:15
|
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 @3Run That is the original example of the ImGui module. I did not write it myself. You can find all the window flags into 'imgui_enums.h' file. Not sure what are you trying to thought. About the button width, you need to get the available width so you can create the button with it.
var _width = imgui_get_content_region_avail_width();
if(imgui_h_button("Button text", _width, 0)) {
...
}
I am not at home and I can't try it but I think it should work as spected. Salud!
|
|
|
Re: Imgui Lite-c Development
[Re: Evo]
#478952
01/23/20 23:26
01/23/20 23:26
|
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
|
You are welcome nice to know edited__________ Just updated the file browser: A new way based on TEXT structs.
Last edited by txesmi; 01/24/20 09:36.
|
|
|
Re: Imgui Lite-c Development
[Re: Evo]
#478970
01/29/20 13:28
01/29/20 13:28
|
Joined: May 2009
Posts: 5,370 Caucasus
3run
Senior Expert
|
Senior Expert
Joined: May 2009
Posts: 5,370
Caucasus
|
There was a memory leak: Unfreed: 1082, , 8 bytes
Unfreed: 1083, , 876 bytes In original and txesmi's examples, so I had to add this:
void on_exit_event()
{
sys_free(ImGui->lpVtbl);
sys_free(ImGui);
}
void main()
{
on_exit = on_exit_event;
....
} Also, there is a typo (no space between ImGuiWindowFlags_AlwaysUseWindowPadding and 1) in imgui_enums.h, in line 35. #define ImGuiWindowFlags_AlwaysUseWindowPadding1 << 16 // Ensure child windows without border uses style.WindowPadding (ignored by default for non-bordered child windowsbecause more convenient)
|
|
|
Re: Imgui Lite-c Development
[Re: alibaba]
#479555
04/06/20 05:12
04/06/20 05:12
|
Joined: Jul 2007
Posts: 619 Turkey, Izmir
Emre
User
|
User
Joined: Jul 2007
Posts: 619
Turkey, Izmir
|
I love you guys! Only recently I've started with 3dgs again and at the right time you come around the corner with such useful contributions! Cheers! Well i can't beleive we are still here. You, me, 3run, txesmi, jenGs, Evo, Quad and some others. (: i think imgui is the biggest factor lately. Thanks to jenGs! it is indeed good that we are still here for whatever reason.
|
|
|
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
|
|
|
|