bushimports 0 Newbie Poster

Ok,I really did not explain things very well. The declarartion for the container is list<string>

The write function is in an entirely different program than the read function. I was using text mode but when I changed the program to set the path in the code,so that all a person has to do is type the filename in the textbox instead of the path and the filename,the program started leaving off one of the backslashes in the path from Level\\ to Level\ . The read function is in a breakout type game and the filenames are read in one at a time as needed to set the path/filename in the Block objects so the class will know which file to load in for that level. If you need any more of the code just tell me what you need and I will post it. Much Thanks again, Jody Bush

bushimports 0 Newbie Poster

Below is the code I have for doing this but something is really wrong .
Filenames is the container I am using.
Filename is a string.

void SaveFileName(){
     ofstream out;
     out.open("..\\..\\Bush Breakout 3D\\Exe\\Level\\filenames.txt",ios::out | ios::app | ios::binary);
    // out.seekp(0,ios::end);
     int size = Filenames.size();     
     for(int i = 0;i < size;++i){      
     out.write((char*)(&Filenames),sizeof(Filename));
     Filenames.pop_back();
     out.seekp(20,ios::cur); 
     }    
     out.close(); 
}

Also how would I read the file back in either to a char array or a to a list and just one of the filenames at a time.
Here is the code I have for the read operation.

int i = 20;
char IFilename[i]; 
in.open("Level\\filenames.txt",ios::binary);                       
     in.seekg(0,ios::beg);        
     in.read((char*)IFilename,i*sizeof(char));
     (*it).SetFileName(IFilename);
     in.close(); 
for(i = 0;i<20;i++){
     IFilename[i] = 0;
     }

Thanks to anyone who will help me with this I have been working on this for quite a while googled my brains several times but can't seem to find anything that will help with it. Much thanks, Jody Bush

bushimports 0 Newbie Poster

How can I draw text in a glut window with the keyboard;
I have tried doing cin with

void TextBox::Keys(unsigned char key,int x,int y){
   switch(key){
      case 13://enter key
      cin >> String;
       DrawString = true;
      break;    
      case 27:
        exit(0);        
      break;                    
   }

and then in the draw function

fontx = tx + 3;
          fonty = ty + (th+8)/2;
         if(DrawString == true){
         glColor3f(0.0,0.0,0.0);               
         Font(GLUT_BITMAP_HELVETICA_12,(char*)String,fontx,fonty);
}

the intention here was to get the string from cin and put it in the string variable and then draw it to the screen. I know how to get
input with cin and put it in a variable with a console program, but i don't know how to do it with the glut keyboard. I also know how to draw text to the screen with glut. I have other questions but I will post them in seperate threads. Much thanks, Jody Bush

bushimports 0 Newbie Poster

No actually my draw functions don't have any parameters. Below is a copy of one of them.

void Circle::Draw()const{
  Shape::Draw();
 int i;
glPushMatrix();
 Shape::SetSize(Sizex,Sizey,Sizez);
// Shape::SetPosition(x,y,z);
// Shape::SetRotation(Angle,Rotx,Roty,Rotz);
glColor3f(r,g,b);

if(!FILL){   
     
   glEnable(GL_LINE_SMOOTH);
   glLineWidth(2);                          
   glPushMatrix(); 
   glBegin(GL_LINE_LOOP);
   for(i=0; i <= pnts; i++){
   float angle = 2 * PI * R / pnts;
   glNormal3f(cos(angle), 0, -sin(angle));
   angle = 2*PI * i / pnts;
   glVertex3f(x+R * cos(angle),y+R * sin(angle),z);
   }
   glEnd();
   glPopMatrix();  
              
}
else{
   glEnable(GL_POLYGON_SMOOTH);                          
   glPushMatrix(); 
   glBegin(GL_TRIANGLE_FAN);
   for(i=0; i <= pnts; i++){
   float angle = 2 * PI * R / pnts;
   glNormal3f(cos(angle), 0, -sin(angle));
   angle = 2*PI * i / pnts;
   glVertex3f(x+R * cos(angle),y+R * sin(angle),z);
   }
   glEnd();
   glPopMatrix();  
              
  }
glPopMatrix();
}

thanks again, Jody Bush

bushimports 0 Newbie Poster

I am trying to implement some getters and setters in an abstract class that I am calling from the derived class draw functions but I can't get the thing to compile and I don't know why. Shape is the abstract base class. I am getting the compiler error that says " passing `const Circle' as `this' argument of `void Shape::SetSize(float, float, float)' discards qualifiers" Below is the code I have for one of the setters and the way I am calling it from the draw functions.

protected:  
      float Sizex, Sizey, Sizez;                          //the member variables for this setter  

 void SetSize(float sx,float sy,float sz);                //the declaration

 void Shape::SetSize(float sx,float sy,float sz){        //the definition  
 this->Sizex = sx;  this->Sizey = sy; this->Sizez = sz;   
 glScalef(Sizex,Sizey,Sizez);                             
 }


 Shape::SetSize(Sizex,Sizey,Sizez);                      // the call from the draw functions

I would greatly apprreciate any help I can get. Much Thanks, Jody Bush