Welcome to Dream.In.Code
Getting Help is Easy!

Join 109,296 Programmers for FREE! Ask your question and get quick answers from experts. There are 1,219 online right now! We've got more than 500 tutorials and 2,000 snippets. Join and find out why Dream.In.Code is the #1 programming help community on the internet! Registration is fast and FREE... Join Now!



[C#] Using XNA In Windows Forms

 
Reply to this topicStart new topic

[C#] Using XNA In Windows Forms, Perfect starting ground for a map editor

NickCosentino
post 16 Jul, 2008 - 09:54 AM
Post #1


New D.I.C Head

*
Joined: 16 Jul, 2008
Posts: 1

Hey,

After searching endlessly for an example in C# on how to get XNA to render 2D graphics in a windows form,
I decided I should try my hand at it all by my lonesome. It took me a while to figure it out, mainly because
when I finally had the graphics device rendering to the correct location, my bitmaps were just solid colours
instead of the correct graphics. So I kept playing with it until finally I got something.

The idea behind it is that you use a normal XNA game project, and then pass the Sprite Batch, Graphics Device,
and Content Manager to your windows form. Then you put a draw loop on the form, and tell the device to
draw to a panel instead of the game window.

If what I said was confusing, take a peak at the code. It's very simple (if you have a bit of experience with basic
programming) and should be a great starting point for anyone who wants to make a level editor (which is why I
stumbled across this in the first place!)

I'm assuming I'm posting this in the correct forum since map editors and XNA are game related, but if it's in the
wrong spot, my apologies (this just seemed the most suitable place).

This project was created as a basis for my map editor for my game Macerus, which I am currently developing on
my own using the XNA framework. Here's a link to the site where you can download the XNA In Windows Form
application.

http://macerus.ath.cx/Macerus_Development.htm

Hope this can be of some use!
User is offlineProfile CardPM

Go to the top of the page

Fast ReplyReply to this topicStart new topic
Time is now: 9/6/08 09:38AM

Live Help!

Tutorials

Programming

Web Development

Reference Sheets

Code Snippets

Bye Bye Ads

Free DIC T-Shirt

T-Shirt Example

Related Sites

Monthly Drawing

Thumb Drive

Partners

Top Contributors

Top 10 Kudos This Month