/// <summary>
 ///		Initializes a new instance of this class.
 /// </summary>
 /// <param name="width">Width of the resolution of this window.</param>
 /// <param name="height">Height of the resolution of this window.</param>
 /// <param name="flags">Decides how the window is created.</param>
 public GameWindow(int width, int height, GraphicsFlags flags)
 {
     InitializeComponent();
     _canvas = new GraphicsCanvas(this, 0, new CanvasRenderHandler(Render));
     GraphicsManager.RenderTarget = _canvas;
     Reset(width, height, flags);
 }
Example #2
0
        /// <summary>
        ///		Creates a canvas that can be rendered to by the current driver.
        /// </summary>
        /// <param name="control">Control to render this canvases graphics to.</param>
        /// <returns>New renderable canvas.</returns>
        public static GraphicsCanvas CreateCanvas(Control control, GraphicsFlags flags, CanvasRenderHandler handler)
        {
            GraphicsCanvas canvas = new GraphicsCanvas(control, flags, handler);

            ClearRenderState();
            return(canvas);
        }
        /// <summary>
        ///     Initializes a new instance of this control.
        /// </summary>
        /// <param name="file">Tileset file to display.</param>
        public TilesetWindow(string file)
        {
            InitializeComponent();

            _canvas = new GraphicsCanvas(canvasPanel, 0, Render);
            _tileset = new Tileset(file);

            TilesetWindow_ResizeEnd(null, new EventArgs());

            EventManager.AttachListener(_listener = new EventListener(EventCaptured));
        }
        /// <summary>
        ///     Invoked when a new instance of this class is created.
        /// </summary>
        public EmitterEditorWindow()
        {
            InitializeComponent();

            _emitterProperties.Emitter = _emitterNode;
            _canvas = new GraphicsCanvas(previewPanel, 0, new CanvasRenderHandler(Render));

            // Create a callback so we can render the canvas (it won't be done my the main loop due to
            // this window being show in model).
            Application.Idle += new EventHandler(Application_Idle);

            SyncronizeTypes();
        }
        /// <summary>
        ///     Called when a new instance of this class is created.
        /// </summary>
        public BitmapFontSelectorWindow()
        {
            InitializeComponent();

            _canvas = new GraphicsCanvas(previewPanel, 0, new CanvasRenderHandler(RenderPreview));

            // Create a callback so we can render the canvas (it won't be done my the main loop due to
            // this window being show in model).
            Application.Idle += new EventHandler(Application_Idle);
        }
 /// <summary>
 ///		Creates a canvas that can be rendered to by the current driver.
 /// </summary>
 /// <param name="control">Control to render this canvases graphics to.</param>
 /// <returns>New renderable canvas.</returns>
 public static GraphicsCanvas CreateCanvas(Control control, GraphicsFlags flags, CanvasRenderHandler handler)
 {
     GraphicsCanvas canvas = new GraphicsCanvas(control, flags, handler);
     ClearRenderState();
     return canvas;
 }
        /// <summary>
        ///		Initializes a new instance of this class, and sets up the form.
        /// </summary>
        public EditorWindow()
        {
            // Initialize the windows form controls.
            InitializeComponent();

            // Refresh the recent file list.
            RefreshRecentFiles();

            // Create the map canvas to render to.
            _mapCanvas = GraphicsManager.CreateCanvas(mapPanel, 0, new CanvasRenderHandler(Render));

            // Grab the path marker image.
            _pathMarkerImage = new Graphics.Image(ReflectionMethods.GetEmbeddedResourceStream("path_marker.png"), 0);

            // Syncronize the window to the current data.
            SyncronizeWindow();

            // Create a new event listener to listen out for input events.
            _listener = new EventListener(new ProcessorDelegate(EventCaptured));
            EventManager.AttachListener(_listener);
        }