Inheritance: MonoBehaviour
コード例 #1
0
        private const string RAW_VIDEO_HEADER = "YUV4MPEG2 "; // The space is intentional

        #endregion Fields

        #region Constructors

        private RawVideoFile(string path, int width, int height, FPS framerate)
        {
            Path = path;
            Width = width;
            Height = height;
            Framerate = framerate;
        }
コード例 #2
0
        public override void Update(GameTime gameTime)
        {
            var deltaSeconds = (float)gameTime.ElapsedGameTime.TotalSeconds;

            FPS.Update(deltaSeconds);
            Garbage.Update(deltaSeconds);

            if (_fpsOrGarbageDirty)
            {
                _fpsOrGarbageDirty = false;
                Game.Window.Title  = $"FPS {_fps} | Garbage per sec KB {_garbage.ToString(CultureInfo.InvariantCulture)}";
            }
        }
コード例 #3
0
        public bool Frame()
        {
            // Update the system stats.
            FPS.Frame();

            // Do the zone frame processing.
            if (!Zone.Frame(D3D, Input, ShaderManager, TextureManager, Timer.FrameTime, FPS.FPS))
            {
                return(false);
            }

            return(true);
        }
コード例 #4
0
    public static void SavePlayer(FPS player)
    {
        BinaryFormatter formatter = new BinaryFormatter();
        string          path      = Application.persistentDataPath + "/player.BlueFlamingo";

        FileStream stream = new FileStream(path, FileMode.Create);

        PlayerData data = new PlayerData(player);

        formatter.Serialize(stream, data);
        Debug.Log("SavePlayer data : " + data.level);
        stream.Close();
    }
コード例 #5
0
    private float timeleft;     // Left time for current interval

    private void Awake()
    {
        // Singleton Pattern
        if (instance == null)
        {
            instance = this;
        }
        else if (instance != this)
        {
            Destroy(gameObject);
        }
        DontDestroyOnLoad(gameObject);
    }
コード例 #6
0
        public Game1()
        {
            graphics = new GraphicsDeviceManager(this);
            Content.RootDirectory = "Content";

            console = new GameConsole(this);
            Components.Add(console);

            fps = new FPS(this);
            Components.Add(fps);

            mouseSpawn = new MouseSpawnGhost(this);
            Components.Add(mouseSpawn);
        }
コード例 #7
0
        public Game1()
        {
            graphics = new GraphicsDeviceManager(this);
            Content.RootDirectory = "Content";

            fps                 = new FPS(this);
            input               = new InputHandler(this);
            gameConsole         = new GameConsole(this);
            celAnimationManager = new CelAnimationManager(this);
            this.Components.Add(fps);
            this.Components.Add(input);
            this.Components.Add(gameConsole);
            this.Components.Add(celAnimationManager);
        }
コード例 #8
0
        private void textBoxFPS_TextChanged(object sender, EventArgs e)
        {
            FPS = 30;

            if (Double.TryParse(textBoxFPS.Text, out double temp))
            {
                if (FPS > 0 && FPS < 10000)
                {
                    FPS = temp;
                }
            }

            textBoxFPS.Text = FPS.ToString();
        }
コード例 #9
0
ファイル: FPS.cs プロジェクト: HiddenRealm/Mobile-Game
 void Awake()
 {
     //this is to make sure that i only
     //ever have 1 instance of this class
     if (Control == null)
     {
         DontDestroyOnLoad(gameObject);
         Control = this;
     }
     else if (Control != this)
     {
         Destroy(this.gameObject);
     }
 }
コード例 #10
0
        public Game1()
        {
            graphics = new GraphicsDeviceManager(this);
            Content.RootDirectory = "Content";

            graphics.PreferredBackBufferHeight = 256;
            graphics.PreferredBackBufferWidth  = 512;

            fps = new FPS(this);
            Components.Add(fps);

            input = new InputHandler(this);
            Components.Add(input);
        }
コード例 #11
0
        public bool Frame(float frameTime)
        {
            // Update the system stats.
            FPS.Frame();
            CPU.Frame();

            // Update the FPS value in the text object.
            if (!Text.SetFps(FPS.FPS, D3D.DeviceContext))
            {
                return(false);
            }

            // Update the CPU usage value in the text object.
            if (!Text.SetCpu(CPU.CPUUsage, D3D.DeviceContext))
            {
                return(false);
            }

            // Do the frame input processing.
            if (!HandleInput(frameTime))
            {
                return(false);
            }

            // Do the water frame processing.
            WaterModel.Frame();

            // Do the sky plane frame processing.
            SkyPlane.Frame();

            // Render the refraction of the scene to a texture.
            if (!RenderRefractionToTexture())
            {
                return(false);
            }

            // Render the reflection of the scene to a texture.
            if (!RenderReflectionToTexture())
            {
                return(false);
            }

            // Render the graphics.
            if (!Render())
            {
                return(false);
            }

            return(true);
        }
コード例 #12
0
        public override void Update(float dtime)
        {
            if (InputHandler != null)
            {
                InputHandler.ProcessMessage(MessageType.Update, new UpdateEventArgs {
                    Dtime = dtime
                });
            }

            if (Direct3DVersion == Direct3DVersion.Direct3D10)
            {
                Device10.ClearRenderTargetView(GraphicsDevice.RenderView, clearColor);
            }
            else
            {
                Device9.Clear(SlimDX.Direct3D9.ClearFlags.Target | SlimDX.Direct3D9.ClearFlags.ZBuffer,
                              clearColor, 1.0f, 0);

                Device9.BeginScene();
            }

            InterfaceRenderer.Render(dtime);
            if (pb != null)
            {
                pb.Value += dtime * 10;
                if (pb.Value > 100)
                {
                    pb.Value = 0;
                }

                tt.SetToolTip(pb, "This is a progress bar\n" + (int)(pb.Value) + "/" + pb.MaxValue);
            }

            //if (cb != null && cb.Checked)
            //{
            //    bvr.Begin(InterfaceScene.Camera);
            //    foreach (var v in Manager.Clickables.All)
            //        bvr.Draw(v.CombinedWorldMatrix, v.PickingLocalBounding, Color.Red);
            //    bvr.End();
            //}

            if (Direct3DVersion == Direct3DVersion.Direct3D9)
            {
                Device9.EndScene();
            }

            Application.MainWindow.Text = "Using " + Direct3DVersion + ", " + FPS.ToString() + " fps";
            System.Console.WriteLine(x++ + " : " + x * 2 + " * " + x * 3 + " - " + x * 4 + " s " + x * 5);
        }
コード例 #13
0
        public Game1()
        {
            graphics = new GraphicsDeviceManager(this);
            Content.RootDirectory = "Content";

            SetWorldTransforms();

            //Game componenets from MonogameLibrary.Util
            input       = new InputHandler(this);
            gameConsole = new GameConsole(this);
            fps         = new FPS(this);
            this.Components.Add(input);
            this.Components.Add(gameConsole);
            this.Components.Add(fps);
        }
コード例 #14
0
        public override void Update(float dtime)
        {
            windowsCursor.Position = new Vector2(LocalMousePosition.X, LocalMousePosition.Y);

            Device9.Clear(ClearFlags.Target | ClearFlags.ZBuffer, Color.FromArgb(1, (int)(0.6 * 255), (int)(0.8 * 255), 255), 1.0f, 0);

            Device9.BeginScene();

            InterfaceRenderer.Render(dtime);
            Application.MainWindow.Text = FPS.ToString();

            Device9.EndScene();

            System.Threading.Thread.Sleep(1000 / 30);
        }
コード例 #15
0
        public Game1()
        {
            graphics = new GraphicsDeviceManager(this);
            Content.RootDirectory = "Content";

            input       = new InputHandler(this);
            gameConsole = new GameConsole(this);
            this.Components.Add(input);
            this.Components.Add(gameConsole);

#if DEBUG
            fps = new FPS(this);

            this.Components.Add(fps);
#endif
        }
コード例 #16
0
        public FlightSimulator()
            : base()
        {
            //ダブルバッファリング設定
            SetStyle(ControlStyles.DoubleBuffer, true);
            SetStyle(ControlStyles.UserPaint, true);
            SetStyle(ControlStyles.AllPaintingInWmPaint, true);


            version  = "Ver.1.1 2003.11.04";
            eh       = new EventHandler();
            tp       = new TimeParam();
            simIF    = new SimulatorInterface();
            recorder = new Recorder();
            fps      = new FPS();
        }
コード例 #17
0
ファイル: Game1.cs プロジェクト: dsp56001/Facesketball
        public Game1()
        {
            graphics = new GraphicsDeviceManager(this);
            Content.RootDirectory = "Content";

            fMan = new FoodManager(this, "20px_1trans", new Point(10, 10));
            //graphics.ToggleFullScreen();
            //graphics.PreferredBackBufferWidth = 1024;
            //graphics.PreferredBackBufferHeight = 768;
            graphics.PreferredBackBufferWidth  = 1280;
            graphics.PreferredBackBufferHeight = 720;
            Content.RootDirectory = "Content";

            #region Library Components
            input = new InputHandler(this);
            this.Components.Add(input);

            gameConsole = new GameConsole(this);
            //gameConsole.ToggleState();
            this.Components.Add(gameConsole);

            fps = new FPS(this);
            this.Components.Add(fps);


            #endregion

            FaceTracker             = new PlayerFace(this);
            FaceTracker.ShowMarkers = false;
            FaceTracker.Scale       = 1.0f;
            FaceTracker.Visible     = false;
            this.Components.Add(FaceTracker);

            FBM = new FoatingBallManager(this);
            this.Components.Add(FBM);

            faceChaser             = new FaceChaser(this);
            faceChaser.Location    = new Vector2(10, 10);
            faceChaser.ChaseSpeed  = new Vector2(1.4f, 1.4f);
            faceChaser.ShowMarkers = false;
            this.Components.Add(faceChaser);
            faceChaser.Enabled = true;
            faceChaser.Visible = true;

            Bball = new BasketBall(this);
            this.Components.Add(Bball);
        }
コード例 #18
0
ファイル: Movie.cs プロジェクト: Suzu-Yoshi/DxLibTemplateCS
        /// <summary>
        /// 動画停止(音量をフェードアウト)
        /// </summary>
        /// <param name="milliTime">フェードアウトする時間(ミリ秒)</param>
        public void StopMovie(int milliTime)
        {
            //最初のフェードアウト処理のとき
            if (this.fadeOutCnt == 0)
            {
                float MilliSec = 1000.0f;   //1秒は1000ミリ秒

                //流し続ける時間=秒数×FPS値
                //例)60FPSのゲームで、1秒間流し続けるなら、1秒×60FPS
                float UpdateTime = (milliTime / MilliSec) * FPS.GetInstance().GetValuef();    //この時間がMAX

                //フェードアウトのカウンタ設定
                this.fadeOutCnt    = 0;
                this.fadeOutCntMax = (int)UpdateTime;

                this.ChangeVolume(this.volume); //音量をMAXにする

                this.IsfadeOutEnd = false;      //フェードアウト開始
            }

            //フェードアウトしているとき(フェードアウトのMAX値以下ならば)
            if (this.fadeOutCnt >= 0 && this.fadeOutCnt < this.fadeOutCntMax)
            {
                //カウンタを上げる
                this.fadeOutCnt++;

                //(MAX時間-現在のカウント時間)÷MAX時間で、音量の全体割合を計算
                float CalcVolume = ((float)this.fadeOutCntMax - (float)this.fadeOutCnt) / (float)this.fadeOutCntMax * 255;

                //読み込み時に設定した音量は超えないように注意すること!
                if (CalcVolume >= this.volume)
                {
                    CalcVolume = this.volume;
                }

                //音量を下げる
                this.ChangeVolume((int)CalcVolume);
            }
            else
            {
                //動画をポーズ
                DX.PauseMovieToGraph(this.handle);

                this.IsfadeOutEnd = true;   //フェードアウト終了
            }
            return;
        }
コード例 #19
0
        public Game1()
        {
            graphics = new GraphicsDeviceManager(this);
            Content.RootDirectory = "Content";

            graphics.PreferredBackBufferHeight = height;
            graphics.PreferredBackBufferWidth  = width;

            input = new InputHandler(this);
            Components.Add(input);

            fps = new FPS(this);
            Components.Add(fps);

            MediaPlayer.ActiveSongChanged +=
                new EventHandler(MediaPlayer_ActiveSongChanged);
        }
コード例 #20
0
ファイル: MainForm.cs プロジェクト: EvitanRelta/3D-Rendering
        private void Form1_Paint(object sender, PaintEventArgs e)
        {
            e.Graphics.DrawRectangle(Pens.Black, screen);
            RenderEngine r = new RenderEngine(e, screen, player, FOV);

            r.Render(polygons);

            //label1.Text = Tick.ToString() + "   " + r.Player.DirectionVector.VertAngDeg.ToString(1, true) + "   " + player.DirectionVector.ToVector().ToString(1, true);
            string tempStr = "";

            if ((DateTime.Now - ProgramStartTime).TotalMilliseconds % 150 < 50)
            {
                tempStr = "FPS: " + FPS.ToString(1, true) + "\nInterval: " + FrameTick.Interval;
            }

            label1.Text = "Coord: " + player.Coord.ToString(1, true) + "\nDirection: " + player.DirectionVector.ToVector().ToString(1, true) + "\n" + tempStr;
        }
コード例 #21
0
    public static int FPStoInt(FPS input)
    {
        switch (input)
        {
        case FPS.FPS5:
            return(5);

        case FPS.FPS15:
            return(15);

        case FPS.FPS30:
            return(30);

        default:
            return(15);
        }
    }
コード例 #22
0
        /// <summary>
        /// Initialize most static objects and dependencies
        /// </summary>
        protected override void Initialize()
        {
            base.Initialize();

            // Copy, if needed, the required assemblies (BASS) for 32 or 64bit CPUs
            NativeAssemblies.Copy();

            // Initialize the logging tool for troubleshooting
            PulsarcLogger.Initialize();

            // Initialize Discord Rich Presence
            PulsarcDiscord.Initialize();

            // Set the default culture (Font formatting Locals) for this thread
            Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;

            // Start the thread listening for user input
            InputManager.StartThread();

            // Start our time and frame-time tracker
            PulsarcTime.Start();

            // Initialize FPS
            fpsDisplay = new FPS(Vector2.Zero);

            // Initialize the game camera
            gameCamera = new Camera(Graphics.GraphicsDevice.Viewport, (int)GetDimensions().X, (int)GetDimensions().Y, 1)
            {
                Pos = new Vector2(GetDimensions().X / 2, GetDimensions().Y / 2)
            };

            // Start the song selection in the background to have music when entering the game
            SongScreen = new SongSelection();
            SongScreen.Init();

            // Create and display the default game screen
            // (Currently Main menu. In the future can implement an intro)
            Menu firstScreen = new Menu();

            ScreenManager.AddScreen(firstScreen);

            cursor = new Cursor();

            IsReadyToUpdate = true;
        }
コード例 #23
0
        public Game1()
        {
            graphics = new GraphicsDeviceManager(this);
            Content.RootDirectory = "Content";

            input = new InputHandler(this);
            Components.Add(input);
            camera = new FirstPersonCamera(this);
            Components.Add(camera);

#if DEBUG
            //draw 60 fps and update as often as possible
            fps = new FPS(this, true, false);
#else
            fps = new FPS(this, true, false);
#endif
            Components.Add(fps);
        }
コード例 #24
0
ファイル: Kernel.cs プロジェクト: wtrsltnk/eresys
        private void Graphics_ContextDestroying(object sender, EventArgs e)
        {
            timer.Pause = true;

            // terminate application
            _app.Terminate();

            // write kernel performance report
            Profiler.WriteReport(new ConsoleLogger(), "kernel main loop");

            // some logging...
            Logger.Log(LogLevels.Info, "Eresys normally terminated.");

            Logger.Log(LogLevels.Info, $"Running time:      {timer.Time.ToString("F4")} seconds");
            Logger.Log(LogLevels.Info, $"Frames rendered:   {FramesDrawn}");
            Logger.Log(LogLevels.Info, $"Average FPS:       {AverageFPS.ToString("F4")}");
            Logger.Log(LogLevels.Info, $"Last Measured FPS: {FPS.ToString("F4")}");
        }
コード例 #25
0
        static void Main(string[] args)
        {
            // Create FPS object
            var fps = new FPS
            {
                FpsID                     = "1234567",                  // Current is 7 digits, further will be 10 digits
                BankCode                  = "004",                      // HSBC
                InitiationMethod          = FPS.InitiationType.Dynamic, // mean the payment is one time only
                TransactionAmount         = 1.00M,                      // $1
                TransactionAmountEditable = false,                      // cannot edit by payer
                ReferenceLabel            = "PayRef00001"               // payment reference, HSBC is must provide the field
            };
            var qrCode = fps.ToString();                                // QR Code content

            // ... Generate real QR Code image by other library
            Console.WriteLine(qrCode);
            Console.ReadKey();
        }
コード例 #26
0
        public bool Frame(float frameTime)
        {
            // Update the system stats.
            FPS.Frame();
            CPU.Frame();

            // Update the FPS value in the text object.
            if (!Text.SetFps(FPS.FPS, D3D.DeviceContext))
            {
                return(false);
            }

            // Update the CPU usage value in the text object.
            if (!Text.SetCpu(CPU.CPUUsage, D3D.DeviceContext))
            {
                return(false);
            }

            // Do the frame input processing.
            if (!HandleInput(frameTime))
            {
                return(false);
            }

            // Get the current position of the camera.
            Vector3 cameraPosition = Camera.GetPosition();

            // Get the height of the triangle that is directly underneath the given camera position.
            // If there was a triangle under the camera then position the camera just above it by two units.
            float height;

            if (QuadTree.GetHeightAtPosition(cameraPosition.X, cameraPosition.Z, out height))
            {
                Camera.SetPosition(cameraPosition.X, height + 2.0f, cameraPosition.Z);
            }

            // Render the graphics.
            if (!RenderGraphics())
            {
                return(false);
            }

            return(true);
        }
コード例 #27
0
    void Awake()
    {
        // start coroutine that checks for screen resize
        StartCoroutine(checkForResize());

        // only one gui draw fase
        useGUILayout = false;

        // setup our lensmodel
        mLensmodel = ScriptableObject.CreateInstance <LensModel>();
        mLensmodel.init(LensModel.LENSMODEL.EQUIRECTANGULAR, Screen.width, Screen.height, 1.0f, 1.0f);

        // setup arcball
        mArcball = ScriptableObject.CreateInstance <ArcBall>();
        mArcball.init(Screen.width, Screen.height, transform.rotation);

        // setup FPS counter
        mFps = ScriptableObject.CreateInstance <FPS>();
    }
コード例 #28
0
        public Game1()
        {
            graphics = new GraphicsDeviceManager(this);
            Content.RootDirectory = "Content";

            rotationX  = 0.0f;
            rotationY  = 0.0f;
            orbitX     = 0.0f;
            orbitY     = 0.0f;
            worldTrans = Vector3.Zero;
            worldScale = 1.0f;

            input       = new InputHandler(this);
            gameConsole = new GameConsole(this);
            fps         = new FPS(this);
            this.Components.Add(input);
            this.Components.Add(gameConsole);
            this.Components.Add(fps);
        }
コード例 #29
0
 public bool Import(string json)
 {
     try
     {
         KinectConfiguration fromJson = JsonUtility.FromJson <KinectConfiguration>(json);
         this.transformationMode = fromJson.transformationMode;
         this.colorResolution    = fromJson.colorResolution;
         this.depthMode          = fromJson.depthMode;
         this.fps                = fromJson.fps;
         this.volumeScale        = fromJson.volumeScale;
         this.depthRangeModifier = fromJson.depthRangeModifier;
         return(true);
     }
     catch (Exception ex)
     {
         Debug.Log("Kinect Configuration deserialization failed with :" + ex.Message);
         return(false);
     }
 }
コード例 #30
0
        /// <summary>
        /// Baut die FPS Berechnung auf
        /// </summary>
        private void setUpFPS()
        {
            if (settings.FPSVisible == true)
            {
                gamingForm.lblFPSVisible = true;
            }
            if (settings.FPSVisible == false)
            {
                gamingForm.lblFPSVisible = false;
            }

            fps = new FPS();

            Timer fpsTimer = new Timer();

            fpsTimer.Interval = 1000;
            fpsTimer.Tick    += new EventHandler(EventFPS);
            fpsTimer.Start();
        }
コード例 #31
0
        public PlatformEngine()
        {
            mGraphics             = new GraphicsDeviceManager(this);
            Content.RootDirectory = "Content";



            mGraphics.PreferredBackBufferWidth  = 1280;
            mGraphics.PreferredBackBufferHeight = 720;
            mGraphics.IsFullScreen        = false;
            mGraphics.PreferMultiSampling = false;
            IsFixedTimeStep = false;
            IsMouseVisible  = true;

            mGraphics.ApplyChanges();
            //FPS Debug..
            FPS FrameRateCounter = new FPS(this, "Fonts/DebugFontBold", Content);

            Components.Add(FrameRateCounter);
        }
コード例 #32
0
 public void LoadContent()
 {
     this.fps = new FPS(base.GraphicsDevice, this.XNAContent);
 }