Jump to content

  • Log In with Google      Sign In   
  • Create Account


#ActualXuchilbara

Posted 29 November 2012 - 12:40 PM

EDIT:

Hey there,

I've just realized that the title may be kind of misleading. so I'm rewriting this part.

Basically I have added a new method which holds the following 'functions' in the title, and I believe its causing my program to break at a very strange point in my 'UpdateSentence' method.

Here is the method I have just recently added "setFPS" in my Text class.

bool Text::setFPS(int fps, ID3D11DeviceContext* deviceContext)
{
char tempS[16];
char fpsS[16];
float red = 1.0f;
float green = 1.0f;
float blue = 1.0f;
bool r;
if(fps > 9999) //Truncate the fps
{
  fps = 9999;
}
_itoa_s(fps, tempS, 10);
strcpy_s(fpsS, "FPS: ");
strcat_s(fpsS, tempS);
/*
if(fps >= 60)   //if FPS is above or equal to 60 set text colour to green
{
  red  = 0.0f;
  green = 1.0f;
  blue = 0.0f;
}
if(fps < 60)   //if FPS is below 60 set text colour to yellow
{
  red  = 1.0f;
  green = 1.0f;
  blue = 0.0f;
}
if(fps < 30)   //if FPS is below 30 set text colour to red
{
  red  = 1.0f;
  green = 0.0f;
  blue = 0.0f;
}
*/
r = UpdateSentence(sentence3, fpsS, 20, 20, red, green, blue, deviceContext);
if(!r)
{
  return false;
}
return true;
}

Now the application isn't breaking/crashing at this point, it's breaking at another method called "UpdateSentence" which you can see in the screenshot here:

http://img547.imageshack.us/img547/3619/accessviolation2.png

Here is the break I'm getting, it seems to be happening with adding colour to the function and I have no idea why its playing up now when it previously wasn't.

Also if someone needs to see more code just ask and I can show

If someone could shine some light on this I would be greatful

#2Xuchilbara

Posted 29 November 2012 - 12:39 PM

EDIT:

Hey there,

I've just realized that the title may be kind of misleading. so I'm rewriting this part.

Basically I have added a new method which holds the following 'functions' in the title, and I believe its causing my program to break at a very strange point in my 'UpdateSentence' method.

Here is the method I have just recently added "setFPS" in my Text class.

bool Text::setFPS(int fps, ID3D11DeviceContext* deviceContext)
{
char tempS[16];
char fpsS[16];
float red = 1.0f;
float green = 1.0f;
float blue = 1.0f;
bool r;
if(fps > 9999) //Truncate the fps
{
  fps = 9999;
}
_itoa_s(fps, tempS, 10);
strcpy_s(fpsS, "FPS: ");
strcat_s(fpsS, tempS);
/*
if(fps >= 60)   //if FPS is above or equal to 60 set text colour to green
{
  red  = 0.0f;
  green = 1.0f;
  blue = 0.0f;
}
if(fps < 60)   //if FPS is below 60 set text colour to yellow
{
  red  = 1.0f;
  green = 1.0f;
  blue = 0.0f;
}
if(fps < 30)   //if FPS is below 30 set text colour to red
{
  red  = 1.0f;
  green = 0.0f;
  blue = 0.0f;
}
*/
r = UpdateSentence(sentence3, fpsS, 20, 20, red, green, blue, deviceContext);
if(!r)
{
  return false;
}
return true;
}

Now the application isn't breaking/crashing at this point, it's breaking at another method called "UpdateSentence" which you can see in the screenshot here:

http://img547.imageshack.us/img547/3619/accessviolation2.png

Here is the break I'm getting, it seems to be happening with adding colour to the function and I have no idea why its playing up now when it previously wasn't.

If someone could shine some light on this I would be greatful

#1Xuchilbara

Posted 29 November 2012 - 12:20 PM

Hey there,

I've recently tried to display FPS to my screen and I've come across 3 new functions I've never seen and it seems to be breaking my application, atleast I think it is.

Since I've added this method into my text class

bool Text::setFPS(int fps, ID3D11DeviceContext* deviceContext)
{
char tempS[16];
char fpsS[16];
float red = 1.0f;
float green = 1.0f;
float blue = 1.0f;
bool r;
if(fps > 9999) //Truncate the fps
{
  fps = 9999;
}
_itoa_s(fps, tempS, 10);
strcpy_s(fpsS, "FPS: ");
strcat_s(fpsS, tempS);
/*
if(fps >= 60)   //if FPS is above or equal to 60 set text colour to green
{
  red  = 0.0f;
  green = 1.0f;
  blue = 0.0f;
}
if(fps < 60)   //if FPS is below 60 set text colour to yellow
{
  red  = 1.0f;
  green = 1.0f;
  blue = 0.0f;
}
if(fps < 30)   //if FPS is below 30 set text colour to red
{
  red  = 1.0f;
  green = 0.0f;
  blue = 0.0f;
}
*/
r = UpdateSentence(sentence3, fpsS, 20, 20, red, green, blue, deviceContext);
if(!r)
{
  return false;
}
return true;
}

My UpdateSentence method (which was previously working fine) seems to be throwing some kind of weird errors, and I believe it to be because of those new functions in the title.

http://img547.imageshack.us/img547/3619/accessviolation2.png

Here is the break I'm getting, it seems to be happening with adding colour to the function and I have no idea why its playing up now when it previously wasn't.

If someone could shine some light on this I would be greatful

PARTNERS