Click here to Skip to main content
13,250,453 members (47,825 online)
Click here to Skip to main content
Add your own
alternative version


15 bookmarked
Posted 8 Oct 2003


, 14 Oct 2003
Rate this:
Please Sign up or sign in to vote.
A simple and efficient interface for using a multi-level matrix of values.


CMapEditor is a simple and efficient interface for using a multi-level matrix of values. This can be easily used in games or any other program that requires a versatile map structure.


How to use CMapEditor:

#include "CMapEditor.h"

Include the .h file in your code. Keep also in mind that CMapEditor requires the <vector> header to be present on your machine.

To initialize a map just use:



CMapEditor *meEditor = new CMapEditor(WIDTH,HEIGHT,LEVELS);

To set a cell's value in the map, use:


You can also use advanced operations, such as region fill, or drag-like procedures:




CMapEditor also supports basic undo and redo operations. You can decide what is going to be undone by calling


before performing other operations. For example:


in this case, the SetMapValue() and the Fill() effects will be undone together. To perform undo and redo, just use:




Why did I write this class

Actually, the purpose of this class was for me to learn. And I did. As a matter of fact, class programming was a bizarre way of thinking about stuff before, therefore, I decided to start from the basics, and started learning about that. OK, I got the basics, but if you have any comments on how I programmed the class, please let me know. Secondly, I wanted to get familiar with Hungarian notation (all my other projects are big messes), so if you have comments also on that, let me know. And finally, I learned how to use vectors, which I didn't expect to use (actually, I didn't even know what thery were) and they seem to be pretty useful. Another reason for which I decided to write this class, is that I wanted to contribute something hopefully useful to CodeProject.


  • Last Update (15 Oct 2003)
    • I have fixed some memory leaks issues. Now the class destructor is correct.


This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


About the Author

United States United States
No Biography provided

You may also be interested in...

Comments and Discussions

GeneralTaking it further Pin
lakie16-Oct-03 22:51
susslakie16-Oct-03 22:51 
GeneralRe: Taking it further Pin
Klaus Nowikow20-Oct-03 0:08
memberKlaus Nowikow20-Oct-03 0:08 
GeneralNice Pin
Marc Clifton9-Oct-03 10:56
editorMarc Clifton9-Oct-03 10:56 
GeneralRe: Nice Pin
eugi9-Oct-03 11:07
membereugi9-Oct-03 11:07 
Thank you Marc !

I rebuilt the zip archive and uploaded it again! Hope it works now!

bye bye Wink | ;)

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.171114.1 | Last Updated 15 Oct 2003
Article Copyright 2003 by eugi
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid