FIUS / ICGE2

Version 2 of the Introduction Course Game Engine for the FIUS Java Introduction Course
MIT License
5 stars 4 forks source link

Limit draw updates #202

Closed graefjk closed 9 months ago

graefjk commented 9 months ago

This change limits the between individual calls of drawEntities(). This way drawEntities() is not called every time a new Entity is created. This can reduce Lag when multible entities are added to the PlayingField at the same time. The time between drawEntities() calls can be changed with the setTimeBetweenDraws method which accepts the time in milliseconds. The time is initially set as 32ms between draw calls, which equates to a maximum of 31.75 Draws/Second. This implements #194.

graefjk commented 9 months ago

I chose to implement this here instead of in the playfield drawer since drawEntities executes this.getAllEntities() every time it is called and this.getAllEntities() takes longer the more entities there are.

graefjk commented 9 months ago

Looks good now. (But I did not run the code myself, so merge at your own risk.)

I cannot merge any pull request as i am not a maintainer of this project

buehlefs commented 9 months ago

It looks like I don't have the rights to make you a project maintainer. You should ensure that you have at least 1-2 active maintainers with the correct access rights (@neumantm should be able to help with that). If you want me to merge just leave me a thumbs up. (but I may not be available for emergency merges on a short notice)