Solved

Design of a tile editor ... DX doesn't seem to work

Posted on 2006-06-23
1
420 Views
Last Modified: 2010-04-07
Hello,

I started writing a tile/map editor a few days ago. Since then, i've had to retry different methods of an engine because I keep running into different problems.

The game will be in C#/DX.

I want each map to be larger than the size of one screen and scroll when you walk on it. (Like Zelda 3)

So in my first attempt at an editor I set up a container panel on my form roughly the same size as the form. Then I attached my map panel to the container panel and set its dimensions to 5000x5000. That way I can use scrollbars to scroll around on my map and place tiles anywhere I want. I was creating new picturebox instances for each tile laid. Due to some limitations of the pictureboxes (couldn't have transparencies and do layered images when multiple pictureboxes overlapped)

My second attempt at the editor was similar to the first. I had a container panel on my form roughly the size of the form. Next, I created a map panel (5000x5000) and attached it to the container panel. That way I could scroll around with scrollbars in the map. This time however, I am using DirectX. So I created a Device and attached it to my map panel (5000,5000). This is where the program crashes. If I make the dimensions of my panel 4000,4000 DX doesn't complain.

Any techniques anyone can think of where I can have a large map I scroll around on and lay sprites anywhere I want? This is starting to get annoying. Once the Map windows is set up and working fine I can fly through the rest of the engine.

Thanks in advance for any helpful posts.
0
Comment
Question by:ThankYouDriveThrough
1 Comment
 
LVL 85

Accepted Solution

by:
Mike Tomlinson earned 500 total points
ID: 16986149
Setup a 2D array (or some other structure) to hold the tiles (or an "index" to the tile that should be in each location).

In the Paint() event of your Panel, iterate the strucutre and draw each tile in the correct location using Graphics.DrawImage().

You can speed things up by only drawing the visible portion of the map.  This can be determined by using information from the AutoScroll() position of your panel and the Panels current width/height...
0

Featured Post

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Artificial Intelligence comes in many forms, and for game developers, Path-Finding is an important ability for making an NPC (Non-Playable Character) maneuver through terrain.  A* is a particularly easy way to approach it.  I’ll start with the algor…
Recently, in one of the tech-blogs I usually read, I saw a post about the best-selling video games through history. The first place in the list is for the classic, extremely addictive Tetris. Well, a long time ago, in a galaxy far far away, I was…
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question