programming windows phone 7 phần 10

RenderTarget2D vẫn giữ nguyên trong suốt thời gian của chương trình, bạn thường sẽ thực hiện toàn bộ hoạt động này trong quá trình ghi đè lên LoadContent. Nếu nhu cầu RenderTarget2D thay đổi, bạn cũng có thể vẽ trên bitmap trong ghi đè lên Cập nhật. Bởi vì RenderTarget2D xuất phát từ Texture2D bạn có thể hiển thị | XNA Project File excerpt public bool ProcessTouch TouchLocation touch bool touchHandled false bool isInside int int switch case if isInside isPressed true touchId touchHandled true break case if isPressed isInside touchHandled true break case if if isInside Click null Click this touchId null isPressed false touchHandled true break return touchHandled If the finger is released when it is inside the Destination rectangle then Button fires a Click event. The Draw override draws the button which is basically a border consisting of a white rectangle with a somewhat smaller black rectangle on top with the text string XNA Project File excerpt public override void Draw GameTime gameTime 903 if isPressed Draw reverse-video background tinyTexture Destination else Draw button border and background Rectangle rect Destination tinyTexture rect -3 -3 tinyTexture rect Draw button text if SpriteFont null Text SpriteFont Text textPosition isPressed gameTime ColorBlock on the other hand is part of the PhingerPaint program and it does not implement the IProcessTouch interface. Here it is in its entirety XNA Project PhingerPaint File complete using System using using Mi cs using Mi namespace PhingerPaint public class ColorBlock DrawableGameComponent SpriteBatch spriteBatch Texture2D block public ColorBlock Game game base game public Coloi Color set get public Rectangle .

Không thể tạo bản xem trước, hãy bấm tải xuống
TÀI LIỆU MỚI ĐĂNG
19    252    1    16-05-2024
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.