コード例 #1
0
ファイル: HandOverlay.cs プロジェクト: SDraw/driver_leap
        public HandOverlay(Hand p_hand)
        {
            m_renderTexture = new SFML.Graphics.RenderTexture(512, 512);

            m_backgroundSprite       = new SFML.Graphics.Sprite(ms_resources["background"]);
            m_backgroundSprite.Color = ms_backgroundColor;

            m_thumbstickShape          = new SFML.Graphics.Sprite(ms_resources["circle"]);
            m_thumbstickShape.Color    = ms_inactiveColor;
            m_thumbstickShape.Position = new SFML.System.Vector2f(40f, 40f);

            m_touchpadShape          = new SFML.Graphics.Sprite(ms_resources["circle"]);
            m_touchpadShape.Color    = ms_inactiveColor;
            m_touchpadShape.Position = new SFML.System.Vector2f(40f, 270f);

            m_buttonB          = new SFML.Graphics.Sprite(ms_resources["buttonB"]);
            m_buttonB.Color    = ms_inactiveColor;
            m_buttonB.Position = new SFML.System.Vector2f(310f, 95f);

            m_buttonA          = new SFML.Graphics.Sprite(ms_resources["buttonA"]);
            m_buttonA.Color    = ms_inactiveColor;
            m_buttonA.Position = new SFML.System.Vector2f(310f, 210f);

            m_buttonSystem          = new SFML.Graphics.Sprite(ms_resources["buttonS"]);
            m_buttonSystem.Color    = ms_inactiveColor;
            m_buttonSystem.Position = new SFML.System.Vector2f(310f, 325f);

            m_cursorShape           = new SFML.Graphics.CircleShape(5f);
            m_cursorShape.FillColor = ms_activeColor;

            m_thumbstickAxisShape           = new SFML.Graphics.CircleShape(7.5f);
            m_thumbstickAxisShape.FillColor = ms_axisColorTouch;

            m_touchpadAxisShape           = new SFML.Graphics.CircleShape(7.5f);
            m_touchpadAxisShape.FillColor = ms_axisColorTouch;

            m_presureRectangle           = new SFML.Graphics.RectangleShape(new SFML.System.Vector2f(10f, 320f));
            m_presureRectangle.Position  = new SFML.System.Vector2f(480f, 100f);
            m_presureRectangle.FillColor = ms_inactiveColor;

            m_presureFillRectangle           = new SFML.Graphics.RectangleShape(new SFML.System.Vector2f(10f, -320f));
            m_presureFillRectangle.Position  = new SFML.System.Vector2f(480f, 420f);
            m_presureFillRectangle.FillColor = ms_inactiveColor;

            // Create overlay
            Valve.VR.OpenVR.Overlay.CreateOverlay(ms_overlayNames[(int)p_hand], "Ultraleap hand overlay", ref m_overlay);
            Valve.VR.OpenVR.Overlay.SetOverlayWidthInMeters(m_overlay, ms_overlayWidth);
            Valve.VR.OpenVR.Overlay.ShowOverlay(m_overlay);
            m_overlayTexture.eColorSpace = Valve.VR.EColorSpace.Gamma;
            m_overlayTexture.eType       = Valve.VR.ETextureType.OpenGL;
            m_overlayTexture.handle      = (IntPtr)m_renderTexture.Texture.NativeHandle;

            // Controls
            m_controlButtons = new List <ControlButton>();
            m_controlButtons.Add(new ControlButton(ControlButton.ButtonType.Button, "a"));
            m_controlButtons.Add(new ControlButton(ControlButton.ButtonType.Button, "b"));
            m_controlButtons.Add(new ControlButton(ControlButton.ButtonType.Button, "system"));
            m_controlButtons.Add(new ControlButton(ControlButton.ButtonType.Axis, "thumbstick"));
            m_controlButtons.Add(new ControlButton(ControlButton.ButtonType.Axis, "touchpad"));
        }
コード例 #2
0
 public Player()
 {
     //    texture = new SFML.Graphics.Texture() do uzupełnienia
     gravityForce   = new SFML.System.Vector2f(0f, 0.00005f);
     texture        = new SFML.Graphics.Texture(800, 800);
     shape          = new SFML.Graphics.CircleShape(30f);
     shape.Position = new SFML.System.Vector2f(20, 400);
     // shape.Texture = texture;
     shape.FillColor = SFML.Graphics.Color.Cyan;
 }
コード例 #3
0
 public Bullets(SFML.System.Vector2f shootAngle)
 {
     this.bulletShape = new SFML.Graphics.CircleShape(5)
     {
         FillColor = SFML.Graphics.Color.White
     };
     this.thrown               = false;
     this.Position             = new SFML.System.Vector2f(shootAngle.X + 35, shootAngle.Y - 20);
     this.bulletShape.Position = this.Position;
     this.startingPosition     = this.Position;
     this.done = false;
 }
コード例 #4
0
        //////////////////////___CONSTRUCTORS___//////////////////////
        #region Constructors

        public Bullet(Vec2f startPosition, Vec2f targetPos, Map map)
        {
            m_map              = map;
            m_circle           = new SFML.Graphics.CircleShape(5);
            m_circle.FillColor = new SFML.Graphics.Color(255, 0, 0, 255);
            m_position         = startPosition;
            m_speed            = 20;
            lifecounter        = 0;
            setBox();


            m_position.X += 40;
            m_position.Y += 40;

            m_direction = (targetPos - m_position).normalized() * m_speed;
            m_leftSteps = (targetPos - m_position).length() + 200;
        }
コード例 #5
0
        public SFML.Graphics.Drawable[] Render()
        {
            Color c = this.GetLightColor();

            SFML.Graphics.Color sfml_c = new SFML.Graphics.Color(c.R, c.G, c.B);

            // Body
            SFML.Graphics.CircleShape body = new SFML.Graphics.CircleShape();
            body.Radius           = Fish.FishSize;
            body.Origin           = new SFML.Window.Vector2f(body.Radius, body.Radius);
            body.Position         = new SFML.Window.Vector2f((float)this.X, (float)this.Y);
            body.OutlineColor     = sfml_c;
            body.OutlineThickness = Fish.FishThickness;
            body.FillColor        = SFML.Graphics.Color.Transparent;

            // Head
            SFML.Graphics.RectangleShape head = new SFML.Graphics.RectangleShape();
            head.Size      = new SFML.Window.Vector2f(Fish.FishSize + Fish.FishThickness * 2f, Fish.FishThickness);
            head.Origin    = new SFML.Window.Vector2f(Fish.FishThickness, Fish.FishThickness / 2f);
            head.Position  = new SFML.Window.Vector2f((float)this.X, (float)this.Y);
            head.Rotation  = (float)this.Angle;
            head.FillColor = sfml_c;

            // Belly
            SFML.Graphics.CircleShape belly = new SFML.Graphics.CircleShape();
            belly.Radius    = Fish.FishBellySize;
            belly.Origin    = new SFML.Window.Vector2f(Fish.FishBellySize, Fish.FishBellySize);
            belly.Position  = new SFML.Window.Vector2f((float)this.X, (float)this.Y);
            belly.FillColor = new SFML.Graphics.Color(
                (byte)((double)byte.MaxValue * (double)(Fish.FishMaxFood - this.Food) / (double)Fish.FishMaxFood),
                (byte)((double)this.Food / (double)Fish.FishMaxFood),
                0);

            // Fin
            SFML.Graphics.CircleShape fin = new SFML.Graphics.CircleShape(Fish.FishSize * 1.25f, 3);
            fin.Origin    = new SFML.Window.Vector2f(fin.Radius, 0f);
            fin.Rotation  = 90f + (float)this.Angle;
            fin.Position  = new SFML.Window.Vector2f((float)this.X, (float)this.Y);
            fin.FillColor = sfml_c;

            return(new SFML.Graphics.Drawable[] { body, belly, head, fin });
        }
コード例 #6
0
        public void Run()
        {
            var mode   = new SFML.Window.VideoMode(800, 600);
            var window = new SFML.Graphics.RenderWindow(mode, "SFML works!");

            window.KeyPressed += Window_KeyPressed;

            var circle = new SFML.Graphics.CircleShape(100f)
            {
                FillColor = SFML.Graphics.Color.Blue
            };

            // Start the game loop
            while (window.IsOpen)
            {
                // Process events
                window.DispatchEvents();
                window.Draw(circle);

                // Finally, display the rendered frame on screen
                window.Display();
            }
        }
コード例 #7
0
ファイル: SFMLCircle2DComp.cs プロジェクト: byteford/AWGP
 public SFMLCircle2DComp() : base()
 {
     SFMLShape = new SFML.Graphics.CircleShape();
 }