mirror of
https://github.com/love2d/love.git
synced 2026-08-15 07:41:11 +02:00
Add initial video playback support for Ogg Theora videos (resolves issue #66.)
The basic APIs are:
video = love.graphics.newVideo("myvideo.ogv")
love.graphics.draw(video, ...) -- Video objects are Drawables.
video:play(), video:pause()
video:getDuration(), video:tell(), video:rewind(), video:seek(seconds)
video:getSource()
video:getWidth(), video:getHeight(), video:setFilter(min, mag)
More advanced APIs include video:setSource(source), video:getStream(), and videostream:setSync.
To use a custom pixel shader when drawing a Video, call the new TexelVideo(texcoords) function instead of Texel(texture, texcoords) in order to get the pixel colors of a video frame.
This commit is contained in:
@@ -56,7 +56,6 @@ Timer::Timer()
|
||||
, fpsUpdateFrequency(1)
|
||||
, frames(0)
|
||||
, dt(0)
|
||||
, timerPeriod(getTimerPeriod())
|
||||
{
|
||||
prevFpsUpdate = currTime = getTime();
|
||||
}
|
||||
@@ -115,8 +114,11 @@ double Timer::getTimerPeriod()
|
||||
return 0;
|
||||
}
|
||||
|
||||
double Timer::getTime() const
|
||||
double Timer::getTimeSinceEpoch()
|
||||
{
|
||||
// The timer period (reciprocal of the frequency.)
|
||||
static const double timerPeriod = getTimerPeriod();
|
||||
|
||||
#if defined(LOVE_LINUX)
|
||||
double mt;
|
||||
// Check for POSIX timers and monotonic clocks. If not supported, use the gettimeofday fallback.
|
||||
@@ -143,5 +145,10 @@ double Timer::getTime() const
|
||||
#endif
|
||||
}
|
||||
|
||||
double Timer::getTime() const
|
||||
{
|
||||
return getTimeSinceEpoch();
|
||||
}
|
||||
|
||||
} // timer
|
||||
} // love
|
||||
|
||||
@@ -77,6 +77,7 @@ public:
|
||||
* @return The time (in seconds)
|
||||
**/
|
||||
virtual double getTime() const;
|
||||
static double getTimeSinceEpoch();
|
||||
|
||||
private:
|
||||
|
||||
@@ -98,9 +99,6 @@ private:
|
||||
// The current timestep.
|
||||
double dt;
|
||||
|
||||
// The timer period (reciprocal of the frequency.)
|
||||
const double timerPeriod;
|
||||
|
||||
// Returns the timer period on some platforms.
|
||||
static double getTimerPeriod();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user