i compiled no error no warning, i run it, the screen really get "clear" but it does not display anything to cout, and it "clear screen" to blanks for 2 seconds, the screen return to this :
Here is my coding:
Expand|Select|Wrap|Line Numbers
- /* screen.h */
- #ifndef _SCREEN_H_
- #define _SCREEN_H_
- #include <string>
- #include <iostream>
- #include <fstream>
- #include <cstdlib>
- #include "array2d.h"
- namespace Game{
- using namespace std;
- class Screen{
- public:
- Screen(): Xsize(80) , Ysize (23), myArray (Xsize,Ysize){};
- ~Screen(){}
- /* clear the previous screen and display new screen image with Xsize Ysize */
- void Paint(){
- /* clear the screen */
- system("clear");
- // and then display the screen with width and height
- for(unsigned y = 0; y < Ysize; y++){
- for(unsigned x = 0; x < Xsize; x++){
- cout << myArray.Get(Xsize , Ysize);
- }
- }
- }
- private:
- unsigned Xsize;
- unsigned Ysize;
- Array2D<char> myArray;
- string status;
Expand|Select|Wrap|Line Numbers
- /* testgame.cpp */
- #include <iostream>
- #include <string>
- #include "screen.h"
- #include "array2d.h"
- using namespace std;
- using namespace Game;
- int main(){
- Screen s;
- s.Paint();
- cout << "Testing screen display..." << endl;
- return 0;
- }
What's the problem?
Please help.
thanks.
Nicky Eng.