/// <summary> /// Constructs the main form. /// </summary> public Xna2dEditorForm() { InitializeComponent(); // Don't initialize the graphics device if we are running in the designer. if (!DesignMode) { graphicsDeviceService = GraphicsDeviceService.AddRef(Handle, ClientSize.Width, ClientSize.Height); // Register the service, so components like ContentManager can find it. services.AddService <IGraphicsDeviceService>(graphicsDeviceService); xna2dShapeControl1 = new Xna2dShapeControl(); xna2dShapeControl1.Size = new System.Drawing.Size(800, 600); xna2dShapeControl1.Dock = DockStyle.Fill; panel1.Controls.Add(xna2dShapeControl1); Mouse.WindowHandle = xna2dShapeControl1.Handle; OpenDefaultProject(); RefreshProject(); } //ProjectNameNode = projectContentTV.Nodes["ProjectNameNode"]; /// Automatically bring up the "Load Model" dialog when we are first shown. //this.Shown += OpenMenuClicked; }
/// <summary> /// Initializes the control. /// </summary> protected override void OnCreateControl() { // Don't initialize the graphics device if we are running in the designer. if (!DesignMode) { graphicsDeviceService = GraphicsDeviceService.AddRef(Handle, ClientSize.Width, ClientSize.Height); // Register the service, so components like ContentManager can find it. services.AddService <IGraphicsDeviceService>(graphicsDeviceService); // Give derived classes a chance to initialize themselves. Initialize(); } base.OnCreateControl(); }
/// <summary> /// Constructs the main form. /// </summary> public Line2dDemoForm() { InitializeComponent(); // Don't initialize the graphics device if we are running in the designer. if (!DesignMode) { graphicsDeviceService = GraphicsDeviceService.AddRef(Handle, ClientSize.Width, ClientSize.Height); // Register the service, so components like ContentManager can find it. services.AddService <IGraphicsDeviceService>(graphicsDeviceService); } ProjectNameNode = projectContentTV.Nodes["ProjectNameNode"]; /// Automatically bring up the "Load Model" dialog when we are first shown. //this.Shown += OpenMenuClicked; }
public void Initialize(IntPtr handle, int width, int height) { graphicsDeviceService = GraphicsDeviceService.AddRef(handle, width, height); // Register the service, so components like ContentManager can find it. services.AddService <IGraphicsDeviceService>(graphicsDeviceService); contentBuilder = new ContentBuilder(ProjectContentFolder, false); contentManager = new ContentManager(this.Services, contentBuilder.OutputDirectory); modelManager = new XnaModelManager(contentBuilder, contentManager, OriginalContentFolder); texture2dManager = new XnaTexture2dManager(contentBuilder, contentManager, OriginalContentFolder); fontManager = new XnaFontManager(contentBuilder, contentManager, OriginalContentFolder); effectManager = new XnaEffectManager(contentBuilder, contentManager, OriginalContentFolder); spriterManager = new XnaSpriterManager(contentBuilder, contentManager, OriginalContentFolder); RefreshLists(); FyriEffect roundlineEffect = effectManager.GetEffect("RoundLine"); FyriFont roundlineFont = fontManager.GetFont("SpriteFont"); roundLineManager = new RoundLineManager(); roundLineManager.Init(this.graphicsDeviceService.GraphicsDevice, roundlineEffect.Effect); lineBatch = new XnaLine2dBatch(); lineBatch.Init(this.graphicsDeviceService.GraphicsDevice, roundlineEffect.Effect); drawingContext = new XnaDrawingContext(this.graphicsDeviceService.GraphicsDevice); IsInitialized = true; }