Jump to content
  • Advertisement
Sign in to follow this  
Hot_Tamalle

Level Editor

This topic is 4460 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, I need some help to create my level editor. I've initialized Directx in a picture Box. I've made a toolbar with tile,brick and wall buttons(with images). Now i want to click a button on the toolbar and then click anywhere on the picuteBox to paste the corresponding image just like MSpaint(replacing colors with pictures). I don't know how to do this. Please advise. Some part of my code is below: private bool InitializeGraphics() { PresentParameters presp = new PresentParameters(); presp.SwapEffect = SwapEffect.Discard; presp.Windowed = true; try { m_device = new Device( 0, DeviceType.Hardware, this.pictureBox2, CreateFlags.SoftwareVertexProcessing, presp ); return true; } catch ( DirectXException ) { return false; } } private void RenderFrame() { m_device.Clear( ClearFlags.Target, Color.Black, 1.0f, 0 ); m_device.BeginScene(); m_device.EndScene(); m_device.Present(); }

Share this post


Link to post
Share on other sites
Advertisement
One thing you could do is store the level (if it's tile based) in an array. When you click on one of the tiles, figure out which tile it is (fairly easy to do if you're using an ortho matrix) and change that tiles value in the array to whatever (ie: 0 for tile, 1 for brick etc).

When you render, change the texture to whatever the tile is, or even better store all the tile textures in one big texture and just use the uv coordinates of the tiles (saves changing textures all the time).

Works well for my map editor anyway.

Share this post


Link to post
Share on other sites
If I understand your post right, you could register the click, divide it by your tile size, put into that part of a string[,] array with characters representing the level.

You could then reload this string array into the picturebox to get the updated image.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!