Android drawrRect only produces squares
Posted
by
user1905553
on Stack Overflow
See other posts from Stack Overflow
or by user1905553
Published on 2014-05-28T21:15:43Z
Indexed on
2014/05/28
21:26 UTC
Read the original article
Hit count: 128
I present the following code snippet:
// < Android / Eclipse Kepler >
// < Screen resolution: 480x800 >
Graphics g = game.getGraphics();
g.drawRect(0, 0, g.getWidth()/2, g.getHeight(), Color.GRAY);
Produces a square [0,0], [240, 240] (240 = g.getWidth/2 = 480/2)
I expected to get a rectangle [0,0] [240, 800]
Can anyone tell me if I'm wrong or if the drawRect uses width instead of height?
How do I fix this?
Please, if possible, test before post your answer. Help me to save a ridiculous bitmap.
Thanks to all!
© Stack Overflow or respective owner