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

Pages: [1]
1
Window / GetEvent always returns true
« on: December 31, 2009, 02:45:30 am »
Just a little update:

It turned out that it was the JoyMoved event that bombarded my loop, and I don't have a joystick connected to the PC. I seem to remember reading about this somewhere a long time ago but I cant find it right now.

Anyway, if anyone else using linux have this problem when they disconnect the joystick it would be interesting to know.


[edit]
Using the jstest utility from the joystick package it turns out that the /dev/input/js0 device thinks it detects a joystick, even though it is the mouse:
Code: [Select]

# jstest /dev/input/js0
Driver version is 2.1.0.
Joystick (Microsoft Microsoft® SideWinder™ X5 Mouse) has 36 axes (X, Y, Z, Rx, Ry, Rz, Throttle, Rudder, Wheel, Hat0X, Hat0Y, Hat1X, (null), (null), (null), (null), (null), (null), (null), (null), (null), (null), (null), (null), (null), (null), (null), (null), (null), (null), (null), (null), (null), (null), (null), (null))
and 7 buttons (BtnThumbL, BtnThumbR, LeftBtn, RightBtn, MiddleBtn, SideBtn, ExtraBtn).
Testing ... (interrupt to exit)
...


I guess this is a kernel or driver issue, as you suggested

2
Window / GetEvent always returns true
« on: December 31, 2009, 01:51:17 am »
Quote from: "Laurent"
This code looks ok.

I don't know, maybe you have a configuration issue. For example, I have a similar problem with my keyboard: the OS sees it as a joystick (in addition to a keyboard), and SFML is stuck in the event loop generating random joystick events. I still haven't found why my Debian does that.


Ok, I'll try to investigate that. Thanks for the replies

3
Window / GetEvent always returns true
« on: December 30, 2009, 10:17:52 pm »
Quote from: "Laurent"
Hi

Can you show a minimal and complete piece of code that reproduces this problem?


Code: [Select]

#include <string.h>
#include <SFML/Window.hpp>
using namespace sf;

int main()
{
    Window App(sf::VideoMode(800, 600, 32), "SFML Window");
    App.ShowMouseCursor(false); // this one doesn't help

    bool Running = true;
    while (Running)
    {
        Event Event;
        memset((void*)&Event, 0, sizeof(Event)); // this one doesnt help either

        while (App.GetEvent(Event))
        {        
            if (Event.Type == Event::Closed)
                Running = false;
       
            if ((Event.Type == Event::KeyPressed) && (Event.Key.Code == Key::Escape))
                Running = false;
        }

        App.Display();
    }

    return EXIT_SUCCESS;
}



Linux 2.6.31-6.slh.2-sidux-amd64 #1 SMP PREEMPT x86_64 GNU/Linux
Code::Blocks SVN 5911
SFML 1.5


I have added sfml-window.so and sfml-system.so to the linker libraries, in that order.
I also added SFML_DYNAMIC to the #defines section

4
Window / GetEvent always returns true
« on: December 30, 2009, 02:17:02 am »
Hi again,

I seem to have a problem with events when I migrate my code to linux and gcc

Here is a snippet of my game loop:

Code: [Select]

void StateManager::startRendering()
{
mRunning = true;
while (mRunning)
{
while (mRenderWindow->GetEvent(mEvent))
{
if (mEvent.Type == Event::Closed)
{
mRunning = false;
}
else if(mEvent.Type == Event::KeyPressed)
{
mStates.back()->keyPressed((Event::KeyEvent&)mEvent.Key);
}
else if(mEvent.Type == Event::KeyReleased)
{
mStates.back()->keyReleased((Event::KeyEvent&)mEvent.Key);
}
}

mRenderWindow->Clear();

if(mStates.back()->frameRender(*mRenderWindow))
{
                 mRunning = false;
}

mRenderWindow->Display();
}

mRenderWindow->Close();
}


This code works fine on windows and VC++, but in linux the event while loop --> while (mRenderWindow->GetEvent(mEvent)) <-- always returns true.
According to the debugger the first few events catched seems reasonable (Joy_Moved, Gained_Focus and Mouse_Entered)
After that it constantly receives the event Mouse_Moved.
The while loop never stops and obviously the code never reaches the actual rendering futher down.
I have tried to replace the while with an if, and then things start to work as expected. But I don't want to do that do I?

Am I overlooking something here or is this a bug?

5
Graphics / Sprite::GetCenter
« on: December 28, 2009, 10:41:51 pm »
Quote from: "Nexus"
In SFML 2, the method is called GetOrigin(), this name is less confusing.


Agree.
So I assume SFML2 won't be backward compatible with SFML?

6
Graphics / Sprite::GetCenter
« on: December 28, 2009, 07:00:46 pm »
Quote from: "Laurent"
It's not the center like (width / 2, height / 2), it's the center of translation/rotation/scaling that you set with SetCenter. So yes, it's always (0, 0) until you change it :)


Ahh, I get it.
Thanks for the quick reply

7
Graphics / Sprite::GetCenter
« on: December 28, 2009, 05:33:20 pm »
Hello

I seem to have a strange problem with Sprite::GetCenter using the latest trunc from SVN. Basically, it always returns coordinates 0.0, 0.0

Is this a known issue?

My system is Windows 7 x64, VC++ 2008 express

8
Graphics / SetFramerateLimit problem
« on: December 28, 2009, 05:26:59 pm »
Im having a similar problem.
I'm using Windows 7 x64, VC++ 2008 Express and latest trunc of SFML from SVN.

Running with no clamps on the frame limit and vertical sync disabled I get ~2700 FPS

Using SetFramerateLimit here is the measures I get:
Code: [Select]

FrameLimit(10) - FPS(9)
FrameLimit(20) - FPS(16)
FrameLimit(30) - FPS(21)
FrameLimit(40) - FPS(32)
FrameLimit(50) - FPS(32)
FrameLimit(60) - FPS(32) Jumps to 64 now and then
FrameLimit(70) - FPS(64)
FrameLimit(80) - FPS(64)
FrameLimit(120) - FPS(64)
FrameLimit(500) - FPS(64)
FrameLimit(700) - FPS(1800)
FrameLimit(800) - FPS(2700)
FrameLimit(> 800) - FPS(2700)


Here is how I calculate FPS:
Code: [Select]

float framerate = 1.f / window.GetFrameTime();
std::stringstream ss;
ss << "FPS: " << framerate;
mDebugInfo->SetText(ss.str());

9
General / GL_INVALID_OPERATION with sf::String
« on: December 26, 2009, 06:07:49 pm »
Hello

I see that this issue has been discussed before so I just thought I would add some info about it.

This is what I use:
Windows 7 x64
Visual C++ 2008 express edition
SFML 1.5 (Official stable download)

As soon as I declare a sf::String anywhere in the code I get the following error at program exit:
Code: [Select]

An internal OpenGL call failed in image.cpp (769) : GL_INVALID_OPERATION, the specified operation is not allowed in the
current state


I have also tried with the example code at this location
http://www.sfml-dev.org/tutorials/1.5/sources/graphics-sprite.cpp
and the same happens. As soon as I add a sf::String declaration I get the error.

I downloaded the latest trunc (Some issues with compilation due to my express version but I got the files I needed) but the error is still there.

By the way, the error only shows up when running in debug mode

edit:
After some more testing it seems to be the call to GetDefaultFont()

Pages: [1]