Originally Posted by jenGs
You can download imgui your self and look at the demo included in the source code. Most of the features are available through the DLL. I am working at the moment on missing features. I will recreate the imgui demo in Lite-C, so I don't miss a feature, but that will take some time, because this is only a hobby.
And sorry for the different notation of the methods but I dispise Camelcase notation very much and used undescore notation for the imgui methods.


You did a great favor and we have no right to expect more from you right now. Take your time. wink I really appreciate your generosity.

To other friends who want examples/samples: imgui is not well documented but it comes with some good example projects. As JenGs mention it; "Most of the features are available through the DLL." Just look at the "imgui_methods.h" All functions are there.

Nevertheless, I have prepared a more comprehensive example/sample for you guys. i'm not a good programmer and as i said before; imgui is not well documented. So i just looked at the example project and ask to google for some methods. I hope that will be useful. Here it is:
Code
//
#include <acknex.h>
#include <default.c>
#define PRAGMA_PATH "%EXE_DIR%\templates\images"
#define PRAGMA_PATH "%EXE_DIR%\samples"
#define PRAGMA_PATH "imgui_header"
#include "imgui.h"



//sky_color.red for slider
int skyred=128;
int skygreen=128;
int skyblue=128;

//for checkbox
int draw_test=0;

char* listbox_items[9]; 
char* combobox_items[4]; 

void synchronize()
{
	//listbox items
	listbox_items[0]="Apple";
	listbox_items[1]="Banana";
	listbox_items[2]="Cherry";
	listbox_items[3]="Kiwi";
	listbox_items[4]="Mango";
	listbox_items[5]="Orange";
	listbox_items[6]="Pineapple";
	listbox_items[7]="Strawberry";
	listbox_items[8]="Watermelon";
	
	//combobox items
	combobox_items[0]="Car";
	combobox_items[1]="Bus";
	combobox_items[2]="Plane";
	combobox_items[3]="Ship";

	
	
	while(1)
	{
		//if checkbox true show this text
		if(draw_test==1)
		{
			draw_text("CheckBox is TRUE",screen_size.x-300,10,COLOR_GREEN);
		}
		
		
		sky_color.red=skyred;
		sky_color.green=skygreen;
		sky_color.blue=skyblue;
		wait(1);
	}
}

BMAP* b1="rock.tga";
BMAP* b2="sand.tga";
BMAP* b3="detail.tga";
BMAP* b4="display.pcx";




// show-hide handle for widnwow 1
static BOOL showWindow1 = true;


STRING* temp_str="";
STRING* temp_str2="";

void window_func()
{
	//!!!CREATE FIRST WINDOW!!!
	#ifndef create_first_window
		#define create_first_window
		if(showWindow1)//for VISIBILITY!
		{
			//Set position and size
			imgui_set_next_window_pos(1, 50, ImGuiCond_Once);
			imgui_set_next_window_size(700, 400, ImGuiCond_Once);

			//Create window --->(name, handle,flags)
			imgui_begin("Pictures Window", &showWindow1, ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoCollapse );
			
			//Add image
			imgui_image(b1);
			
			//Next image will be on same line
			imgui_same_line();
			//add image (Same line)
			imgui_image(b2);
			
			//Add image 
			//it will not be on same line because we didn't use "imgui_same_line();" again
			imgui_image(b3);
			
			//Add text
			imgui_text("Click to picture below");
			
			//Add button image 
			if(imgui_button_img("Button Image",b4, 200, 200))
			{
				//event
				printf("Test Message");
			}
			
			
			// Always  finish with this function  (imgui_begin...other codes...imgui_end)
			imgui_end();
		}
	#endif
	
	//!!!CREATE SECOND WINDOW!!!
	#ifndef create_second_window
		#define create_second_window
		
		//Set position and size
		imgui_set_next_window_pos(screen_size.x-400, 50, ImGuiCond_Once);
		imgui_set_next_window_size(400, 600, ImGuiCond_Once);
		
		//Create window
		imgui_begin("Test Window", NULL, NULL);
		
		
		//Add sliders ---> (Name, variable,min,max)
		imgui_slider_int("Sky Red", skyred, 0, 255);
		imgui_slider_int("Sky Green", skygreen, 0, 255);
		imgui_slider_int("Sky Blue", skyblue, 0, 255);
		
		//Add button for change first windows visibility
		if(imgui_button("Hide/Show Pictures window"))
		{
			//button event
			if(showWindow1==true)
			{
				showWindow1=false;
				return;
			}
			if(showWindow1==false)
			{
				showWindow1=true;
			}
		}
		
		//Add checkbox (Name, variable)
		imgui_checkbox("Test",&draw_test);
		
		
		
		#ifndef listbox_sample
			#define listbox_sample
			static int listbox_item_current = 1;
			
			//Set listbox specific width
			imgui_push_item_width(90);
			
			//CREATE LISTBOX
			imgui_listbox("##listbox1",&listbox_item_current, listbox_items, 9, 9);
			
			//Event for listbox
			int i=0;
			for(i=0;i<9;i++)
			{
				if(listbox_item_current==i)
				{
					//Draw selected word
					str_cpy(temp_str,"Listbox: ");
					str_cat(temp_str,listbox_items[i]);
					str_cat(temp_str," is selected");
					draw_text(temp_str,10,10,COLOR_GREEN);
				}
				
			}
		#endif 
		
		
		#ifndef combobox_sample
			#define combobox_sample
			
			//Create handle and set current item for Combobox
			static const char* item_current = "Bus"; 
			
			//CREATE COMBOBOX
			if (imgui_begin_combo("Combo", item_current, ImGuiComboFlags_HeightSmall))
			{
				
				//Event for combobox
				int n=0;
				for ( n = 0; n <4; n++)
				{
					
					BOOL is_selected = (item_current == combobox_items[n]);
					
					if (imgui_selectable(combobox_items[n], is_selected,0))
					{
						//Print selected item
						item_current = combobox_items[n];
						str_cpy(temp_str2,combobox_items[n]);
						str_cat(temp_str2," is selected");
						printf(_chr(temp_str2));
					}     
					
				}
				//END
				imgui_end_combo();
			}
		#endif
		
		
		//Child+Column
		#ifndef Child_Window_Sample
			#define Child_Window_Sample
			imgui_text("\r\nChild and Column");
			
			//CREATE CHILD
			imgui_begin_child("Child1", vector(300,35,0), 1,ImGuiWindowFlags_NoScrollWithMouse);
			
			//CREATE 3 COLUMNS
			imgui_columns(3, "COLUMN", true);
			
			//Set column width
			set_column_width(0, 100);
			set_column_width(1, 100);
			set_column_width(2, 100);
			
			
			
			//Colors (for buttons)
			static float red_color[4] = { 0,0,100,100 };
			static float green_color[4] = { 0,100,0,100 };
			static float blue_color[4] = { 100,0,0,100 };
			
			//Color begin
			imgui_push_style_color(ImGuiCol_Button, red_color);
			//Create button
			imgui_button("Red Button");
			//Color end
			imgui_pop_style_color(1);
			
			//Next Column and button
			imgui_next_column();
			imgui_push_style_color(ImGuiCol_Button, green_color);
			imgui_button("Green Button");
			imgui_pop_style_color(1);
			//Next Column and button
			imgui_next_column();
			imgui_push_style_color(ImGuiCol_Button, blue_color);
			imgui_button("Blue Button");
			imgui_pop_style_color(1);
			
			//End Child
			imgui_end_child();
		#endif
		
		
		//PLOT LINES
		static float arr[7] = { 0.6, 0.1, 1.0, 0.5, 0.92, 0.1, 0.2 };
		
		imgui_plotlines("Frame Times", arr, 7);       
		

		//!!End of second window!!!
		imgui_end();
	#endif






}

void loop()
{
	imgui_start_imode();
	window_func();
	imgui_end_imode();
}

void main()
{
	mouse_sync = 0;
	mouse_pointer = 2;
	mouse_mode = 4;
	video_switch(10, 32, 2);
	wait(1);
	level_load("");
	bmap_preload(b1); 
	bmap_preload(b2); 
	bmap_preload(b3); 
	bmap_preload(b4);
	synchronize();
	imgui_init(0);
	on_d3d_lost = imgui_reset;
	on_scanmessage = custom_scan_message;
	on_frame = loop;
}



Thanks again, JenGs!

______
Edit: Some of my methods may not be properly.

For example: i realized that code is wrong;

Code
static float red_color[4] = { 0,0,100,100 };

imgui_push_style_color(ImGuiCol_Button, red_color);


it should actually be like this:
Code
static var red_color[4] = { 0,255,0,255};

imgui_push_style_color(ImGuiCol_Button, (float*)red_color);


So, at your own risk! Still learning. Sorry. grin

______
Edit2: Sorry again. That's the correct one:
Code
COLOR4* red_color=
{
	red=255;
	green=0;
	blue=0;
	alpha=255;
}

imgui_push_style_color(ImGuiCol_Button, red_color);


Last edited by Emre; 09/20/19 05:21. Reason: Some corrections, again.