QTfrontend/itemNum.h
author nemo
Sun, 10 Oct 2010 16:51:40 -0400
changeset 3949 4c4c0a2507cc
parent 2377 f3fab2b09e0c
child 4412 c9a78ba03679
permissions -rw-r--r--
Add the standard delay (1.25 seconds) between attacks on inf attack mode, as well as checks for damage and win. There is probably some better way to do this. Weapons still need fixing.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
612
333d095319de abstract class for items container (hedgehogs num, bullets, etc.)
displacer
parents:
diff changeset
     1
/*
1066
1f1b3686a2b0 Update copyright headers a bit
unc0rr
parents: 883
diff changeset
     2
 * Hedgewars, a free turn based strategy game
883
07a568ba44e0 Update copyright info in source files headers
unc0rr
parents: 681
diff changeset
     3
 * Copyright (c) 2006-2008 Ulyanov Igor <iulyanov@gmail.com>
612
333d095319de abstract class for items container (hedgehogs num, bullets, etc.)
displacer
parents:
diff changeset
     4
 *
333d095319de abstract class for items container (hedgehogs num, bullets, etc.)
displacer
parents:
diff changeset
     5
 * This program is free software; you can redistribute it and/or modify
333d095319de abstract class for items container (hedgehogs num, bullets, etc.)
displacer
parents:
diff changeset
     6
 * it under the terms of the GNU General Public License as published by
333d095319de abstract class for items container (hedgehogs num, bullets, etc.)
displacer
parents:
diff changeset
     7
 * the Free Software Foundation; version 2 of the License
333d095319de abstract class for items container (hedgehogs num, bullets, etc.)
displacer
parents:
diff changeset
     8
 *
333d095319de abstract class for items container (hedgehogs num, bullets, etc.)
displacer
parents:
diff changeset
     9
 * This program is distributed in the hope that it will be useful,
333d095319de abstract class for items container (hedgehogs num, bullets, etc.)
displacer
parents:
diff changeset
    10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
333d095319de abstract class for items container (hedgehogs num, bullets, etc.)
displacer
parents:
diff changeset
    11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
333d095319de abstract class for items container (hedgehogs num, bullets, etc.)
displacer
parents:
diff changeset
    12
 * GNU General Public License for more details.
333d095319de abstract class for items container (hedgehogs num, bullets, etc.)
displacer
parents:
diff changeset
    13
 *
333d095319de abstract class for items container (hedgehogs num, bullets, etc.)
displacer
parents:
diff changeset
    14
 * You should have received a copy of the GNU General Public License
333d095319de abstract class for items container (hedgehogs num, bullets, etc.)
displacer
parents:
diff changeset
    15
 * along with this program; if not, write to the Free Software
333d095319de abstract class for items container (hedgehogs num, bullets, etc.)
displacer
parents:
diff changeset
    16
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
333d095319de abstract class for items container (hedgehogs num, bullets, etc.)
displacer
parents:
diff changeset
    17
 */
2377
f3fab2b09e0c And in frontend
nemo
parents: 1904
diff changeset
    18
1455
7d0a4ecd8210 Better look for weapon sets page
unc0rr
parents: 1066
diff changeset
    19
#include <QFrame>
612
333d095319de abstract class for items container (hedgehogs num, bullets, etc.)
displacer
parents:
diff changeset
    20
#include <QImage>
333d095319de abstract class for items container (hedgehogs num, bullets, etc.)
displacer
parents:
diff changeset
    21
333d095319de abstract class for items container (hedgehogs num, bullets, etc.)
displacer
parents:
diff changeset
    22
#ifndef _ITEM_NUM_INCLUDED
333d095319de abstract class for items container (hedgehogs num, bullets, etc.)
displacer
parents:
diff changeset
    23
#define _ITEM_NUM_INCLUDED
333d095319de abstract class for items container (hedgehogs num, bullets, etc.)
displacer
parents:
diff changeset
    24
1455
7d0a4ecd8210 Better look for weapon sets page
unc0rr
parents: 1066
diff changeset
    25
class ItemNum : public QFrame
612
333d095319de abstract class for items container (hedgehogs num, bullets, etc.)
displacer
parents:
diff changeset
    26
{
333d095319de abstract class for items container (hedgehogs num, bullets, etc.)
displacer
parents:
diff changeset
    27
  Q_OBJECT
333d095319de abstract class for items container (hedgehogs num, bullets, etc.)
displacer
parents:
diff changeset
    28
640
e69b651bb336 first buggy infinity state for weapons
displacer
parents: 624
diff changeset
    29
  public:
e69b651bb336 first buggy infinity state for weapons
displacer
parents: 624
diff changeset
    30
    void setInfinityState(bool value);
681
7a20c50988ec working weapons select
displacer
parents: 643
diff changeset
    31
    unsigned char getItemsNum() const;
7a20c50988ec working weapons select
displacer
parents: 643
diff changeset
    32
    void setItemsNum(const unsigned char num);
640
e69b651bb336 first buggy infinity state for weapons
displacer
parents: 624
diff changeset
    33
1904
20348675b015 - Fix warnings in frontend
unc0rr
parents: 1455
diff changeset
    34
  private:
20348675b015 - Fix warnings in frontend
unc0rr
parents: 1455
diff changeset
    35
    QImage m_im;
20348675b015 - Fix warnings in frontend
unc0rr
parents: 1455
diff changeset
    36
    bool infinityState;
20348675b015 - Fix warnings in frontend
unc0rr
parents: 1455
diff changeset
    37
612
333d095319de abstract class for items container (hedgehogs num, bullets, etc.)
displacer
parents:
diff changeset
    38
  protected:
624
e7673b036db5 weaponItem added
displacer
parents: 612
diff changeset
    39
    ItemNum(const QImage& im, QWidget * parent, unsigned char min=2, unsigned char max=8);
643
281af1f040fb sizeHint for items Widget
displacer
parents: 640
diff changeset
    40
    virtual QSize sizeHint () const;
612
333d095319de abstract class for items container (hedgehogs num, bullets, etc.)
displacer
parents:
diff changeset
    41
    virtual ~ItemNum()=0;
1904
20348675b015 - Fix warnings in frontend
unc0rr
parents: 1455
diff changeset
    42
612
333d095319de abstract class for items container (hedgehogs num, bullets, etc.)
displacer
parents:
diff changeset
    43
    bool nonInteractive;
624
e7673b036db5 weaponItem added
displacer
parents: 612
diff changeset
    44
    unsigned char minItems;
e7673b036db5 weaponItem added
displacer
parents: 612
diff changeset
    45
    unsigned char maxItems;
1904
20348675b015 - Fix warnings in frontend
unc0rr
parents: 1455
diff changeset
    46
    unsigned char numItems;
624
e7673b036db5 weaponItem added
displacer
parents: 612
diff changeset
    47
612
333d095319de abstract class for items container (hedgehogs num, bullets, etc.)
displacer
parents:
diff changeset
    48
    // from QWidget
333d095319de abstract class for items container (hedgehogs num, bullets, etc.)
displacer
parents:
diff changeset
    49
    virtual void mousePressEvent ( QMouseEvent * event );
333d095319de abstract class for items container (hedgehogs num, bullets, etc.)
displacer
parents:
diff changeset
    50
    virtual void paintEvent(QPaintEvent* event);
1904
20348675b015 - Fix warnings in frontend
unc0rr
parents: 1455
diff changeset
    51
612
333d095319de abstract class for items container (hedgehogs num, bullets, etc.)
displacer
parents:
diff changeset
    52
    // to be implemented in child
333d095319de abstract class for items container (hedgehogs num, bullets, etc.)
displacer
parents:
diff changeset
    53
    virtual void incItems()=0;
333d095319de abstract class for items container (hedgehogs num, bullets, etc.)
displacer
parents:
diff changeset
    54
    virtual void decItems()=0;
333d095319de abstract class for items container (hedgehogs num, bullets, etc.)
displacer
parents:
diff changeset
    55
};
333d095319de abstract class for items container (hedgehogs num, bullets, etc.)
displacer
parents:
diff changeset
    56
333d095319de abstract class for items container (hedgehogs num, bullets, etc.)
displacer
parents:
diff changeset
    57
#endif // _ITEM_NUM_INCLUDED