Example #1
0
 void Grating_Dir()
 {
     if (Input.IsMouseLeftButtonDown())
     {
         Grating.Para.BasePara.direction = (Grating.Para.BasePara.direction + 1.0f) % 360;
     }
     if (Input.IsMouseRightButtonDown())
     {
         Grating.Para.BasePara.direction = (Grating.Para.BasePara.direction - 1.0f) % 360;
     }
     Grating.Ori3DMatrix = Matrix.CreateRotationZ((float)(Grating.Para.BasePara.direction * Math.PI / 180.0));
     Grating.WorldMatrix = Matrix.CreateTranslation(Grating.Para.BasePara.center);
     Grating.SetTime((float)Timer.ElapsedSeconds);
 }
Example #2
0
        protected override void Draw()
        {
            GraphicsDevice.Clear(Color.Gray);

            if (GO_OVER)
            {
                audio.PauseAll();
                video.Play();
                video.Draw();
            }
            else
            {
                audio.ResumeAll();
                video.Stop();

                //bar.Draw(GraphicsDevice);
                grating.SetTime((float)timer.ElapsedSeconds);
                grating.Draw(GraphicsDevice);
                //image.Draw(new Rectangle(210, 100, 400, 200), Color.White);
                //quad.Draw(GraphicsDevice);
                model.Ori3DMatrix = Matrix.CreateRotationY((float)timer.ElapsedSeconds);
                model.Draw(GraphicsDevice);
                //point.Draw(GraphicsDevice);
                circle.Draw(GraphicsDevice);
                //disk.Draw(GraphicsDevice);
                //cross.Draw(GraphicsDevice);
                //arrow.Draw(GraphicsDevice);
                radialcircle.Draw(GraphicsDevice);
                //gaussian.Draw(GraphicsDevice);
                vsc.BatchDraw(GraphicsDevice);
                //vscp.Draw(GraphicsDevice);

                text.Draw(new Vector2(5, 5), SLConstant.Help + "\n" + frameinfo.FPS.ToString() + " FPS", Color.PeachPuff);
                text.Draw(new Vector2(5, 70), "Unicode Text: ¦«¦²¦µ¦¶¦·¦¸¦°", Color.Red, 10f * (float)SLConstant.Rad_p_Deg, Vector2.Zero, Vector2.One);
            }
        }
Example #3
0
        protected override void Draw()
        {
            GraphicsDevice.Clear(Color.Gray);

            if (GO_OVER)
            {
                audio.PauseAll();
                model.Ori3DMatrix = Matrix.CreateRotationY((float)timer.ElapsedSeconds);
                model.Draw(GraphicsDevice);
            }
            else
            {
                audio.ResumeAll();

                //bar.Draw(GraphicsDevice);
                grating.SetTime((float)timer.ElapsedSeconds);
                grating.Draw(GraphicsDevice);
                //cross.Draw(GraphicsDevice);
                //arrow.Draw(GraphicsDevice);

                text.Draw(new Vector2(10, 10), SLConstant.Help + "\n" + frameinfo.FPS.ToString() + " FPS", Color.PeachPuff);
                text.Draw(new Vector2(10, 80), serverstate, Color.Red);
            }
        }
Example #4
0
        void Update_sdGrating()
        {
            if (ex.Flow.IsStiOn)
            {
                ex.PPort.Timer.Start();
                // Stimulus Onset Marker
                ex.PPort.Trigger();
                ex.Flow.IsStiOn = false;
            }

            if (ex.Flow.IsStiOff)
            {
                // Stimulus Offset Marker
                ex.PPort.Trigger();
                ex.Flow.IsStiOff = false;
                if (ex.Flow.TrialCount == ex.Exdesign.trial - 1)
                {
                    GO_OVER = false;
                    return;
                }
            }

            ex.Flow.LastingTime = ex.PPort.Timer.ElapsedSeconds;

            // In Presentation
            if (ex.Flow.LastingTime < ex.Flow.StiTime)
            {
                if (!ex.Flow.IsPred)
                {
                    ex.Flow.IsPred = true;

                    grating.Ori3DMatrix = ex.Flow.RotateDir;
                    grating.WorldMatrix = ex.Flow.TranslateCenter;
                    grating.Visible     = true;

                    ex.Flow.IsStiOn = true;
                }

                if (ex.Flow.LastingTime > ex.Exdesign.preT && ex.Flow.LastingTime < ex.Flow.PreDurTime)
                {
                    grating.SetTime((float)ex.Flow.LastingTime - ex.Exdesign.preT);
                }
            }
            else // End of Presentation
            {
                if (!ex.Flow.IsRested)
                {
                    ex.Flow.IsRested = true;
                    grating.Visible  = false;
                    ex.Flow.IsStiOff = true;
                }

                if (ex.Flow.TrialCount < ex.Exdesign.trial - 1)
                {
                    if (ex.Flow.LastingTime > ex.Flow.StiTime + ex.Exdesign.trestT)
                    {
                        ex.Flow.IsPred      = false;
                        ex.Flow.IsRested    = false;
                        ex.Flow.TrialCount += 1;
                        // Set Temporal Phase back to zero for new stimulus
                        grating.SetTime(0.0f);
                        ex.PPort.Timer.Reset();
                    }
                }
            }
        }