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 - BMCha

Pages: [1]
1
General / GetFrameTime bug?
« on: July 21, 2009, 07:31:16 am »
Without SetFramerateLimit, I get fps around 2200. Also, I just ran it with fraps, and it reported 60 fps instead of the 30 that my fps counter reported when I moved the mouse with vsync on. Also, when my fps goes down to 30, it sometimes shows random high numbers(usually > 10,000). I'm now thinking that it has something to do with the getframetime function I'm using for fps calculation.

2
General / GetFrameTime bug?
« on: July 21, 2009, 02:27:10 am »
EDIT: After a test, this topic has been changed.

If I run my game with frame limiting enabled, It correctly reports 60 fps. However, if I run with vsync, it runs at 60, but reports 30 fps when I move my mouse, sometimes showing very large numbers around 10,000. Commenting out my event loop fixes the problem.

Event loop below:
Code: [Select]

while (App.GetEvent(Event))
        {
            // Window closed
            if (Event.Type == sf::Event::Closed)
                App.Close();

            if (Event.Type == sf::Event::KeyPressed && Event.Key.Code == sf::Key::Space && jumping==false) {
                body->ApplyImpulse(b2Vec2(0.f,-80.f), body->GetPosition());
                jumping=true;
            }

            if (Event.Type == sf::Event::MouseButtonPressed && Event.MouseButton.Button == sf::Mouse::Left) {
                //calculate starting pos and vector
                sf::Vector2f P2MVec;
                sf::Vector2f MousePos=App.ConvertCoords(Input.GetMouseX(), Input.GetMouseY(), &MainView);
                P2MVec.x=MousePos.x-body->GetPosition().x;
                P2MVec.y=MousePos.y-body->GetPosition().y;
                P2MVec=VecTools::Normalize(P2MVec);
                //create grenade
                Grenade * boop=new Grenade (body->GetPosition().x,body->GetPosition().y,P2MVec.x,P2MVec.y,1.f);
                UpdateList.push_back(boop);
            }
        }







OLD TOPIC:
If I have vsync enabled in my program, it runs fine, but whenever I move the mouse the fps drops to 30 from 60. If I disable vsync and instead limit the framerate to 30, there is not fps drop. In an attempt to find the cause, I commented out my event loop, and there was no drop. Perhaps it has something to do with mousemove events? This isn't a game-breaking bug, but it would be nice to be able to use vsync.

3
General / Inheritance Problem?
« on: May 10, 2009, 05:25:56 am »
I have a class that inherits from sf::Sprite called AnimSprite.
Now, I'm trying to make a player class that inherits from AnimSprite.
Everything works fine until I try to add a constructor to PlayerClass. Right now the constructor is exactly the same as the (working) AnimSprite constructor.

Code: [Select]

PlayerClass::PlayerClass(std::string ImagePath) {
    if (!MyImage.LoadFromFile(ImagePath)) throw(-1);
    SetImage(MyImage);
}


This is the Error
Code: [Select]

In constructor `PlayerClass::PlayerClass(std::string)':
error: no matching function for call to `AnimSprite::AnimSprite()'
note: candidates are: AnimSprite::AnimSprite(const AnimSprite&)
note:                 AnimSprite::AnimSprite(std::string)
|=== Build finished: 1 errors, 0 warnings ===|

Pages: [1]