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

Pages: [1]
1
Window / Moving mouse events = FPS drop. Bottleneck?
« on: April 08, 2010, 01:23:50 am »
hahaha I know :D

and once again, Thank you so much Laurent. SFML has been really great. Love it :D

2
Window / Moving mouse events = FPS drop. Bottleneck?
« on: April 07, 2010, 02:00:24 am »
hmmm ... confused ... :roll:

I stopped development for a while after my previous post. Then only recently I have decided to upgrade to SFML 1.6 (Thank you Laurent :D). I tried running the same program again, and this time no problem.

So ... all is good.
Thx Meseira :D

3
Window / Moving mouse events = FPS drop. Bottleneck?
« on: April 04, 2010, 03:26:49 am »
Hi, firstly the code:

Code: [Select]
#include <iostream>
#include <sstream>
#include <SFML/Graphics.hpp>
using namespace std;

template <class T>
inline static string toString (const T& t) {
  std::stringstream ss;
  ss << t;
  return ss.str();
}

int main() {
  sf::RenderWindow App(sf::VideoMode(800, 600, 32), "SFML OpenGL");
  sf::Clock Clock;

  glClearColor(0.f, 0.f, 0.f, 0.f);
  glMatrixMode(GL_PROJECTION);
  glLoadIdentity();
  gluPerspective(90.f, 1.f, 1.f, 500.f);

  sf::Event Event;
  sf::String fpsDisplay;  
  fpsDisplay.SetFont(sf::Font::GetDefaultFont());
  fpsDisplay.Move(10,10);

  App.SetFramerateLimit(60);
  App.UseVerticalSync(true);

  while (App.IsOpened()) {
    fpsDisplay.SetText("FPS: " + toString(1/App.GetFrameTime()));
    //cout << (1/App.GetFrameTime()) << endl;

    while (App.GetEvent(Event)) {
      //Irrelevant. An empty event polling will still cause a drop
      if (Event.Type == sf::Event::Closed) {App.Close();}
    }
    App.SetActive();
    glClear(GL_COLOR_BUFFER_BIT);
    App.Draw(fpsDisplay);
    App.Display();
  }
  return EXIT_SUCCESS;
}


Now, if I move my mouse wildly around in the window (just moving the mouse, not pressing anything), the frame rate drops from 60 to ~35-45. Is there a way around this or to fix this?

I don't want my game slowing down cause the user accidentally moves the mouse across the screen lol

Setup: SFML 1.5, VS Studio 2008, C++, Windows 7 64Bit

Thank you very much :)

Pages: [1]
anything