add fps modifier for animation

This commit is contained in:
Jinhao
2015-02-16 06:59:56 +08:00
parent 274155b1da
commit 4385ac623d
4 changed files with 103 additions and 77 deletions

View File

@@ -1,6 +1,7 @@
/*
* An Animation Implementation
* Copyright(C) 2003-2013 Jinhao(cnjinhao@hotmail.com)
* Nana C++ Library(http://www.nanapro.org)
* Copyright(C) 2003-2015 Jinhao(cnjinhao@hotmail.com)
*
* Distributed under the Boost Software License, Version 1.0.
* (See accompanying file LICENSE_1_0.txt or copy at
@@ -27,15 +28,13 @@ namespace nana
friend class animation;
public:
/// function which builds frames.
typedef std::function<bool(std::size_t pos, paint::graphics&, nana::size&)> framebuilder;
using framebuilder = std::function<bool(std::size_t pos, paint::graphics&, nana::size&)>;
struct impl;
public:
frameset();
void push_back(const paint::image&); ///< Inserts frames at the end.
void push_back(paint::image&&);
void push_back(framebuilder& fb, std::size_t length); ///< Insters a framebuilder and the number of frames that it generates.
void push_back(framebuilder&& fb, std::size_t length); ///< Insters a framebuilder and the number of frames that it generates.
void push_back(paint::image); ///< Inserts frames at the end.
void push_back(framebuilder fb, std::size_t length); ///< Insters a framebuilder and the number of frames that it generates.
private:
std::shared_ptr<impl> impl_;
};
@@ -51,9 +50,9 @@ namespace nana
struct impl;
class performance_manager;
public:
animation();
animation(std::size_t fps = 23);
void push_back(const frameset& frms);
void push_back(frameset frms);
/*
void branch(const std::string& name, const frameset& frms)
{
@@ -75,6 +74,9 @@ namespace nana
void pause();
void output(window wd, const nana::point& pos);
void fps(std::size_t n);
std::size_t fps() const;
private:
impl * impl_;
};

View File

@@ -44,7 +44,6 @@ namespace nana
widget * widget_{nullptr};
nana::paint::graphics* graph_{nullptr};
unsigned draw_width_{static_cast<unsigned>(-1)};
//bool has_value_{true}; //deprecated
bool unknown_{false};
unsigned max_{100};
unsigned value_{0};