Different spriteBatch.Draw behaviour on Windows and Linux

Hello all,

I am new to mono and I like it a lot!
I am creating a game that is running great on Windows but there is a difference when I run it on Linux.

-When spriteBatch.Draw origin Vector2 is at the center of the image, in windows when you change the size it is changing around the center of the image, proportionally from both sides.
In Linux the image size change is centered in top left corner and it is not proportional as it is in Windows. It grows in right and down directions and this is very importnt part of my game so I want to make sure it is consistent on all platforms.

This is te only problem I have so far when moving to Linux and I would be very thankful if some can give me a tip, maybe I am missing something obvious :).

Rotation however is same in Windows and Linux, it rotates fine around the image’s center as expected.

-Fyi, I used monodevelop in Linux to build the code and it failed because it could not load the images. The problem was that the .png files were created with 16bits per chanel and after converting them to 8bits per chanel it worked. Maybe this will help someone.

-I also created mono Linux project in Windows and it was running fine(without any difference with the Windows project) but when I moved the built files to Linux and tried to run the exe with “mono mygame.exe” it gave me errors “System.DllNotFoundException: SDL.dll…” and I would like to know if I am missing something here.

Thank you,

Could you post an example app project that shows the issue?
We don’t have too many linux users, but the behaviour here should match between WindowsGL and linux as they share most of their code!

“System.DllNotFoundException: SDL.dll” can easilly be fixed. If you are using Ubuntu just run this in terminal:

sudo apt-get install libsdl2-dev libsdl2-mixer-2.0-0 libopenal-dev libsdl-mixer1.2

If you are using some other linux, tell me the name of it and I’ll help you get it fixed.

Yes, I have Ubuntu, will test that and let you know.

Btw, this is my early version of the game on Steam greenlight:

And this is the official website:

Thank you!

Thanks, this helped but I had to add one more thing - XML file Tao.Sdl.dll.config with:

<?xml version="1.0" encoding="utf-8"?>
  <dllmap dll="SDL.dll" target="libSDL-1.2.so.0" />
  <dllmap dll="SDL_image.dll" target="libSDL_image-1.2.so.0" />
  <dllmap dll="SDL_mixer.dll" target="libSDL_mixer-1.2.so.0" />
  <dllmap dll="SDL_ttf.dll" target="libSDL_ttf-2.0.so.0" />
  <dllmap dll="SDL_net.dll" target="libSDL_net-1.2.so.0" />
  <dllmap dll="smpeg.dll" target="libsmpeg-0.4.so.0" />
  <dllmap dll="SDL_gfx.dll" target="libSDL_gfx.so.4" />

So using the Linux template in Visual Studio works fine in Linux now!
I just have to figure out why sound is not working.

OpenAL is used to play SounEffect/s
SDL is used to play Song/s

Which one of these doesn’t work?

Thanks for the quick reply!
I use SoundEffectInstance to play music and sound.
It works fine in Windows and Mac builds but not in Linux, not sure why.
Sound and music are .wav files converted to .xnb files.

WAV files take too much space. How can I use ogg files in a way that it will work on all platforms?
Is using FMOD the way to go and is it easy to implement?


Ok, so to make this quicker, there are several things that could be causing no sound, and it’s gonna take a while to do it this way(going back and forth on this thread), so private message me your skype name(or any other messaging client name, just write which client), and I’ll add you.

Thanks cra0zy for the help so much!
Guys, the problem I had was related to a missing file OpenTK.dll.config that Linux version needs for linking.
Now the sound works fine in Linux version!