0
我目前正在開發一款android遊戲。畫布矩陣轉換
我已添加按鈕以允許用戶在x軸上導航相機並放大和縮小。
要做到這一點我用下面的矩陣碼:
// c is the canvas..
Matrix m = c.getMatrix();
// Make sure that the ground is always at the bottom of the screen
m.setScale(zoom,zoom,0.0f,height);
m.preTranslate(camera_x, 0); // Change offset in x-direction
c.setMatrix(m);
這個工程在模擬器上,但給我我真正的設備上一些奇怪的結果。
誰能告訴我它有什麼問題嗎?我發現使用矩陣很棘手,特別是因爲Matrix對象有很多選項可用(前置,後置和設置)。
感謝