java - Not able to change color with Slick2d Graphics context -
i'm playing around slick2d , can't change color of graphics context.
this have:
public void render(gamecontainer gc, graphics g) throws slickexception { color color = new color(1f, 0f, 0f, 1f); g.setlinewidth(2); g.setcolor(color); g.drawrect(100, 100, 100, 100); }
i still rectangle white border.
i tried setcolor(color.red)
, nothing.
what missing?
edit 1: changing background red works: g.setbackground(new color(1f, 0f, 0f, 1f)); http://abload.de/img/bildschirmfoto2013-05b2uba.png the…
edit 2: g.getcolor(); giving me correct "red" color…
solved:
ok found error, dont understand it. set renderer vertex_array_renderer. after commenting out line able change color.
@override public void init(gamecontainer gc) throws slickexception { //renderer.setrenderer(renderer.vertex_array_renderer); }
try adding:
render(gamecontainer gc, graphics g) throws slickexception { graphics2d g = (graphics2d) bufferstrategy.getdrawgraphics(); //your code render(g); g.dispose(); }
to code.
Comments
Post a Comment