Hey people!
I have just made a big structural change in my game and its graphic system, so now i have accelerated graphics instead of using Toolkit and Image.
By having this i thought that AffineTransform might be a nice thing to use instead of pre rendered graphics for rotation of tiles, so i implemeted this in the game, but i have also done quite more stuff to the system.
The thing now is that the game is very slow, and i dont really know whats slowing down the system, is it AffineTransform or is it the way i render things?
Heres a code snippet on the tile renderer, what do you think is wrong, and what can slow down the system?
public void draw(Graphics2D g)
{
Graphics2D gTiles = (Graphics2D) g.create();
if(transform != 0)
{
if(transform == 1)
gTiles.rotate(1.5707963267949d, pos[0]+(size[0]/2), pos[1]+(size[1]/2));
else if(transform == 2)
gTiles.rotate(3.1415926535898d, pos[0]+(size[0]/2), pos[1]+(size[1]/2));
else
gTiles.rotate(4.71238898038469d, pos[0]+(size[0]/2), pos[1]+(size[1]/2));
}
if(id == 1)
image = concrete1;
else if(id == 2)
image = concrete2;
else if(id == 3)
image = concrete2_c;
else if(id == 4)
image = concrete2_cc;
else if(id == 101)
image = wall1;
else if(id == 102)
image = wall1_c;
else if(id == 103)
image = wall1_cc;
else if(id == 201)
{
if(frame == 0)
image = dorr1f1;
else if(frame == 1)
image = dorr1f2;
if(frame == 2)
image = dorr1f3;
}
gTiles.drawImage(image, pos[0], pos[1], size[0], size[1], null);
gTiles.dispose();
}
Maybe its because i create a new Graphic2D object each time i render a tile or what can it be?