예제 #1
0
 public void grab()
 {
     if (currentGraphics != this)
     {
         currentGraphics = this;
         if (target != null)
         {
             target.GraphicsDevice.SetRenderTarget(target);
         }
     }
 }
 public override void perform(XNAGraphics xg, SpriteBatch batch)
 {
     xg.clip = new Rectangle(x, y, w, h);
 }
        public override void perform(XNAGraphics xg, SpriteBatch batch)
        {
            VertexPositionColor[] vertices = new VertexPositionColor[2];
            vertices[0].Position = new Vector3(x1, y1, 0);
            vertices[0].Color = xg.cColor;
            vertices[1].Position = new Vector3(x2, y2, 0);
            vertices[1].Color = vertices[0].Color;
            xg.basicEffect.CurrentTechnique.Passes[0].Apply();
            xg.target.GraphicsDevice.DrawUserPrimitives<VertexPositionColor>(PrimitiveType.LineList, vertices, 0, 1);
            /*Vector2 firstPosition = new Vector2(x1, y1);
            Vector2 secondPosition = new Vector2(x2, y2);
            float distance = Vector2.Distance(firstPosition, secondPosition);
            float rotation = (float)Math.Atan2(secondPosition.Y - firstPosition.Y,
                            secondPosition.X - firstPosition.X);

            Texture2D t = new Texture2D(xg.target.GraphicsDevice, 1, 1);
            t.SetData(new Color[] { col });
            //batch.Draw(t, firstPosition, null, col, rotation, Vector2.Zero, new Vector2(distance, 5), SpriteEffects.None, 0);
             */
        }
 public override void perform(XNAGraphics xg, SpriteBatch batch)
 {
     Texture2D t = new Texture2D(xg.target.GraphicsDevice, 1, 1);
     t.SetData(new Color[] { col });
     batch.Draw(t, new Rectangle(x, y, w, 1), col);
     batch.Draw(t, new Rectangle(x, y + h - 1, w, 1), col);
     batch.Draw(t, new Rectangle(x, y, 1, h), col);
     batch.Draw(t, new Rectangle(x + w - 1, y, 1, h), col);
 }
 public override void perform(XNAGraphics xg, SpriteBatch batch)
 {
     batch.Draw(peer.uir.Texture, new Vector2(peer.getAbsoluteX(), peer.getAbsoluteY()), Color.White);
 }
 public override void perform(XNAGraphics xg, SpriteBatch batch)
 {
     if (uir != null)
     {
         batch.Draw(uir.Texture, new Vector2(x, y), col);
     }
 }
 public override void perform(XNAGraphics xg, SpriteBatch batch)
 {
     if (alpha != 255)
     {
         batch.Draw(img.image, new Rectangle(x, y, w, h), new Color(255, 255, 255, alpha));
     }
     else
     {
         batch.Draw(img.image, new Rectangle(x, y, w, h), Color.White);
     }
 }
 public abstract void perform(XNAGraphics xg, SpriteBatch batch);
 public void performBench(XNAGraphics xg, SpriteBatch batch)
 {
     tick = System.Environment.TickCount;
     perform(xg, batch);
 }
        public override void init(global::java.lang.Object n1)
        {
            _rasterizerState.ScissorTestEnable = true;
            graphics = new XNAGraphics();
            currentlyShowing = new RenderTarget2D(SharedGraphicsDeviceManager.Current.GraphicsDevice, getDisplayWidth(), getDisplayHeight(), false,
                SurfaceFormat.Color, DepthFormat.None,
                0, RenderTargetUsage.PreserveContents);
            SharedGraphicsDeviceManager.Current.GraphicsDevice.RasterizerState = _rasterizerState;
            spriteBatch = new SpriteBatch(SharedGraphicsDeviceManager.Current.GraphicsDevice);
            graphics.target = currentlyShowing;
            graphics.clipW = getDisplayWidth();
            graphics.clipH = getDisplayHeight();

            app.KeyDown += new KeyEventHandler(systemKeyDown);
            app.KeyUp += new KeyEventHandler(systemKeyUp);

            Uri uriResource = new Uri("SplashScreenImage.jpg", UriKind.Relative);
            StreamResourceInfo si = Application.GetResourceStream(uriResource);
            Stream strm = si.Stream;

            Texture2D background = Texture2D.FromStream(SharedGraphicsDeviceManager.Current.GraphicsDevice, strm);
            SharedGraphicsDeviceManager.Current.GraphicsDevice.SetRenderTarget(currentlyShowing);
            spriteBatch.Begin();
            spriteBatch.Draw(background, new Rectangle(0, 0, getDisplayWidth(), getDisplayHeight()), Color.White);
            spriteBatch.End();
            SharedGraphicsDeviceManager.Current.GraphicsDevice.SetRenderTarget(null);

            textInputInstance.TextChanged += textChangedEvent;
        }
예제 #11
0
 public void grab()
 {
     if (currentGraphics != this)
     {
         currentGraphics = this;
         if (target != null)
         {
             target.GraphicsDevice.SetRenderTarget(target);
         }
     }
 }