You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
38 lines
883 B
38 lines
883 B
#ifndef CIRCUITWIRE_H |
|
#define CIRCUITWIRE_H |
|
|
|
#include <QGraphicsLineItem> |
|
|
|
class Connector; |
|
class Scene; |
|
|
|
class Wire : private QGraphicsLineItem |
|
{ |
|
public: |
|
friend class Connector; |
|
friend class Scene; |
|
friend class Logic; |
|
|
|
friend class RemoveWire; |
|
|
|
friend class MainWindow; |
|
|
|
friend class FileHandler; |
|
|
|
friend class CircuitBuffer; |
|
|
|
// Assumes that the CircuitConnectors A and B each have a different orientation |
|
Wire(Scene* scene, Connector *A, Connector *B); |
|
|
|
void updateLine(); // Graphical update |
|
void feedInput(); // Logical update (feeds input to output and updates state, also causes a graphical update) |
|
private: |
|
Scene* m_scene; |
|
|
|
Connector* m_connectorInput; // connector inputting to this wire |
|
Connector* m_connectorOutput; // connector receiving output from this wire |
|
|
|
bool m_state = false; |
|
}; |
|
|
|
#endif // CIRCUITWIRE_H
|
|
|