summaryrefslogtreecommitdiffstats
path: root/ktux/spritemisc.h
blob: 2034907d59944016dcb3e9a51d261916357957b9 (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 <tqstring.h>
#include <tqsize.h>

class SpriteRange
{
public:
    SpriteRange(const TQString &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 TQString &str);

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

protected:
    int parse(const TQString &str);

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

#endif