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

Pages: [1]
1
Graphics / Re: Untolerably Slow Debug
« on: June 01, 2013, 12:41:33 pm »
Are you inadvertently copying large objects? When I ported my game from C#/XNA to C++/SFML, I had similar issues because I was unfamiliar with C++.

2
Feature requests / Re: How to find out if window has focus?
« on: May 14, 2013, 12:11:27 am »
Thanks a lot. Sadly that's not cross platform. I'll use that code, but my feature request to implement that for all platforms in SFML remains.

Luckily I had to also do this in Linux and OSX ;) it's really hacky, but let me know if you'd like the code.

3
Feature requests / Re: How to find out if window has focus?
« on: May 09, 2013, 10:35:34 pm »
I had similar problems, so I added a function for testing focus directly.

Here's the Windows implementation:

bool appInFocus(sf::RenderWindow* app)
{
        if(app == NULL)
                return false;

        HWND handle = app->getSystemHandle();
        bool one = handle == GetFocus();
        bool two = handle == GetForegroundWindow();

        if(one != two) //strange 'half-focus': window is in front but you can't click anything - so we fix it
        {
                SetFocus(handle);
                SetForegroundWindow(handle);
        }

        return one && two;
}
 

This has always worked perfectly for me.

4
Window / Speed issues with Joystick event processing
« on: February 29, 2012, 02:28:39 pm »
Sorry to bump an old topic, but I also had this problem and discovered a different solution.

I modified JoystickImpl::IsConnected to use XInput instead of JoyGetPosEx, and there's no longer any lag. I was getting huge spikes when triggering mouse move events on my SFML window, particularly when a gamepad was recently unplugged (even after restarting the program).


This probably only works for Xbox controllers as I haven't got anything else to test it with, but here's what I changed:

src\SFML\Window\Win32\JoystickImpl.cpp
Code: [Select]

#include <Xinput.h>
...
bool JoystickImpl::IsConnected(unsigned int index)
{
    //removed joyGetPosEx stuff

    XINPUT_STATE dummy;
    ZeroMemory(&dummy, sizeof(XINPUT_STATE));
    DWORD result = XInputGetState(index, &dummy);
    return result == ERROR_SUCCESS;
}


But it allows you to poll the connection state as often as you like with no slowdown.

5
General / SetFramerateLimit does not seem to work correctly
« on: February 01, 2012, 12:23:25 am »
I get this too. I got the latest SFML build today, and this is what happens:

Code: [Select]

//stays fairly constant at 60fps but very visibly stutters every few frames
EnableVerticalSync(true);
SetFramerateLimit(60);

//stays very loosely around 60fps (around 50-80), but runs smoothly
EnableVerticalSync(false);
SetFramerateLimit(60);


oh and also, the first bit of code works perfectly in Ubuntu 11.10 without stuttering.

6
General discussions / New graphics API ready
« on: January 16, 2012, 05:36:34 pm »
I can, since it works now:

Code: [Select]

sf::VertexArray va(sf::Quads, 4);
va.Append(sf::Vertex(sf::Vector2f(0, 0), sf::Color::Red));
va.Append(sf::Vertex(sf::Vector2f(100, 0), sf::Color::White));
va.Append(sf::Vertex(sf::Vector2f(100, 100), sf::Color::Black));
va.Append(sf::Vertex(sf::Vector2f(0, 100), sf::Color::Yellow));
rTarget->Draw(va); //any render target


after my fixes:



Thanks!

7
General discussions / New graphics API ready
« on: January 16, 2012, 04:18:00 pm »
I'm trying to convert my project to the new system, but I've come across a problem. There no longer seems to be a way to set individual point colours in ConvexShapes. I was previously using them to do this:



I could take the polygons that I draw (see below) and set a different fill colour for each one, but that won't interpolate between vertices and looks like coloured squares instead of a nice gradient.



Is this going to be a feature later on?

Pages: [1]
anything