コード例 #1
0
        public RangeInput(Position position, Gamestate gamestate, PlayersManager playersManager, int startValue, int minValue, int maxValue, Color color, Action <RangeInput, int> action, int id) : base(position, gamestate, id)
        {
            PlayersManager = playersManager;
            Value          = startValue;
            MinValue       = minValue;
            MaxValue       = maxValue;
            Action         = action;

            LeftOffset = CalculateLeftOffset();

            CollisionBox = new RenderRectangle(CalculateScreenSpacePosition(new Position(Position.X, Position.Y, Position.Width, Position.Height)), this, new Color(0, 0, 0, 0));
            Bar          = new RenderRectangle(CalculateScreenSpacePosition(new Position(Position.X, Position.Y + Position.Height / 3, Position.Width, Position.Height / 3)), this, color);
            Circle       = new RenderCircle(CalculateScreenSpacePosition(new Position(Position.X + LeftOffset, Position.Y, 0, Position.Height / 2)), this, Color.White, color, Position.Height / 16);
            Text         = new AlignedRenderText(CalculateScreenSpacePosition(new Position(Position.X + LeftOffset, Position.Y, Position.Height, Position.Height)), new Vector2f(0, 0), CalculateScreenSpaceHeight((int)(Position.Height * 0.4F)), TextPosition.Middle, TextPosition.Middle, this, Color.Black, Value.ToString());
        }
コード例 #2
0
        /// <summary>
        /// Initializes <see cref="SceneScreen"/>.
        /// </summary>
        protected override void Initialize()
        {
            _nodes = new SceneNodesList(this);

            AllowDrop = true;

            font       = Content.Load <SpriteFont>("EditorFont");
            updateIcon = Content.Load <Texture2D>("UpdateIcon");

            MouseMove  += new MouseEventHandler(SceneScreenControl_MouseMove);
            MouseUp    += new MouseEventHandler(SceneScreenControl_MouseUp);
            MouseDown  += new MouseEventHandler(SceneScreenControl_MouseDown);
            MouseWheel += new MouseEventHandler(SceneScreenControl_MouseWheel);

            KeyDown  += new KeyEventHandler(SceneScreenControl_KeyDown);
            KeyUp    += new KeyEventHandler(SceneScreenControl_KeyUp);
            KeyPress += new KeyPressEventHandler(SceneScreenControl_KeyPress);

            DragEnter += new DragEventHandler(SceneScreen_DragEnter);
            DragDrop  += new DragEventHandler(SceneScreenControl_DragDrop);

            Resize += new EventHandler(SceneScreen_Resize);

            // set moving state as default state
            State = new MovingNodesSceneState()
            {
                Screen = this
            };

            sceneBatch = new SceneBatch(GraphicsDevice);

            RenderCircle.Init(GraphicsDevice, Content);

            SceneScreen_Resize(null, null);

            Position = new Vector2();
            Zoom     = 100;
        }
コード例 #3
0
 /// <summary>
 /// Draws the specified circle by the specified color.
 /// </summary>
 /// <param name="circle">The circle to draw.</param>
 /// <param name="color">The color of the circle.</param>
 /// <param name="z">The z coordinate of the circle.</param>
 public void Draw(Circle circle, Color color, float z)
 {
     Apply3D();
     RenderCircle.DrawCircle(circle.Origin, circle.Radius, color, this);
 }