Comments (3)
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.
please paste your use code of the file browser
from imgui-filebrowser.
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)
- `#include <version>` requires C++20 HOT 1
- Double-click file selection HOT 3
- Flags are not modifiable after construction HOT 2
- Segmentation fault on calling Display()
- Capitalized extensions are ignored HOT 2
- Missing some extensions when using SetTypeFilters() HOT 2
- A lot of errors when compiling with GCC. HOT 4
- Which compiler should I use to compile this library? HOT 2
- 请问怎么才能设置成多选 HOT 2
- Compilation fails in Visual Studio less than 2019 due to missing include HOT 1
- Read access violation when setting type filters on release HOT 4
- File browser turns gray instead of background with recent ImGui version. HOT 2
- Mouse position bug on multiple monitors HOT 2
- file not loading until clicked a second time HOT 3
- Crash when opening a directory containing a file with a weird character in its extension HOT 3
- Not working with gamepad HOT 2
- Still shows files even when select directory flag is set HOT 1
- Select several files with Shift key pressed HOT 9
- uncaught filesystem error exceptions cause problems HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from imgui-filebrowser.