Ejemplo n.º 1
0
        /// <summary>
        /// Constructs a DisplayWindow from a resource.
        /// </summary>
        /// <param name="resources"></param>
        /// <param name="name"></param>
        public DisplayWindow(Resources.AgateResourceCollection resources, string name)
        {
            Resources.AgateResource         res  = resources[name];
            Resources.DisplayWindowResource disp = res as Resources.DisplayWindowResource;

            if (disp == null)
            {
                throw new Resources.AgateResourceException("Resource " + name + " was found, but was of type " + name.GetType().ToString() + ", not DisplayWindowResource.");
            }


            if (disp.FullScreen)
            {
                CreateWindowParams par = CreateWindowParams.FullScreen(
                    disp.Title, disp.Size.Width, disp.Size.Height, disp.Bpp);

                impl = Display.Impl.CreateDisplayWindow(par);
            }
            else
            {
                CreateWindowParams par = CreateWindowParams.Windowed(
                    disp.Title, disp.Size.Width, disp.Size.Height, disp.AllowResize, null);

                impl = Display.Impl.CreateDisplayWindow(par);
            }

            Display.RenderTarget    = this;
            Display.DisposeDisplay += new Display.DisposeDisplayHandler(Dispose);
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Creates a DisplayWindow object which generates a desktop window to render into.
 /// </summary>
 /// <param name="title"></param>
 /// <param name="width"></param>
 /// <param name="height"></param>
 /// <param name="iconFile"></param>
 /// <param name="allowResize"></param>
 /// <returns></returns>
 public static DisplayWindow CreateWindowed(string title, int width, int height, bool allowResize, string iconFile)
 {
     return(new DisplayWindow(CreateWindowParams.Windowed(title, width, height, allowResize, iconFile)));
 }