Angband Forums

Angband Forums (http://angband.oook.cz/forum/index.php)
-   Development (http://angband.oook.cz/forum/forumdisplay.php?f=10)
-   -   SDL2 port when ? (http://angband.oook.cz/forum/showthread.php?t=9076)

shirish September 20, 2018 15:34

Quote:

Originally Posted by t4nk (Post 133352)
Yeah, in principle, it should be simple enough. Replace main-sdl.c (SDL1 version) with main-sdl2.c, replace all references to main-sdl.c with references to main-sdl2.c in autogen stuff, link with SDL2 instead of SDL1, and then it should work. I just don't know how to do it :)
Code:

/usr/lib/x86_64-linux-gnu/libSDL2.so
/usr/lib/x86_64-linux-gnu/libSDL2_mixer.so

You'll also need libSDL2_ttf.so (for loading fonts) and libSDL2_image.so (for loading tiles).

All of these I have -

Code:

/usr/lib/x86_64-linux-gnu/libSDL2_ttf.so
/usr/lib/x86_64-linux-gnu/libSDL2_image.so

As far main-sdl.c I didn't find any changes to do apart from the comments -

Code:

~/games/takkaria-angband/src$ cat main-sdl.c | grep endif
#endif
#endif
#endif /* USE_SDL2 */

Code:

games/takkaria-angband/src$ cat main-sdl.c | grep ifdef
#ifdef USE_SDL2

Quote:

Originally Posted by t4nk (Post 133352)
Well, if you're serious about it, I'll write the Makefile. It'll be simpler than trying to figure out autoconf :) The only problem with that is I now have a new hobby , which is writing a roguelike, loosely inspired by (among other things) Angband. And I'm not using C or Make for that, so it'll cause me some moral suffering to go back to those, and I need to muster my strength first :)

There might be other things which might be contributing to the complexity -

My tooling -

Code:

$ libtool --version
libtool (GNU libtool) 2.4.6
Written by Gordon Matzigkeit, 1996

Copyright (C) 2014 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Code:

$ autoconf --version
autoconf (GNU Autoconf) 2.69
Copyright (C) 2012 Free Software Foundation, Inc.
License GPLv3+/Autoconf: GNU GPL version 3 or later
<http://gnu.org/licenses/gpl.html>, <http://gnu.org/licenses/exceptions.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Written by David J. MacKenzie and Akim Demaille.

Code:

$ automake --version
automake (GNU automake) 1.16.1
Copyright (C) 2018 Free Software Foundation, Inc.
License GPLv2+: GNU GPL version 2 or later <https://gnu.org/licenses/gpl-2.0.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Written by Tom Tromey <tromey@redhat.com>
      and Alexandre Duret-Lutz <adl@gnu.org>.

Code:

$ gcc --version
gcc (Debian 8.2.0-6) 8.2.0
Copyright (C) 2018 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

so it's possible there might be bug-fixes, regressions etc. that I do not know about . As shared before I'm not a developer so don't know anything about C.

I personally like cmake for compiling as things are lot smoother and it's easier to debug, give feedback to developers etc. but it is what it is :)

t4nk September 20, 2018 16:20

OK, shirish, tell you what. When I'll have some free time and gather some strength (hopefully in the next several days) I'll fork Angband's repo on github, add SDL2 frontend to it, and post compilation instructions here (in this forum). Who knows, maybe I'll even make pull request to the upstream again... SDL1 is really getting obsolete... but then, so is Angband :)

t4nk September 20, 2018 21:10

Quote:

Originally Posted by t4nk (Post 133346)
You can try to go back futher in this branch and look for something like Makefile.sdl2... although it probably shouldn't be there.

Interestingly, it's actually there: https://github.com/takkaria/angband/.../Makefile.sdl2
So I guess the only thing to do is to add the module to the list in main.c...
Now the problem is remembering how Github works. And that also reminds me that Github was bought by the oligarchs from Microsoft. Argh! Well, life is cruel and unfair... I'll see what I can do :) In a couple of days, maybe?

shirish September 21, 2018 10:06

Quote:

Originally Posted by t4nk (Post 133358)
Interestingly, it's actually there: https://github.com/takkaria/angband/.../Makefile.sdl2
So I guess the only thing to do is to add the module to the list in main.c...
Now the problem is remembering how Github works. And that also reminds me that Github was bought by the oligarchs from Microsoft. Argh! Well, life is cruel and unfair... I'll see what I can do :) In a couple of days, maybe?

Sure, take your time, although reading the makefile.sdl2 from whatever I could understand it is/was for the windows port and not *ix so it probably will need quite a bit of change :(

If you can't stand github.com I could put the takkaria's port on salsa.debian.org . I have access there. It's a gitlab instance. We could also use gitlab's own instance as well.

https://about.gitlab.com/

t4nk September 21, 2018 14:00

Quote:

Originally Posted by shirish (Post 133360)
Sure, take your time, although reading the makefile.sdl2 from whatever I could understand it is/was for the windows port and not *ix so it probably will need quite a bit of change :(

It's definitely for Unix, even specifically for Debian Wheezy :) I know it because I made it out of Angband's Makefile.std (which didn't work and probably still doesn't). Perhaps you're thinking about another Makefile in this directory? (Makefile.ms.ui2, which is an entirely different thing).

Quote:

If you can't stand github.com I could put the takkaria's port on salsa.debian.org . I have access there. It's a gitlab instance. We could also use gitlab's own instance as well.

https://about.gitlab.com/
Thanks for the offer... the funny thing is, this port is actually written by me :) in the summer of 2016. And then everyone, including myself, forgot about it. Which is why I was shocked when you posted :) It's a long story... hmm... actually, it's a reasonably short story. It goes like this:

After writing the SDL2 port I decided that Angband's entire UI is outdated and has too many hacks (accumulated over decades) and needs to be rewritten. So I did rewrite the UI and it turned out pretty good (opinion :)). However, Angband's UI is large (about 1/3 of the whole program) and it was never pulled into the official repo. Currently, Angband's devteam seems to consist of one person who has limited time to work on it and there are just no resources for such a massive disruption. Meanwhile, everyone's forgotten that there is, in fact, a complete and working SDL2 frontend...

So... question to the maintainer:
NIck, let's be realistic here, textui2 will never make it into Angband. However, main-sdl2.c is a plausible addition to the game. It's just another frontend, after all. SDL1 is an obsolete library, and SDL2 port, as you know, has more and better functionality. I can register on Github again and send a pull request. What do you say?
If not, I'd rather go with shirish's suggestion and use Gitlab.

shirish September 21, 2018 18:24

I would rather have the maintainer be with us rather than having a fork because a fork takes a lot of time. I do not know what targets the maintainer has but if mobile is going to be a space then android has quite a bit of support with libsdl2

https://wiki.libsdl.org/Android .

Of course all osses are moving to libsdl2 from libsdl1.2 . Even SBC's like raspberry pi and like are moving to libsdl2

See https://choccyhobnob.com/raspberry-p...-raspberry-pi/ as an example and games like bzflag https://github.com/BZFlag-Dev/bzflag/issues/94 , wine https://www.winehq.org/announce/3.0.3 and few others . There is also this interesting discussion at https://www.gamedev.net/forums/topic...n-to-use-sdl2/

Nick September 21, 2018 23:43

Quote:

Originally Posted by t4nk (Post 133365)
So... question to the maintainer:
NIck, let's be realistic here, textui2 will never make it into Angband. However, main-sdl2.c is a plausible addition to the game. It's just another frontend, after all. SDL1 is an obsolete library, and SDL2 port, as you know, has more and better functionality. I can register on Github again and send a pull request. What do you say?

That sounds good. I’m hoping to be back working on Angband in a couple of weeks, and will pull it in then.

I wouldn’t necessarily say never for textui2 either , but I am an optimist:)

shirish September 22, 2018 08:11

Quote:

Originally Posted by Nick (Post 133372)
That sounds good. I’m hoping to be back working on Angband in a couple of weeks, and will pull it in then.

I wouldn’t necessarily say never for textui2 either , but I am an optimist:)

Having the maintainer's blessings is good.

@t4nk now it's upto you, let me know when you want to sign up for either github.com or gitlab.com

Update - The repo. (wherever it's hosted) would be to test and get feedback from each other and if and when it's clean and mergeable state get it into angband main repo. Win, win for all.

t4nk September 22, 2018 12:22

Quote:

Originally Posted by shirish (Post 133376)
Having the maintainer's blessings is good.

@t4nk now it's upto you, let me know when you want to sign up for either github.com or gitlab.com

Update - The repo. (wherever it's hosted) would be to test and get feedback from each other and if and when it's clean and mergeable state get it into angband main repo. Win, win for all.

OK. I'll be busy tomorrow, I think I can do it the day after tomorrow. Or at least, I'll upload somewhere the three files required - main-sdl2.c, the updated main.c and the Makefile (which also needs updating), as you seem to have some interest in trying it out. The frontend does have some revolutionary features, such as the ability to use resizable fonts - .ttf, .otf and stuff. Amazing, right? :) (or, rather, it's amazing that Angband still uses the .fon files in 2018...)

shirish September 22, 2018 15:02

sure, take your time. This is how angband is shown in Debian testing -

Code:

$ aptitude show angband
Package: angband                       
Version: 1:3.5.1-2.2+b1
State: not installed
Priority: optional
Section: games
Maintainer: Chris Carr <rantingman@gmail.com>
Architecture: amd64
Uncompressed Size: 3,254 k
Depends: libc6 (>= 2.14), libncursesw6 (>= 6), libsdl-image1.2 (>= 1.2.10), libsdl-mixer1.2, libsdl-ttf2.0-0,
        libsdl1.2debian (>= 1.2.11), libtinfo6 (>= 6), libx11-6, angband-data
Recommends: xfonts-base
Suggests: angband-audio, angband-bigtiles

There are however couple of angband audio bugs which have been there a while -

https://bugs.debian.org/793668

and

https://bugs.debian.org/793452

maybe an updated SDL build with the SDL2 frontend, audio etc. may fix some of the problems. Of course the maintainer would have to do the packaging part but it might work. I would signal to the maintainer that we are going to try and have an updated build with SDL2 .

This is how most libsdl2 libraries look , just sharing the working parts at the moment -

Code:

$ dpkg -L libsdl2-mixer-dev
/.
/usr
/usr/include
/usr/include/SDL2
/usr/include/SDL2/SDL_mixer.h
/usr/lib
/usr/lib/x86_64-linux-gnu
/usr/lib/x86_64-linux-gnu/libSDL2_mixer.a
/usr/lib/x86_64-linux-gnu/pkgconfig
/usr/lib/x86_64-linux-gnu/pkgconfig/SDL2_mixer.pc
/usr/lib/x86_64-linux-gnu/libSDL2_mixer-2.0.so
/usr/lib/x86_64-linux-gnu/libSDL2_mixer.so

There are coding documentation examples in -
Code:

/usr/share/doc/libsdl2-mixer-dev/examples/playmus.c
/usr/share/doc/libsdl2-mixer-dev/examples/playwave.c

Unfortunately (or not) the bigtiles package is no more there :(

Code:

$ aptitude show angband-bigtiles
No candidate version found for angband-bigtiles
Package: angband-bigtiles
State: not a real package

Let's focus though on one thing at one time, the other things we can try to do later if we can.


All times are GMT +1. The time now is 07:29.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2022, vBulletin Solutions Inc.