From 33613a85afc4b1481367fbe92a17ee59c240250b Mon Sep 17 00:00:00 2001 From: Sven Eisenhauer Date: Fri, 10 Nov 2023 15:11:48 +0100 Subject: add new repo --- Master/Real-Time Systems/RTS_A8/src/Display.cpp | 111 ++++++++++++++++++++++++ 1 file changed, 111 insertions(+) create mode 100644 Master/Real-Time Systems/RTS_A8/src/Display.cpp (limited to 'Master/Real-Time Systems/RTS_A8/src/Display.cpp') diff --git a/Master/Real-Time Systems/RTS_A8/src/Display.cpp b/Master/Real-Time Systems/RTS_A8/src/Display.cpp new file mode 100644 index 0000000..7f8e925 --- /dev/null +++ b/Master/Real-Time Systems/RTS_A8/src/Display.cpp @@ -0,0 +1,111 @@ +/* + * Display.cpp + * + * Created on: 30.11.2010 + * Author: istsveise + */ + +#include "Display.h" +#ifndef POS_H_ + #include "POS.h" +#endif +#include +#include +#include +#include +#include +#include + +using namespace std; + +extern POS vehiclePosition; +extern double lineDir; +const int WIN_WIDTH = 600; +const int WIN_HEIGHT = 600; +const int WIN_BPP = 32; + +// because of static +Display* Display::msDispPtr = NULL; + +void* dispInit(void*) { + ApplicationWindow appWin(WIN_WIDTH,WIN_HEIGHT,WIN_BPP); + if(!appWin.create()) { + cout << "error creating app window. exiting" << endl; + exit(1); + } + Display::msDispPtr->mStarted = true; + glutDisplayFunc(displayFunc); + glutMainLoop(); + return NULL; +} + +Display::Display(int t) +:Task(t),mStarted(false) +{ + Display::msDispPtr = this; + sem_init(&dispSem,0,0); + pthread_create(&mDispThread,NULL,dispInit,NULL); +} + +Display::~Display() { +} + +void Display::execute() +{ + cout << "...Display::execute T="<< T <