Advertisement

What does the arrow at the top do in imgui.

Started by August 21, 2020 08:36 PM
15 comments, last by RedBull4 4 years, 5 months ago

@Shaanveer Thanks. But I already found out just need to do this

Thanks for all your help I found out. After nullptr just add this ImGuiWindowFlags_NoTitleBar.

Advertisement

It's just a way to write bit flag constants in C/C++.

It is the bitshift operator, so “1 << 0” is binary “1” (1), “1 << 1” is binary “10” (2), “1 << 2” is binary “100” (4), etc.

So you can do like `ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoMove` which is ((1 << 1) | (1 << 2)) so binary 110 or 6.

Then it can do like `if (flags & ImGuiWindowFlags_NoResize)` later to see if you set it.

It's a constant definition of bit flags. It means the value of 1 shifted to the left by zero (so basically not shifted at all), resulting in 1.

Usually bit flags are used to have several flags stored in a 32bit or 64bit value.

Fruny: Ftagn! Ia! Ia! std::time_put_byname! Mglui naflftagn std::codecvt eY'ha-nthlei!,char,mbstate_t>

Shaanveer said:
What do the numbers mean

Those are bits that you can combine to setup your window using ImGui::Begin().
For example here i have disabled almost everything to render some text in the 3D view without any window or background:

void Vis::RenderLabel (sVec3 pos, float r, float g, float b, const char *text, ...)
{
	pos = WorldToScreen (pos);
	// cull
	if (pos[2]<0) return;
	if (pos[0]<-300) return;
	if (pos[0]>simpleVis.viewportWidth) return;
	if (pos[1]<-30) return;
	if (pos[1]>simpleVis.viewportHeight) return;


	// generate some string to give unique id
	labelID++;
 // set to zero each frame
	char stringID[4];
	stringID[0] = 48 + (labelID & 0x3F);
	stringID[1] = 48 + ((labelID>>6) & 0x3F);
	stringID[2] = 48 + ((labelID>>12) & 0x3F);
	stringID[3] = 0;


	// make window
	ImGui::SetNextWindowPos(ImVec2(pos[0], pos[1]));
	ImGui::SetNextWindowSize(ImVec2 (100000, 100000));
	
	ImGui::Begin((char*)stringID, NULL, 
		ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoScrollbar | 
		ImGuiWindowFlags_NoScrollWithMouse | ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_AlwaysAutoResize | 
		ImGuiWindowFlags_NoBackground | ImGuiWindowFlags_NoSavedSettings | ImGuiWindowFlags_NoMouseInputs | 
		ImGuiWindowFlags_NoFocusOnAppearing | ImGuiWindowFlags_NoBringToFrontOnFocus | ImGuiWindowFlags_NoNavInputs | ImGuiWindowFlags_NoNavFocus);


	// render text
	va_list args;
	va_start(args, text);
	ImGui::TextColoredV(ImVec4(r,g,b,1), text, args);
	va_end(args);

	ImGui::End();
}

@undefined Oh. Is there any way I can make a full on calculator with buttons in imgui

I know the other part

Advertisement

Hides the window, just click on it!

None

This topic is closed to new replies.

Advertisement