Gamestudio Links
Zorro Links
Newest Posts
Blobsculptor tools and objects download here
by NeoDumont. 03/28/24 03:01
Issue with Multi-Core WFO Training
by aliswee. 03/24/24 20:20
Why Zorro supports up to 72 cores?
by Edgar_Herrera. 03/23/24 21:41
Zorro Trader GPT
by TipmyPip. 03/06/24 09:27
VSCode instead of SED
by 3run. 03/01/24 19:06
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
3 registered members (AndrewAMD, TipmyPip, Edgar_Herrera), 804 guests, and 4 spiders.
Key: Admin, Global Mod, Mod
Newest Members
sakolin, rajesh7827, juergen_wue, NITRO_FOREVER, jack0roses
19043 Registered Users
Previous Thread
Next Thread
Print Thread
Rating: 5
Page 546 of 554 1 2 544 545 546 547 548 553 554
Re: What are you working on? [Re: ratchet] #478203
09/18/19 15:07
09/18/19 15:07
Joined: Feb 2013
Posts: 122
Maysville, Ga
Evo Offline
Member
Evo  Offline
Member

Joined: Feb 2013
Posts: 122
Maysville, Ga
imgui : Does anyone have a standalone script that has an example of each feature so that I can understand how each instruction is used?

Re: What are you working on? [Re: Evo] #478204
09/18/19 16:35
09/18/19 16:35
Joined: May 2009
Posts: 5,370
Caucasus
3run Offline
Senior Expert
3run  Offline
Senior Expert

Joined: May 2009
Posts: 5,370
Caucasus
Originally Posted by EVO
imgui : Does anyone have a standalone script that has an example of each feature so that I can understand how each instruction is used?
+1 yep, it would be great to have working examples for all features!

Thank you guys for sharing your work.


Looking for free stuff?? Take a look here: http://badcom.at.ua
Support me on: https://boosty.to/3rung
Re: What are you working on? [Re: ratchet] #478206
09/19/19 04:13
09/19/19 04:13
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!

Can you share the example?
Listbox, Combo, Columns and imgui_plot_lines.
Thanks again.

Re: What are you working on? [Re: jenGs] #478207
09/19/19 04:51
09/19/19 04:51
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
@jenGs Thank you very much!

Re: What are you working on? [Re: 20BN] #478209
09/19/19 06:40
09/19/19 06:40
Joined: Jul 2010
Posts: 283
Germany
J
jenGs Offline
Member
jenGs  Offline
Member
J

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

Re: What are you working on? [Re: jenGs] #478210
09/19/19 08:20
09/19/19 08:20
Joined: Jul 2007
Posts: 619
Turkey, Izmir
Emre Offline
User
Emre  Offline
User

Joined: Jul 2007
Posts: 619
Turkey, Izmir
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.
Re: What are you working on? [Re: ratchet] #478211
09/19/19 09:15
09/19/19 09:15
Joined: Feb 2003
Posts: 146
RP China
2
20BN Offline
Member
20BN  Offline
Member
2

Joined: Feb 2003
Posts: 146
RP China
@Emre

Thanks!

@JenGs

Thanks again.

Re: What are you working on? [Re: ratchet] #478212
09/19/19 09:42
09/19/19 09:42
Joined: May 2009
Posts: 5,370
Caucasus
3run Offline
Senior Expert
3run  Offline
Senior Expert

Joined: May 2009
Posts: 5,370
Caucasus
JenGs and Emre, thank you both for your time and help!


Looking for free stuff?? Take a look here: http://badcom.at.ua
Support me on: https://boosty.to/3rung
Re: What are you working on? [Re: ratchet] #478282
09/27/19 14:56
09/27/19 14:56
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
Cars. 2x3 tiles each. 4 rounded rectangles and a bunch of offsets. Outstanding results from the simplest.

[Linked Image]

and some tiles more for buildings

[Linked Image]

Last edited by txesmi; 09/27/19 15:05.
Re: What are you working on? [Re: ratchet] #478284
09/28/19 11:27
09/28/19 11:27
Joined: Jul 2007
Posts: 619
Turkey, Izmir
Emre Offline
User
Emre  Offline
User

Joined: Jul 2007
Posts: 619
Turkey, Izmir
Amazing work! You're skilful coder and you are also very successful in 2D design. That's really impressive. smile

Page 546 of 554 1 2 544 545 546 547 548 553 554

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