Hallo,
Ich bräuchte dringend einen Editor, deswegen hab ich ein paar fragen an euch (falls ihr antworten wisst 🙂)
Ich bin nur frustriert da es meines wissens nur einen freien XNA Editor gibt, der ist aber unter GameStudio 1.1 gemacht und hat nicht sonderlich viele funktionen 🙁
Wer kann mir helfen? Wäre sehr dankbar 🙂
Danke,
christian
Projekte:
http://code.google.com/p/freeminerdotnet/ - MMORPG-Maker im grafischen Stile von Minecraft
http://code.google.com/p/directzzt/ - ZZT Remake mit eigenen Ideen
Bau dir nen XNAPanel. Das PAnel erstellt einen GraphicsDevice für das Panel und dadrauf kannste mit XNA befehlen zeichnen.
Anleitungen gibts es zu hunderten im inet. einfach mal google anschmeissen.
Hier ist der Code für ein Panel aus meinem XNA 2D Engine vielleicht hilft das ja schon weiter:
namespace FlatEngine.Windows
{
public class FERenderPanel : Panel
{
private GraphicsDevice mDevice;
private SpriteBatch mSpriteBatch;
private Timer mUpdateTimer;
private FECamera mCamera;
private FEScene mScene;
private FEDummyServiceContainer mServices;
private FEContentManager mContent;
private bool mUpdateSprites;
public FEScene Scene
{ get { return mScene; } }
public FECamera Camera
{ get { return FECameraManager.ActiveCamera; } }
public GraphicsDevice GraphicsDevice
{ get { return mDevice; } }
public FEContentManager Content
{ get { return mContent; } }
public bool UpdateSprites
{ get { return mUpdateSprites; } set { mUpdateSprites = value; } }
public FERenderPanel( )
: base( )
{
this.SetStyle( ControlStyles.AllPaintingInWmPaint, true );
BorderStyle = BorderStyle.FixedSingle;
this.Paint += new PaintEventHandler( Repaint );
this.Resize += new EventHandler( ThisResize );
}
/// <summary>
/// Initialize everything you need (Graphics, SpriteBatch, Scene...)
/// </summary>
public void InitializeGraphics( )
{
// Setup the Device
PresentationParameters pp = new PresentationParameters( );
pp.BackBufferCount = 1;
pp.IsFullScreen = false;
pp.SwapEffect = SwapEffect.Discard;
pp.BackBufferWidth = this.Width;
pp.BackBufferHeight = this.Height;
pp.AutoDepthStencilFormat = DepthFormat.Depth24Stencil8;
pp.EnableAutoDepthStencil = true;
pp.PresentationInterval = PresentInterval.Default;
pp.BackBufferFormat = SurfaceFormat.Unknown;
pp.MultiSampleType = MultiSampleType.None;
mDevice = new GraphicsDevice( GraphicsAdapter.DefaultAdapter, DeviceType.Hardware,
this.Handle, CreateOptions.HardwareVertexProcessing, pp );
mServices = new FEDummyServiceContainer( mDevice );
mContent = new FEContentManager( mServices );
mCamera = new FECamera( );
FECameraManager.AddCamera( mCamera, "default" );
FECameraManager.SetCamera( "default" );
mScene = new FEScene( );
mSpriteBatch = new SpriteBatch( mDevice );
mUpdateSprites = false;
ResetGraphics( );
}
public void LoadGraphicsContent( FESprite sprite )
{
if ( sprite is IFELoadable )
( (IFELoadable)sprite ).LoadGraphicsContent( mDevice, mContent );
}
public void LoadGraphicsContent( )
{
mScene.LoadGraphicsContent( mDevice, mContent );
}
private void ResetGraphics( )
{
if ( mUpdateTimer == null )
{
mUpdateTimer = new Timer( );
mUpdateTimer.Interval = 16;
mUpdateTimer.Tick += new EventHandler( UpdateTimerTick );
}
mUpdateTimer.Enabled = false;
if ( this.Width == 0 || this.Height == 0 )
return;
mDevice.PresentationParameters.BackBufferWidth = this.Width;
mDevice.PresentationParameters.BackBufferHeight = this.Height;
Camera.Origin = new Vector2( this.Width / 2, this.Height / 2 );
mDevice.Reset( );
mUpdateTimer.Enabled = true;
Repaint( null, null );
}
public virtual void Repaint( object sender, PaintEventArgs e )
{
if ( mDevice != null )
{
mDevice.Clear( new XNAColor( this.BackColor.R, this.BackColor.G, this.BackColor.B ) );
mScene.Draw( mDevice, mSpriteBatch );
mDevice.Present( );
}
}
private void ThisResize( object sender, EventArgs e )
{
if ( mDevice != null )
ResetGraphics( );
Repaint( null, null );
}
private void UpdateTimerTick( object sender, EventArgs e )
{
if ( mScene != null && mUpdateSprites )
{
GameTime gt = new GameTime( TimeSpan.Zero, TimeSpan.Zero, TimeSpan.Zero, TimeSpan.FromMilliseconds( 16 ) );
mScene.Update( gt );
}
Repaint( null, null );
}
public void BeginUpdate( )
{
mUpdateTimer.Enabled = false;
}
public void EndUpdate( bool init )
{
if ( init )
{
mScene.Initialize( );
mScene.LoadGraphicsContent( mDevice, mContent );
}
mUpdateTimer.Enabled = true;
}
}
}
Das wichtigste ist wohl der DummyContainerService:
using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
namespace FlatEngine.Windows
{
internal class FEDummyServiceContainer : IServiceProvider, IGraphicsDeviceService
{
private GraphicsDevice mDevice;
public FEDummyServiceContainer( GraphicsDevice device )
{
mDevice = device;
}
#region IServiceProvider Member
public object GetService( Type serviceType )
{
if ( serviceType == typeof( IGraphicsDeviceService ) )
return this;
return null;
}
#endregion
#region IGraphicsDeviceService Member
public event EventHandler DeviceCreated;
public event EventHandler DeviceDisposing;
public event EventHandler DeviceReset;
public event EventHandler DeviceResetting;
public GraphicsDevice GraphicsDevice
{
get { return mDevice; }
}
#endregion
}
}
Gruss Ari
Wer lesen kann ist klar im vorteil!
MSDN
Dein Feund in allen fragen