zacharycarter / zengine

2D | 3D Game development library
156 stars 13 forks source link

Timer Module #51

Closed zacharycarter closed 7 years ago

zacharycarter commented 7 years ago

I think we should drop the TImer object and just have the module expose the functions that are there and move the vars under the timer object to globals. I don't see much point in having a timer object and I think it's going to be problematic.

I'm writing network code now where I want to be able to access the engine's time globally in a callback method and I can't do it. Do you see any benefits to having an object? I think if it's modular like the rest of the engine, it's more beneficial and more easily accessible.

zacharycarter commented 7 years ago

Here's what I propose -

1) We merge my changes into zengine/timer. This becomes the "main" timer.

2) We copy what was in the Timer module into the Utils package - now we have utils/timer - this is a timer folks can use whenever they need an additional timer.

Thoughts?

define-private-public commented 7 years ago

I think that is a bit better, but then we have a duplicate code issue. What happens when we need to change one? that means we'll have to change the other too. I like to keep duplicate code as minimal as possible.

I'm still standing for having one Timer be the "main zengine app timer." That was you can have your global access to a single timer, and users can use Times as they need them (like I will).

define-private-public commented 7 years ago

After see the latest updates to PR #50, is your final decision to go with with I have described above?

zacharycarter commented 7 years ago

yup!