Example #1
0
 public RLSettings()
 {
     BitmapFile       = "ascii_8x8.png";
     Width            = 60;
     Height           = 40;
     CharWidth        = 8;
     CharHeight       = 8;
     Scale            = 1f;
     Title            = "RLNET Console";
     WindowBorder     = RLWindowBorder.Fixed;
     ResizeType       = RLResizeType.None;
     StartWindowState = RLWindowState.Normal;
 }
Example #2
0
        private void Init(RLSettings settings)
        {
            if (settings == null)
            {
                throw new ArgumentNullException("settings");
            }
            if (settings.BitmapFile == null)
            {
                throw new ArgumentNullException("BitmapFile");
            }
            if (settings.Title == null)
            {
                throw new ArgumentNullException("Title");
            }
            if (settings.Width <= 0)
            {
                throw new ArgumentException("Width cannot be zero or less");
            }
            if (settings.Height <= 0)
            {
                throw new ArgumentException("Height cannot be zero or less");
            }
            if (settings.CharWidth <= 0)
            {
                throw new ArgumentException("CharWidth cannot be zero or less");
            }
            if (settings.CharHeight <= 0)
            {
                throw new ArgumentException("CharHeight cannot be zero or less");
            }
            if (settings.Scale <= 0)
            {
                throw new ArgumentException("Scale cannot be zero or less");
            }
            if (System.IO.File.Exists(settings.BitmapFile) == false)
            {
                throw new System.IO.FileNotFoundException("cannot find bitmapFile");
            }



            this.scale      = settings.Scale;
            this.scale3     = new Vector3(scale, scale, 1f);
            this.charWidth  = settings.CharWidth;
            this.charHeight = settings.CharHeight;
            this.resizeType = settings.ResizeType;

            window = new GameWindow((int)(settings.Width * charWidth * scale), (int)(settings.Height * charHeight * scale), GraphicsMode.Default);
            window.WindowBorder = (WindowBorder)settings.WindowBorder;
            if (settings.StartWindowState == RLWindowState.Fullscreen || settings.StartWindowState == RLWindowState.Maximized)
            {
                window.WindowState = (WindowState)settings.StartWindowState;
            }

            window.Title        = settings.Title;
            window.RenderFrame += window_RenderFrame;
            window.UpdateFrame += window_UpdateFrame;
            window.Load        += window_Load;
            window.Resize      += window_Resize;
            window.Closed      += window_Closed;
            window.Closing     += window_Closing;
            Mouse    = new RLMouse(window);
            Keyboard = new RLKeyboard(window);
            LoadTexture2d(settings.BitmapFile);

            vboId       = GL.GenBuffer();
            iboId       = GL.GenBuffer();
            tcboId      = GL.GenBuffer();
            foreColorId = GL.GenBuffer();
            backColorId = GL.GenBuffer();
            CalcWindow(true);
        }