Beispiel #1
0
        private static RenderTarget2D CreateEmptyTarget(TGraphics graphics, int width, int height)
        {
            RenderTarget2D newtarget;

            newtarget = new RenderTarget2D(graphics.GraphicsDevice, width, height, false, SurfaceFormat.Color, DepthFormat.Depth24Stencil8);

            return(newtarget);
        }
Beispiel #2
0
        private static Texture2D CreateEmptyTexture(TGraphics graphics, int width, int height)
        {
            Texture2D newtexture;

            newtexture = new Texture2D(graphics.GraphicsDevice, width, height, false, SurfaceFormat.Color);

            return(newtexture);
        }
Beispiel #3
0
 private FontManager(TGraphics graphics, FontTypes type, float size)
 {
     _graphics = graphics;
     FontSize  = size;
     FontName  = type;
     Font      = new System.Drawing.Font(GetName(type), size);
     Bitmap    = graphics.Content.Load <SpriteFont>(string.Format("{0}-{1}", GetName(type), FontFileSize));
 }
Beispiel #4
0
        public static Surface CreateBlankSurface(TGraphics graphics, int Width, int Height)
        {
            Surface result;

            result = new Surface(graphics, Width, Height);
            result.Initialize();
            return(result);
        }
Beispiel #5
0
        public static void DrawLine(TGraphics tgraphics, Point point1, Point point2, Color color, int width = 1)
        {
            int length = Point.Distance(point1, point2);

            float angle = (float)Math.Atan2(point2.Y - point1.Y, point2.X - point1.X);

            DrawLine(tgraphics, point1, length, angle, color, width);
        }
Beispiel #6
0
 public Label(TGraphics graphics, string name, string text, Rectangle area, FontManager fontInfo)
     : base(graphics, name, area)
 {
     Text       = text;
     _fontInfo  = fontInfo;
     _textColor = Color.Black;
     //_gorgonText = _graphics.Renderer2D.Renderables.CreateText(name + "_label", fontInfo.GFont, text);
 }
Beispiel #7
0
        public static Surface CreateFromFile(TGraphics graphics, string Filename)
        {
            Surface result;

            result = new Surface(graphics, Filename);
            result.Initialize();
            return(result);
        }
 public Control(TGraphics graphics, string name, Rectangle area)
 {
     _graphics     = graphics;
     _threadSafety = new ThreadSafetyEnforcer(name);
     _invoker      = new Invoker(_threadSafety);
     _area         = area;
     _anchor       = ControlAnchor.Default;
     Name          = name;
 }
Beispiel #9
0
        public TKeyState(TGraphics graphics)
        {
            _graphics      = graphics;
            _keyEventData  = new List <KeyStateEventData>();
            _keyStateArray = new Key[0];

            graphics.Control.KeyDown += Control_KeyDown;
            graphics.Control.KeyUp   += Control_KeyUp;
        }
Beispiel #10
0
        public TInputManager(TGraphics graphics)
        {
            Keyboard.KeyboardManager.LoadKeyboards();
            Keyboard.KeyboardManager.LoadKeyboard(Keyboard.US_English_103.Type);

            MouseStateManager = new TMouseState(graphics);
            KeyStateManager   = new TKeyState(graphics);

            _stateManagerArray = new InputState[] { MouseStateManager, KeyStateManager };
        }
Beispiel #11
0
        public LoginStatusScreen(TGraphics graphics) : base(graphics)
        {
            BackgroundColor = System.Drawing.Color.Wheat;
            Label cointents = new Label(Program.GameLogic.Graphics, "_contents", "", new Point(0, 0), new Size(Program.GameLogic.Graphics.ScreenSize.Width, Program.GameLogic.Graphics.ScreenSize.Height))
            {
                TextAlignement = TextAlignement.Center
            };

            Controls.Add(10, cointents);
        }
Beispiel #12
0
        private Surface(TGraphics graphics, int width, int height)
        {
            _graphics = graphics;


            _target = CreateEmptyTarget(_graphics, width, height);

            this.Width  = width;
            this.Height = height;
        }
        public TMouseState(TGraphics graphics)
        {
            _mouseStateArray = new MouseButtons[0];
            _mouseEventData  = new List <MouseStateEventData>();

            _graphics = graphics;

            graphics.Control.MouseDown  += _control_MouseDown;
            graphics.Control.MouseUp    += _control_MouseUp;
            graphics.Control.MouseMove  += _control_MouseMove;
            graphics.Control.MouseWheel += _control_MouseWheel;
        }
Beispiel #14
0
        public static void DrawBox(TGraphics tgraphics, Rectangle rec, Color color, int width = 1)
        {
            Point p1, p2, p3, p4;

            p1 = new Point(rec.X, rec.Y);
            p2 = new Point(rec.X + rec.Width, rec.Y);
            p3 = new Point(rec.X + rec.Width, rec.Y + rec.Height);
            p4 = new Point(rec.X, rec.Y + rec.Height);

            Line.DrawLine(tgraphics, p1, p2, color, width);
            Line.DrawLine(tgraphics, p2, p3, color, width);
            Line.DrawLine(tgraphics, p3, p4, color, width);
            Line.DrawLine(tgraphics, p4, p1, color, width);
        }
Beispiel #15
0
        public TextBox(TGraphics graphics, string name, Rectangle area)
            : base(graphics, name, area)
        {
            //_gorgonText = _graphics.Renderer2D.Renderables.CreateText(name + "_TextRenderer");
            _fontInfo     = FontManager.GetInstance(graphics, 22, FontTypes.Sans);
            _flasherTimer = new Timer();

            FocusChanged += delegate
            {
                _redrawPreRenderd = true;
            };

            _textColor = Color.Black;
        }
Beispiel #16
0
        public static FontManager GetInstance(TGraphics graphics, float size, FontTypes name)
        {
            foreach (FontManager obj in _data)
            {
                if (obj.FontName == name && obj.FontSize == size && obj._graphics == graphics)
                {
                    return(obj);
                }
            }
            FontManager font = new FontManager(graphics, name, size);

            _data.Add(font);
            return(font);
        }
Beispiel #17
0
        private Surface(TGraphics graphics, string Filename)
        {
            _graphics = graphics;

            if (!System.IO.File.Exists(Filename))
            {
                throw new System.IO.FileNotFoundException("The file could not be found!", Filename);
            }


            _target = (RenderTarget2D)RenderTarget2D.FromStream(graphics.GraphicsDevice, new FileStream(Filename, FileMode.Open));

            Width  = _target.Width;
            Height = _target.Height;
        }
        protected static Surface getPixel(TGraphics tgraphics)
        {
            if (pixleSet == null)
            {
                pixleSet = new List <Surface>();
            }
            foreach (Surface pb in pixleSet)
            {
                if (pb.Graphics == tgraphics)
                {
                    return(pb);
                }
            }
            Surface newPixle = _createPixle(tgraphics);

            pixleSet.Add(newPixle);
            return(newPixle);
        }
Beispiel #19
0
 public MainMenuScreen(TGraphics graphics)
     : base(graphics)
 {
 }
Beispiel #20
0
        public static void DrawBox(TGraphics tgraphics, Point point1, Point point2, Color color, int width = 1)
        {
            Rectangle rec = new Rectangle(point1, point2);

            DrawBox(tgraphics, rec, color, width);
        }
Beispiel #21
0
 public TextBox(TGraphics graphics, string name, Point location, Size size)
     : this(graphics, name, new Rectangle(location, size))
 {
 }
Beispiel #22
0
 public TextBox(TGraphics graphics, string name, int x, int y, int width, int height)
     : this(graphics, name, new Rectangle(x, y, width, height))
 {
 }
Beispiel #23
0
 public Picturebox(TGraphics graphics, string name, Surface image, Rectangle area)
     : base(graphics, name, area)
 {
     _image = image;
 }
Beispiel #24
0
 public Picturebox(TGraphics graphics, string name, Surface image, Point location, Size size)
     : this(graphics, name, image, new Rectangle(location, size))
 {
 }
 private static Surface _createPixle(TGraphics tgraphics)
 {
     return(Surface.CreateBlankSurface(tgraphics, 1, 1));
 }
Beispiel #26
0
 public Label(TGraphics graphics, string name, string text, Point location, Size size, FontManager fontInfo)
     : this(graphics, name, text, new Rectangle(location, size), fontInfo)
 {
 }
Beispiel #27
0
 public Label(TGraphics graphics, string name, string text, int x, int y, int width, int height)
     : this(graphics, name, text, new Rectangle(x, y, width, height), FontManager.GetInstance(graphics, 18, FontTypes.Sans))
 {
 }
Beispiel #28
0
 public Picturebox(TGraphics graphics, string name, Surface image, int x, int y, int width, int height)
     : this(graphics, name, image, new Rectangle(x, y, width, height))
 {
 }
Beispiel #29
0
        public static void DrawString(TGraphics graphics, string text, float size, FontTypes name, Point position, Color color)
        {
            FontManager font = GetInstance(graphics, size, name);

            DrawString(font, text, position, color);
        }
Beispiel #30
0
 public Label(TGraphics graphics, string name, string text, Point location, Size size)
     : this(graphics, name, text, new Rectangle(location, size), FontManager.GetInstance(graphics, 18, FontTypes.Sans))
 {
 }