Let individual dialogs toggle pict animations
This commit is contained in:
@@ -146,9 +146,9 @@ cKey cControl::parseKey(string what){
|
||||
return key;
|
||||
}
|
||||
|
||||
cDialog::cDialog(cDialog* p) : parent(p) {}
|
||||
cDialog::cDialog(cDialog* p) : parent(p), doAnimations(defaultDoAnimations) {}
|
||||
|
||||
cDialog::cDialog(const DialogDefn& file, cDialog* p) : parent(p) {
|
||||
cDialog::cDialog(const DialogDefn& file, cDialog* p) : parent(p), doAnimations(defaultDoAnimations) {
|
||||
loadFromFile(file);
|
||||
}
|
||||
|
||||
@@ -1075,12 +1075,12 @@ xBadVal::~xBadVal() throw(){
|
||||
if(msg != nullptr) delete[] msg;
|
||||
}
|
||||
|
||||
bool cDialog::doAnimations = false;
|
||||
bool cDialog::defaultDoAnimations = false;
|
||||
|
||||
void cDialog::draw(){
|
||||
win.setActive(false);
|
||||
tileImage(win,winRect,::bg[bg]);
|
||||
if(doAnimations && animTimer.getElapsedTime().asMilliseconds() >= 500) {
|
||||
if(doAnimations && animTimer.getElapsedTime().asMilliseconds() >= (1000 / anim_pict_fps)) {
|
||||
cPict::advanceAnim();
|
||||
animTimer.restart();
|
||||
}
|
||||
|
@@ -75,6 +75,8 @@ class cDialog : public iComponent, public iNameGiver {
|
||||
std::vector<std::pair<std::string,cTextField*>> tabOrder;
|
||||
static cDialog* topWindow; // Tracks the frontmost dialog.
|
||||
static bool initCalled;
|
||||
int anim_pict_fps = 2;
|
||||
bool doAnimations;
|
||||
public:
|
||||
static void (*redraw_everything)();
|
||||
/// Performs essential startup initialization. Generally should not be called directly.
|
||||
@@ -239,7 +241,7 @@ public:
|
||||
/// @return true if there was a dialog opened to send to.
|
||||
static bool sendInput(cKey key);
|
||||
/// Sets whether to animate graphics in dialogs.
|
||||
static bool doAnimations;
|
||||
static bool defaultDoAnimations;
|
||||
/// Adds a new control described by the passed XML element.
|
||||
/// @tparam Ctrl The type of control to add.
|
||||
/// @param who The XML element describing the control.
|
||||
@@ -261,6 +263,8 @@ public:
|
||||
}
|
||||
cDialog& operator=(cDialog& other) = delete;
|
||||
cDialog(cDialog& other) = delete;
|
||||
inline void setAnimPictFPS(int fps) { if(fps == -1) fps = 2; anim_pict_fps = fps; }
|
||||
inline void setDoAnimations(bool value) { doAnimations = value; }
|
||||
private:
|
||||
void draw();
|
||||
void handle_events();
|
||||
|
@@ -350,7 +350,7 @@ void init_scened(int argc, char* argv[]) {
|
||||
set_cursor(sword_curs);
|
||||
|
||||
cDialog::defaultBackground = cDialog::BG_LIGHT;
|
||||
cDialog::doAnimations = true;
|
||||
cDialog::defaultDoAnimations = true;
|
||||
set_up_apple_events();
|
||||
process_args(argc, argv);
|
||||
init_fileio();
|
||||
|
Reference in New Issue
Block a user