Пример #1
0
#pragma warning restore CS0067

        public GLLabelRenderer(Dictionary <string, ITexture> textures,
                               IBoundingBoxBuilder boundingBoxBuilder, IGLColorBuilder colorBuilder,
                               IGLTextureRenderer textureRenderer, BitmapPool bitmapPool, IGLViewportMatrixFactory viewportMatrix,
                               AGSBoundingBoxes labelBoundingBoxes, AGSBoundingBoxes textBoundingBoxes, IGraphicsFactory graphicsFactory,
                               IGLUtils glUtils, IGraphicsBackend graphics, IBitmapLoader bitmapLoader, IFontLoader fonts,
                               IRuntimeSettings settings, IRenderMessagePump messagePump, IGameState state, IGameEvents events)
        {
            _bindings = new List <IComponentBinding>();
            _afterCropTextBoundingBoxes = new AGSBoundingBoxes();
            _state                       = state;
            _events                      = events;
            Width                        = 1f;
            Height                       = 1f;
            _matricesPool                = new GLMatrices[3];
            _messagePump                 = messagePump;
            OnLabelSizeChanged           = new AGSEvent();
            _glUtils                     = glUtils;
            _graphics                    = graphics;
            _fonts                       = fonts;
            _bitmapPool                  = bitmapPool;
            _viewport                    = viewportMatrix;
            _textureRenderer             = textureRenderer;
            _labelBoundingBoxes          = labelBoundingBoxes;
            _textBoundingBoxes           = textBoundingBoxes;
            _boundingBoxBuilder          = boundingBoxBuilder;
            _virtualResolution           = settings.VirtualResolution;
            _settings                    = settings;
            _labelBoundingBoxFakeBuilder = new BoundingBoxesEmptyBuilder();
            _bgRenderer                  = new GLImageRenderer(textures,
                                                               colorBuilder, _textureRenderer, graphicsFactory, glUtils, bitmapLoader);

            _colorBuilder = colorBuilder;

            TextVisible           = true;
            TextBackgroundVisible = true;

            subscribeTextConfigChanges();
            PropertyChanged += (sender, e) =>
            {
                if (e.PropertyName == nameof(TextBackgroundVisible))
                {
                    return;
                }
                onBoundingBoxShouldChange();
                if (e.PropertyName == nameof(Config))
                {
                    subscribeTextConfigChanges();
                }
            };
            _shouldUpdateBoundingBoxes = true;
        }
Пример #2
0
 public AGSBoundingBoxComponent(IRuntimeSettings settings, IGLViewportMatrixFactory layerViewports,
                                IBoundingBoxBuilder boundingBoxBuilder, IGameState state, IGameEvents events)
 {
     _boundingBoxes = new ConcurrentDictionary <IViewport, ViewportBoundingBoxes>(new IdentityEqualityComparer <IViewport>());
     _boundingBoxes.TryAdd(state.Viewport, new ViewportBoundingBoxes(state.Viewport));
     _settings = settings;
     _state    = state;
     OnBoundingBoxesChanged = new AGSEvent();
     _layerViewports        = layerViewports;
     _boundingBoxBuilder    = boundingBoxBuilder;
     boundingBoxBuilder.OnNewBoxBuildRequired.Subscribe(onHitTextBoxShouldChange);
     events.OnRoomChanging.Subscribe(onHitTextBoxShouldChange);
     onHitTextBoxShouldChange();
 }
Пример #3
0
 public GLImageRenderer(Dictionary <string, ITexture> textures,
                        IGLBoundingBoxBuilder boundingBoxBuilder,
                        IGLColorBuilder colorBuilder, IGLTextureRenderer renderer, IGLBoundingBoxes bgBoxes,
                        IGLViewportMatrixFactory layerViewports, IGraphicsFactory graphicsFactory, IGLUtils glUtils,
                        IBitmapLoader bitmapLoader)
 {
     _graphicsFactory    = graphicsFactory;
     _textures           = textures;
     _boundingBoxBuilder = boundingBoxBuilder;
     _colorBuilder       = colorBuilder;
     _renderer           = renderer;
     _layerViewports     = layerViewports;
     BoundingBoxes       = bgBoxes;
     _glUtils            = glUtils;
     _bitmapLoader       = bitmapLoader;
     _emptyTexture       = new Lazy <ITexture>(() => initEmptyTexture());
 }
Пример #4
0
        public GLImageRenderer (Dictionary<string, ITexture> textures, 
			IGLMatrixBuilder hitTestMatrixBuilder, IGLMatrixBuilder renderMatrixBuilder, IGLBoundingBoxBuilder boundingBoxBuilder,
			IGLColorBuilder colorBuilder, IGLTextureRenderer renderer, IGLBoundingBoxes bgBoxes,
            IGLViewportMatrixFactory layerViewports, IGraphicsFactory graphicsFactory, IGLUtils glUtils)
		{
            _graphicsFactory = graphicsFactory;
			_textures = textures;
			_renderMatrixBuilder = renderMatrixBuilder;
            _hitTestMatrixBuilder = hitTestMatrixBuilder;
			_boundingBoxBuilder = boundingBoxBuilder;
			_colorBuilder = colorBuilder;
			_renderer = renderer;
			_layerViewports = layerViewports;
			BoundingBoxes = bgBoxes;
            _glUtils = glUtils;
            _emptyTexture = new Lazy<ITexture>(() => initEmptyTexture());
		}
Пример #5
0
        public GLLabelRenderer(Dictionary <string, ITexture> textures,
                               IGLBoundingBoxBuilder boundingBoxBuilder, IGLColorBuilder colorBuilder,
                               IGLTextureRenderer textureRenderer, BitmapPool bitmapPool, IGLViewportMatrixFactory viewportMatrix,
                               IGLBoundingBoxes labelBoundingBoxes, IGLBoundingBoxes textBoundingBoxes, IGraphicsFactory graphicsFactory,
                               IGLUtils glUtils, IGraphicsBackend graphics, IBitmapLoader bitmapLoader, IFontLoader fonts)
        {
            _glUtils            = glUtils;
            _graphics           = graphics;
            _fonts              = fonts;
            _bitmapPool         = bitmapPool;
            _viewport           = viewportMatrix;
            _textureRenderer    = textureRenderer;
            _labelBoundingBoxes = labelBoundingBoxes;
            _textBoundingBoxes  = textBoundingBoxes;
            _boundingBoxBuilder = boundingBoxBuilder;
            _bgRenderer         = new GLImageRenderer(textures,
                                                      new BoundingBoxesEmptyBuilder(), colorBuilder, _textureRenderer, _labelBoundingBoxes,
                                                      viewportMatrix, graphicsFactory, glUtils, bitmapLoader);

            _colorBuilder = colorBuilder;

            TextVisible = true;
        }