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

Pages: [1]
1
Window / Xbox 360 controller: invalid axis values (linux)
« on: February 03, 2015, 05:22:26 pm »
Hello,

I started digging into coding gamepad support for my game, but ran into some issues, particularly with getting seemingly bad values from the axis inputs on my (brand new) Xbox 360 wired controller.

When I compile and start my program, I see the following printed to stdout:

Quote
Unable to get joystick attribute. Could not find USB device for joystick at index 0.
Unable to get joystick attribute. Could not find USB device for joystick at index 0.

When I query the values of sf::Joystick::getIdentification(0), I get the following:

Quote
name: Microsoft X-Box 360 pad
vendorId: 0
productId: 0

I am able to see input occurring from all of the buttons and axis, however the state of the axis appear to be incorrect. In the resting/center position, either of the axis will return values anywhere across the spectrum, from -1 to 1.

For example:

sf::Joystick::update()
float x = sf::Joystick::getAxisPosition(0, sf::Joystick::X);
float y = sf::Joystick::getAxisPosition(0, sf::Joystick::Y);

sf::Vector2f normalized = normalize(x, y);

Output at resting/center position (not touching the controller):

Quote
x: -0.977409
y: 0.211355

If I move the controller around and then release it back to the resting state, it will give a totally different set of nonzero values. At least one of the x/y axis is typically pegged at around 0.9 (or -0.9).

Interestingly, I plugged in another generic controller with a similar layout (an old Belkin Nostromo N45) and it works fine with the same code, giving zero values in the center position and normal/expected values throughout it's movement range (although SFML outputs the same warning message about not finding the USB device).

However, the Xbox gamepad works great and behaves as expected in all other games on my system, so I don't think it's faulty controller hardware.

I'm running the latest SFML (built from github source) on Archlinux x86_64. The xpad driver module is automatically loaded.

2
General / Thor: Moving particle emitters
« on: December 03, 2014, 08:22:54 am »
Hello,

I'm trying out Thor 2.0 with the git development version of SFML and have a basic question about the particle system. However after several attempts and re-reads of the docs, I seem to be missing something simple or fundamental: how do I change the position of the particle emitters themselves after creation?

I need to be able to move emitters along with other moving objects in my game, such as the main character. However subsequent calls to emitter.setParticlePosition() have no effect, unless perhaps I completely remove and re-create the emitter on every frame, which of course doesn't make sense.

According to the tutorial:

Quote
There is one concrete emitter type in Thor, namely thor::UniversalEmitter. This class can determine parameters like emission rate as well as initial particle conditions such as position, rotation or lifetime. However, UniversalEmitter itself has no geometric representation in 2D space.

Since the API doesn't seem to have any obvious setPosition()-like method, beyond setting the initial parameters upon creation, what's the trick to transforming emitters in 2D space?

Thanks!

Pages: [1]
anything