Should I use OpenGL for chess with animations?
Posted
by fhucho
on Stack Overflow
See other posts from Stack Overflow
or by fhucho
Published on 2010-03-21T13:00:15Z
Indexed on
2010/03/21
13:21 UTC
Read the original article
Hit count: 647
At the moment I am experimenting with SurfaceView for my chess game with animations. I am getting only about 8 FPS in the emulator. I draw a chess board and 32 chess pieces and rotate everything (to see how smooth it is), I am using antialiasing. On the Droid I'm getting about 20FPS, so it's not very smooth. Is it possible to implement a game with very scarce and simple animations without having to use OpenGL?
This is what I do every frame:
// scale and rotate
matrix.setScale(scale, scale);
rotation += 3;
matrix.postRotate(rotation, 152, 152);
canvas = surfaceHolder.lockCanvas();
canvas.setDrawFilter(new PaintFlagsDrawFilter(0, Paint.FILTER_BITMAP_FLAG));
canvas.setMatrix(matrix);
canvas.drawARGB(255, 255, 255, 255); // fill the canvas with white
for (int i = 0; i < sprites.size(); i++) {
sprites.get(i).draw(canvas); // draws chessboard and chess pieces
}
© Stack Overflow or respective owner