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.


Topics - Daepilin

Pages: [1]
1
Window / SetFramerateLimit makes the Game stutter
« on: July 28, 2013, 08:12:30 pm »
Hi :)

I've got a little problem with my game. If i use the built in SetFramerateLimit method to limit my Windows Framerate to 60 it varies a bit (not the problem) but has some issues:

1) stuttering. Quite regular the game stutters which results in double or tripple the "normal" rendertime for the window.
2) Framerate is actually below 60. On my system it's on 58, a friend tested it on quite a weak laptop and only got 53Fps(which stayed the same when he underclocked the thing, so i guess it's no lack of performance)

(Fps measured with Fraps, rendertimes with sf::clock. Don't get any Framedrops, when i leave the Limiter out but 1500+FPs is not what i want^^)

i wrote my own functionality, very crude, but working(no drops and bang on 60Fps on my machine), but: i don't really know how to prevent it from using the core it runs on at 100%:

Code: [Select]
void Framework::Render(){

if(mCurrentRenderFrameTime >= 0.01667){
mMainWindow->clear();
mMainStateManager->Render();
mMainWindow->display();

mCurrentRenderFrameTime = 0.0;
}
mCurrentRenderFrameTime += mFrameT / 1000000.0;
}

Code: [Select]
void Framework::RunGame(){
mCurrentRenderFrameTime = 1.0;
while (mMainWindow->isOpen()){

this->HandleEvents();
this->Update();
this->Render();
}
}


Any Tips how i could solve the problem?

2
Window / Get Window Style?
« on: June 23, 2013, 04:22:00 pm »
Hi :)

I was wondering if there is a way to get the current window style?

background is, that i would only want to recreate the window when the style changes (fullscreen to windowed and vice versa) and not always uppon applying my settings.

(atm i just recreate it either with one or the other style, but every time).

Code: [Select]
if(mSettings->GetFullscreen()){
mMainStateWindow->create(sf::VideoMode(sf::VideoMode::getDesktopMode()), "Test", sf::Style::Fullscreen);
}
else{
mMainStateWindow->create(sf::VideoMode(mSettings->GetXRes(), mSettings->GetYRes(), 32), "Testn", sf::Style::Close);
}

sure, i could have a history of my fullscreen setting but  i don't really like that solution.

3
Hi :)

I'm quite new to SFML and atm trying to write myself a GUI for a game in want to make.

For that i need a checkbox, but that doesn't work the way i think it should.

my code:

Code: [Select]
if(mInFocus == true){
if(sf::Mouse::isButtonPressed(sf::Mouse::Left)){
if(ev->MouseButtonReleased){
mState = !mState;
}
}
}

it keeps changing the mState Value when the button is pressed down and the mouse is moved in the checkbox area(mInFocus == true).

the button release seems to be ignored as long as there are other mouse events like the movement.

Any idea what i could do to prevent that from happening?

Pages: [1]
anything