Esempio n. 1
0
 public override void Update()
 {
     base.Update();
     if (UnderMouse() &&
         EngineCore.currentMouseState.LeftButton == ButtonState.Pressed &&
         EngineCore.oldMouseState.LeftButton == ButtonState.Released)
     {
         pressed = true;
     }
     if (pressed)
     {
         slider.pos.X = EngineCore.GetCurrentCursorPos().X - absolutePos.X - slider.scale / 2;
         if (slider.pos.X < 0)
         {
             slider.pos.X = 0;
         }
         if (slider.pos.X > scale - slider.size.X)
         {
             slider.pos.X = scale - slider.size.X;
         }
         value = slider.pos.X / (scale - slider.size.X) * 100;
         onMove.Invoke();
     }
     if (EngineCore.currentMouseState.LeftButton == ButtonState.Released &&
         EngineCore.oldMouseState.LeftButton == ButtonState.Pressed)
     {
         pressed = false;
     }
 }
Esempio n. 2
0
 public static void DrawCursor()
 {
     Cursor.pos = EngineCore.GetCurrentCursorPos();
     EngineCore.spriteBatch.Begin();
     if (ShowCursor)
     {
         Cursor.Draw();
     }
     EngineCore.spriteBatch.End();
 }
Esempio n. 3
0
 public DebugOuput()
 {
     font         = EngineCore.content.Load <SpriteFont>("DebugFont");
     choose       = new GraphicRect();
     choose.size  = Vector2.Zero;
     vline        = new GraphicRect();
     vline.pos.Y  = -10;
     vline.size.X = EngineCore.LengthToHundred(1);
     hline        = new GraphicRect();
     hline.size.Y = EngineCore.LengthToHundred(1);
 }
Esempio n. 4
0
 protected override void Update(GameTime gameTime)
 {
     base.Update(gameTime);
     EngineCore.Update(gameTime);
     if (EngineCore.FullScreen != EngineCore.graphics.IsFullScreen)
     {
         if (!EngineCore.graphics.IsFullScreen)
         {
             EngineCore.graphics.PreferredBackBufferWidth  = GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Width;
             EngineCore.graphics.PreferredBackBufferHeight = GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Height;
         }
         else
         {
             EngineCore.graphics.PreferredBackBufferWidth  = 800;
             EngineCore.graphics.PreferredBackBufferHeight = 480;
         }
         EngineCore.graphics.ToggleFullScreen();
         EngineCore.graphics.ApplyChanges();
     }
 }
Esempio n. 5
0
        public virtual void Update()
        {
            if (DebugMode)
            {
                debug.Update();
            }
            if (Draggable != null)
            {
                Draggable.absolutePos = EngineCore.GetCurrentCursorPos() - Draggable.size / 2;
            }
            Canvas.Update();
            Effects.Update();
            Effects.elements.RemoveAll(delegate(Object2D a) { return(((EffectSprite)a).died); });
            int startCount = dEvents.Count;

            for (int i = 0; i < startCount; i++)
            {
                dEvents[i].Update();
            }
            dEvents.RemoveAll(delegate(DEvent a) { return(((DEvent)a).died); });
        }
Esempio n. 6
0
        public void Update()
        {
            vline.size.Y = EngineCore.HundredToLength(100);
            vline.pos.X  = EngineCore.GetCurrentCursorPos().X;
            hline.size.X = EngineCore.HundredToLength(100);
            hline.pos.Y  = EngineCore.GetCurrentCursorPos().Y;

            if (EngineCore.currentMouseState.LeftButton == ButtonState.Pressed && EngineCore.oldMouseState.LeftButton == ButtonState.Released)
            {
                choose.pos = EngineCore.GetCurrentCursorPos();
            }
            if (EngineCore.currentMouseState.LeftButton == ButtonState.Pressed)
            {
                choose.size += EngineCore.GetCurrentCursorPos() - EngineCore.GetOldCursorPos();
            }
            else
            {
                choose.size = Vector2.Zero;
            }
            text = ("Cursor: {" + EngineCore.GetCurrentCursorPos().X + ", " + EngineCore.GetCurrentCursorPos().Y + "}\n" + otherInfo +
                    ((choose.size.Length() > 1) ? ("Size: {" + choose.size.X.ToString() + ", " + choose.size.Y.ToString() + "}\n") : ""));
        }
Esempio n. 7
0
 protected override void LoadContent()
 {
     EngineCore.Initialize(new SpriteBatch(GraphicsDevice), Content);
 }
Esempio n. 8
0
 public static Vector2 GetOldCursorPos()
 {
     return(new Vector2(EngineCore.LengthToHundred(EngineCore.oldMouseState.X), EngineCore.LengthToHundred(EngineCore.oldMouseState.Y - EngineCore.RenderedRectangle.Y)));
 }
Esempio n. 9
0
 public bool UnderMouseBefore()
 {
     return(UnderMouse(EngineCore.GetOldCursorPos()));
 }
Esempio n. 10
0
 public bool UnderMouse()
 {
     return(UnderMouse(EngineCore.GetCurrentCursorPos()));
 }