File indexing completed on 2024-09-15 03:46:15
0001 /* 0002 This file is part of the KDE games lskat program 0003 SPDX-FileCopyrightText: 2006 Martin Heni <kde@heni-online.de> 0004 0005 SPDX-License-Identifier: LGPL-2.0-or-later 0006 */ 0007 0008 #ifndef DISPLAY_INTRO_H 0009 #define DISPLAY_INTRO_H 0010 0011 // Qt includes 0012 #include <QGraphicsScene> 0013 #include <QTimer> 0014 0015 // KF includes 0016 0017 // local includes 0018 #include "abstractdisplay.h" 0019 #include "deck.h" 0020 #include "lskat_debug.h" 0021 #include "thememanager.h" 0022 0023 // Forward declaration 0024 class Player; 0025 0026 /** 0027 * The display engine for the intro graphics animation. 0028 */ 0029 class DisplayIntro : public AbstractDisplay, public virtual Themable 0030 { 0031 Q_OBJECT 0032 0033 public: 0034 /** Animation state of the intro display */ 0035 enum AnimState {Idle, Putting, Turning, Waiting, Clearing, Waiting2}; 0036 0037 /** 0038 * Constructor for the display. 0039 * @param deck The card deck 0040 * @param scene The graphics scene to work with 0041 * @param theme The theme manager 0042 * @param advancePeriod The advance period [ms] 0043 * @param parent The parent object 0044 */ 0045 DisplayIntro(Deck *deck, QGraphicsScene *scene, ThemeManager *theme, int advancePeriod, QGraphicsView *parent); 0046 0047 /** 0048 * Main theme function. Called by the theme manager. Redraw and resize 0049 * display. 0050 */ 0051 void changeTheme() override; 0052 0053 /** 0054 * Start the intro. 0055 */ 0056 void start() override; 0057 0058 /* 0059 * Deal cards - unused. 0060 * @param player The player object 0061 * @param position The position to place the player (0,1) 0062 */ 0063 void deal(Player */*player*/, int /*position*/) {} 0064 0065 /** 0066 * Play a card on the display - unused. 0067 */ 0068 void play(int /*cardNumber*/, int /*playerNumber*/, int /*phase*/) override {} 0069 0070 /** 0071 * Turn a card on the display - unused. 0072 */ 0073 void turn(int /*cardNumber*/) override {} 0074 0075 /** 0076 * Remove the given card from the display - unused. 0077 */ 0078 void remove(int /*winnerPosition*/, int /*cardNumber*/, int /*delta*/) override {} 0079 0080 public Q_SLOTS: 0081 /** 0082 * Convert the position of a mouse click to a logical 0083 * game position - unused. 0084 */ 0085 void convertMousePress(const QPoint &/*mouse*/, int &/*playerNumber*/, int &/*cardNumber*/) override {} 0086 0087 /** 0088 * Animation loop. Called by timer. 0089 */ 0090 void loop(); 0091 0092 private: 0093 // Timer for animation loop 0094 QTimer *mTimer; 0095 // Animation counter 0096 int mAnimCnt; 0097 // Animation state 0098 AnimState mState; 0099 // Text shown? 0100 bool mTextShown; 0101 }; 0102 0103 #endif