26

Re: Migrate to SDL2

No, it does not.

27

Re: Migrate to SDL2

I removed all all calls to grab window. Maybe Mac needs it?
So, even if hardware cursor is turned off, your the in-game cursor doesn't move at all but stays at the top left of the window, right?

28

Re: Migrate to SDL2

No, it points to some direction, and if I hit f1/f2, it moves shortly in the direction, I moved the mouse to. Also, if I press esc I get no cursor, but if I then press f1/f2, the cursor works like normal in the menus. However, pressing esc again and going back into game, it does not work again.

29

Re: Migrate to SDL2

http://lists.libsdl.org/pipermail/sdl-l … 89768.html

Looks like SDL2.0 will be released next week!

30

Re: Migrate to SDL2

Yay. smile

31 (edited by i.gnatenko.brain 2013-08-14 08:53:14)

Re: Migrate to SDL2

Released: http://lists.libsdl.org/pipermail/sdl-l … 89854.html
Migration Guide: http://wiki.libsdl.org/moin.fcg/MigrationGuide

32

Re: Migrate to SDL2

Updated SDL from RC to release, fixed a small bug with lineinputs.

Am I right that this still doesn't work on Mac?

33

Re: Migrate to SDL2

Yes, you are correct, the issue is still the same.

34

Re: Migrate to SDL2

I don't have access to a Mac so I won't be able to fix this bug. If someone wants to look into it I'm willing to help as much as I can.
As long as it doesn't work on Mac it won't get into master and everyone has to wait longer...

35 (edited by ghost 2013-09-10 01:05:44)

Re: Migrate to SDL2

I would love to work on this, but I don't really know where to start. I can do basic stuff, but I have not tried working on some more complicated stuff yet. I'll try to do what I can, but I doubt I'll be able to achieve a lot. The problem is, that there is no really active developer that is specialized on Mac OS X.

I would appreciate any help you can give me.

One more note: this could easily be a bug of SDL. Is there even a lot of platform dependent code in teeworlds for the input stuff?

36

Re: Migrate to SDL2

Currently there is no platform dependent code for input.

First step is to make sure your config is right. So disable hardware cursor (inp_hw_cursor) and ignore inp_grab because it is not used in my branch anymore. Also try to start teeworlds in window mode because it makes testing easier.

A quick writeup of how teeworlds should behave:
* hardware cursor disabled: hide the system cursor if it is in the teeworlds window and render a cursor via GL on top of the frame
* hardware cursor enabled: change the look of the system if it is in the teeworlds window, don't hide it
* the cursor is free (you can move it freely in and out of the window) except for in-game (playing or spectating)
* if the cursor it not-free (playing, spectating) it hides the cursor and warps (moves) it back to the center of the window after every frame and uses the offsett from the center to calculate the mouse movement

So, you first start teeworlds in window mode, hw cursor disabled and ignore playing and spectating. Then you try to eliminate possible error sources. CInput::GetMousePosition might be interesting: make sure GetMouseModes() == MOUSE_MODE_NONE as long as you're not opening a console, playing or spectating, then look at the values returned by SDL_GetMouseState.

Btw, if teeworlds is in windowed mode, can you move your cursor completely through it (moving the mouse from over the window, through it and leave it at the bottom)? Maybe a video would help, too.

37 (edited by ghost 2013-09-12 04:25:18)

Re: Migrate to SDL2

Ok, I am now able to give a bit more detail about what happens: As long, as we are in MOUSE_MODE_NONE (in the menu, or even in game, if we did not move the mouse yet, since we had MOUSE_MODE_NONE active), everything is fine. So once you are in game and move the mouse, mouse mode is set to MOUSE_MODE_WARP_CENTER, as it should. you can also see the screen/crosshair move for maybe 2 ticks/frames (for these frames, SDL_GetRelativeMouseState() gives x and y values, that are different from 0). After these frames. nothing happens anymore. SDL_GetRelativeMouseState(&x, &y) returns 0 for both x and y, regardless how much I move the mouse. If I now open the menu (esc), still nothing happens upon moving the mouse (this is only logical, since nothing changes, because no mouse movement is recognized and thus CMenus::OnMouseMovement() is not called, which would set mouse mode to MOUSE_MODE_NONE again). However, once you open a console, it sets mouse mode to MOUSE_MODE_NONE and then everything is fine again.

To summarize it: Obviously there is a problem with the combination of SDL_GetRelativeMouseState() and MOUSE_MODE_WARP_CENTER.

However, as long as we are in MOUSE_MODE_NONE, everything works fine (including moving the cursor in and out of the window and everything).

EDIT: nevermind, I fixed the problem. The problem was, that in CGameClient::DispatchInput(), GetMousePosition() got called called before MouseMoved(). This made the cursor warp to the center everytime before MouseMoved() is called, and then of course SDL_GetRelativeMouseState() returns 0.

I do not understand why it worked on other platforms though oO.

38

Re: Migrate to SDL2

Awesome!
I merged the fix and the code is also in my master branch now.

ghost wrote:

I do not understand why it worked on other platforms though oO.

That's really interesting. Sometimes the mouse stalled on linux but it went away after a few seconds. Your fix seems to eliminate this bug, too.

Can we somehow have more testing on all platforms? Is it ready to merge into teeworlds master?

39 (edited by ghost 2013-09-12 14:08:24)

Re: Migrate to SDL2

I am continuing testing on Mac OS X. I already found a crash connected to clipboard and already fixed it. I will let you know if I find anything else.

40

Re: Migrate to SDL2

Any official plans of making 0.7 use SDL2?

41

Re: Migrate to SDL2

Siile wrote:

Any official plans of making 0.7 use SDL2?

SDL2 support has already been added in the master branch (:

42

Re: Migrate to SDL2

BeaR wrote:
Siile wrote:

Any official plans of making 0.7 use SDL2?

SDL2 support has already been added in the master branch (:

SDL_SetRenderTarget (with some full screen shaders) and SDL_HapticOpenFromJoystick would be so cool. But I need "changing Teeworlds from SDL 1.2 to SDL 2 for dummies" tutorial. big_smile

43

Re: Migrate to SDL2

Siile wrote:

But I need "changing Teeworlds from SDL 1.2 to SDL 2 for dummies" tutorial. big_smile

Any chance of getting one? tongue

44

Re: Migrate to SDL2

Siile wrote:
Siile wrote:

But I need "changing Teeworlds from SDL 1.2 to SDL 2 for dummies" tutorial. big_smile

Any chance of getting one? tongue

If you want to do it by yourself, there is an official migration guide(https://wiki.libsdl.org/MigrationGuide). It's actually pretty straightforward, there are not that many changes required.
Or you can also try to merge the changes from the master branch:
https://github.com/teeworlds/teeworlds/pull/1246
together with some follow-up fixes:
https://github.com/teeworlds/teeworlds/ … 92fd2ab430
https://github.com/teeworlds/teeworlds/ … 008c48e2ba
https://github.com/teeworlds/teeworlds/ … 3282de997a
https://github.com/teeworlds/teeworlds/ … a64e3c7ade
https://github.com/teeworlds/teeworlds/ … 3cd3bf1d2e
https://github.com/teeworlds/teeworlds/ … 72530121b4

45

Re: Migrate to SDL2

BeaR wrote:
Siile wrote:
Siile wrote:

But I need "changing Teeworlds from SDL 1.2 to SDL 2 for dummies" tutorial. big_smile

Any chance of getting one? tongue

If you want to do it by yourself, there is an official migration guide(https://wiki.libsdl.org/MigrationGuide). It's actually pretty straightforward, there are not that many changes required.
Or you can also try to merge the changes from the master branch:
https://github.com/teeworlds/teeworlds/pull/1246
together with some follow-up fixes:
https://github.com/teeworlds/teeworlds/ … 92fd2ab430
https://github.com/teeworlds/teeworlds/ … 008c48e2ba
https://github.com/teeworlds/teeworlds/ … 3282de997a
https://github.com/teeworlds/teeworlds/ … a64e3c7ade
https://github.com/teeworlds/teeworlds/ … 3cd3bf1d2e
https://github.com/teeworlds/teeworlds/ … 72530121b4

Thanks!

46

Re: Migrate to SDL2

Ah, compiling issues (not suprised tongue)

http://ninslash.com/img/bam_error.png

47

Re: Migrate to SDL2

Siile wrote:

Ah, compiling issues (not suprised tongue)

http://ninslash.com/img/bam_error.png

Delete config.lua.

48

Re: Migrate to SDL2

Next big_smile

http://ninslash.com/img/compile.png

The same if I try to compile the main branch.

49 (edited by rand() 2015-07-17 16:47:47)

Re: Migrate to SDL2

Try `server_release client_release` instead of `release`

50

Re: Migrate to SDL2

rand() wrote:

Try `server_release client_release` instead of `release`

Tried both, same thing.