Archived

This topic is now archived and is closed to further replies.

Placenta

Windows Programming Question....

Recommended Posts

I am writing a little tile editor (something I have never done before) and I have a question. When the user hits file new I want to create a new file but I am not quite sure how to do that... I know this part case ID_FILE_NEW : { } but I am not sure what would go in the middle of it. Any help would be appreciated.

Share this post


Link to post
Share on other sites
Um, you might want to start with something simpler, like a text editor. Just so, I haven''t done a tile editor before myself, so I can''t speak from experience, but here''s my guess as to how to go about it generally. Use a bmp as the tile map, a DIB is probably better so that you can get at the data using a memory mapped file. Invoking "new file" would create a new DIB section and display it in the main window''s client area. Each brush type would be an item in a list, such that placing a tile would replace the relevant bytes in the DIB with a copy of the bytes from the brush. Once you''ve finished, you can save the color data into any format that you fancy. Take a look at CreateDIBSection, CreateFile, MapViewOfFile (and related api''s). I may be off a bit, but you''re bound to come across those api''s at some point or another anyway.

Share this post


Link to post
Share on other sites
Well how do you make a dialog box that comes up and lets you type in the name of he file? Do you have to make a Dialog Box resource or is there already a simple function call that you can use.

Share this post


Link to post
Share on other sites
You''ll want to look at the OPENFILENAME structure and GetOpenFileName and GetSaveFileName api''s. Take a look at the MDI example in the faq section at winprog.org. That will give you a better sense of how those functions operate, and maybe a sense of how to approach a tile editor as well, although I would expect a tile editor to differ somewhat from a text editor because each kind of data is different.

Share this post


Link to post
Share on other sites