Ejemplo n.º 1
0
        public AptGeometryView(DiagnosticViewContext context)
            : base(context)
        {
            _renderedView = AddDisposable(new RenderedView(context));

            _renderedView.RenderPipeline.Rendering2D += (sender, e) =>
            {
                _shapeRenderer.Render(e.DrawingContext);
            };
        }
Ejemplo n.º 2
0
        public RuView(FileSystemEntry entry, Func <IntPtr, Game> createGame)
        {
            string ruText;

            using (var fileStream = entry.Open())
                using (var streamReader = new StreamReader(fileStream))
                {
                    ruText = streamReader.ReadToEnd();
                }

            Panel1 = new TextBox
            {
                ReadOnly = true,
                Width    = 250,
                Text     = ruText
            };

            Panel2 = new GameControl
            {
                CreateGame = h =>
                {
                    var game = createGame(h);

                    //load the corresponding .dat file
                    var movieName = entry.FilePath.Split('/')[0].Split('_')[0];
                    var datPath   = movieName + ".dat";
                    var datEntry  = game.ContentManager.FileSystem.GetFile(datPath);
                    var imageMap  = ImageMap.FromFileSystemEntry(datEntry);

                    var shape = Geometry.FromFileSystemEntry(entry);

                    var shapeRenderer = new ShapeRenderer(
                        shape,
                        game.ContentManager,
                        imageMap,
                        movieName);

                    game.Rendering2D += (sender, e) => shapeRenderer.Render(e.DrawingContext);

                    game.Window.ClientSizeChanged += (sender, e) =>
                    {
                        shapeRenderer.Update(
                            game.GraphicsDevice,
                            game.Window.ClientBounds.Size);
                    };

                    return(game);
                }
            };
        }
Ejemplo n.º 3
0
        public RuView(AssetViewContext context)
            : base(context)
        {
            using (var fileStream = context.Entry.Open())
                using (var streamReader = new StreamReader(fileStream))
                {
                    _ruText = streamReader.ReadToEnd();
                }

            var game = context.Game;

            //load the corresponding .dat file
            var movieName = context.Entry.FilePath.Split('/')[0].Split('_')[0];
            var datPath   = movieName + ".dat";
            var datEntry  = game.ContentManager.FileSystem.GetFile(datPath);
            var imageMap  = ImageMap.FromFileSystemEntry(datEntry);

            var shape = Geometry.FromFileSystemEntry(context.Entry);

            var shapeRenderer = new ShapeRenderer(
                shape,
                game.ContentManager,
                imageMap,
                movieName);

            void onRendering2D(object sender, Rendering2DEventArgs e)
            {
                shapeRenderer.Render(e.DrawingContext);
            }

            game.Rendering2D += onRendering2D;

            AddDisposeAction(() => game.Rendering2D -= onRendering2D);

            void onClientSizeChanged(object sender, EventArgs e)
            {
                shapeRenderer.Update(
                    game.GraphicsDevice,
                    game.Panel.ClientBounds.Size);
            }

            game.Panel.ClientSizeChanged += onClientSizeChanged;

            AddDisposeAction(() => game.Panel.ClientSizeChanged -= onClientSizeChanged);
        }