Skip to content

TKazer/OS-ImGui

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

35 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

OS-ImGui

A simple imgui library, develop based on Dear-ImGui.

Aim to make it easy for people to use imgui, which only takes few minutes.

Chinese -> README-ZH

Feature

  • Compatible for internal and external use, and easy to switch.

If you want to use internal mode, just need define "OSIMGUI_INTERNAL" in preprocessing.

  • Easy to use.

Only one line of code is needed to call.

  • MutipleDrawing

Example

void DrawCallBack()
{
	ImGui::Begin("Menu");
	{
		ImGui::Text("This is a text.");
		if (ImGui::Button("Quit"))
		{
			// Using Gui.Quit() to quit the exe or dll.
			Gui.Quit();
			//...
		}
	}ImGui::End();
}
  1. External Mode
int main()
{
	try {
		/*
		   New a window for using.
		*/
		Gui.NewWindow("WindowName", Vec2(500, 500), DrawCallBack);
		/*
		   Attach to another window by window's name or classname.
		*/
		Gui.AttachAnotherWindow("Title","", DrawCallBack);
	}
	catch (OSImGui::OSException& e)
	{
		std::cout << e.what() << std::endl;
	}

	system("pause");
	return 0;
}
  1. Internal Mode
// Define "OSIMGUI_INTERNAL" in preprocessing before use.

BOOL APIENTRY DllMain(HMODULE hModule, DWORD  ul_reason_for_call, LPVOID lpReserved)
{
	if (ul_reason_for_call == DLL_PROCESS_ATTACH)
	{
		// Entry
		// Detect directX type automatically.
		Gui.Start(hModule, DrawCallBack, OSImGui::DirectXType::AUTO);
	}
	return TRUE;
}

Releases

No releases published

Packages

No packages published