void Awake() { if (Instance == null) { Instance = this; } }
public Game1() { selectedStructure = null; oldState = Mouse.GetState(); newState = oldState; IsMouseVisible = true; Window.AllowUserResizing = false; Content.RootDirectory = "Content"; graphics = new GraphicsDeviceManager(this); IsFixedTimeStep = false; //vsync graphics.SynchronizeWithVerticalRetrace = false; //fpsCount FpsCounter = new FPSCounter(physicalMaxFPS); //graphical cords windowSizeXPlus12 = windowSizeX + 12; windowSizeXPlus46 = windowSizeX + 46; windowSizeXPlus37 = windowSizeX + 37; windowSizeXPlus6 = windowSizeX + 6; windowSizeXPlus4 = windowSizeX + 4; windowSizeXPlus27 = windowSizeX + 27; windowSizeXPlus50 = windowSizeX + 50; windowSizeXPlus1 = windowSizeX + 1; menuHeightMinus30 = menuHeight - 30; menuHeightMinus5 = menuHeight - 5; menuHeightPlus4 = menuHeight + 4; }
/// <summary> /// <see cref="E:System.Windows.Forms.Form.Load" /> イベントを発生させます。 /// </summary> /// <param name="e">イベント データを格納している <see cref="T:System.EventArgs" />。</param> protected override void OnLoad(EventArgs e) { base.OnLoad(e); #region デザインモード時処理 if (DesignMode) { var label = new Label(); label.Text = "RenderForm\n*デザインモードでは描画できません。\n*ウィンドウの大きさ、タイトルなどはデザインビューからも変更可能です。"; label.Dock = DockStyle.Fill; label.TextAlign = ContentAlignment.MiddleCenter; label.Font = new Font("Meiriyo", 30); Controls.Add(label); return; } #endregion if (RenderContext == null) { RenderContext = new RenderContext(); ScreenContext = RenderContext.Initialize(this); RenderContext.UpdateRequireWorlds.Add(WorldSpace); } else //RenderContextがすでにあるばあい { ScreenContext = RenderContext.CreateScreenContext(this); } FpsCounter = new FPSCounter(); FpsCounter.Start(); ClientSizeChanged += RenderForm_ClientSizeChanged; IsInitialized = true; }
void OnEnable() { windowMethods = new GUI.WindowFunction[] { LogWindow, CopyLogWindow, WatchVarWindow }; fps = new FPSCounter(); StartCoroutine(fps.Update()); nameRect = messageLine; valueRect = messageLine; Message.defaultColor = defaultColor; Message.warningColor = warningColor; Message.errorColor = errorColor; Message.systemColor = systemColor; Message.inputColor = inputColor; Message.outputColor = outputColor; _windowRect = new Rect(Screen.width / 2 - 300, 30, 960, 720); LogMessage(Message.System("输入 '/?' 显示帮助")); LogMessage(Message.Log("")); this.RegisterCommandCallback("close", CMDClose, "关闭调试窗口"); this.RegisterCommandCallback("clear", CMDClear, "清除调试信息"); this.RegisterCommandCallback("sys", CMDSystemInfo, "显示系统信息"); this.RegisterCommandCallback("/?", CMDHelp, "显示可用命令"); this.RegisterCommandCallback("openlog", CMDOpenLog, "打来Log显示"); this.RegisterCommandCallback("closelog", CMDCloseLog, "关闭Log显示"); }
private void OnEnable() { this.windowMethods = new GUI.WindowFunction[] { new GUI.WindowFunction(this.LogWindow), new GUI.WindowFunction(this.CopyLogWindow), new GUI.WindowFunction(this.WatchVarWindow) }; this.fps = new FPSCounter(); base.StartCoroutine(this.fps.Update()); this.nameRect = this.messageLine; this.valueRect = this.messageLine; DebugConsole.Message.defaultColor = this.defaultColor; DebugConsole.Message.warningColor = this.warningColor; DebugConsole.Message.errorColor = this.errorColor; DebugConsole.Message.systemColor = this.systemColor; DebugConsole.Message.inputColor = this.inputColor; DebugConsole.Message.outputColor = this.outputColor; this._windowRect = new Rect((float)(Screen.width / 2 - 300), 30f, 960f, 720f); this.LogMessage(DebugConsole.Message.System("输入 '/?' 显示帮助")); this.LogMessage(DebugConsole.Message.Log(string.Empty)); this.RegisterCommandCallback("close", new DebugConsole.DebugCommand(this.CMDClose), "关闭调试窗口"); this.RegisterCommandCallback("clear", new DebugConsole.DebugCommand(this.CMDClear), "清除调试信息"); this.RegisterCommandCallback("sys", new DebugConsole.DebugCommand(this.CMDSystemInfo), "显示系统信息"); this.RegisterCommandCallback("/?", new DebugConsole.DebugCommand(this.CMDHelp), "显示可用命令"); this.RegisterCommandCallback("openlog", new DebugConsole.DebugCommand(this.CMDOpenLog), "打来Log显示"); this.RegisterCommandCallback("closelog", new DebugConsole.DebugCommand(this.CMDCloseLog), "关闭Log显示"); }
/* * * // public void UpdateMem(float dt) * // { * // var fps = 0.75f * 1 / dt + 0.25f * Timer.GetFPS(); * // UpdateGraph(graph, mem, "Memory (KB): " .. math.floor(mem*10)/10, dt) * // } * * */ public void DrawGraph() { Graphics.SetColor(0, 0, 0, 0.6f); Graphics.Rectangle(DrawMode.Fill, m_rect); Graphics.SetColor(Color.White); // loop through all of the graphs var maxVal = m_vals.Max(); var minVal = 0; var lastValue = m_vals.Peek(); float stepX = m_rect.width / m_vals.Count; int index = 0; Vector2 lastPoint = new Vector2(m_rect.Left, m_rect.Bottom - m_rect.height * (lastValue / (maxVal - minVal))); foreach (var v in m_vals) { Vector2 currentPoint = new Vector2(index * stepX + m_rect.x, m_rect.Bottom - m_rect.height * (v / (maxVal - minVal))); Graphics.Line(lastPoint, currentPoint); lastValue = v; index++; lastPoint = currentPoint; } Graphics.SetFont(FPSGraph_FONT); Graphics.Print("MAX:" + maxVal.ToString("00.0") + "\nFPS:" + FPSCounter.GetFPS(), m_rect.x, m_rect.Top); }
public void UpdateFPS(float dt) { //var fps = 0.75f * 1 / dt + 0.25f * Timer.GetFPS(); var fps = FPSCounter.GetFPS(); UpdateGraph(fps, (Mathf.Floor(fps * 10) / 10).ToString("00.0"), dt); }
public void Start() { NodeEditor.checkInit(false); NodeEditor.initiated = false; LoadNodeCanvas(canvasPath); FPSCounter.Create(); }
private static void addDebugLabels(IGame game) { ILabel fpsLabel = game.Factory.UI.GetLabel("FPS Label", "", 30, 25, 320, 25, config: new AGSTextConfig(alignment: Alignment.TopLeft, autoFit: AutoFit.LabelShouldFitText)); fpsLabel.Anchor = new AGS.API.PointF(1f, 0f); fpsLabel.ScaleBy(0.7f, 0.7f); fpsLabel.RenderLayer = new AGSRenderLayer(-99999); var red = Colors.IndianRed; fpsLabel.Tint = Color.FromRgba(red.R, red.G, red.B, 125); FPSCounter fps = new FPSCounter(game, fpsLabel); fps.Start(); ILabel label = game.Factory.UI.GetLabel("Mouse Position Label", "", 30, 25, 320, 5, config: new AGSTextConfig(alignment: Alignment.TopRight, autoFit: AutoFit.LabelShouldFitText)); var blue = Colors.SlateBlue; label.Tint = Color.FromRgba(blue.R, blue.G, blue.B, 125); label.Anchor = new AGS.API.PointF(1f, 0f); label.ScaleBy(0.7f, 0.7f); label.RenderLayer = new AGSRenderLayer(-99999); MousePositionLabel mouseLabel = new MousePositionLabel(game, label); mouseLabel.Start(); }
private void OnEnable() { //var scale = Screen.dpi/160.0f; //if (scale != 0.0f && scale >= 1.1f) //{ // _scaled = true; // _guiScale.Set(scale, scale, scale); //} windowMethods = new GUI.WindowFunction[] { LogWindow, CopyLogWindow, WatchVarWindow }; _fps = new FPSCounter(); StartCoroutine(_fps.Update()); nameRect = messageLine; valueRect = messageLine; #if MOBILE this.useGUILayout = false; _windowRect = WindowRect; _fakeWindowRect = new Rect(0.0f, 0.0f, _windowRect.width, _windowRect.height); _fakeDragRect = new Rect(0.0f, 0.0f, _windowRect.width - 32, 24); #else _windowRect = WindowRect; #endif LogMessage(ConsoleMessage.Info(string.Format(" UtyMap, version {0}", EnvironmentApi.Version))); LogMessage(ConsoleMessage.Info(" type 'help' for available commands.")); LogMessage(ConsoleMessage.Info(" double tap or press tilda to show/hide console.")); LogMessage(ConsoleMessage.Info("")); }
public override void LoadContent() { this.AddChild(GameManager.MainCamera); for (int i = 0; i < DEFAULT_QTD_LAYERS; i++) { base.AddChild(this.layers[i]); } #if DEBUG var debugPanel = new VisualDebugPanel(Color.Red); var screenMsgLog = new ScreenMessageLog(Color.White); var fps = new FPSCounter(screenMsgLog); var cameraVisualDebug = new CameraVisualDebug(GameManager.MainCamera); GameManager.Services.RemoveService(typeof(IVisualDebugService)); GameManager.Services.RemoveService(typeof(IMessageDebugService)); GameManager.Services.AddService <IVisualDebugService>(debugPanel); GameManager.Services.AddService <IMessageDebugService>(screenMsgLog); this.AddChild(LAYER_WORLD_DEBUG, debugPanel); this.AddChild(LAYER_WORLD_DEBUG, cameraVisualDebug); this.AddChild(LAYER_HUD_DEBUG, screenMsgLog); this.AddChild(LAYER_HUD_DEBUG, fps); #endif base.LoadContent(); }
public void Initialize() { //Setup initial state fps = new FPSCounter(); fpsCounter = new Text("0", local, 20); fpsCounter.Position = new Vector2f(0, 0); }
protected override void LoadContent() { // Create a new SpriteBatch, which can be used to draw textures. spriteBatch = new SpriteBatch(GraphicsDevice); ContentLoader.LoadContent(Content); Active.LoadContent(); // TODO: use this.Content to load your game content here fps = new FPSCounter(); Active.OnClick = (Entity entity) => { Active.p_testform.SetEventEntity(entity, Events.OnClick); }; Active.OnMouseDown = (Entity entity) => { Active.p_testform.SetEventEntity(entity, Events.OnMouseDown); }; Active.OnMouseEnter = (Entity entity) => { Active.p_testform.SetEventEntity(entity, Events.OnMouseEnter); }; Active.OnMouseLeave = (Entity entity) => { Active.p_testform.SetEventEntity(entity, Events.OnMouseLeave); }; Active.OnMouseReleased = (Entity entity) => { Active.p_testform.SetEventEntity(entity, Events.OnMouseReleased); }; Active.OnMouseWheelScroll = (Entity entity) => { Active.p_testform.SetEventEntity(entity, Events.OnMouseWheelScroll); }; Active.OnStartDrag = (Entity entity) => { Active.p_testform.SetEventEntity(entity, Events.OnStartDrag); }; Active.OnStopDrag = (Entity entity) => { Active.p_testform.SetEventEntity(entity, Events.OnStopDrag); }; Active.OnFocusChange = (Entity entity) => { Active.p_testform.SetEventEntity(entity, Events.OnFocusChange); }; Active.OnValueChange = (Entity entity) => { Active.p_testform.SetEventEntity(entity, Events.OnValueChange); }; Active.WhileDragging = (Entity entity) => { Active.p_testform.SetEventEntity(entity, Events.WhileDragging); }; Active.WhileMouseDown = (Entity entity) => { Active.p_testform.SetEventEntity(entity, Events.WhileMouseDown); }; Active.WhileMouseHover = (Entity entity) => { Active.p_testform.SetEventEntity(entity, Events.WhileMouseHover); }; }
private void OnEnable() { var scale = Screen.dpi / 160.0f; if (scale != 0.0f && scale >= 1.1f) { _scaled = true; _guiScale.Set(scale, scale, scale); } windowMethods = new GUI.WindowFunction[] { LogWindow, CopyLogWindow, WatchVarWindow }; _fps = new FPSCounter(); StartCoroutine(_fps.Update()); nameRect = messageLine; valueRect = messageLine; #if MOBILE this.useGUILayout = false; _windowRect = new Rect(5.0f, 5.0f, 300.0f, 450.0f); _fakeWindowRect = new Rect(0.0f, 0.0f, _windowRect.width, _windowRect.height); _fakeDragRect = new Rect(0.0f, 0.0f, _windowRect.width - 32, 24); #else _windowRect = new Rect(30.0f, 30.0f, 300.0f, 450.0f); #endif LogMessage(ConsoleMessage.Info(string.Format(" ActionStreetMap Engine, version {0}", Version))); LogMessage(ConsoleMessage.Info(" type 'help' for available commands.")); LogMessage(ConsoleMessage.Info("")); //RegisterTerminalCommands(); }
public CameraAnalyzer(SurfaceView surfaceView) { cameraEventListener = new CameraEventsListener(); cameraController = new CameraController(surfaceView, cameraEventListener); InitTensorflowLineService(); var outputInfo = new SKImageInfo( TensorflowLiteService.ModelInputSize, TensorflowLiteService.ModelInputSize, SKColorType.Rgba8888); inputScaled = new SKBitmap(outputInfo); inputScaledRotated = new SKBitmap(outputInfo); colors = inputScaledRotated.GetPixels(); colorCount = TensorflowLiteService.ModelInputSize * TensorflowLiteService.ModelInputSize; stopwatch = new Stopwatch(); cameraFPSCounter = new FPSCounter((x) => { Stats.CameraFps = x.fps; Stats.CameraMs = x.ms; }); processingFPSCounter = new FPSCounter((x) => { Stats.ProcessingFps = x.fps; Stats.ProcessingMs = x.ms; }); }
// Use this for initialization void Awake() { fpsCounter = GetComponent <FPSCounter>(); fpsLabel = gameObject.GetComponent <Text>(); fpsLabel.enabled = false; }
public void Awake() { GameManager.instance = this; frameController = gameObject.AddComponent <FrameController>(); frameController.game = this; fpsCounter = GetComponent <FPSCounter>(); }
float _survivalTime = 0f; // 生存時間 #endregion // Private Fields // ---------------------------------------------------- #region // Unity Events /// <summary> /// MonoBehaviour.Start /// </summary> void Start() { this._gameStatus = new GameStatus(this._addScore); // ECSの初期化 this._ecsManager = new ECSManager(this._lookSettings, this._collider2DSettings, this._enemySettings, this._gameStatus); // UniRx.AsyncとUnity.Entitiesの和解 var playerLoop = ScriptBehaviourUpdateOrder.CurrentPlayerLoop; PlayerLoopHelper.Initialize(ref playerLoop); #if ENABLE_DEBUG // FPSCounterの起動 this._fpsCounter = new FPSCounter(); Observable.EveryUpdate().Subscribe(_ => this._fpsCounter.UpdateInternal()).AddTo(this.gameObject); #endif // プレイヤーのインスタンス化 & 初期化 var obj = Instantiate <GameObject>(this._playerPrefab); this._player = obj.GetComponent <Player>(); this._player.Initialize(this._ecsManager); this._player.OnDestroy.Subscribe(_ => this.OnGameOver()).AddTo(this.gameObject); // 敵生成ロジックのインスタンス化 this._enemySpawner = new EnemySpawner(this._ecsManager, this._enemySettings, this._spawnPoints); // UI Event Settings this._titleUI.OnGameStartClick.Subscribe(_ => this.OnGameStart()).AddTo(this.gameObject); this._titleUI.OnRankingCkick.Subscribe(_ => this.Ranking()).AddTo(this.gameObject); this._resultUI.OnRetryClick.Subscribe(_ => this.OnGameStart()).AddTo(this.gameObject); this._resultUI.OnRankingCkick.Subscribe(_ => this.Ranking()).AddTo(this.gameObject); this._resultUI.OnTweetCkick.Subscribe(_ => this.Tweet()).AddTo(this.gameObject); // Audio & Particle Settings this._ecsManager.OnDestroyEnemy.Subscribe(pos => { // Audio this.PlaySE(SE_ID.EnemyDestroy); // TODO: Add Particle }).AddTo(this.gameObject); this._player.OnDestroy.Subscribe(pos => { // Audio this.PlaySE(SE_ID.PlayerDestroy); // TODO: Add Particle }).AddTo(this.gameObject); this._player.OnShot.Subscribe(pos => { // Audio this.PlaySE(SE_ID.PlayerShot); // TODO: Add Particle }).AddTo(this.gameObject); // タイトルの表示 this._titleUI.Show(); }
public static void Create() { if (instance == null) { instance = new FPSCounter(); instance.FPSNextPeriod = Time.realtimeSinceStartup + FPSMeasurePeriod; } }
public static void Create() { if (instance == null) { instance = new FPSCounter (); instance.FPSNextPeriod = Time.realtimeSinceStartup + FPSMeasurePeriod; } }
protected Console() { this.fpsCounter = new FPSCounter(); this.memoryDetector = new MemoryDetector(); App.Instance.onUpdate += Update; App.Instance.onGUI += OnGUI; }
void Start() { this.inspector = new Inspector(new Rect(Screen.width - 400, 0, 400, Screen.height - Screen.height / 5)); this.hierarchy = new Hierarchy(new Rect(0, 0, 500, Screen.height), this.inspector, this); this.console = new DebugConsole(new Rect(500, Screen.height - Screen.height / 5, Screen.width - 500, Screen.height / 5)); this.fps = new FPSCounter(new Rect(Screen.width / 2, 0, 100, 100)); StartCoroutine(this.fps.fpsCounter()); }
private Console() { this.fpsCounter = new FPSCounter(this); this.memoryDetector = new MemoryDetector(this); // this.showGUI = App.Instance().showLogOnGUI; App.Instance().onUpdate += Update; App.Instance().onGUI += OnGUI; }
private Console() { this.fpsCounter = new FPSCounter(this); this.memoryDetector = new MemoryDetector(this); this.showGUI = Setting.GetBool("ShowLogOnGUI", false); Game.Instance().onUpdate += Update; Game.Instance().onGUI += OnGUI; }
static GameController() { GameObject go = new GameObject("GameController"); instance = go.AddComponent <GameController>(); FpsCounter = go.AddComponent <FPSCounter>(); FpsCounter.Show = true; DontDestroyOnLoad(go); }
public void Initialize(int pWidth, int pHeight) { this.mFPSCounter = new FPSCounter(); this.mRasterizerState = new RasterizerState(); this.mRasterizerState.CullMode = CullMode.None; this.mLightMapBlendState = new BlendState(); this.mLightMapBlendState.ColorSourceBlend = Blend.One; this.mLightMapBlendState.ColorDestinationBlend = Blend.One; this.mLightMapBlendState.ColorBlendFunction = BlendFunction.Add; this.mLightMapBlendState.AlphaSourceBlend = Blend.One; this.mLightMapBlendState.AlphaDestinationBlend = Blend.One; this.mLightMapBlendState.AlphaBlendFunction = BlendFunction.Add; this.mSamplerState = SamplerState.LinearClamp; this.mAlphaBlend = BlendState.AlphaBlend; this.mDepthStencilState = new DepthStencilState(); this.mDepthStencilState.DepthBufferWriteEnable = true; this.mDepthStencilState.DepthBufferEnable = true; this.mDepthStencilState.DepthBufferFunction = CompareFunction.GreaterEqual; this.mNoDepthStencilState = new DepthStencilState(); this.mNoDepthStencilState.DepthBufferWriteEnable = false; this.mNoDepthStencilState.DepthBufferEnable = false; this.mNoDepthStencilState.DepthBufferFunction = CompareFunction.GreaterEqual; // this.mAlphaBlend = new BlendState(); //this.mAlphaBlend.ColorDestinationBlend = Blend.InverseSourceAlpha; //this.mAlphaBlend.ColorSourceBlend = Blend.SourceAlpha; //this.mAlphaBlend.AlphaSourceBlend = Blend.Zero; //this.mAlphaBlend.AlphaDestinationBlend = Blend.Zero; //this.mAlphaBlend.ColorBlendFunction = BlendFunction.Add; //this.mAlphaBlend.AlphaBlendFunction = BlendFunction.Add; this.mLightTarget = new RenderTarget2D(this.mGraphicsDevice, pWidth, pHeight, false, SurfaceFormat.Color, DepthFormat.None); this.mFinalTarget = new RenderTarget2D(this.mGraphicsDevice, pWidth, pHeight, false, SurfaceFormat.Color, DepthFormat.None); this.mView = Matrix.CreateLookAt(new Vector3(0.0f, 0.0f, 1.0f), Vector3.Zero, Vector3.Up); this.mTranslatetViewMatrix = this.mView; this.mWorld = Matrix.Identity; this.mGBuffer = new GBuffer(this.mGraphicsDevice); this.mTextureArray = new Texture2D[4]; this.mBatch = new Batch(this.mGraphicsDevice); mTextureFinalTarget = (Texture2D)mFinalTarget; this.mFogPost = new FogPostShader(ref mTextureFinalTarget, ref mGBuffer.RenderTargets[3]); }
protected override void InitScreen(PloobsEngine.Engine.GraphicInfo GraphicInfo, PloobsEngine.Engine.EngineStuff engine) { FPSCounter fp = new FPSCounter(); fp.CombinedFps += new FpsEvent(fp_CombinedFps); engine.AddComponent(fp); engine.IsFixedTimeStep = false; base.InitScreen(GraphicInfo, engine); }
protected override void Awake() { base.Awake(); KeepAlive.Apply(this); CleanupHook.CreateSingleton(); FPSCounter.CreateSingleton(); }
/// <summary> /// Allows the game to perform any initialization it needs to before starting to run. /// This is where it can query for any required services and load any non-graphic /// related content. Calling base.Initialize will enumerate through any components /// and initialize them as well. /// </summary> protected override void Initialize() { fps = new FPSCounter(this); debug = new Debug(this); this.Components.Add(fps); this.Components.Add(debug); base.Initialize(); }
public TrackingResultProcessing(UserInterfaceOutputFacade outputFacade, GameController gameController, IProgramState programState) { OutputFacade = outputFacade; GameController = gameController; ProgramState = programState; FpsCounter = new FPSCounter(); TrackningInProgress = false; AveragingQueue = new Queue <TimestampObject <TrackingState> >(); TimeOffset = DateTime.Now + TimeSpan.FromSeconds(1.5); }
public PowerRegulator() { _Sample = 1.0f; _SpinWait = new SpinWait(); _SpinCount = 0; _WorkCount = 0; _Busy = 0; _TimeCount = new TimeCounter(); _FPS = new FPSCounter(); }
public DiagnosticsManager(Game game) { ui = new DiagnosticsUI(game, this); host = new DiagnosticsCommandHost(ui); fps = new FPSCounter(game, this); ruler = new TimeRuler(game, this); factory = new GameComponentFactory(game, this); InitBasicCommands(); }
public void Init() { FpsEnabled = ToylandSiege.GetInstance().configurationManager.FPSEnabled; _spriteBatch = new SpriteBatch(ToylandSiege.GetInstance().GraphicsDevice); _spriteFont = ToylandSiege.GetInstance().Content.Load <SpriteFont>("Fonts/FPS"); _configurationManager = ToylandSiege.GetInstance().configurationManager; Mouse.SetPosition(ToylandSiege.GetInstance().Window.ClientBounds.Width / 2, ToylandSiege.GetInstance().Window.ClientBounds.Height / 2); _previousMouseState = Mouse.GetState(); _frameCounter = new FPSCounter(); }
public string Off() { if (this.counter != null) { this.counter.Dispose(); this.counter = null; } return(string.Empty); }
public static Node Create(Vector3 pos) { var cmp = new MyFPSCounter (); var fps = new FPSCounter (); var node = new Node ("FPSCounter"); node.Attach (cmp); node.Attach (fps); node.Translation = pos; return node; }
public static void Init() { fpsCounter = new FPSCounter(); fpsCounter.Init(); //memoryDetector = new MemoryDetector(); //memoryDetector.Init(); ApplicationManager.s_OnApplicationUpdate += Update; ApplicationManager.s_OnApplicationOnGUI += OnGUI; Application.logMessageReceived += HandleLog; //consoleStyle = GUI.skin.label; //consoleStyle.fontSize = 20; }
public string On() { this.counter = new FPSCounter(ConsoleManager.GetInstance(), this.screen.alwaysShownText); return string.Empty; }
protected override void Initialize() { debugObjects = new Dictionary<string, object>(); debugValues = new Dictionary<string, float>(); debugStrings = new List<string>(); ContentManager content = new ResourceContentManager(services, Resource.ResourceManager); DebugFont = content.Load<SpriteFont>("DebugFont"); DebugPos = new Vector2(15, 15); DebugColor = Color.Yellow; FPSCounter = new FPSCounter(DebugPos, DebugFont, DebugColor); }
protected override void Initialize() { FPSCounter = new FPSCounter(); fade = new Texture2D(GraphicsDevice, width, height); Color[] colorData = new Color[width * height]; for (int i = 0; i < width * height; i++) { colorData[i] = Color.Black; } fade.SetData<Color>(colorData); base.Initialize(); }
public string Off() { if (this.counter != null) { this.counter.Dispose(); this.counter = null; } return string.Empty; }
void OnEnable() { fps = new FPSCounter(); StartCoroutine(fps.Update()); Message.defaultColor = defaultColor; Message.warningColor = warningColor; Message.errorColor = errorColor; Message.systemColor = systemColor; Message.inputColor = inputColor; Message.outputColor = outputColor; _windowRect = new Rect(Screen.width / 2 - 200, 30, 400, 320); //LogMessage(Message.System("输入 '/?' 显示帮助")); this.RegisterCommandCallback("clear", CMD_Clear, "清除调试信息"); this.RegisterCommandCallback("sys", CMD_SystemInfo, "显示系统信息"); this.RegisterCommandCallback("/?", CMD_Help, "显示可用命令"); }
public TestLevel(Game game, GameStateManager manager, SpriteBatch spriteBatch, Rectangle screenRectangle) : base(game, manager, spriteBatch, screenRectangle) { FpsCounter = new FPSCounter(game, manager, spriteBatch, screenRectangle, Vector2.Zero, Color.White, Color.Red, Color.Gray); ChildComponents.Add(FpsCounter); }
protected override void LoadContent() { sb = new SpriteBatch(Game.GraphicsDevice); TexBlank = Game.Content.Load<Texture2D>(@"textures\gui\blank"); TexBar = Game.Content.Load<Texture2D>(@"textures\gui\bar"); TexCursor = Game.Content.Load<Texture2D>(@"textures\gui\cursor"); TexKnob = Game.Content.Load<Texture2D>(@"textures\gui\knob"); TexButtonL = Game.Content.Load<Texture2D>(@"textures\gui\buttonLeft"); TexButtonM = Game.Content.Load<Texture2D>(@"textures\gui\buttonMiddle"); TexButtonR = Game.Content.Load<Texture2D>(@"textures\gui\buttonRight"); screenManager.LoadContent(Game.Content); fpsCounter = new FPSCounter(this.GraphicsDevice.Viewport); }
protected override void LoadContent() { // Create a new SpriteBatch, which can be used to draw textures. spriteBatch = new SpriteBatch(GraphicsDevice); // Load shaders fxParticles = Content.Load<Effect>("Shaders\\Particles"); fxParticles.Parameters["Texture"].SetValue(Content.Load<Texture2D>("Textures\\Particle")); box = new TransparentBox(GraphicsDevice); // load font font = Content.Load<SpriteFont>("Fonts\\Debug"); this.Components.Add(fpsCounter = new FPSCounter(this)); int pCount = 0; // Particles particles = new Particles(fxParticles); float pOffset = particles.ParticleRadius * 2; Color color = Color.White; for (int x = 0; x < 5; x++) { for (int z = 0; z < 5; z++) { for (int y = 0; y < 10; y++) { if (pCount >= 50 && pCount < 100) color = Color.Red; else if (pCount >= 100 && pCount < 150) color = Color.Yellow; else if (pCount >= 150 && pCount < 200) color = Color.Green; else if(pCount >= 200 && pCount < 250) color = Color.CornflowerBlue; particles.Add(new Particle(new Vector3(x, y, z) * pOffset, particles.GetRandomVelocity(), color)); pCount++; } } } color = Color.Red; }
protected override void Initialize() { viewport = graphics.GraphicsDevice.Viewport; player = new Player(); for (int i = 0; i < swordNumber; i++) swords.Add(new Sword(i*50)); fpsCounter = new FPSCounter(); base.Initialize(); }
// Use this for initialization void Start() { fpsScript = gameObject.GetComponent<FPSCounter> (); }
void Awake() { fpsCounter = GetComponent<FPSCounter>(); }