기술/beginning games2011. 5. 25. 11:32
download download



- 48*32 경우에 (width – 1, height – 1)을 해줘야 함

public class ShapeTest extends Activity {
class RenderView extends View {
Paint paint;
public RenderView(Context context) {
super(context);
paint = new Paint();
}
protected void onDraw(Canvas c){
c.drawRGB(255, 255, 255);
paint.setColor(Color.RED);
c.drawLine(0, 0, c.getWidth()-1, c.getHeight()-1, paint);
paint.setStyle(Style.STROKE);
paint.setColor(0xff00ff00);
c.drawCircle(c.getWidth()/2, c.getHeight()/2, 40, paint);
paint.setStyle(Style.FILL);
paint.setColor(0x770000ff);
c.drawRect(100, 100,200,200,paint);
invalidate();
}
}

@Override
public void onCreate(Bundle savedInstanceState) {
   super.onCreate(savedInstanceState);
   requestWindowFeature(Window.FEATURE_NO_TITLE);
   getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
   setContentView(new RenderView(this));
}
}
download download download
Posted by yachtie_leo