summaryrefslogtreecommitdiffstats
path: root/ktux/spritemisc.h
blob: 0a0d0585b1230d64c91bc0267cf6a1fa7b8bc71c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
//-----------------------------------------------------------------------------
//
// spritemisc
//
// Copyright (c)  Martin R. Jones 1999
//

#ifndef __SPRITEMISC_H__
#define __SPRITEMISC_H__

#include <qstring.h>
#include <qsize.h>

class SpriteRange
{
public:
    SpriteRange(const QString &str);
    SpriteRange(int l=0, int h=0) : mMin(l), mMax(h) {}

    int min() const { return mMin; }
    int max() const { return mMax; }

    int random() const;

    void set(int l, int h) { mMin=l; mMax=h; }
    void set(const QString &str);

    static void setFieldSize(const QSize &size);
    static QSize fieldSize() { return mFieldSize; }

protected:
    int parse(const QString &str);

protected:
    int             mMin;
    int             mMax;
    static QSize    mFieldSize;
};

#endif