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

Pages: [1] 2 3 ... 7
1
General discussions / Switched times to Uint32 milliseconds in SFML 2
« on: December 17, 2011, 09:08:15 am »
Yes, I think that if we care about the "Simple" in SFML, then the time unit should be 1 second, thus forcing to use a floating point variable. With a millisecond as a unit, if you want to keep all your variables true to the SI units, each time you have to divide the time by 1000.

2
Python / Help with PySFML
« on: November 29, 2011, 09:05:12 pm »
I don't understand why anybody who has windows should bother to compile SFML and PySFML on his own. It's that stupid linux obsession to compile everything. Give us one lib pack for windows and it will work. I think using MinGW is bad. Python was compiled in VC++ 2008.

I have complete PySFML2 libs compiled for Python 2.7 if you want.

3
Window / Beginner question about RenderWindow::Display()
« on: November 27, 2011, 12:33:05 am »
I think if you do not handle all events, the window will freeze.

4
Window / Input feels delayed at 60FPS
« on: November 26, 2011, 12:33:06 pm »
Quote from: "Laurent"
Quote
Just to make it clear, I managed to create a thread in Python

That will probably be worse, because there's no true threading in Python. But anyway, you'll see the result by yourself, and it will be an excellent use case for Bastien, if I remember correctly he was waiting for feedback before possibly improving multithreaded performances of the Python binding :)
But keep this in mind, the result might be worse.


Well, before I set the setactive to false, the other thread would never get executed. As a result I had my display window white and frozen. Then I set the setactive to false, it draws the first frame and then stops drawing.

In C++, how can you make a thread which uses RenderWindow that is not declared as a global?

5
Window / Input feels delayed at 60FPS
« on: November 25, 2011, 11:30:01 pm »
Quote from: "Laurent"
You're the first user to request it in 5 years, and only to implement a workaround for the lack of real threads in Python...


Just to make it clear, I managed to create a thread in Python, but I was having trouble to understand how to use sf::Window::SetActive (bool). I read the docs which state:

Quote
A window is active only on the current thread, if you want to make it active on another thread you have to deactivate it on the previous thread first if it was active. Only one window can be active on a thread at a time, thus the window previously active (if any) automatically gets deactivated.


Could you explain how to use the SetActive method? Is there a sample code somewhere that I could refer to (even in C++)? If I check the window input in the main loop and display the window in a thread, when should I call the setactive(false) and when the setactive(true). I mean, since the thread and the main loop run alternately, how to tell which thread should be the active one?

Also, I had to set the Window as global to be able to use it in the thread. Can the window object be passed somehow to the thread so that it's shared between the main loop and the thread? Again, can I find a code snippet in C++ somewhere that would demonstrate how sf:window and sf:thread can work together?

Thanks in advance for your help!

6
Window / [SOLVED]Need sf::Clock to be more specific
« on: November 23, 2011, 10:29:27 pm »
Quote from: "sbroadfoot90"
There's nothing much to floats (that's sort of a lie). For your purposes, think of a float as something that can store a decimal number to about 8 significant figures. A double can store about 16 significant figures.


That double precision is worthless when you're losing the fractions of a pixel each frame of not using floats.

7
Window / Input feels delayed at 60FPS
« on: November 23, 2011, 06:07:18 pm »
Quote from: "SuperV1234"
Quote from: "kolofsson"
Where exactly do you set the framerate limit for the window in case of static framerate?


I'm just doing this currently:
Code: [Select]
RenderWindow.EnableVerticalSync(false);
RenderWindow.SetFramerateLimit((uint) SSSettings.FramerateLimit);


with SSSettings.FramerateLimit being 60.


Somebody prove me wrong, but I think you should use either EnableVerticalSync or SetFramerateLimit. If you enable Vsync, there is no need to limit the framerate as it is limited.

8
Window / Input feels delayed at 60FPS
« on: November 23, 2011, 02:52:24 pm »
Quote
Code: [Select]
if (SSSettings.FrametimeStatic) frameTime = SSSettings.FrametimeStaticValue;
Game.Update(frameTime);


What is SSSettings? What does Game.Update do with the frameTime?

Where exactly do you set the framerate limit for the window in case of static framerate?

9
Window / [SOLVED]Need sf::Clock to be more specific
« on: November 23, 2011, 10:18:26 am »
Quote from: "Tex Killer"
The measured time is a float representing the ammount of seconds that has passed. By putting it into an integer, you are cutting the smaller parts and taking only the integer part. If you want milliseconds, just multiply the float by 1000 before truncationg it into an integer.


In SFML2 GetElapsedTime is a Uint32 measuring time in milliseconds. I think the X and Y should be floats not ints.

If you want an accurate timer, do not reset it, instead calculate the difference

Code: [Select]
last_frame = FootImgClock.GetElapsedTime();
while (running)
{
    frame_time = FootImgClock.GetElapsedTime() - last_frame;
    last_frame = FootImgClock.GetElapsedTime();
    Player.Move(frame_time, 0);
}

10
Window / Input feels delayed at 60FPS
« on: November 20, 2011, 09:10:39 pm »
Quote from: "Laurent"
Quote
would this addition be a big complication

Yes :)


Really? If you say so...

I just found how to get it in python and on windows:

Code: [Select]
import win32api

device = win32api.EnumDisplayDevices()
settings = win32api.EnumDisplaySettings(device.DeviceName, 0)
print 'DeviceName:', device.DeviceName
print 'DeviceString:', device.DeviceString
print 'BitsPerPel:', settings.BitsPerPel
print 'DisplayFrequency:', settings.DisplayFrequency
print 'PelsWidth:', settings.PelsWidth
print 'PelsHeight:', settings.PelsHeight


Returns:
Code: [Select]
DeviceName: \\.\DISPLAY1
DeviceString: NVIDIA GeForce GTX 260
BitsPerPel: 32
DisplayFrequency: 60
PelsWidth: 640
PelsHeight: 480


It looks pretty simple to me, but it's only for windows...

11
Window / Input feels delayed at 60FPS
« on: November 20, 2011, 07:46:33 pm »
Sure thing, Laurent, I don't want to complicate SFML or convince you to do useless work. But would this addition be a big complication:

Code: [Select]
current_mode = sf::VideoMode::GetDesktopMode()
refresh_rate = current_mode.RefreshRate

or

RenderWindow::GetScreenRefreshRate()


 :?:

12
Window / Input feels delayed at 60FPS
« on: November 20, 2011, 05:04:18 pm »
Quote from: "Laurent"
SFML is very low-level, it provides building blocks but then it's up to you to decide how to use these blocks. If you want display and input to be separated, then separate them ;)

But to be honest, I've never had problems with input at 60Hz, I think it is responsive enough for most applications. What kind of app are you developping? What are inputs used for?


I created an app that measures response time. Since typical human response ranges between 0.2 and 0.3 second, I would need better granularity than 0.0166 of a second. Without it my app is showing 0.233 all the time (exactly 14 frames out of 60).

Here is my app (windows, but runs on wine):
http://grebocin.com/upload/screenway11.zip

My final goal is to make an online racing game and I think it would be useful to shave off these extra 16 ms of lag that the display generates.

I agree about the blocks thing, but unfortunately I can't create some blocks myself. If SFML could at least retrieve refresh rate of current video mode, I would know when to call window.display to cause the least delay. Also, I think it's not possible to get a list of supported refresh rates at given resolution or to set a video mode with a desired refresh rate, right?

13
Python / pysfml2-cython
« on: November 20, 2011, 04:27:48 pm »
I've been looking at sf.Event documentation in the docs and I think this is missing:

Code: [Select]
       CLOSED: 'Closed',
        RESIZED: 'Resized',
        LOST_FOCUS: 'Lost focus',
        GAINED_FOCUS: 'Gained focus',
        TEXT_ENTERED: 'Text entered',
        KEY_PRESSED: 'Key pressed',
        KEY_RELEASED: 'Key released',
        MOUSE_WHEEL_MOVED: 'Mouse wheel moved',
        MOUSE_BUTTON_PRESSED: 'Mouse button pressed',
        MOUSE_BUTTON_RELEASED: 'Mouse button released',
        MOUSE_MOVED: 'Mouse moved',
        MOUSE_ENTERED: 'Mouse entered',
        MOUSE_LEFT: 'Mouse left',
        JOYSTICK_BUTTON_PRESSED: 'Joystick button pressed',
        JOYSTICK_BUTTON_RELEASED: 'Joystick button released',
        JOYSTICK_MOVED: 'Joystick moved',
        JOYSTICK_CONNECTED: 'Joystick connected',
        JOYSTICK_DISCONNECTED: 'Joystick disconnected'

14
Window / Input feels delayed at 60FPS
« on: November 20, 2011, 03:45:59 pm »
HAHA welcome to the club. Im really puzzled that nobody had problems with it before :D.

Check this: http://sfml-dev.org/forum/viewtopic.php?t=6237

With vertical sync you get a framerate pegged to 60/75/100 Hz. This is because each frame the window.display() pauses the whole application until the graphics card decides it is safe to fill the video buffer without the risk of tearing.

So, in 60 FPS 1 frame lasts 1 / 60 = 0,01667 seconds

Now, imagine you press a key just after the display method was called. It waits and waits, and your input stays unregistered. The worst case is getting 0,0166 delay because of Vertical Sync.

Laurent, maybe it would be possible for you to put the window.display in a thread, so it would not freeze the whole application? I really don't see why limiting DISPLAY framerate should limit the CALCULATION framerate.

A partial solution to your problem could be sth like this. It's in python but you may use the sf::Clock instaead of time:
Code: [Select]
     if time.clock() - last_display > 0.016:
         window.clear(sf.Color(200,   0,   0))
         window.display()
         last_display = time.clock()


It calls the window.display right before the Vertical Sync

15
Python / What version of Python for Windows 7 64 bit?
« on: November 20, 2011, 02:57:41 pm »
Quote from: "bastien"
Can you use this tool to see which libraries to load?
http://www.dependencywalker.com/


I'm not sure if know how to use this tool and if I should have examined the sf.pyd file, but there it goes:



http://grebocin.com/upload/sf.dwi

I downloaded the two missing files libgcc_s_dw2-1 and libstdc++-6 and now your libraries work LOL. I guess some MinGW redistributable would be required :D.

If I might suggest anything, you could use the Pyinstaller to convert the pong example to an execuable. It does a miraculous work of putting all missing DLLs in the folder together with the EXE, or even putting everything inside a single EXE file.

When I ran the Walker through my sf.pyd, these 2 were missing: GPSVC and IESHIMS. They are also missing in your sf.pyd. I have no idea why both run fine without these DLLs.

Pages: [1] 2 3 ... 7