qmlfrontend/engine_instance.h
changeset 15217 b32c52c76977
parent 14854 aed75d439027
child 15891 d52f5d8e75e6
equal deleted inserted replaced
15216:387345a14b3f 15217:b32c52c76977
    10 
    10 
    11 class EngineInstance : public QObject {
    11 class EngineInstance : public QObject {
    12   Q_OBJECT
    12   Q_OBJECT
    13 
    13 
    14  public:
    14  public:
    15   using SimpleEventType = Engine::SimpleEventType;
       
    16   Q_ENUMS(SimpleEventType)
       
    17   using LongEventType = Engine::LongEventType;
       
    18   Q_ENUMS(LongEventType)
       
    19   using LongEventState = Engine::LongEventState;
       
    20   Q_ENUMS(LongEventState)
       
    21   using PositionedEventType = Engine::PositionedEventType;
       
    22   Q_ENUMS(PositionedEventType)
       
    23 
       
    24   explicit EngineInstance(const QString& libraryPath,
    15   explicit EngineInstance(const QString& libraryPath,
    25                           QObject* parent = nullptr);
    16                           QObject* parent = nullptr);
    26   ~EngineInstance();
    17   ~EngineInstance();
    27 
    18 
    28   Q_PROPERTY(bool isValid READ isValid NOTIFY isValidChanged)
    19   Q_PROPERTY(bool isValid READ isValid NOTIFY isValidChanged)
    38   void isValidChanged(bool isValid);
    29   void isValidChanged(bool isValid);
    39 
    30 
    40  public slots:
    31  public slots:
    41   void advance(quint32 ticks);
    32   void advance(quint32 ticks);
    42   void moveCamera(const QPoint& delta);
    33   void moveCamera(const QPoint& delta);
    43   void simpleEvent(SimpleEventType event_type);
    34   void simpleEvent(Engine::SimpleEventType event_type);
    44   void longEvent(LongEventType event_type, LongEventState state);
    35   void longEvent(Engine::LongEventType event_type,
    45   void positionedEvent(PositionedEventType event_type, qint32 x, qint32 y);
    36                  Engine::LongEventState state);
       
    37   void positionedEvent(Engine::PositionedEventType event_type, qint32 x,
       
    38                        qint32 y);
    46 
    39 
    47  private:
    40  private:
    48   Engine::EngineInstance* m_instance;
    41   Engine::EngineInstance* m_instance;
    49 
    42 
    50   Engine::hedgewars_engine_protocol_version_t*
    43   Engine::hedgewars_engine_protocol_version_t*
    63   Engine::long_event_t* long_event;
    56   Engine::long_event_t* long_event;
    64   Engine::positioned_event_t* positioned_event;
    57   Engine::positioned_event_t* positioned_event;
    65   bool m_isValid;
    58   bool m_isValid;
    66 };
    59 };
    67 
    60 
    68 Q_DECLARE_METATYPE(EngineInstance::SimpleEventType)
       
    69 Q_DECLARE_METATYPE(EngineInstance::LongEventType)
       
    70 Q_DECLARE_METATYPE(EngineInstance::LongEventState)
       
    71 Q_DECLARE_METATYPE(EngineInstance::PositionedEventType)
       
    72 
       
    73 #endif  // ENGINEINSTANCE_H
    61 #endif  // ENGINEINSTANCE_H