File: display_intro.h

package info (click to toggle)
lskat 4%3A18.04.1-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 5,404 kB
  • sloc: cpp: 4,934; xml: 96; makefile: 5; sh: 2
file content (116 lines) | stat: -rw-r--r-- 3,182 bytes parent folder | download
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
/*
   This file is part of the KDE games lskat program
   Copyright (c) 2006 Martin Heni <kde@heni-online.de>

   This library is free software; you can redistribute it and/or
   modify it under the terms of the GNU Library General Public
   License as published by the Free Software Foundation; either
   version 2 of the License, or (at your option) any later version.

   This library is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   Library General Public License for more details.

   You should have received a copy of the GNU Library General Public License
   along with this library; see the file COPYING.LIB.  If not, write to
   the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
   Boston, MA 02110-1301, USA.
*/

#ifndef DISPLAY_INTRO_H
#define DISPLAY_INTRO_H

// Qt includes
#include <QGraphicsScene>
#include <QTimer>

// KDE includes

// local includes
#include "abstractdisplay.h"
#include "deck.h"
#include "lskat_debug.h"
#include "thememanager.h"

// Forward declaration
class Player;

/**
 * The display engine for the intro graphics animation.
 */
class DisplayIntro : public AbstractDisplay, public virtual Themable
{
    Q_OBJECT

public:
    /** Animation state of the intro display */
    enum AnimState {Idle, Putting, Turning, Waiting, Clearing, Waiting2};

    /**
     * Constructor for the display.
     * @param deck          The card deck
     * @param scene         The graphics scene to work with
     * @param theme         The theme manager
     * @param advancePeriod The advance period [ms]
     * @param parent        The parent object
     */
    DisplayIntro(Deck *deck, QGraphicsScene *scene, ThemeManager *theme, int advancePeriod, QGraphicsView *parent);

    /**
     * Main theme function. Called by the theme manager. Redraw and resize
     * display.
     */
    void changeTheme() override;

    /**
     * Start the intro.
     */
    void start() override;

    /*
     * Deal cards - unused.
     * @param player The player object
     * @param position The position to place the player (0,1)
     */
    void deal(Player */*player*/, int /*position*/) {}

    /**
     * Play a card on the display - unsused.
     */
    void play(int /*cardNumber*/, int /*playerNumber*/, int /*phase*/) override {}

    /**
     * Turn a card on the display - unused.
     */
    void turn(int /*cardNumber*/) override {}

    /**
     * Remove the given card from the display - unused.
     */
    void remove(int /*winnerPosition*/, int /*cardNumber*/, int /*delta*/) override {}

public slots:
    /**
     * Convert the position of a mouse click to a logical
     * game position - unused.
     */
    void convertMousePress(const QPoint &/*mouse*/, int &/*playerNumber*/, int &/*cardNumber*/) override {}

    /**
     * Animation loop. Called by timer.
     */
    void loop();

private:
    // Timer for animation loop
    QTimer *mTimer;
    // Animation counter
    int mAnimCnt;
    // Animation state
    AnimState mState;
    // Text shown?
    bool mTextShown;
};

#endif