Пример #1
0
        protected override void OnRender(SpriteShader shader, Vector2 renderPosition = new Vector2())
        {
            _sprite.Position = renderPosition;

            _sprite.Render(shader);
        }
Пример #2
0
        public override void Render(SpriteShader shader)
        {
            if (_invalidated) {
                UpdateImage();
                _invalidated = false;
            }

            base.Render(shader);
        }
Пример #3
0
 protected override void OnRender(SpriteShader shader, Vector2 renderPosition = new Vector2())
 {
     _buttonSprite.Position = renderPosition;
     _buttonSprite.Colour = (IsEnabled ? Colour : DisabledColour);
     _buttonSprite.Render(shader);
 }
Пример #4
0
        public virtual void Render(SpriteShader shader)
        {
            if (VertsChanged) {
                _vertices = FindVerts();
                VertsChanged = false;
            }

            shader.Texture = Texture;
            shader.Render(_vertices);
        }
Пример #5
0
        public void Render(SpriteShader shader, Vector2 parentPosition = new Vector2())
        {
            if (IsVisible) {
                parentPosition += Position;

                OnRender(shader, parentPosition);
                if (RenderObject != null)
                    RenderObject(this, new RenderEventArgs(shader, parentPosition));

                foreach (UIObject child in _children)
                    child.Render(shader, parentPosition + _paddingTopLeft);
            }
        }
Пример #6
0
 public RenderEventArgs(SpriteShader shader, Vector2 drawPosition)
 {
     ShaderProgram = shader;
     DrawPosition = drawPosition;
 }
Пример #7
0
        protected virtual void OnRender(SpriteShader shader, Vector2 renderPosition = new Vector2())
        {

        }
Пример #8
0
        public override void Render(SpriteShader shader)
        {
            double secs = (CurrentMilliseconds() - _startTime + _stopTime) / 1000.0;
            int frame = StartFrame + (int) ((long) (secs * FrameRate) % (long) FrameCount);

            if (frame != _lastFrame)
                SubrectOffset = _frameLocations[frame];

            base.Render(shader);
        }
Пример #9
0
        protected override void OnLoad(EventArgs e)
        {
            VSync = VSyncMode.On;

            String dataPath = "Data" + Path.DirectorySeparatorChar;
            String loadorderpath = dataPath + "loadorder.txt";

            if (!File.Exists(loadorderpath))
                return;

            Archive.RegisterAll(Assembly.GetExecutingAssembly());

            var resourceDirs = new[] {
                dataPath,
                Path.Combine(dataPath, "..", "..", "..", "Content")
            };

            var archives = File.ReadAllLines(loadorderpath).Where(x => x.Length > 0);

            foreach (var resDir in resourceDirs) {
                foreach (String line in archives.Select(x => Path.Combine(resDir, x + ".dat")))
                    if (File.Exists(line)) Archive.FromFile(line).Mount();
                
                foreach (String line in archives.Select(x => Path.Combine(resDir, x)))
                    if (line.Length > 0 && Directory.Exists(line))
                        Archive.FromDirectory(line).Mount();
            }

            Keyboard.KeyDown += OnKeyDown;

            Mouse.Move += OnMouseMove;
            Mouse.ButtonUp += OnMouseButtonUp;
            Mouse.ButtonDown += OnMouseButtonDown;
            Mouse.WheelChanged += OnMouseWheelChanged;

            _thinkTimer = new Stopwatch();
            _thinkTimer.Start();

            _spareTime = 0.0;

            TextureManager.Initialize();
            ScriptManager.Initialize();
            Plugin.Initialize();

            SpriteShader = new SpriteShader(Width, Height);
        }
Пример #10
0
 protected override void OnRender(SpriteShader shader, Vector2 renderPosition = new Vector2())
 {
     _frameSprite.Position = renderPosition;
     _frameSprite.Colour = (IsEnabled ? OpenTK.Graphics.Color4.White : DisabledColour);
     _frameSprite.Render(shader);
 }
Пример #11
0
        protected override void OnRender(SpriteShader shader, Vector2 renderPosition = new Vector2())
        {
            _sprite.Position = renderPosition;
            _sprite.Colour = (IsEnabled ? OpenTK.Graphics.Color4.White : DisabledColour);
            _sprite.Render(shader);

            double timeSinceFlash = (DateTime.Now - _lastFlashTime).TotalSeconds;

            if (timeSinceFlash < 0.5 && IsFocused && IsEnabled && Text.Length < CharacterLimit) {
                _underlineChar.Position = renderPosition + new Vector2(PaddingLeft + _text.Width, PaddingTop + Math.Max(_text.Height, _font.CharHeight) - _underlineChar.Height);
                _underlineChar.Render(shader);
            } else if (timeSinceFlash >= 1.0)
                _lastFlashTime = DateTime.Now;
        }