예제 #1
0
        protected override void Load(BaseGame game)
        {
            Resources = new ResourceStore <byte[]>();
            Resources.AddStore(new NamespacedResourceStore <byte[]>(new DllResourceStore(@"osu.Framework.dll"), @"Resources"));
            Resources.AddStore(new DllResourceStore(MainResourceFile));

            Textures = new TextureStore(new RawTextureLoaderStore(new NamespacedResourceStore <byte[]>(Resources, @"Textures")));
            Textures.AddStore(new RawTextureLoaderStore(new OnlineStore()));

            Audio = new AudioManager(new NamespacedResourceStore <byte[]>(Resources, @"Tracks"), new NamespacedResourceStore <byte[]>(Resources, @"Samples"));

            Shaders = new ShaderManager(new NamespacedResourceStore <byte[]>(Resources, @"Shaders"));

            Fonts = new TextureStore(new GlyphStore(Resources, @"Fonts/OpenSans"))
            {
                ScaleAdjust = 1 / 100f
            };

            (performanceContainer = new PerformanceOverlay
            {
                Position = new Vector2(5, 5),
                Direction = FlowDirection.VerticalOnly,
                AutoSizeAxes = Axes.Both,
                Alpha = 0,
                Spacing = new Vector2(10, 10),
                Anchor = Anchor.BottomRight,
                Origin = Anchor.BottomRight,
                Depth = float.MaxValue
            }).Preload(game, AddInternal);

            base.Load(game);

            addDebugTools();
        }
예제 #2
0
        protected override void LoadComplete()
        {
            base.LoadComplete();

            LoadComponentAsync(performanceContainer = new PerformanceOverlay
            {
                Margin       = new MarginPadding(5),
                Direction    = FillDirection.Vertical,
                Spacing      = new Vector2(10, 10),
                AutoSizeAxes = Axes.Both,
                Alpha        = 0,
                Anchor       = Anchor.BottomRight,
                Origin       = Anchor.BottomRight,
                Depth        = float.MinValue
            }, delegate(Drawable overlay)
            {
                performanceContainer.Threads.AddRange(Host.Threads.Reverse());

                // Note, that RegisterCounters only has an effect for the first
                // GameHost to be passed into it; i.e. the first GameHost
                // to be instantiated.
                FrameStatistics.RegisterCounters(performanceContainer);

                performanceContainer.CreateDisplays();

                AddInternal(overlay);
            });

            addDebugTools();
        }
예제 #3
0
        /// <summary>
        /// Registers statistics counters to the performance overlay first passed into this function
        /// </summary>
        /// <param name="target">The overlay that wants to register for statistics counters.</param>
        internal static void RegisterCounters(PerformanceOverlay target)
        {
            if (FrameStatistics.target != null)
            {
                return;
            }

            for (StatisticsCounterType i = 0; i < StatisticsCounterType.AmountTypes; ++i)
            {
                getMonitor(i, target).RegisterCounter(i);
            }

            FrameStatistics.target = target;
        }
예제 #4
0
        protected override void LoadComplete()
        {
            base.LoadComplete();

            LoadComponentAsync(performanceContainer = new PerformanceOverlay(Host.Threads.Reverse())
            {
                Margin       = new MarginPadding(5),
                Direction    = FillDirection.Vertical,
                Spacing      = new Vector2(10, 10),
                AutoSizeAxes = Axes.Both,
                Alpha        = 0,
                Anchor       = Anchor.BottomRight,
                Origin       = Anchor.BottomRight,
                Depth        = float.MinValue
            }, AddInternal);

            addDebugTools();
        }
예제 #5
0
        protected override void LoadComplete()
        {
            base.LoadComplete();

            (performanceContainer = new PerformanceOverlay
            {
                Margin = new MarginPadding(5),
                Direction = FlowDirection.VerticalOnly,
                AutoSizeAxes = Axes.Both,
                Alpha = 0,
                Spacing = new Vector2(10, 10),
                Anchor = Anchor.BottomRight,
                Origin = Anchor.BottomRight,
                Depth = float.MinValue
            }).Preload(this, AddInternal);

            addDebugTools();
        }
예제 #6
0
        protected override void LoadComplete()
        {
            base.LoadComplete();

            PerformanceOverlay performanceOverlay;

            LoadComponentAsync(performanceOverlay = new PerformanceOverlay(Host.Threads.Reverse())
            {
                Margin       = new MarginPadding(5),
                Direction    = FillDirection.Vertical,
                Spacing      = new Vector2(10, 10),
                AutoSizeAxes = Axes.Both,
                Alpha        = 0,
                Anchor       = Anchor.BottomRight,
                Origin       = Anchor.BottomRight,
                Depth        = float.MinValue
            }, AddInternal);

            FrameStatistics.BindValueChanged(e => performanceOverlay.State = e.NewValue, true);
        }
예제 #7
0
        private static PerformanceMonitor getMonitor(StatisticsCounterType type, PerformanceOverlay target)
        {
            switch (type)
            {
            case StatisticsCounterType.Invalidations:
            case StatisticsCounterType.Refreshes:
            case StatisticsCounterType.DrawNodeCtor:
            case StatisticsCounterType.DrawNodeAppl:
            case StatisticsCounterType.ScheduleInvk:
                return(target.Threads[2].Monitor);

            case StatisticsCounterType.VBufBinds:
            case StatisticsCounterType.VBufOverflow:
            case StatisticsCounterType.TextureBinds:
            case StatisticsCounterType.DrawCalls:
            case StatisticsCounterType.VerticesDraw:
            case StatisticsCounterType.VerticesUpl:
            case StatisticsCounterType.KiloPixels:
                return(target.Threads[3].Monitor);

            case StatisticsCounterType.MouseEvents:
            case StatisticsCounterType.KeyEvents:
                return(target.Threads[1].Monitor);

            case StatisticsCounterType.TasksRun:
            case StatisticsCounterType.Tracks:
            case StatisticsCounterType.Samples:
            case StatisticsCounterType.SChannels:
            case StatisticsCounterType.Components:
                return(target.Threads[0].Monitor);

            default:
                Trace.Assert(false, "Requested counter which is not assigned to any performance monitor.");
                break;
            }

            return(null);
        }
예제 #8
0
 public override Widget build(BuildContext context)
 {
     return(new Scaffold
            (
                backgroundColor: Colors.white,
                appBar: new AppBar
                (
                    title: new Text("Node Editor (UIWidgets Based)"),
                    centerTitle: false,
                    actions: new List <Widget>
     {
         new IconButton
         (
             icon: new Icon(Icons.brightness_4, color: Colors.white),
             onPressed: () =>
         {
         }
         ),
         new IconButton
         (
             icon: new Icon(Icons.settings, color: Colors.white),
             onPressed: () =>
         {
             BottomSheetUtils.showModalBottomSheet <object>
             (
                 context,
                 buildContext => new NodeEditorSettingsWidget()
             );
         }
         )
     }
                ),
                body: new Stack
                (
                    children: new List <Widget>
     {
         new NodeEditorWidget(nodeEditorWidgetKey),
         new Visibility
         (
             maintainInteractivity: false,
             maintainAnimation: false,
             child: PerformanceOverlay.allEnabled(),
             visible: NodeEditorSettingsManager.Instance.frameCounterEnabled.Value
         )
     }
                ),
                floatingActionButton: new FloatingActionButton
                (
                    onPressed: () =>
     {
         BottomSheetUtils.showModalBottomSheet <object>
         (
             context,
             buildContext => new NodeDataClassesListWidget().WithNodeEditorKey(nodeEditorWidgetKey)
         );
     },
                    tooltip: "Add",
                    child: new Icon(Icons.add)),
                floatingActionButtonLocation: FloatingActionButtonLocation.endFloat
            ));
 }