Advertisement

File Selection (writing on screen)

Started by March 10, 2004 07:58 AM
8 comments, last by Ructions 20 years, 11 months ago
I am writing an arkanoid game and having a level editor to make your own levels. I dont want to have a dialog box to come up and select the level. I want the user to enter a option on my screen and select it from my screen then it opens so my question is. Is there a way of making all the files in a folder come up on screen and so make them select them. I was also wondering how would i be able to get the user to input text on my screen using the Fonts used in lesson 14 etc. Any help would be greatful Ructions
If you are using C++ on Win32, take a look at using FindFirstFile and FindNextFile. They give you a way of stepping through the files in a directory. You can also apply a filter like "*.jpg" or whatever.
Advertisement
Do you have any code examples for these functions that would help alot. As i have looked it but but dont really understand it
As with any Microsoft development questions, try MSDN:

Search for ''FindFirstFile''

Hope this helps.



--
Cheers,
--
Cheers,
Darren Clark
Searching the MSDN is definitely the best first step. If you are having some trouble understanding it, I''ll try to demonstrate it some.

WIN32_FIND_DATA findData;HANDLE findHandle = FindFirstFile("*.bmp",&findData);if(findHandle == INVALID_HANDLE_VALUE)    return;//findData.cFileName is the first file namewhile(FindNextFile(findHandle,&findData) == true){    //Do something with the findData.cFileName}FindClose(findHandle);


That''s about it. Once you have the filenames, you do whatever you want to display them.


That works fine but i was wondering how would you get the full path name of the file. As i want to search the whole computer for a type of file and i want the full path name so that i can open it.

Thanks in advance

Ructions
Advertisement
That could take a rediculous amount of time, and I certainly wouldn''t want to play a game like that. Just create one folder and say that the maps have to be in there or something.

You have to remember that you''re unique, just like everybody else.
If at first you don't succeed, redefine success.
Actually I am making my own extension so it wont be like searching a whole computer for .txt files etc.

So how do you get the full search path
what python_regious meant was that even if you look for a specific file extension or any file, it will take the same amount of time because you need to go through all the files and it can take a lot of time. for an example, try to search for *.* in the find files utility in your start menu and then reboot (to clear the cache so you''ll have real results) and then do a search for like *.txt they will take about the same time to execute.

hope that helps
Matt
Matt
That helped man thanks. I can see what you mean.

This topic is closed to new replies.

Advertisement