tailieunhanh - programming windows phone 7 phần 2

Màu đỏ tươi trên các góc làm cho những khu vực của bitmap trong suốt khi XNA làm cho nó. Như với chương trình Silverlight, bạn sẽ cần một tham chiếu đến thư viện và chỉ thị bằng cách sử dụng cho các không gian tên . | The XnaAccelerometer project includes a 48-by-48 pixel bitmap named that consists of a red circle The magenta on the corners makes those areas of the bitmap transparent when XNA renders it. As with the Silverlight program you ll need a reference to the library and a using directive for the namespace. The fields in the Gamel class mostly involve variables necessary to position that bitmap on the screen XNA Project XnaAccelerometer File excerpt showing fields public class Gamel const float BUBBLE_RADIUS_MAX 25 const float BUBBLE_RADIUS_MIN 12 GraphicsDeviceManager graphics SpriteBatch spriteBatch Vector2 screenCenter float screenRadius less BUBBLE_RADIUS_MAX Texture2D bubbleTexture Vector2 bubbleCenter Vector2 bubblePosition float bubbleScale Vector3 accelerometerVector object accelerometerVectorLock new object 87 Towards the bottom you ll see a field named acclerometerVector of type Vectors. The OnAccelerometerReadingChanged event handler will store a new value in that field and the Update method will utilize the value in calculating a position for a bitmap. OnAccelerometerReadingChanged and Update run in separate threads. One is setting the field the other is accessing the field. This is no problem if the field is set or accessed in a single machine code instruction. That would be the case if Vectors were a class which is a reference type and basically referenced with something akin to a pointer. But Vectors is a structure a value type consisting of three properties of type float each of which occupies four bytes for a total of 12 bytes or 96 bits. Setting or accessing this Vectors field requires this many bits to be transferred. A Windows Phone 7 device contains at least a 32-bit ARM processor and a brief glance at the ARM instruction set does not reveal any machine code that would perform a 12-byte memory transfer in one instruction. This means that the .

crossorigin="anonymous">
Đã 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.