istereo2
annotate libs/goatkit/boolanm.h @ 35:643f4ab609a4
added readme and license
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Sat, 31 Oct 2015 05:45:35 +0200 |
parents | 3bccfc7d10fe |
children |
rev | line source |
---|---|
nuclear@6 | 1 /* |
nuclear@6 | 2 GoatKit - a themable/animated widget toolkit for games |
nuclear@6 | 3 Copyright (C) 2014 John Tsiombikas <nuclear@member.fsf.org> |
nuclear@6 | 4 |
nuclear@6 | 5 This program is free software: you can redistribute it and/or modify |
nuclear@6 | 6 it under the terms of the GNU Lesser General Public License as published by |
nuclear@6 | 7 the Free Software Foundation, either version 3 of the License, or |
nuclear@6 | 8 (at your option) any later version. |
nuclear@6 | 9 |
nuclear@6 | 10 This program is distributed in the hope that it will be useful, |
nuclear@6 | 11 but WITHOUT ANY WARRANTY; without even the implied warranty of |
nuclear@6 | 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
nuclear@6 | 13 GNU Lesser General Public License for more details. |
nuclear@6 | 14 |
nuclear@6 | 15 You should have received a copy of the GNU Lesser General Public License |
nuclear@6 | 16 along with this program. If not, see <http://www.gnu.org/licenses/>. |
nuclear@6 | 17 */ |
nuclear@6 | 18 #ifndef BOOLANIM_H_ |
nuclear@6 | 19 #define BOOLANIM_H_ |
nuclear@6 | 20 |
nuclear@6 | 21 class BoolAnim { |
nuclear@6 | 22 private: |
nuclear@6 | 23 mutable float value; |
nuclear@6 | 24 mutable float trans_dir; // transition direction (sign) |
nuclear@6 | 25 long trans_start; // transition start time |
nuclear@6 | 26 long trans_dur; |
nuclear@6 | 27 |
nuclear@6 | 28 long (*get_msec)(); |
nuclear@6 | 29 |
nuclear@6 | 30 void update(long tm) const; |
nuclear@6 | 31 |
nuclear@6 | 32 public: |
nuclear@6 | 33 BoolAnim(bool st = false); |
nuclear@6 | 34 |
nuclear@6 | 35 void set_transition_duration(long dur); |
nuclear@14 | 36 long get_transition_duration() const; |
nuclear@14 | 37 |
nuclear@6 | 38 void set_time_callback(long (*time_func)()); |
nuclear@6 | 39 |
nuclear@6 | 40 void set(bool st); |
nuclear@6 | 41 |
nuclear@6 | 42 void change(bool st); |
nuclear@6 | 43 void change(bool st, long trans_start); |
nuclear@6 | 44 |
nuclear@6 | 45 bool get_state() const; |
nuclear@6 | 46 bool get_state(long tm) const; |
nuclear@6 | 47 |
nuclear@6 | 48 float get_value() const; |
nuclear@6 | 49 float get_value(long tm) const; |
nuclear@6 | 50 |
nuclear@6 | 51 // transition direction (-1, 0, 1) |
nuclear@6 | 52 float get_dir() const; |
nuclear@6 | 53 float get_dir(long tm) const; |
nuclear@6 | 54 |
nuclear@6 | 55 operator bool() const; // equivalent to get_state |
nuclear@6 | 56 operator float() const; // equivalent to get_value |
nuclear@6 | 57 }; |
nuclear@6 | 58 |
nuclear@6 | 59 #endif // BOOLANIM_H_ |