예제 #1
0
        public ERectangleF GetPortionOfMemberToDisplay()
        {
            //TODO: doesn't care about SrcCrop!
            ERectangleF rctfCropped;

            EPoint size      = Member.Size; // Member.TotalSize;
            EPoint sizeFrame = Member.Size;
            EPoint sizeReal  = size;        //GetUpperPowerTextureSize(size);

            //if (Member.GotAnimation)
            //{
            //    ERectangle rctAnim = SourceRect;

            //    rctfCropped = new ERectangleF((float)rctAnim.X/sizeReal.X, (float)rctAnim.Y/sizeReal.Y,
            //        (float)rctAnim.Width/sizeReal.X, (float)rctAnim.Height/sizeReal.Y);
            //}
            //else
            //{
            ERectangle rctAnim = SourceRect;

            rctfCropped = new ERectangleF((float)rctAnim.X / sizeReal.X, (float)rctAnim.Y / sizeReal.Y,
                                          (float)rctAnim.Width / sizeReal.X, (float)rctAnim.Height / sizeReal.Y);
            //}

            return(rctfCropped);
        }
예제 #2
0
 public static void SetRegPoints(List <PicRef> picRefs, EPoint pnt)
 {
     foreach (PicRef p in picRefs)
     {
         p.Offset = pnt;
     }
 }
예제 #3
0
 public void ExpandSpecial(EPoint pnt)
 {
     this.Left   = pnt.X < this.Left?pnt.X:this.Left;
     this.Top    = pnt.Y < this.Top?pnt.Y:this.Top;
     this.Right  = pnt.X > this.Right?pnt.X:this.Right;
     this.Bottom = pnt.Y > this.Bottom?pnt.Y:this.Bottom;
 }
예제 #4
0
        public TestCircle()
        {
            m_pntVel = new EPointF(0,0);
            m_pntThrust = new EPoint(0,0);

            aKeysPressedX = new ArrayList();
            aKeysPressedY = new ArrayList();

            Bitmap bmp = new Bitmap(40,40, PixelFormat.Format24bppRgb);
            Graphics g = Graphics.FromImage(bmp);
            g.FillEllipse(new SolidBrush(Color.Red), 0,0,40,40);
            g.Dispose();
            MemberSpriteBitmap mb = new MemberSpriteBitmap(bmp);
            mb.CenterRegPoint();
            Member = mb;

            m_aLines = new ArrayList();
            for (int i = 0; i < 1; i++)
            {
                TestLine line = new TestLine(m_endogine);
                line.SetLine(new EPointF((i)*150,0), new EPointF((i+1)*150,150));
                m_aLines.Add(line);
            }

            LocZ = 10;
            Loc = new EPointF(171,171);
            m_endogine.KeyEvent+=new KeyEventHandler(m_endogine_KeyEvent);
        }
예제 #5
0
 public void Multiply(EPoint pnt)
 {
     x      *= pnt.X;
     y      *= pnt.Y;
     width  *= pnt.X;
     height *= pnt.Y;
 }
예제 #6
0
        private void _picRef_Changed()
        {
            ERectangle rct = _picRef.SourceRectangle;

            this._regPointInternal = rct.TopLeft + _picRef.Offset;
            //this.RegPoint = rct.TopLeft + _picRef.Offset + this._regPointInternal;
            this.SourceRect = rct;
        }
예제 #7
0
        public ArrayList CalcColorChain(EPoint a_pntLoc)
        {
            m_aCurrentChainInfo = new ChainInfo();

            Ball ball = GetBallOnLoc(a_pntLoc);
            RecursiveCalcColorChain(ball);
            return m_aCurrentChainInfo.Balls; //		return duplicate(currentChain)
        }
예제 #8
0
 public void Move(EPoint newLocation)
 {
     this._lastLocation = this._location;
     this._location     = newLocation;
     if (this.MouseMove != null)
     {
         this.MouseMove(null, this);
     }
 }
예제 #9
0
        public JogShuttle()
        {
            // This call is required by the Windows.Forms Form Designer.
            InitializeComponent();

            m_pntFactor = new EPointF(1,1);
            m_pntWrappedAdd = new EPoint();
            m_pntActiveAxes = new EPoint(1,1);
            FixLayout();
        }
예제 #10
0
        public JogShuttle()
        {
            // This call is required by the Windows.Forms Form Designer.
            InitializeComponent();

            m_pntFactor     = new EPointF(1, 1);
            m_pntWrappedAdd = new EPoint();
            m_pntActiveAxes = new EPoint(1, 1);
            FixLayout();
        }
예제 #11
0
        private void Init(bool bAutoSetParent)
        {
            m_aChildrenToRemove        = new ArrayList();
            m_plChildrenByHash         = new Hashtable();
            this._slChildrenLocZSorted = new SortedFloatList();

            m_sID    = "";
            m_nInk   = (int)RasterOps.ROPs.Copy;
            m_nBlend = 255;


            m_matrix = new Matrix4();
            m_vPivot = new Vector3();

            m_fLocZ       = 0.0f;
            m_pntLoc      = new EPointF(0.0f, 0.0f);
            m_pntScale    = new EPointF(1.0f, 1.0f);
            m_pntRegPoint = new EPoint(0, 0);


            m_rctSrcClip   = new ERectangle(0, 0, 1, 1);
            m_clr          = Color.White;
            m_rctDstParent = new ERectangleF(0, 0, 0, 0);

            m_aBehaviors = new ArrayList();

            m_nMemberAnimFrame = 0;

            m_dtChildren = new DataTable();
            m_dtChildren.Columns.Add("Name", typeof(System.String));
            m_dtChildren.Columns.Add("LocZ", typeof(System.Double));
            m_dtChildren.Columns.Add("Hash", typeof(System.Int32));

            m_pntMouseDown = new EPoint();
            m_pntMouseLast = new EPoint();
            _pntMouse      = new EPoint();

            if (bAutoSetParent && m_endogine != null && m_endogine.Stage != null)
            {
                Parent = m_endogine.Stage.DefaultParent;
            }

            m_renderStrategy = m_endogine.Stage.CreateRenderStrategy();

            m_renderStrategy.SetEndogine(m_endogine);
            m_renderStrategy.SetSprite(this);
            m_renderStrategy.Init();

            //TODO: make this optional (takes some resources)
            Sprite[] lcs = new Sprite[1];
            lcs[0] = this;
            EH.Instance.LatestCreatedSprites = lcs;
        }
예제 #12
0
 private void PostConstructor(string originalName)
 {
     PicRef._numCreated++;
     if (originalName == null)
     {
         originalName = "Unnamed" + PicRef._numCreated;
     }
     this._originalName = originalName;
     this._offset       = new EPoint();
     this._sourceRect   = new ERectangle();
     PicRef.AddPicture(this);
 }
예제 #13
0
        public Track(string a_sSoundFile, int nNumNotes, EPoint pntGridCellSize)
        {
            m_snd = new Sound();
            m_snd.Filename = a_sSoundFile;

            for (int nNote = 0; nNote < nNumNotes; nNote++)
            {
                CheckBox cb = new CheckBox();
                cb.Parent = this;
                cb.Rect = new ERectangleF(nNote*pntGridCellSize.X,0,30,30);
                cb.Name = nNote.ToString();
            }
        }
예제 #14
0
        private Form _startupForm; //TODO: shouldn't have such a thing, console startup rather...

        #endregion Fields

        #region Constructors

        public EndogineHub(string a_sApplicationPath)
        {
            m_sApplicationPath = a_sApplicationPath;

            m_pntMouseLoc = new EPoint();
            m_endogine = this;

            AppSettings app = new AppSettings();

            string s = AppSettings.Instance.GetNodeText("DisplayMode.Fullscreen");
            if (s != null)
                m_bFullscreen = Convert.ToBoolean(s);

            s = AppSettings.Instance.GetNodeText("DisplayMode.Renderer");
            if (s != null)
                this._renderStrategy = s;
        }
예제 #15
0
        private void CheckKeys()
        {
            if (this.keysSteering == null)
            {
                return;
            }

            EPoint pntMove = new EPoint();

            if (keysSteering.GetKeyActive("up"))
            {
                pntMove.Y = -1;
            }
            else if (keysSteering.GetKeyActive("down"))
            {
                pntMove.Y = 1;
            }

            if (keysSteering.GetKeyActive("left"))
            {
                pntMove.X = -1;
            }
            else if (keysSteering.GetKeyActive("right"))
            {
                pntMove.X = 1;
            }

            if (pntMove.X != 0 || pntMove.Y != 0)
            {
                if ((Control.ModifierKeys & Keys.Shift) == Keys.Shift)
                {
                    pntMove *= 10;
                }
                if ((Control.ModifierKeys & Keys.Control) == Keys.Control)
                {
                    pntMove *= 100;
                }

                if (KeyMoveEvent != null)
                {
                    KeyMoveEvent(this, pntMove.ToEPointF());
                }
            }
        }
예제 #16
0
 public void MakePointInside(EPoint pnt)
 {
     if (pnt.X < this.Left)
     {
         pnt.X = this.Left;
     }
     else if (pnt.X > this.Right)
     {
         pnt.X = this.Right;
     }
     if (pnt.Y < this.Top)
     {
         pnt.Y = this.Top;
     }
     else if (pnt.Y > this.Bottom)
     {
         pnt.Y = this.Bottom;
     }
 }
예제 #17
0
 public void WrapPointInside(EPoint pnt)
 {
     if (pnt.X < this.Left)
     {
         pnt.X = this.Right - (this.Left - pnt.X);
     }
     else if (pnt.X > this.Right)
     {
         pnt.X = this.Left + (pnt.X - this.Right);
     }
     if (pnt.Y < this.Top)
     {
         pnt.Y = this.Bottom - (this.Top - pnt.Y);
     }
     else if (pnt.Y > this.Bottom)
     {
         pnt.Y = this.Top + (pnt.Y - this.Bottom);
     }
 }
예제 #18
0
        private Form _startupForm; //TODO: shouldn't have such a thing, console startup rather...



        public EndogineHub(string a_sApplicationPath)
        {
            m_sApplicationPath = a_sApplicationPath;

            m_pntMouseLoc = new EPoint();
            m_endogine    = this;

            AppSettings app = new AppSettings();

            string s = AppSettings.Instance.GetNodeText("DisplayMode.Fullscreen");

            if (s != null)
            {
                m_bFullscreen = Convert.ToBoolean(s);
            }

            s = AppSettings.Instance.GetNodeText("DisplayMode.Renderer");
            if (s != null)
            {
                this._renderStrategy = s;
            }
        }
예제 #19
0
        public static List <PicRef> CreatePicRefs(Endogine.ResourceManagement.MemberBitmapBase mb, int numFramesOnX, int numFramesTotal)
        {
            List <string> animRefs     = new List <string>();
            List <PicRef> picRefs      = new List <PicRef>();
            int           numFramesOnY = numFramesTotal / numFramesOnX;
            EPoint        frameSize    = new EPoint(mb.Size.X / numFramesOnX, mb.Size.Y / numFramesOnY);

            for (int i = 0; i < numFramesTotal; i++)
            {
                string picRefName = mb.Name + "_" + i;
                int    x          = i % numFramesOnX;
                int    y          = i / numFramesOnX;
                PicRef pr         = PicRef.Create((MemberSpriteBitmap)mb, picRefName);
                pr.SourceRectangle = new ERectangle(x * frameSize.X, y * frameSize.Y, frameSize.X, frameSize.Y);
                picRefs.Add(pr);
                animRefs.Add(picRefName);
            }

            EH.Instance.CastLib.FrameSets.AddFrameSet(mb.Name, animRefs);

            return(picRefs);
        }
예제 #20
0
        public DrumForm()
        {
            if (Endogine.Audio.SoundManager.DefaultSoundManager == null)
            {
                throw new Exception("No sound system .dll found!");
            }
            this.Rect = new ERectangleF(0,0,600,150);
            this.m_pntGridCellSize = new EPoint(35,40);
            this.m_pntGridStart = new EPointF(10,50);
            this.MouseActive = true;

            this.m_tracks = new Track[2];

            string[] aSounds = new string[]{"drumsnare.wav", "drumbass.wav"};
            for (int nChannel = 0; nChannel < aSounds.Length; nChannel++)
            {
                Track track = new Track(aSounds[nChannel], m_nNumNotes, this.m_pntGridCellSize);
                track.Parent = this;
                track.Loc = new EPointF(0,nChannel*this.m_pntGridCellSize.Y)+m_pntGridStart;
                this.m_tracks[nChannel] = track;
                //track.Visible=false;
            }

            this.m_tracks[0].LoadPattern(new int[]{0,0,0,0,1,0,0,0,0,0,0,0,1,0,1,0});
            this.m_tracks[1].LoadPattern(new int[]{1,0,1,0,0,0,1,0,1,0,1,0,0,0,0,0});

            this.m_spPlaybackHead = new Sprite();
            this.m_spPlaybackHead.MemberName = "Cross";
            this.m_spPlaybackHead.CenterRegPoint();
            this.m_spPlaybackHead.Parent = this;
            this.m_spPlaybackHead.Loc = m_pntGridStart;

            this.m_timer = new Timer(new TimerCallback(this.Tick), null, 0, 125);

            this._listener = new Endogine.Audio.Listener();

            this._pk = new PlayKeyboard();
        }
예제 #21
0
        public GameMain()
        {
            m_starField = new StarField();
            m_player = new Player(this);
            m_aAsteroids = new ArrayList();

            //The aOKLocs is generated so no asteroids will appear close to the ship
            EPoint pntStageSize = EndogineHub.Instance.Stage.Size;
            ArrayList aOKLocs = new ArrayList();
            EPoint pntNumPositions = new EPoint(6,6);
            ERectangle rctFreePositions = new ERectangle(2,2,2,2);
            for (int y = 0; y < pntNumPositions.Y; y++)
            {
                if (y >= rctFreePositions.Y && y < rctFreePositions.Bottom)
                    y+=rctFreePositions.Height;
                for (int x = 0; x < pntNumPositions.X; x++)
                {
                    if (x >= rctFreePositions.X && x < rctFreePositions.Right)
                        x+=rctFreePositions.Width;
                    EPoint pnt = new EPoint(x,y) * pntStageSize/(pntNumPositions-new EPoint(1,1)) - pntStageSize/2;;
                    aOKLocs.Add(pnt);
                }
            }

            Random rnd = new Random();
            for (int i = 0; i < 4; i++)
            {
                Asteroid asteroid = new Asteroid(this, 3);
                asteroid.Velocity = new EPointF((float)rnd.NextDouble()-0.5f, (float)rnd.NextDouble()-0.5f);

                int nRndPos = rnd.Next(aOKLocs.Count);
                EPoint pntLoc = (EPoint)aOKLocs[nRndPos];
                aOKLocs.RemoveAt(nRndPos);
                asteroid.Loc = pntLoc.ToEPointF();
            }
        }
예제 #22
0
 public void SetPosColor(EPoint pos, Color clr)
 {
     Graphics g = Graphics.FromImage(this.m_bmp);
     ERectangle rct = new ERectangle(pos.X, pos.Y, 1,1)*this.SquareSide;
     g.FillRectangle(new SolidBrush(clr), rct.ToRectangle());
 }
예제 #23
0
 public void Offset(EPoint pnt)
 {
     x += pnt.X;
     y += pnt.Y;
 }
예제 #24
0
 abstract public void CalcRenderRegion(ERectangleF rctDrawTarget, float rotation, EPoint regPoint, EPoint sourceRectSize);
예제 #25
0
 private void PostConstructor(string originalName)
 {
     PicRef._numCreated++;
     if (originalName == null)
         originalName = "Unnamed" + PicRef._numCreated;
     this._originalName = originalName;
     this._offset = new EPoint();
     this._sourceRect = new ERectangle();
     PicRef.AddPicture(this);
 }
예제 #26
0
        public static List<PicRef> CreatePicRefs(Endogine.ResourceManagement.MemberBitmapBase mb, int numFramesOnX, int numFramesTotal)
        {
            List<string> animRefs = new List<string>();
            List<PicRef> picRefs = new List<PicRef>();
            int numFramesOnY = numFramesTotal / numFramesOnX;
            EPoint frameSize = new EPoint(mb.Size.X / numFramesOnX, mb.Size.Y / numFramesOnY);
            for (int i = 0; i < numFramesTotal; i++)
            {
                string picRefName = mb.Name + "_" + i;
                int x = i % numFramesOnX;
                int y = i / numFramesOnX;
                PicRef pr = PicRef.Create((MemberSpriteBitmap)mb, picRefName);
                pr.SourceRectangle = new ERectangle(x * frameSize.X, y * frameSize.Y, frameSize.X, frameSize.Y);
                picRefs.Add(pr);
                animRefs.Add(picRefName);
            }

            EH.Instance.CastLib.FrameSets.AddFrameSet(mb.Name, animRefs);

            return picRefs;
        }
예제 #27
0
        private void label1_MouseMove(object sender, System.Windows.Forms.MouseEventArgs e)
        {
            if (!m_bMouseMoveDown)
            {
//				string sText = this.label1.Text.Split(" ".ToCharArray())[0];
                EPoint  pntMid   = new EPoint(this.label1.Left, this.label1.Top) + new EPoint(this.label1.Width, this.label1.Height) / 2;
                EPoint  pntMouse = new EPoint(e.X, e.Y);                //this.label1.PointToClient(new Point(e.X, e.Y))
                EPointF pntDiff  = (pntMouse - pntMid).ToEPointF();
                if (pntDiff.Length < 0.8f * this.label1.Width / 2)
                {
                    m_pntActiveAxes = new EPoint(1, 1);
                }
                else
                {
                    if ((pntDiff.Angle > Math.PI / 4 && pntDiff.Angle < 3 * Math.PI / 4) ||
                        (pntDiff.Angle < -Math.PI / 4 && pntDiff.Angle > -3 * Math.PI / 4))
                    {
                        m_pntActiveAxes = new EPoint(1, 0);
                    }
                    else
                    {
                        m_pntActiveAxes = new EPoint(0, 1);
                    }
                }


                if (m_pntActiveAxes.X == 1 && m_pntActiveAxes.Y == 1)
                {
//					sText+=" XY";
                    this.Cursor = System.Windows.Forms.Cursors.SizeAll;
                }
                else if (m_pntActiveAxes.X == 1)
                {
//					sText+=" X";
                    this.Cursor = System.Windows.Forms.Cursors.SizeWE;
                }
                else if (m_pntActiveAxes.Y == 1)
                {
//					sText+=" Y";
                    this.Cursor = System.Windows.Forms.Cursors.SizeNS;
                }

//				this.label1.Text = sText;
            }
            else
            {
                EPoint pntNow  = new EPoint(e.X, e.Y);
                EPoint pntDiff = pntNow - m_pntMouseLastLoc;
                //CameraMove(pntDiff.ToEPointF());

                //If mouse moves outside screen, wrap it around the edges:

                EPoint pntScreen = new EPoint(label1.PointToScreen(m_pntMouseLastLoc.ToPoint()));
                EPoint pntOrg    = pntScreen.Copy();

                ERectangle rct = new ERectangle(System.Windows.Forms.Screen.PrimaryScreen.WorkingArea);
                rct = rct + new ERectangle(5, 5, -10, -10);
                rct.WrapPointInside(pntScreen);

                if (!pntOrg.Equals(pntScreen))
                {
                    System.Windows.Forms.Cursor.Position = pntScreen.ToPoint();
                    pntNow           = new EPoint(label1.PointToClient(pntScreen.ToPoint()));
                    m_pntWrappedAdd += pntOrg - pntScreen;
                }

                //when using timer - don't send on mouse move
                if (timer1.Enabled == false)
                {
                    if (DraggingEvent != null)
                    {
                        DraggingEvent(this, pntDiff.ToEPointF() * m_pntFactor * m_pntActiveAxes);
                    }
                }

                m_pntMouseLastLoc = pntNow;
            }
        }
예제 #28
0
 public Ball GetBallOnLoc(EPoint a_pnt)
 {
     if (a_pnt.X < 0 || a_pnt.Y < 0 || a_pnt.X >= GridSize.Width || a_pnt.Y >= GridSize.Height)
         return (Ball)null;
     return (Ball)m_aGrid[a_pnt.X, a_pnt.Y];
 }
예제 #29
0
 private void RemoveBallAtLoc(EPoint a_pnt)
 {
     m_aGrid[a_pnt.X, a_pnt.Y] = (Ball)null;
 }
예제 #30
0
 /// <summary>
 /// adds pnt to size (this is what Rectangle does, it seems from the manual)
 /// </summary>
 /// <param name="pnt"></param>
 public void Inflate(EPoint pnt)
 {
     this.height += pnt.X;          //Math.Max(height, pnt.X);
     this.width  += pnt.Y;          //Math.Max(width, pnt.Y);
 }
예제 #31
0
        public void SetBallOnLoc(EPoint a_pnt, Ball a_ball)
        {
            if (a_pnt.X < 0 || a_pnt.X >= GridSize.Width || a_pnt.Y < 0)
                return;
            m_aGrid[a_pnt.X, a_pnt.Y] = a_ball;
            a_ball.GridLoc = a_pnt;
            a_ball.Loc = GetGfxLocFromGridLoc(a_pnt);

            ResetChainNums();
            m_nCurrentChainNum = 0;
            ArrayList aSameColor = CalcColorChain(a_pnt);

            if (aSameColor.Count > 2)
            {
                ArrayList aAllRemove = new ArrayList();
                //remove balls in color chain, and then all balls that are no longer connected to ceiling!

                //first color chain, and also find all neighbours to the color chain
                ArrayList aAllNeighbours = new ArrayList();
                    //make a list of all neighbours:
                    foreach (Ball removeball in aSameColor)
                    {
                        ArrayList aNeighbours = GetNeighbours(removeball);
                        foreach (Ball neighbour in aNeighbours)
                        {
                            if (aAllNeighbours.Contains(neighbour) == false && aSameColor.Contains(neighbour) == false)
                                aAllNeighbours.Add(neighbour);
                        }
                        RemoveBallAtLoc(removeball.GridLoc);
                        removeball.Burst();
                        //aAllRemove.Add(removeball);
                    }

                ResetChainNums();
                m_nCurrentChainNum = 0;
                //now for each neighbour, add to remove list if not connected to ceiling:
                foreach (Ball ball in aAllNeighbours)
                {
                    //if one of these balls is connected to another, the recursive function will already have added it to its remove list
                    if (ball.ChainNum < 0)
                    {
                        EndogineHub.Put("New chain");
                        m_aCurrentChainInfo = new ChainInfo();
                        if (RecursiveCalcConnection(ball) == false) //the chain is not connected to ceiling
                        {
                            foreach (Ball removeball in m_aCurrentChainInfo.Balls)
                            {
                                aAllRemove.Add(removeball);
                                RemoveBallAtLoc(removeball.GridLoc);
                            }
                        }
                    }
                }

                foreach (Ball removeball in aAllRemove)
                {
                    removeball.Fall(); //Dispose(); //.Color = Color.FromArgb(100,100,100);
                }

                m_playArea.RemovedBalls(aSameColor.Count, aAllRemove.Count);
            }
        }
예제 #32
0
 public void NoRemoveSetBallOnLoc(EPoint a_pnt, Ball a_ball)
 {
     m_aGrid[a_pnt.X, a_pnt.Y] = a_ball;
 }
예제 #33
0
 public void Move(EPoint newLocation)
 {
     this._lastLocation = this._location;
     this._location = newLocation;
     if (this.MouseMove != null)
         this.MouseMove(null, this);
 }
예제 #34
0
 private void m_astar_ChangedAcceptableGoals(object sender, EPoint coordinate)
 {
     foreach (EPoint pnt in this.m_astar.AcceptableGoals)
         this.SetPosColor(pnt, Color.FromArgb(0,200,200));
     this.m_sp.Member.Bitmap = this.m_bmp;
 }
예제 #35
0
 public EPointF GetGfxLocFromGridLoc(EPoint a_pnt)
 {
     return GetGfxLocFromGridLoc(new EPointF(a_pnt.X, a_pnt.Y));
 }
예제 #36
0
 public bool Contains(EPoint pnt)
 {
     return(pnt.X >= Left && pnt.X <= Right && pnt.Y >= Top && pnt.Y <= Bottom);
 }
예제 #37
0
 public ERectangle(EPoint loc, EPoint size)
 {
     x = loc.X; y = loc.Y; width = size.X; height = size.Y;
 }
예제 #38
0
        public bool CheckMouse(MouseEventArgs e, EPointF a_pntLocalLoc, bool a_bButtonAction, bool a_bDown)
        {
            _pntMouse.X = e.X;             //a_pntLocalLoc;
            _pntMouse.Y = e.Y;

            if (e.Button != MouseButtons.Left && this.m_bMouseReactToOtherThanLeftButton == false)
            {
                return(true);
            }

            bool bReactedToButton = false;
            bool bReactedRoll     = false;

            //TODO: make property of bMouseNotOutsideWhileDown
            bool bMouseNotOutsideWhileDown = true;

            if (m_bMouseDown && a_bDown && bMouseNotOutsideWhileDown)
            {
                OnMouse(e, MouseEventType.StillDown);
            }
            else
            {
                if (Rect.Contains(a_pntLocalLoc))
                {
                    if (!m_bMouseIsInside)
                    {
                        //enter
                        bReactedRoll     = true;
                        m_bMouseIsInside = true;
                        OnMouse(e, MouseEventType.Enter);
                    }

                    if (a_bButtonAction)
                    {
                        if (a_bDown)
                        {
                            m_pntMouseDown.X = e.X;
                            m_pntMouseDown.Y = e.Y;
                            m_pntMouseLast   = m_pntMouseDown.Copy();
                            OnMouse(e, MouseEventType.Down);
                            //EH.Put("Down:"+this.GetSceneGraphName());
                        }
                        else
                        {
                            if (m_bMouseDown)
                            {
                                OnMouse(e, MouseEventType.Click);
                            }
                            else
                            {
                                OnMouse(e, MouseEventType.Up);
                            }
                        }
                        bReactedToButton = true;
                    }
                    else if (m_bMouseDown)
                    {
                        OnMouse(e, MouseEventType.StillDown);
                        bReactedToButton = true;
                    }
                }
                else
                {
                    if (m_bMouseIsInside)
                    {
                        //leave
                        bReactedRoll     = true;
                        m_bMouseIsInside = false;
                        OnMouse(e, MouseEventType.Leave);
                    }
                    if (a_bButtonAction && !a_bDown && m_bMouseDown)                     //got mouseUp event, and mouse was down before
                    {
                        m_bMouseDown = false;
                        OnMouse(e, MouseEventType.UpOutside);
                    }
                }
            }
            m_pntMouseLast.X = e.X;
            m_pntMouseLast.Y = e.Y;

            if (bReactedToButton)
            {
                m_bMouseDown = a_bDown;
            }

            if (!this._passEvent)
            {
                //Can't stop checking completely: sprites under might need to send Leave, or UpOutside...
                if (bReactedToButton && !m_bMousePassButton)
                {
                    return(false);
                }
                if (m_bMouseIsInside && false)                 //TODO: pass?   bReactedRoll
                {
                    return(false);
                }
            }
            else
            {
                this._passEvent = false;
            }
            return(true);
        }
예제 #39
0
 /// <summary>
 /// adds pnt to size (this is what Rectangle does, it seems from the manual)
 /// </summary>
 /// <param name="pnt"></param>
 public void Inflate(EPoint pnt)
 {
     this.height+=pnt.X; //Math.Max(height, pnt.X);
     this.width+=pnt.Y; //Math.Max(width, pnt.Y);
 }
예제 #40
0
 private void label1_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e)
 {
     m_bMouseMoveDown  = true;
     m_pntMouseLastLoc = new EPoint(e.X, e.Y);
     m_pntMouseDownLoc = new EPoint(e.X, e.Y);
 }
예제 #41
0
 public void Multiply(EPoint pnt)
 {
     x*=pnt.X;
     y*=pnt.Y;
     width*=pnt.X;
     height*=pnt.Y;
 }
예제 #42
0
 public static void SetRegPoints(List<PicRef> picRefs, EPoint pnt)
 {
     foreach (PicRef p in picRefs)
         p.Offset = pnt;
 }
예제 #43
0
 public void WrapPointInside(EPoint pnt)
 {
     if (pnt.X < this.Left)
         pnt.X = this.Right - (this.Left - pnt.X);
     else if (pnt.X > this.Right)
         pnt.X = this.Left + (pnt.X - this.Right);
     if (pnt.Y < this.Top)
         pnt.Y = this.Bottom - (this.Top - pnt.Y);
     else if (pnt.Y > this.Bottom)
         pnt.Y = this.Top + (pnt.Y - this.Bottom);
 }
예제 #44
0
 public bool Contains(EPoint pnt)
 {
     return (pnt.X >= Left && pnt.X <= Right && pnt.Y >= Top && pnt.Y <= Bottom);
 }
예제 #45
0
 public ERectangle(EPoint loc, EPoint size)
 {
     x = loc.X; y = loc.Y; width = size.X; height = size.Y;
 }
예제 #46
0
 public void ExpandSpecial(EPoint pnt)
 {
     this.Left = pnt.X<this.Left?pnt.X:this.Left;
     this.Top = pnt.Y<this.Top?pnt.Y:this.Top;
     this.Right = pnt.X>this.Right?pnt.X:this.Right;
     this.Bottom = pnt.Y>this.Bottom?pnt.Y:this.Bottom;
 }
예제 #47
0
 private void m_astar_ChangedStartCoordinate(object sender, EPoint coordinate)
 {
     this.SetPosColor(coordinate, Color.Green);
     this.m_sp.Member.Bitmap = this.m_bmp;
 }
예제 #48
0
 public void MakePointInside(EPoint pnt)
 {
     if (pnt.X<this.Left)
         pnt.X = this.Left;
     else if (pnt.X>this.Right)
         pnt.X = this.Right;
     if (pnt.Y<this.Top)
         pnt.Y = this.Top;
     else if (pnt.Y>this.Bottom)
         pnt.Y = this.Bottom;
 }
예제 #49
0
 private void m_astar_SearchedCoordinate(object sender, EPoint coordinate)
 {
     this.SetPosColor(coordinate, Color.Blue);
     if (this.UpdateWhileSearching)
     {
         this.m_sp.Member.Bitmap = this.m_bmp;
         this.m_astar.Paused = true;
         m_nNumFramesLeftToWaitAfterUpdate = 1;
     }
 }
예제 #50
0
 public void Offset(EPoint pnt)
 {
     x+=pnt.X;
     y+=pnt.Y;
 }
예제 #51
0
 private void m_astar_SearchFinished(object sender, EPoint coordinate)
 {
     for (int i = 1; i < this.m_astar.Solution.Count-1; i++)
         this.SetPosColor((EPoint)this.m_astar.Solution[i], Color.Yellow);
     this.m_sp.Member.Bitmap = this.m_bmp;
 }
예제 #52
0
        public override bool Equals(object obj)
        {
            EPoint pnt = (EPoint)obj;

            return(pnt.X == x && pnt.Y == y);
        }
예제 #53
0
 private void m_astar_SearchStarted(object sender, EPoint coordinate)
 {
     this.ClearGrid();
     this.SetPosColor(this.m_astar.StartPos, this.StartColor);
     this.SetPosColor(this.m_astar.GoalPos, this.GoalColor);
     this.m_sp.Member.Bitmap = this.m_bmp;
 }