diff options
author | Paul Gilbert | 2019-01-02 18:18:11 -0800 |
---|---|---|
committer | Paul Gilbert | 2019-01-02 18:18:11 -0800 |
commit | f1d9722f3bd58f7883f3e76c19d4a0133da73489 (patch) | |
tree | 26986b085d83e597b10c3851fde9b49574c10586 /engines/glk/utils.h | |
parent | 3ed48e3de223259dd58f0c613c2d68d69848e5a2 (diff) | |
download | scummvm-rg350-f1d9722f3bd58f7883f3e76c19d4a0133da73489.tar.gz scummvm-rg350-f1d9722f3bd58f7883f3e76c19d4a0133da73489.tar.bz2 scummvm-rg350-f1d9722f3bd58f7883f3e76c19d4a0133da73489.zip |
GLK: FROTZ: Add support for pair windows to have more than 2 children
This is primarily for the V6 games, which have up to 8 windows
on-screen at the same time in arbitray positions
ext
Diffstat (limited to 'engines/glk/utils.h')
-rw-r--r-- | engines/glk/utils.h | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/engines/glk/utils.h b/engines/glk/utils.h index 3655f57c33..2532f270a5 100644 --- a/engines/glk/utils.h +++ b/engines/glk/utils.h @@ -23,13 +23,20 @@ #ifndef GLK_UTILS_H #define GLK_UTILS_H +#include "common/array.h" #include "common/rect.h" #include "glk/glk_types.h" namespace Glk { +/** + * Two dimensional point + */ typedef Common::Point Point; +/** + * Contains a square box/rect area + */ struct Rect : public Common::Rect { public: static Rect fromXYWH(int x, int y, int w, int h) { @@ -42,6 +49,24 @@ public: }; /** + * Derived array class + */ +template<class T>class Array : public Common::Array<T> { +public: + /** + * Return the index in the array of a passed item + */ + int indexOf(T val) { + for (size_t idx = 0; idx < this->size(); ++idx) { + if ((*this).operator[](idx) == val) + return idx; + } + + return -1; + } +}; + +/** * Converts a decimal or hexadecimal string into a number */ int strToInt(const char *s); |