Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <conio.h>
- #include <graphics.h>
- #include <iostream>
- #include <vector>
- enum NodeType {
- NONE = 0,
- START_NODE,
- STOP_NODE,
- INPUT_NODE,
- OUTPUT_NODE,
- ASSIGN_NODE,
- CONDITIONAL_NODE
- };
- struct Point {
- int x, y;
- };
- struct Node {
- NodeType nodeType;
- char* nodeData;
- Point coordonates;
- Node() {
- nodeType = NONE;
- nodeData = "Uninitialized node";
- coordonates = Point{0, 0};
- }
- void showNode() {
- int tw = textwidth(nodeData);
- int th = textheight(nodeData);
- setfillstyle(4, CYAN);
- bar(coordonates.x-6, coordonates.y-6, coordonates.x+tw+10, coordonates.y+th+10);
- // setcolor(WHITE);
- // rectangle(coordonates.x, coordonates.y, coordonates.x+tw+2, coordonates.y+th+2);
- // setbkcolor(16);
- outtextxy(coordonates.x+2, coordonates.y+2, nodeData);
- }
- };
- void line(Point A, Point B) {
- line(A.x, A.y, B.x, B.y);
- }
- const int WIDTH = 800;
- const int HEIGHT = 600;
- int main() {
- initwindow(WIDTH, HEIGHT, "InterSchem");
- int cnt = 1;
- while(1) {
- if(ismouseclick(WM_LBUTTONDOWN)) {
- clearmouseclick(WM_LBUTTONDOWN);
- Node* node = new Node();
- node->coordonates = Point{mousex(), mousey()};
- node->nodeData = "This node is just a node";
- node->showNode();
- }
- }
- getch();
- closegraph();
- }
Advertisement
Add Comment
Please, Sign In to add comment