1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
|
public void render( Graphics g )
{
for(Entry<Long, Vector<Component>> entry : this.entities.entrySet())
{
Vector<Component> components = entry.getValue();
if( components.stream().anyMatch(CTexture.class::isInstance)
&& components.stream().anyMatch(CPosition.class::isInstance) )
{
double x = 0;
double y = 0;
for( Component c : components )
{
if( c instanceof CPosition )
{
x = ((CPosition) c).x();
y = ((CPosition) c).y();
}
}
for( Component c : components )
{
if( c instanceof CTexture )
{
g.drawImage(this.tl.texture(((CTexture) c).texture()).getScaledCopy(((CTexture) c).size().x(), ((CTexture) c).size().y()),(float)x,(float)y);
}
}
}
}
} |