完善桌宠内核基础设施
This commit is contained in:
+23
-9
@@ -1,20 +1,30 @@
|
||||
#pragma once
|
||||
|
||||
#include "../character/AnimationClip.h"
|
||||
#include "../character/CharacterPackage.h"
|
||||
#include "../character/FrameAnimator.h"
|
||||
#include "../config/AppConfig.h"
|
||||
#include "../state/PetStateMachine.h"
|
||||
|
||||
#include <QLabel>
|
||||
#include <QMap>
|
||||
#include <QPoint>
|
||||
#include <QStringList>
|
||||
#include <QTimer>
|
||||
#include <QWidget>
|
||||
|
||||
class QMenu;
|
||||
class QPixmap;
|
||||
class PetView;
|
||||
|
||||
class PetWindow : public QWidget
|
||||
{
|
||||
public:
|
||||
explicit PetWindow(QWidget *parent = nullptr);
|
||||
|
||||
void applyAppConfig(const AppConfig &config);
|
||||
AppConfig currentAppConfig() const;
|
||||
void pauseAnimation();
|
||||
void resumeAnimation();
|
||||
|
||||
protected:
|
||||
void contextMenuEvent(QContextMenuEvent *event) override;
|
||||
void mouseMoveEvent(QMouseEvent *event) override;
|
||||
@@ -23,24 +33,28 @@ protected:
|
||||
|
||||
private:
|
||||
void loadInitialImage();
|
||||
void buildAnimationClips();
|
||||
void addStateTestActions(QMenu *menu);
|
||||
void playState(const QString &stateName, bool centerWindow, bool autoReturn = false);
|
||||
void advanceStateFrame();
|
||||
void playState(const QString &stateName, bool centerWindow);
|
||||
void playResolvedState(const QString &stateName, bool centerWindow);
|
||||
void scheduleIdleBehavior();
|
||||
void playIdleBehavior();
|
||||
void returnToIdleFromBehavior();
|
||||
void setDisplayImage(const QString &imagePath, bool centerWindow);
|
||||
void setDisplayPixmap(const QPixmap &pixmap, bool centerWindow);
|
||||
bool isPointVisibleOnScreen(const QPoint &point) const;
|
||||
void setAlwaysOnTop(bool enabled);
|
||||
|
||||
QLabel *m_imageLabel;
|
||||
QTimer m_animationTimer;
|
||||
PetView *m_petView;
|
||||
QTimer m_idleBehaviorTimer;
|
||||
QTimer m_behaviorReturnTimer;
|
||||
CharacterPackage m_characterPackage;
|
||||
QString m_currentStateName;
|
||||
QStringList m_currentFrames;
|
||||
QMap<QString, AnimationClip> m_clips;
|
||||
FrameAnimator m_frameAnimator;
|
||||
PetStateMachine m_stateMachine;
|
||||
QPoint m_dragOffset;
|
||||
int m_currentFrameIndex;
|
||||
bool m_dragging;
|
||||
bool m_alwaysOnTop;
|
||||
bool m_centerNextFrame;
|
||||
bool m_returnToIdleAfterResume = false;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user