简体   繁体   中英

how do I get win32 file browser with SDL?

I want to create an editor in C++ using SDL & OpenGL and have decided to use the win32 api to access the window bar menus (for file, edit and so on) and it seems quite simple, but I don't know how to create a "file-> open" file browser/loader... I'm hoping it's quite simple but I'm finding it hard to look up any tutorials on google because of the phrasing...

I just want to have an "open" or "import" option in the file menu that will open a standard windows file browser... then grab the file location, place it into a string then pass it into a function that is activated by selection a file... (I hope that makes sense).

The method I'm using to create the win32 menus are from this post: http://www.gamedev.net/topic/400677-sdl-with-a-win32-menu/

Half way down the page there is a comment by "caseyd"... that's how I learnt how to use it, so that is my current understanding of win32 menus in SDL... I wanted to post the code here, but I didn't know how to paste it here in codeblocks without reformatting every line.

I'm hoping this is quite simple... Thanks to anyone who can teach me how or just point me in the right direction.

Oh, and I'm not trying to convert this to other operating systems, I just like SDL.

Use GetOpenFileName() . Note that that function blocks until the user selects a file, so if you want to continue rendering etc. in the background, make sure to run it on a separate thread.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM