tailieunhanh - Symbian OS C++ for Mobile Phones VOL 1 PHẦN 5

bên trái, và biên giới phải, thu hút 64 gạch trong khu vực biển. Đây là một flickery chức năng vẽ cổ điển, trong đó được rút ra những nền tảng đầu tiên và sau đó overpainted tiền cảnh. Có vẻ đặc biệt là xấu về phía bên phải dưới cùng của vùng biển, bởi vì có một sự chậm trễ đáng kể giữa các chức năng gọi đầu tiên | Figure I started out with code that looked something like this void CFleetView Draw const TRect const This code draws a black square over the region of the board including both the border area and the sea area draws the letters and numbers for the top bottom left and right borders draws the 64 tiles in the sea area. This is a classic flickery-draw function in which the backgrounds are drawn first and then overpainted by the foreground. It looks especially bad towards the bottom right of the sea area because there is a significant delay between the first function call which painted the whole board black and the last one which finally painted the 64th tile . Whiting out the background There is another problem which I ll demonstrate in Chapter 15 because I had not whited out the background area between the board and the edge of the control. I could have tackled that easily enough using say void CFleetView Draw const TRect const ClearBackground DrawBoard DrawBorders DrawTiles but that would have made the flicker even worse. Important The general solution to flicker problems is to avoid painting large areas twice. And so to my code in its present form void CFleetView Draw const TRect const DrawOutside DrawBorders DrawTiles This code whites out the area of the control between the board rectangle and the border of the control - it doesn t touch the board area itself draws the whole top bottom left and right borders - without affecting the sea area draws each of the 64 tiles in the sea area. My new draw-border code draws the border background and then overpaints it with the letters or numbers which is a potential source of flicker. But the border is small and the time interval between drawing the background and overpainting the eighth letter or number is too short to notice any flicker. Likewise the code I use to draw each tile starts by drawing the tile with its letter and then if it s the cursor tile overpaints the cursor. Again this is OK - it happens so quickly .

TỪ KHÓA LIÊN QUAN
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.