SDL and mouse x and y axis swapped
Moderator: OpenTTD Developers
-
- Engineer
- Posts: 49
- Joined: 09 Oct 2010 13:45
- Location: Göteborg, Sweden
SDL and mouse x and y axis swapped
Hi,
I'm new to this forum.
I recently compiled openttd for my mini2440 development board. It's an armv4t device with a tslib touchscreen.
OpenTTD runs very nicely on it, however, the x and y axis of the touch screen is wrong. When I move the mouse up and down, it moves left and right. The calibration tool with tslib shows its fine.
I Looked at the SDL environment variables to see if there was anything there I could tweak, but I couldn't find anything that would work.
Is there some trick to getting the raw mouse events to work with SDL and with openttd? I Do not want to end up having to run this in X. My little dev board can hardly handle it.
Thanks,
Bill
I'm new to this forum.
I recently compiled openttd for my mini2440 development board. It's an armv4t device with a tslib touchscreen.
OpenTTD runs very nicely on it, however, the x and y axis of the touch screen is wrong. When I move the mouse up and down, it moves left and right. The calibration tool with tslib shows its fine.
I Looked at the SDL environment variables to see if there was anything there I could tweak, but I couldn't find anything that would work.
Is there some trick to getting the raw mouse events to work with SDL and with openttd? I Do not want to end up having to run this in X. My little dev board can hardly handle it.
Thanks,
Bill
Re: SDL and mouse x and y axis swapped
Maybe the calibration tool is coded with to work with a bug in SDL that swaps the axis.
To test this you should test some other SDL applications as well to see whether they work correctly or are broken as well. If they're broken as well it's most likely something in SDL that needs to be fixed, though it might be something "stupid" in OpenTTD as well. In any case, testing some other generic SDL application should give an idea where the bug is.
To test this you should test some other SDL applications as well to see whether they work correctly or are broken as well. If they're broken as well it's most likely something in SDL that needs to be fixed, though it might be something "stupid" in OpenTTD as well. In any case, testing some other generic SDL application should give an idea where the bug is.
-
- Engineer
- Posts: 49
- Joined: 09 Oct 2010 13:45
- Location: Göteborg, Sweden
Re: SDL and mouse x and y axis swapped
Rubidium wrote:Maybe the calibration tool is coded with to work with a bug in SDL that swaps the axis.
To test this you should test some other SDL applications as well to see whether they work correctly or are broken as well. If they're broken as well it's most likely something in SDL that needs to be fixed, though it might be something "stupid" in OpenTTD as well. In any case, testing some other generic SDL application should give an idea where the bug is.
As far as I know, ts_calib isn't written at all with SDL in mind. It's simply a low level calibration tool that uses libts (tslib) to create a calibration file. Theres a ts_test as well which shows whether the calibration is correct or not, which allows you to draw lines and shows a crosshair to show that it's working correctly.
I really don't know of any simple SDL applications I could test. I'm actually new to SDL altogether. Is there a specific version of SDL that is recommended for OpenTTD compilation? And has anyone else successfully got this working on ARM with a touch screen?
Bill
-
- Engineer
- Posts: 49
- Joined: 09 Oct 2010 13:45
- Location: Göteborg, Sweden
Re: SDL and mouse x and y axis swapped
Oh I should note, that I used OpenEmbedded to compile openttd since it already had a recipe for bitbake in it.
0.7.4 is the version of openttd its compiling.
The recipe configures it this way:
And it has dependencies of
It's using libsdl-net 1.2.7
You may be saying this is something I should post on a openembedded forum, but since it compiles clean and runs, nobody there can help. And nobody there seems to be running this on my device so they dont seem to have any help for me.
Bill
0.7.4 is the version of openttd its compiling.
The recipe configures it this way:
Code: Select all
do_configure() {
# The way the OTTD configure system handles the application's directories
# isn't the way autotools does it. Mainly prefix is always prepended even if
# absolute binary-dir and data-dir is given.
${S}/configure \
--host=${TARGET_SYS} \
--windres=${MACHINE_DISPLAY_WIDTH_PIXELS}x${MACHINE_DISPLAY_HEIGHT_PIXELS} \
--os=UNIX \
--endian=${SITEINFO_ENDIANNESS} \
--prefix-dir=${prefix} \
--binary-dir=bin \
--with-midi=/bin/true \
--with-zlib=${STAGING_LIBDIR} \
--with-png \
--with-freetype \
--without-icu \
--without-allegro \
--cc-build=gcc \
--cc-host=${TARGET_SYS}-gcc \
--cxx-build=g++ \
--cxx-host=${TARGET_SYS}-g++ \
--cxx-build=g++ \
--cxx-host=${TARGET_SYS}-g++ \
--strip=${TARGET_SYS}-strip \
--install-dir=${D}
}
Code: Select all
DEPENDS = "libsdl-net libpng zlib freetype fontconfig"
You may be saying this is something I should post on a openembedded forum, but since it compiles clean and runs, nobody there can help. And nobody there seems to be running this on my device so they dont seem to have any help for me.
Bill
Re: SDL and mouse x and y axis swapped
OpenTTD doesn't need libsdl-net, just libsdl. It should work fine with any recent version, where recent is everything since early 2008, or basically libsdl versions 1.2.13 and 1.2.14.
Also, if the calibration thing doesn't use libsdl then it's quite likely libsdl itself is actually broken.
Also, if the calibration thing doesn't use libsdl then it's quite likely libsdl itself is actually broken.
-
- Engineer
- Posts: 49
- Joined: 09 Oct 2010 13:45
- Location: Göteborg, Sweden
Re: SDL and mouse x and y axis swapped
Ok I'm going to work on this recipe and swap out libsdl-net with libsdl. I'll keep you posted on my progress. It might be helpful to someone else if I can get this fixedRubidium wrote:OpenTTD doesn't need libsdl-net, just libsdl. It should work fine with any recent version, where recent is everything since early 2008, or basically libsdl versions 1.2.13 and 1.2.14.
Also, if the calibration thing doesn't use libsdl then it's quite likely libsdl itself is actually broken.
Bill
-
- Engineer
- Posts: 49
- Joined: 09 Oct 2010 13:45
- Location: Göteborg, Sweden
Re: SDL and mouse x and y axis swapped
It'll be awhile before I can get back to this. Seems that most of the SDL recipes in Openembedded are broken. Won't even compile.
I'll have to wait until those people get around to fixing it. But I will keep you posted. A nice arm port of this with instructions wouldnt be a bad idea. Surely someone could use it
I'll have to wait until those people get around to fixing it. But I will keep you posted. A nice arm port of this with instructions wouldnt be a bad idea. Surely someone could use it
-
- Engineer
- Posts: 49
- Joined: 09 Oct 2010 13:45
- Location: Göteborg, Sweden
Re: SDL and mouse x and y axis swapped
Forget that last post. I just pulled the latest svn of openembedded and they've apparently corrected libsdl so that it compiles and its 1.2.14
Same problem. Beyond what I've tried, I don't know what else I can do. I don't know enough about SDL or OpenTTD to attempt to patch it.If someone knows of a quick and dirty way to swap x and y, that would probably be the best approach for a quick fix.
Bill
Same problem. Beyond what I've tried, I don't know what else I can do. I don't know enough about SDL or OpenTTD to attempt to patch it.If someone knows of a quick and dirty way to swap x and y, that would probably be the best approach for a quick fix.
Bill
Re: SDL and mouse x and y axis swapped
I'd check in driver/sdl_v or similar where the sdl video driver for OpenTTD is located in the source code. To me it seems likely that each video driver (sdl, directx, etc.) has a function to get the mouse location. In this function you could just swap x and y before the location is returned.
My OpenTTD contributions (AIs, Game Scripts, patches, OpenTTD Auto Updater, and some sprites)
Junctioneer (a traffic intersection simulator)
Junctioneer (a traffic intersection simulator)
Who is online
Users browsing this forum: No registered users and 21 guests