Gamestudio Links
Zorro Links
Newest Posts
Data from CSV not parsed correctly
by EternallyCurious. 04/18/24 10:45
StartWeek not working as it should
by Zheka. 04/18/24 10:11
folder management functions
by VoroneTZ. 04/17/24 06:52
lookback setting performance issue
by 7th_zorro. 04/16/24 03:08
zorro 64bit command line support
by 7th_zorro. 04/15/24 09:36
Zorro FIX plugin - Experimental
by flink. 04/14/24 07:48
Zorro FIX plugin - Experimental
by flink. 04/14/24 07:46
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
1 registered members (SBGuy), 652 guests, and 3 spiders.
Key: Admin, Global Mod, Mod
Newest Members
EternallyCurious, howardR, 11honza11, ccorrea, sakolin
19047 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 1 of 6 1 2 3 4 5 6
Imgui Lite-c Development #478265
09/26/19 19:43
09/26/19 19:43
Joined: Feb 2013
Posts: 122
Maysville, Ga
Evo Offline OP
Member
Evo  Offline 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-integration
Txesmi's File Browser Plugin : https://github.com/txesmi/imgui-Lite-C-integration

Custom 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 v2
[Linked Image]

Original Template v1
Imgui Template v1
[Linked Image]


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 Offline
User
Emre  Offline
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.
[Linked Image]

btw: i discovered that we can use "imgui_slider_var" for engine variables directly. e.g:

Code
imgui_slider_var("##Rotation", &mdl_example->pan, set_ent_pan_min, set_ent_pan_max);

Re: Imgui Lite-c Development [Re: Evo] #478269
09/26/19 22:09
09/26/19 22:09
Joined: Jun 2007
Posts: 1,337
Hiporope and its pain
txesmi Offline
Serious User
txesmi  Offline
Serious User

Joined: Jun 2007
Posts: 1,337
Hiporope and its pain
Thank you very much to all!

Re: Imgui Lite-c Development [Re: Emre] #478270
09/26/19 22:22
09/26/19 22:22
Joined: Feb 2013
Posts: 122
Maysville, Ga
Evo Offline OP
Member
Evo  Offline OP
Member

Joined: Feb 2013
Posts: 122
Maysville, Ga
Thanks Emre. Once I know the dll has been updated with some new features, I'll update the template.

Re: Imgui Lite-c Development [Re: Evo] #478272
09/27/19 07:27
09/27/19 07:27
Joined: Jul 2010
Posts: 283
Germany
J
jenGs Offline
Member
jenGs  Offline
Member
J

Joined: Jul 2010
Posts: 283
Germany
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.

Re: Imgui Lite-c Development [Re: jenGs] #478273
09/27/19 07:29
09/27/19 07:29
Joined: Jul 2010
Posts: 283
Germany
J
jenGs Offline
Member
jenGs  Offline
Member
J

Joined: Jul 2010
Posts: 283
Germany
@Emre I welcome the tabs and font addition, because they are indeed still missing

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 Offline
User
Emre  Offline
User

Joined: Jul 2007
Posts: 619
Turkey, Izmir
Originally Posted by jenGs
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!

Originally Posted by jenGs
@Emre I welcome the tabs and font addition, because they are indeed still missing


Tabs are here:

SDK
Code
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

Code
var  imgui_begintabbar(char* str_id, long flags);
void imgui_endtabbar();
var imgui_begintabitem(char* label,void* state,long flags);
void imgui_endtabitem();


Example:

Code
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] #478276
09/27/19 10:40
09/27/19 10:40
Joined: Feb 2003
Posts: 146
RP China
2
20BN Offline
Member
20BN  Offline
Member
2

Joined: Feb 2003
Posts: 146
RP China
@jenGs @Emre @EVO

THANKS ALL!

Can't support Asian languages at present, can you update dll?

Re: Imgui Lite-c Development [Re: 20BN] #478277
09/27/19 11:13
09/27/19 11:13
Joined: Jul 2010
Posts: 283
Germany
J
jenGs Offline
Member
jenGs  Offline
Member
J

Joined: Jul 2010
Posts: 283
Germany
@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)

Re: Imgui Lite-c Development [Re: Evo] #478281
09/27/19 14:55
09/27/19 14:55
Joined: Feb 2013
Posts: 122
Maysville, Ga
Evo Offline OP
Member
Evo  Offline OP
Member

Joined: Feb 2013
Posts: 122
Maysville, Ga
@jenGs : Thank you for taking the time to update your dll. I look forward to adding some new features and custom ideas to the imgui template.

@Emre : Thanks for helping get some of these features integrated.

* I was curious about custom window background styling. Windows are separate from lite-c layers and panels can't be layered between windows. The old lbgui had structs set up and BMAP images were used for window BG creation/styling.

Q. Is there a draw_list method for images? (imgui_drawlist_add_image(x,y,size,bmap,etc)). Drawlist commands can render into windows and that would allow me to create a custom feature for adding image backgrounds that are layered behind elements within a transparent window BG (Using the get methods to obtain window xy,size, custom bgs can be drawn for any window). This would let developers match the style of their in-game gui and to use imgui for actual in-game menus. Seamlessly integrating its visual with gui thats already been created for their projects. A drawlist method for images should be all that's needed for me to create the feature.

Re: Imgui Lite-c Development [Re: Evo] #478283
09/27/19 15:32
09/27/19 15:32
Joined: Jul 2010
Posts: 283
Germany
J
jenGs Offline
Member
jenGs  Offline
Member
J

Joined: Jul 2010
Posts: 283
Germany
Yes that is possible. I will add this before I release the new version tomorrow

Re: Imgui Lite-c Development [Re: jenGs] #478288
09/28/19 16:17
09/28/19 16:17
Joined: Jun 2007
Posts: 1,337
Hiporope and its pain
txesmi Offline
Serious User
txesmi  Offline
Serious User

Joined: Jun 2007
Posts: 1,337
Hiporope and its pain
Hi, I miss to link to the engines SDK for the project in VS2017. I copied the engines SDK plugin folder (adll.h, adll.lib, etc) to my VS projects folder and set the path in the aditional includes of code and in the aditional libraries of the linker, but it is not able to find "adll.h". I believe it was enough. What I am missing? Thank you in advance and excuse the noob question laugh

Re: Imgui Lite-c Development [Re: txesmi] #478290
09/28/19 16:58
09/28/19 16:58
Joined: Jul 2007
Posts: 619
Turkey, Izmir
Emre Offline
User
Emre  Offline
User

Joined: Jul 2007
Posts: 619
Turkey, Izmir
i'm not sure what you are missed. I change the imgui project settings as follows: (maybe it helps)

[Linked Image]
[Linked Image]

That's all. You don't have to copy engine plugin folder to vs project folder. btw; there is two important thing too:

[Linked Image]
[Linked Image]

i hope that helps.

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 Offline
Serious User
txesmi  Offline
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
J
jenGs Offline
Member
jenGs  Offline
Member
J

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 laugh 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 Offline
User
Emre  Offline
User

Joined: Jul 2007
Posts: 619
Turkey, Izmir
Originally Posted by txesmi
Ok, I found the problem. I mixed up things with the VS tools version. It compiles now.


Glad to hear that! laugh

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: Evo] #478297
09/28/19 19:26
09/28/19 19:26
Joined: Feb 2013
Posts: 122
Maysville, Ga
Evo Offline OP
Member
Evo  Offline OP
Member

Joined: Feb 2013
Posts: 122
Maysville, Ga
@jenGs : I wasn't able to go through the new example.c due to an error, but I updated to the new files for my template and everything works just fine. I see a lot of new features that you included. Thanks for the new update. Once I have time, I'll go through each new feature and add it to the template.

Re: Imgui Lite-c Development [Re: Emre] #478298
09/28/19 19:46
09/28/19 19:46
Joined: Jul 2010
Posts: 283
Germany
J
jenGs Offline
Member
jenGs  Offline
Member
J

Joined: Jul 2010
Posts: 283
Germany
Quote
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] #478299
09/28/19 19:50
09/28/19 19:50
Joined: Jul 2010
Posts: 283
Germany
J
jenGs Offline
Member
jenGs  Offline
Member
J

Joined: Jul 2010
Posts: 283
Germany
ah you need <windows.h> for the POINT struct. I think I will change that und use an own point struct

Re: Imgui Lite-c Development [Re: jenGs] #478300
09/28/19 19:55
09/28/19 19:55
Joined: Jul 2010
Posts: 283
Germany
J
jenGs Offline
Member
jenGs  Offline
Member
J

Joined: Jul 2010
Posts: 283
Germany
One moment, I make the demo runnable. I tested with the wrong script

Re: Imgui Lite-c Development [Re: jenGs] #478301
09/28/19 19:58
09/28/19 19:58
Joined: Jul 2010
Posts: 283
Germany
J
jenGs Offline
Member
jenGs  Offline
Member
J

Joined: Jul 2010
Posts: 283
Germany
Originally Posted by jenGs
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 Offline
Serious User
txesmi  Offline
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!

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!



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 Offline
Serious User
txesmi  Offline
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.

[Linked Image]

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] #478394
10/11/19 23:53
10/11/19 23:53
Joined: Feb 2013
Posts: 122
Maysville, Ga
Evo Offline OP
Member
Evo  Offline OP
Member

Joined: Feb 2013
Posts: 122
Maysville, Ga
@Txesmi : Thanks for getting involved and creating some new features.

Sadly I haven't had much time to work on my projects, but once I can, I'll have a new source code template update with some new ideas and new custom plug-n-play examples.
Thanks to everyone for helping out.

Re: Imgui Lite-c Development [Re: Evo] #478395
10/12/19 01:11
10/12/19 01:11
Joined: Jul 2010
Posts: 283
Germany
J
jenGs Offline
Member
jenGs  Offline
Member
J

Joined: Jul 2010
Posts: 283
Germany
thank you txesmi. Due to work obligations I have not much time at the moment to work on more features. And I always hated unicode and ackenx in combination laugh

Re: Imgui Lite-c Development [Re: Evo] #478396
10/12/19 19:06
10/12/19 19:06
Joined: Jun 2007
Posts: 1,337
Hiporope and its pain
txesmi Offline
Serious User
txesmi  Offline
Serious User

Joined: Jun 2007
Posts: 1,337
Hiporope and its pain
you are welcome laugh

little by little, step by step

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 Offline
Serious User
txesmi  Offline
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.

Code
// 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 Offline
User
Emre  Offline
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.

[Linked Image]

//DLL (i'm still using first version of dll.)
Code
DLLFUNC void imgui_set_global_fontscale(float scalefactor)
{
    ImGuiIO& io = ImGui::GetIO();
    io.FontGlobalScale = scalefactor;
	
}

//Lite-c
Code
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.


Code
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 Offline
Senior Expert
3run  Offline
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
Code
void ShowDemoWindowWidgets()
{
	if (!ImGui->CollapsingHeader("Widgets", NULL, 0))
	return;
But where? grin 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.

Looking for free stuff?? Take a look here: http://badcom.at.ua
Support me on: https://boosty.to/3rung
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 Offline
Serious User
txesmi  Offline
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.
Code
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] #478951
01/23/20 21:18
01/23/20 21:18
Joined: May 2009
Posts: 5,370
Caucasus
3run Offline
Senior Expert
3run  Offline
Senior Expert

Joined: May 2009
Posts: 5,370
Caucasus
Thank you for quick reply! I just saw that you were using that 'imgui_h_button' in your example, my bad. I need to be more attentive. I was previously using imgui_button(text), which doesn't allow to set the size, but only created a button, which will change it's size automatically depending on the text length.

Small tip: just found out how to remove close button from the window, without using NoTitleBar flag seton. In 'imgui_begin(char *name, void *p_close, long flags);' simply pass NULL for p_close.


Looking for free stuff?? Take a look here: http://badcom.at.ua
Support me on: https://boosty.to/3rung
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 Offline
Serious User
txesmi  Offline
Serious User

Joined: Jun 2007
Posts: 1,337
Hiporope and its pain
You are welcome
Originally Posted by 3run
pass NULL for p_close

nice to know wink

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 Offline
Senior Expert
3run  Offline
Senior Expert

Joined: May 2009
Posts: 5,370
Caucasus
There was a memory leak:
Code
Unfreed: 1082,    , 8 bytes
Unfreed: 1083,    , 876 bytes

In original and txesmi's examples, so I had to add this:
Code
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.
Code
#define ImGuiWindowFlags_AlwaysUseWindowPadding1 << 16 // Ensure child windows without border uses style.WindowPadding (ignored by default for non-bordered child windowsbecause more convenient)


Looking for free stuff?? Take a look here: http://badcom.at.ua
Support me on: https://boosty.to/3rung
Re: Imgui Lite-c Development [Re: Evo] #478982
01/30/20 10:26
01/30/20 10:26
Joined: Jun 2007
Posts: 1,337
Hiporope and its pain
txesmi Offline
Serious User
txesmi  Offline
Serious User

Joined: Jun 2007
Posts: 1,337
Hiporope and its pain
@3run
I will try to fix that inside the module...

Re: Imgui Lite-c Development [Re: Evo] #479498
04/02/20 17:33
04/02/20 17:33
Joined: Feb 2013
Posts: 122
Maysville, Ga
Evo Offline OP
Member
Evo  Offline OP
Member

Joined: Feb 2013
Posts: 122
Maysville, Ga
Created a new v2 of the Imgui Template. The main post has been updated with the new info and links.

Re: Imgui Lite-c Development [Re: Evo] #479501
04/02/20 21:17
04/02/20 21:17
Joined: May 2008
Posts: 2,113
NRW/Germany
alibaba Offline
Expert
alibaba  Offline
Expert

Joined: May 2008
Posts: 2,113
NRW/Germany
Holy moly, this comes just right!! Thanks a bunch!


Professional Edition
A8.47.1
--------------------
http://www.yueklet.de
Re: Imgui Lite-c Development [Re: Evo] #479518
04/03/20 14:50
04/03/20 14:50
Joined: Feb 2013
Posts: 122
Maysville, Ga
Evo Offline OP
Member
Evo  Offline OP
Member

Joined: Feb 2013
Posts: 122
Maysville, Ga
Thanks. Once more development and plugins are created, I'll update it again in the future.

Re: Imgui Lite-c Development [Re: Evo] #479538
04/05/20 04:47
04/05/20 04:47
Joined: Jul 2007
Posts: 619
Turkey, Izmir
Emre Offline
User
Emre  Offline
User

Joined: Jul 2007
Posts: 619
Turkey, Izmir
Hi everybody. i made a simple theme editor. You can easily create your theme and export it. It's not that great, but still it's useful i guess. You can download from here.

[Linked Image]


Last edited by Emre; 04/09/20 14:44. Reason: Change the link. Now it contain source code.
Re: Imgui Lite-c Development [Re: Evo] #479544
04/05/20 11:47
04/05/20 11:47
Joined: May 2008
Posts: 2,113
NRW/Germany
alibaba Offline
Expert
alibaba  Offline
Expert

Joined: May 2008
Posts: 2,113
NRW/Germany
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!


Professional Edition
A8.47.1
--------------------
http://www.yueklet.de
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 Offline
User
Emre  Offline
User

Joined: Jul 2007
Posts: 619
Turkey, Izmir
Originally Posted by alibaba
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: Evo] #479604
04/10/20 03:39
04/10/20 03:39
Joined: Feb 2003
Posts: 146
RP China
2
20BN Offline
Member
20BN  Offline
Member
2

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?

Re: Imgui Lite-c Development [Re: 20BN] #479606
04/10/20 05:18
04/10/20 05:18
Joined: Jul 2007
Posts: 619
Turkey, Izmir
Emre Offline
User
Emre  Offline
User

Joined: Jul 2007
Posts: 619
Turkey, Izmir
Originally Posted by 20BN
@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. wink

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
2
20BN Offline
Member
20BN  Offline
Member
2

Joined: Feb 2003
Posts: 146
RP China
Originally Posted by Emre
Originally Posted by 20BN
@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. wink


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 Offline
Serious User
txesmi  Offline
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:
Code
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:
Code
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 Offline
Senior Expert
3run  Offline
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:
[Linked Image]
I couldn't really find anything about this over the web...

Greets

Last edited by 3run; 04/28/20 16:20.

Looking for free stuff?? Take a look here: http://badcom.at.ua
Support me on: https://boosty.to/3rung
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 Offline
User
Emre  Offline
User

Joined: Jul 2007
Posts: 619
Turkey, Izmir
Originally Posted by 3run
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;

Code
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 Offline
Senior Expert
3run  Offline
Senior Expert

Joined: May 2009
Posts: 5,370
Caucasus
Thank you! laugh

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 grin

And for disabling linear filtering, indeed, changing D3DTEXF_LINEAR to D3DTEXF_NONE in imgui_impl_dx9.cpp works.
Code
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

Looking for free stuff?? Take a look here: http://badcom.at.ua
Support me on: https://boosty.to/3rung
Re: Imgui Lite-c Development [Re: Evo] #480508
06/12/20 01:23
06/12/20 01:23
Joined: Apr 2005
Posts: 795
U.S.A. Michigan
exile Offline
User
exile  Offline
User

Joined: Apr 2005
Posts: 795
U.S.A. Michigan
Hey all. Having some issues with imgui_add_ttf_from_file. Trying to use the previously provided examples in the demo but the font either doesn't change or causes an immediate crash. Before the imgui_begin function I am defining;

ImFont *ImFont01 = imgui_add_ttf_from_file("c:\\Windows\\Fonts\\FuturBlock-Regular.ttf", 18, GLYPH_RANGE_Default);

Then in the function I am calling it as;

imgui_push_font(ImFont01);
imgui_text("Test\r\n");
imgui_pop_font();

Any idea on what I am doing wrong?

Re: Imgui Lite-c Development [Re: 20BN] #480514
06/12/20 07:30
06/12/20 07:30
Joined: Feb 2003
Posts: 146
RP China
2
20BN Offline
Member
20BN  Offline
Member
2

Joined: Feb 2003
Posts: 146
RP China
[Linked Image]

Hello,
Can DLL currently implement this kind of node UI?

Re: Imgui Lite-c Development [Re: exile] #480526
06/12/20 20:18
06/12/20 20:18
Joined: Jun 2007
Posts: 1,337
Hiporope and its pain
txesmi Offline
Serious User
txesmi  Offline
Serious User

Joined: Jun 2007
Posts: 1,337
Hiporope and its pain
@exile
I experimented some crashes when font do not contain the glyphs stated in the array. Did you try with other fonts?

Re: Imgui Lite-c Development [Re: Evo] #481029
08/02/20 12:59
08/02/20 12:59
Joined: Feb 2003
Posts: 146
RP China
2
20BN Offline
Member
20BN  Offline
Member
2

Joined: Feb 2003
Posts: 146
RP China
Hope to update this plugin:
https://github.com/Nelarius/imnodes

Re: Imgui Lite-c Development [Re: Evo] #485065
01/13/22 13:33
01/13/22 13:33
Joined: Jan 2012
Posts: 108
G
gamers Offline
Member
gamers  Offline
Member
G

Joined: Jan 2012
Posts: 108
Hello guys,

Is there a way to type Turkish characters (i.e., i,ç,ğ,ş,ö,ü) in text box in IMGUI's multiline textbox? In addition, how can I change the font in this field?

Re: Imgui Lite-c Development [Re: Evo] #487071
01/09/23 13:25
01/09/23 13:25
Joined: Jan 2012
Posts: 108
G
gamers Offline
Member
gamers  Offline
Member
G

Joined: Jan 2012
Posts: 108
Can anyone help with how to adapt the ImGUI project to the Lite-C? I changed the default font in ImGUI but I can't do it in Lite-C.

Page 1 of 6 1 2 3 4 5 6

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1