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