コード例 #1
0
        public void BoundingBoxTest()
        {
            System.Console.Out.WriteLine("Running bounding box Test");
            SFML.Graphics.RenderTexture MyTexture = new SFML.Graphics.RenderTexture(100, 100);

            MyTexture.Clear(SFML.Graphics.Color.White);

            SFML.Graphics.Sprite TestSprite1 = new SFML.Graphics.Sprite();
            TestSprite1.Texture = MyTexture.Texture;

            TestSprite1.Position = new SFML.Window.Vector2f(0, 0);

            SFML.Graphics.Sprite TestSprite2 = new SFML.Graphics.Sprite();
            TestSprite2.Texture  = MyTexture.Texture;
            TestSprite2.Position = new SFML.Window.Vector2f(10, 10);


            Assert.IsTrue(Collision.BoundingBoxTest(TestSprite1, TestSprite2));

            TestSprite2.Position = new SFML.Window.Vector2f(0, 200);
            Assert.IsFalse(Collision.BoundingBoxTest(TestSprite1, TestSprite2));

            TestSprite2.Position = new SFML.Window.Vector2f(0, 100);
            Assert.IsTrue(Collision.BoundingBoxTest(TestSprite1, TestSprite2));

            TestSprite2.Position = new SFML.Window.Vector2f(-50, -50);
            Assert.IsTrue(Collision.BoundingBoxTest(TestSprite1, TestSprite2));
        }
コード例 #2
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"));
        }
コード例 #3
0
ファイル: ResourceManager.cs プロジェクト: pzaps/CrossGFX
        public IRenderTexture CreateRenderTexture(int width, int height)
        {
            SFML.Graphics.RenderTexture sfmlRenderTexture = new SFML.Graphics.RenderTexture((uint)width, (uint)height, false);

            RenderTexture renderTexture = new RenderTexture(sfmlRenderTexture);
            return renderTexture;
        }
コード例 #4
0
ファイル: Texture.cs プロジェクト: kukuru3/Sargon
 internal Texture(int width, int height, Ur.Color color)
 {
     this.Path                = "";
     this.nativeTexture       = null;
     this.nativeRenderTexture = new SFML.Graphics.RenderTexture((uint)width, (uint)height, false);
     this.nativeRenderTexture.Clear(color.ToSFMLColor());
     this.Size   = new Int2(width, height);
     IsRenderTex = true;
     StartLoad();
 }
コード例 #5
0
        private void RegenerateRT()
        {
            if (renderTexture != null)
            {
                renderTexture.Dispose();
            }
            var desiredW = (uint)Pipeline.Context.Screen.Width;
            var desiredH = (uint)Pipeline.Context.Screen.Height;

            renderTexture = new SFML.Graphics.RenderTexture(desiredW, desiredH);
        }
コード例 #6
0
            //public Shader                      Shader       { get; }

            public ProtocolItem(
                ProtocolItemTypes type,
                SFML.Graphics.RenderTexture renderSource = null,
                SFML.Graphics.RenderTarget renderTarget  = null,
                Ur.Color?color = null,
                Canvas canvas  = null,
                //Dictionary<string, object>  shaderParams = null,
                int blendMode = 0
                )
            {
                this.Type         = type;
                this.RenderSource = renderSource;
                this.RenderTarget = renderTarget;
                this.Color        = color?.ToSFMLColor() ?? SFML.Graphics.Color.Black;
                this.Canvas       = canvas;
                this.BlendMode    = blendMode;
            }