Welcome, Guest. Please login or register. Did you miss your activation email?

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - vietanh8286

Pages: [1]
1
General / Problem with sf::Clock
« on: August 03, 2012, 03:49:21 am »
Hi there,
I have a problem with below code:

       
         int Fps::getFps(sf::Time elapsedTime)
        {
                static int frameCounter = 0;
                static float frameTime = 0.0f;
                static int fps = 0;
                frameCounter++;
                frameTime += elapsedTime.asSeconds();
                if(frameTime >= 1.0f)
                {
                        fps = frameCounter;
                        frameCounter = 0;
                        frameTime -= 1.0f;
                }
                return fps;
        }
 

       
        void Game::processRenderThread()
        {
                if(renderWindow)
                {
                        renderWindow->setActive(true);
                        sf::Clock clock;
                        while(renderWindow->isOpen())
                        {
                                sf::Time elapsedTime = clock.getElapsedTime();
                                //clear
                                //draw something
                                //update and draw FPS
                                //display
                                sf::sleep(sf::milliseconds(1));
                                clock.restart();
                        }
                }
        }
 
If i use this code, the FPS is always equal 0

But, if i change:
                               
   sf::Time elapsedTime = clock.restart();
   //clear
   //draw something
   //update and draw FPS
   //display
   sf::sleep(sf::milliseconds(1));
 
It works!!!
Why???

2
Graphics / Re: Proplem with sf::Text
« on: July 30, 2012, 09:42:44 am »
 :( ohhhh!!! I forgot it :(
I fixed it. Very Thank you  ;D

3
Graphics / Re: Proplem with sf::Text
« on: July 30, 2012, 08:43:11 am »
I use Windows 7 64bit, VS2008 and SFML2 (81e4209)

4
Graphics / Proplem with sf::Text
« on: July 30, 2012, 05:50:54 am »
Hi there,

my code:

textFps->setString("FPS: "); <- has an exception: std::bad_alloc

but,

textFps->setString(L"FPS: ");
-> OK

-------------------------------------------------
extend:

std::stringstream ss;
ss << getFps(elapsedTime);
textFps->setString("FPS: " + ss.str());
-> has an exception: std::length_error

help me :( Thanks!!!

5
Graphics / How to draw drawable inside another?
« on: June 16, 2011, 12:24:35 pm »
i got it  :lol: haha it's amazing!!!

i read this thread that i need. Thanks!!!

6
Graphics / How to draw drawable inside another?
« on: June 16, 2011, 11:43:59 am »
Quote from: "Laurent"
In SFML 1, the common workaround is to use glScissor.


I use SFML 2. Have you example to do? Thanks!!! :oops:

7
Graphics / How to draw drawable inside another?
« on: June 16, 2011, 10:34:15 am »
Quote from: "Groogy"
If it's a Sprite you can change it's subrect to cut it off.

Though this seems like a missing part in Drawable. Or what do you think Laurent? Add some sort of clipping to Drawable so you can do it with shapes and text easily?


Oh, i understand. Thank you!
it's difficult for me :(

8
Graphics / How to draw drawable inside another?
« on: June 16, 2011, 10:03:33 am »

I am creating a GUI, like a panel. Look image that i want..
How i can do that?
Thanks for your help!!!

9
General discussions / Thanks
« on: November 27, 2010, 04:28:13 pm »
Code: [Select]

#define WORK_SUCCESS 1;

int main()
{
while(Lauren_Is_Still_Here())
{
while(Lauren_Check_Forum())
{
if(Has_Error_From_Member())
{
Lauren_Confirm_Error();
Lauren_Do_Task(); //Look error, fix it...(with others...)
}

if(Has_Question_From_Member())
{
Lauren_Answer_So_Quickly();
std::cout<<"You are special administrator that i have never ever seen before!";
}

       if(Lauren_Is_Feeling_Tired())
       {
       std::cout<<"Oa oa oa...zzzzZZZZ";
       break;
       }
}


}
std::cout<<"Oh my god...SFML is still more unknown and known bugs :D \n Members are waiting for you when start a new day and run this program again. \n Have a nice day!!!";
return WORK_SUCCESS;
}


Lauren, you are special administrator have i ever seen and i thank you for your SFML library.
It is so powerful!!!
Thank you!!! :lol:

Pages: [1]
anything