コード例 #1
0
        //Initialize
        public override void Initialize(System.Windows.Forms.Form form, SpriteBatch spriteBatch)
        {
            //Load Images
            shapeHelper = new DirectX_Shape_Helper(Game.Content);

            //Initialize Shapes (get bounds and images)
            for (int i = 0; i < 4; i++)
            {
                stimStruct[i].shape     = Shape.Rectangle;
                stimStruct[i].type      = (Type)i;
                stimStruct[i].stimScale = 1;
                stimStruct[i]           = shapeHelper.GetShape(stimStruct[i]);
            }

            ////set up the Initial stimuli locations
            stimStruct[0].stimRect.Location = new Point((SCREENWIDTH - stimStruct[0].stimRect.Width) / 2, 0);                                              //Up
            stimStruct[1].stimRect.Location = new Point((SCREENWIDTH - stimStruct[1].stimRect.Width) / 2, SCREENHEIGHT - stimStruct[1].stimRect.Height);   //Down
            stimStruct[2].stimRect.Location = new Point((SCREENWIDTH - stimStruct[2].stimRect.Width), (SCREENHEIGHT - stimStruct[2].stimRect.Height) / 2); //Right
            stimStruct[3].stimRect.Location = new Point(0, (SCREENHEIGHT - stimStruct[3].stimRect.Height) / 2);                                            //Left

            ////Event Handlers
            form.MouseDown        += onMouseDown;
            form.MouseMove        += onMouseMove;
            form.MouseUp          += onMouseUp;
            form.MouseClick       += onMouseClick;
            form.MouseDoubleClick += onMouseDoubleClick;
            form.MouseWheel       += onMouseScroll;
            form.AllowTransparency = false;
            this.form = form;

            InterceptKeys.KeyDown += handleKeyDown;
            InterceptKeys.KeyUp   += handleKeyUp;

            base.Initialize(form, spriteBatch);
        }