Comments (1)
Test case (modified from mlabbe/nativefiledialog#79):
main.c:
#include <stdio.h>
#include <stdbool.h>
#include <stdlib.h>
#include <SDL.h>
#include <nfd.h>
int main()
{
SDL_Init(SDL_INIT_VIDEO);
NFD_Init();
SDL_Window *window = SDL_CreateWindow("nativefiledialog issue 79", SDL_WINDOWPOS_CENTERED,
SDL_WINDOWPOS_CENTERED, 800, 480, SDL_WINDOW_SHOWN);
int w, h;
SDL_GetWindowSize(window, &w, &h);
bool running = true;
while (running) {
SDL_Event e;
while (SDL_PollEvent(&e)) {
if (e.type == SDL_QUIT) {
running = false;
break;
}
if (e.type == SDL_MOUSEBUTTONDOWN) {
nfdchar_t *filename;
nfdresult_t res = NFD_OpenDialog(&filename, NULL, 0, NULL);
if (res == NFD_OKAY) {
printf("Got filename: %s\n", filename);
free(filename);
}
}
}
}
SDL_DestroyWindow(window);
NFD_Quit();
SDL_Quit();
return 0;
}
CMakeLists.txt:
cmake_minimum_required(VERSION 3.2)
project(MyProgram)
set (CMAKE_CXX_STANDARD 17)
add_executable(MyProgram main.c)
find_package(PkgConfig REQUIRED)
pkg_check_modules(SDL2 REQUIRED sdl2)
target_include_directories(MyProgram PRIVATE ${SDL2_INCLUDE_DIRS})
target_link_libraries(MyProgram PRIVATE ${SDL2_LIBRARIES})
add_subdirectory(${PROJECT_SOURCE_DIR}/../nativefiledialog-extended ${PROJECT_SOURCE_DIR}/../nativefiledialog-extended/build)
target_link_libraries(MyProgram PRIVATE nfd)
from nativefiledialog-extended.
Related Issues (20)
- Use GitHub Actions to let contributors open PRs for wiki pages HOT 2
- How does this project work? HOT 8
- Consider documentation website? HOT 2
- [PR for wiki] Add overview comments & move bindings to readme HOT 1
- Consider comparison of other native file dialog libraries? HOT 2
- WebAssembly (emscripten) support HOT 3
- Setting up Xcode search path for nfd.hpp HOT 5
- Try to use portals, and fall back on GTK HOT 3
- Universal Bindings HOT 3
- Doxygen HOT 6
- Arm64 Support HOT 10
- CI bug? HOT 2
- I made a C# binding HOT 32
- Don't use nullptr in fileOpenDialog->Show HOT 3
- OpenDialog with portal backend allows folders to be picked HOT 1
- Standalone Library build instructions always build Debug version HOT 1
- How to use NFD_OpenDialog(, , , default_path) HOT 3
- Not able to import file with non-ASCII characters in the path on Windows HOT 3
- PickFolder on Portal backend should support default path too HOT 1
- How to set the dialog title? HOT 2
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 nativefiledialog-extended.