Release Name: 2.5.0
Notes:
== Rubygame 2.5.0
Release focus: Clock improvements.
=== Features
- New and improved algorithm for calculating framerate.
- Better Clock compatibility with multithreaded applications:
- Clock.delay and Clock.wait now accept a new argument: +nice+.
If nice is +true+, these methods try to allow other ruby threads
to run during the delay. The default behavior is to block other
threads, as previous versions of Rubygame do.
- Added: Clock @nice.
This instance variable controls the +nice+ value used while
delaying in #tick (if framerate limiting is active).
- Better control over the balance between CPU usage and accuracy
when using Clock's framerate limiting:
- Added: Clock @granularity.
This instance variable controls the granularity value used while
delaying in #tick (if framerate limiting is active). Smaller
values lower CPU usage, but framerate limiting will be less
accurate if the granularity is lower than the system's actual
clock granularity. Use Clock#calibrate to find the best value for
the current system.
- Added: Clock#calibrate.
Call this after you create a Clock instance calibrate the Clock's
granularity to match the system's actual clock granularity. This
reduces wasteful CPU usage when using framerate limiting.
- New ClockTicked event for use with EventHandlers:
- Added: ClockTicked event class.
If you call Clock#enable_tick_events, Clock#tick will return an
instance of ClockTicked instead of the raw delay time in milliseconds.
- Added: TickTrigger event trigger class.
Matches ClockTicked events.
- HasEventHandler#make_magic_hooks accepts the symbol :tick to create a
TickTrigger.
- Added: Clock#frametime.
Returns the actual milliseconds per frame recorded by the Clock.
- New in-depth Clock tutorial, "Managing Framerate".
See doc/managing_framerate.rdoc[link:files/doc/managing_framerate_rdoc.html].
An accompanying code example has also been added, samples/framerate.rb.
- A few Screen additions:
- Added: Screen.get_resolution. Returns the user's desktop resolution.
Due to a limitation of SDL, this can ONLY be used when the Rubygame
window is closed (i.e. before you have called Screen.new, or after
you have called Screen.close).
- Added: Screen.close. Closes the Rubygame window, if it's open.
- Added: Screen.open?. True if the Rubygame window is open.
- Added: Screen.open (alias of Screen.new).
- Added: HasEventHandler#make_magic_hooks_for.
It's like make_magic_hooks, but the hook's owner will be the
specified object, instead of the object with the handler.
=== Other Stuff
- Various Clock fixes and improvements:
- Clock#tick when called for the first time, no longer considers the
creation time of the Clock instance to be "the previous tick",
when checking how much time has passed.
- Clock#tick won't do any extra delay if the frame has already taken
longer than the target.
- Clock.delay and Clock.wait handle negative numbers more gracefully.
Instead of hanging for a long time, they act as if the values were 0.
- Deprecation: Screen.set_mode and Screen.instance (both aliases of
Screen.new) are deprecated and will be removed in Rubygame 3.0.
Use Screen.new or Screen.open instead.
- Deprecation: Ftor is deprecated and will be removed in Rubygame 3.0.
A mostly-compatible vector class will be provided at or before that time.
- Deprecation: MediaBag is deprecated and will be removed in Rubygame 3.0.
Use the NamedResource functionality of Music, Sound, and Surface instead.
Changes:
|