Giter Site home page Giter Site logo

All dont work about imgui-filebrowser HOT 3 CLOSED

airguanz avatar airguanz commented on July 23, 2024
All dont work

from imgui-filebrowser.

Comments (3)

AirGuanZ avatar AirGuanZ commented on July 23, 2024 1

try moving the definition of dialog variable out of the rendering loop. the dialog object is stateful and the current usage recreates it every frame.

from imgui-filebrowser.

AirGuanZ avatar AirGuanZ commented on July 23, 2024

please paste your use code of the file browser

from imgui-filebrowser.

NekoMazix avatar NekoMazix commented on July 23, 2024

HRESULT __stdcall hkPresent(IDXGISwapChain* pSwapChain, UINT SyncInterval, UINT Flags)
{
if (!init)
{
if (SUCCEEDED(pSwapChain->GetDevice(__uuidof(ID3D11Device), (void**)& pDevice)))
{
pDevice->GetImmediateContext(&pContext);
DXGI_SWAP_CHAIN_DESC sd;
pSwapChain->GetDesc(&sd);
window = sd.OutputWindow;
ID3D11Texture2D* pBackBuffer;
pSwapChain->GetBuffer(0, __uuidof(ID3D11Texture2D), (LPVOID*)& pBackBuffer);
pDevice->CreateRenderTargetView(pBackBuffer, NULL, &mainRenderTargetView);
pBackBuffer->Release();
oWndProc = (WNDPROC)SetWindowLongPtr(window, GWLP_WNDPROC, (LONG_PTR)WndProc);
InitImGui();
init = true;
}

	else
		return oPresent(pSwapChain, SyncInterval, Flags);
}

// (optional) set browser properties

ImGui::FileBrowser fileDialog;
// (optional) set browser properties
fileDialog.SetTitle(xorstr("Select Config!"));

fileDialog.SetTypeFilters({ ".txt" });

if (GetAsyncKeyState(VK_END)) {
	kiero::shutdown();
	return 0;
}

if (GetAsyncKeyState(VK_INSERT) & 1) {
	menu = !menu;
}


if (menu) {
	ImGui_ImplDX11_NewFrame();
	ImGui_ImplWin32_NewFrame();
	ImGui::NewFrame();
	analhooks();
	if (ImGui::Begin("dummy window"))
	{
		// open file dialog when user clicks this button
		if (ImGui::Button("open file dialog"))
			fileDialog.Open();
	}
	ImGui::Text("\n");
	ImGui::Text(xorstr("Application average %.3f ms/frame (%.1f FPS)"), 1000.0f / ImGui::GetIO().Framerate, ImGui::GetIO().Framerate);
	ImGui::End();
	fileDialog.Display();
	if (fileDialog.HasSelected())
	{
		std::cout << "Selected filename" << fileDialog.GetSelected().string() << std::endl;
		fileDialog.ClearSelected();
	}
	ImGui::Render();

	pContext->OMSetRenderTargets(1, &mainRenderTargetView, NULL);
	ImGui_ImplDX11_RenderDrawData(ImGui::GetDrawData());
}
return oPresent(pSwapChain, SyncInterval, Flags);

}

from imgui-filebrowser.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.