public void Update()
        {
            _cursor = _input.Cursor;
            _alreadyPrepared.Clear();
            bool isDirty = _isDirty || _roomTransitions.State == RoomTransitionState.PreparingNewRoomRendering;

            _isDirty = false;

            _matrixUpdater.ClearCache();
            foreach (var viewport in _viewportSubscribers.Keys)
            {
                ViewportDisplayList list;
                if (isDirty)
                {
                    list = _cache.GetOrAdd(viewport, initDisplayList);
                    updateDisplayList(viewport, list);
                    _cache[viewport] = list;
                }
                else
                {
                    list = _cache.GetOrAdd(viewport, initAndUpdateDisplayList);
                }
                foreach (var item in list.DisplayList)
                {
                    if (_alreadyPrepared.Add(item.ID))
                    {
                        _matrixUpdater.RefreshMatrix(item);
                    }
                }
            }
        }
        public void Update(bool forceUpdate)
        {
            _cursor = _gameState.Cursor;
            if (forceUpdate)
            {
                onEverythingChanged();
            }
            bool isDirty = _isDirty;

            _isDirty = false;

            _matrixUpdater.ClearCache();
            foreach (var viewport in _viewportSubscribers.Keys)
            {
                ViewportDisplayList list;
                if (isDirty)
                {
                    list = _cache.GetOrAdd(viewport, initDisplayList);
                    updateDisplayList(viewport, list);
                    _cache[viewport] = list;
                }
                else
                {
                    list = _cache.GetOrAdd(viewport, initAndUpdateDisplayList);
                }
                foreach (var item in list.DisplayList)
                {
                    _matrixUpdater.RefreshMatrix(item);
                }
            }
        }
Exemple #3
0
        private void renderCursor()
        {
            IObject cursor = _input.Cursor;

            if (cursor == null)
            {
                return;
            }
            if (_mouseCursorContainer == null || _mouseCursorContainer.Animation != cursor.Animation)
            {
                _mouseCursorContainer = cursor;
            }
            var viewport = _gameState.Viewport;

            _mouseCursorContainer.X = (_input.MousePosition.XMainViewport - viewport.X) * viewport.ScaleX;
            _mouseCursorContainer.Y = (_input.MousePosition.YMainViewport - viewport.Y) * viewport.ScaleY;
            _glUtils.RefreshViewport(_game.Settings, _gameWindow, viewport);
            _matrixUpdater.RefreshMatrix(_mouseCursorContainer);
            renderObject(viewport, _mouseCursorContainer);
        }