G15 LCD programm [Verbesserungen?!]
-
Ich habe mir für meine Tastatur ein Progrämmchen geschreiben, welches mir einen Pixel auf meinem LCD anzeigt und diesen von oben links angefangen nach unten rechts wandern lässt nun frage ich hier ob ich dies auch einfacher schreiben könnte?
#include <iostream> #include "stdafx.h" using namespace std; template<typename T> string toStr(T var) { std::ostringstream Str; Str << var; return Str.str(); } DISPLAYDATA clearLCD(int black = 128,LCDDEVICE Device = NULL) { int x,y; DISPLAYDATA pointer; for(y = 0;y<(LGLCD_BMP_HEIGHT / 8)+1;y++) { for(x = 0;x<LGLCD_BMP_WIDTH;x++) { pointer.data[y][x] = black; cout << pointer.data[y][x]; } } return pointer; } int main() { DWORD KeybdVer = 0; LCDDEVICE Device = LgOpenLcdDevice(0, FALSE, &KeybdVer); DISPLAYDATA DisplayImage; int pointX = 0,pointY = 0,Ycolum = 0,foo = 1,dump = 0,schlaufe = 0, repeat = 1; double fm = 2; while (repeat == 1) { cout << "Geben sie ein wie oft der schleife durchwandert werden soll" << endl; cin >> schlaufe; for(int win = 0;win<schlaufe;win++) { foo = win%8; if(win%40 == 3) { dump = 0; } if(foo==0) { pointY++; pointX++; if(pointY>=5) { pointY = 0; } } else { pointX++; } if(pointX == LGLCD_BMP_WIDTH) { pointX = 0; } else{} DisplayImage = clearLCD(0,Device); dump = pow(fm,Ycolum); if(Ycolum == 7) { Ycolum = 0; } else { Ycolum++; } cout << Ycolum << " || Ycolum" << endl; cout << foo << " || foo"<< endl; cout << pointY << " || pointY"<< endl; cout << pointX << " || pointX"<< endl; cout << dump << " || dump"<< endl; DisplayImage.data[pointY][pointX] = dump; LgSetDisplayData (Device,&DisplayImage); } cout << "Wiederholen? 1 fuer ja 0 fuer nein" <<endl; cin >> repeat; } LgFreeLcdDevice(Device); }