Settings window

Open-source port of PoP that runs natively on Windows, Linux, etc.

Moderator: English Moderator Team

David
The Prince of Persia
The Prince of Persia
Posts: 1493
Joined: December 11th, 2008, 9:48 pm
Location: Hungary

Re: Settings window

Post by David » September 17th, 2017, 10:12 am

Falcury wrote:I'm experimenting with adding a menu bar to the SDLPoP main window, taking inspiration from oitofelix's recent additions to MININIM,
It looks like Allegro (which is used by MININIM) has built-in support for menus: http://liballeg.org/a5docs/trunk/native ... html#menus
That's why he could add it in a cross-platform way...

salvadorc17
Calif
Calif
Posts: 521
Joined: August 27th, 2011, 2:04 am

Re: Settings window

Post by salvadorc17 » September 24th, 2017, 10:18 pm

The windows api can not be used with wine on multiplatform??

Falcury
Wise Scribe
Wise Scribe
Posts: 326
Joined: June 25th, 2009, 10:01 pm

Re: Settings window

Post by Falcury » October 30th, 2017, 12:42 am

David wrote:
September 17th, 2017, 10:12 am
It looks like Allegro (which is used by MININIM) has built-in support for menus: http://liballeg.org/a5docs/trunk/native ... html#menus
That's why he could add it in a cross-platform way...
I have tried very hard to get SDL2 and GTK (Allegro uses GTK for its UI elements on X) to cooperate within the same X window, but unfortunately I couldn't get it to work in the end.

If I still want to proceed with experimenting with menu bars on GNU/Linux systems, I think the most logical option is to create the menu bar as an independent (floating) GTK window. That way, the SDL2 window and the GTK window would not interfere. Obviously that's not ideal, but it's better than nothing.

Either that, or I would need to write code for manually drawing the menus. The advantage of that approach would be that I could simply use the existing SDL2 drawing area, and no native routines would be necessary. It seems like it could be an interesting challenge, although it might be more effort than it is worth.
salvadorc17 wrote:
September 24th, 2017, 10:18 pm
The windows api can not be used with wine on multiplatform??
Thanks for the suggestion, but I do not think that Wine is really an ideal solution... Wine's goal is to make Windows programs run on GNU/Linux systems, but SDLPoP is already cross-platform. And it probably does not make good sense anyway to rely on Win32 routines on any other platform than Windows.

User avatar
Norbert
The Prince of Persia
The Prince of Persia
Posts: 3139
Joined: April 9th, 2009, 10:58 pm
Contact:

Re: Settings window

Post by Norbert » November 1st, 2017, 11:16 pm

Norbert wrote:
July 1st, 2017, 7:20 pm
Falcury, where it says "TODO: Save all settings" could you make it save all the INI settings to sPathFile. (sPathFile is already either SDLPoP.ini or mod.ini.) Of course there's no hurry, we're all busy with our jobs and such. I'm asking you because you've worked with/created the 'INI system' and are familiar with related variable names.
[Edit: I mean literally all INI settings, not just what is currently available on the Settings window.]
Falcury, let's take, for example, "enable_mixer".
The "live" column should make this toggleable, plus I need to remember the SDLPoP.ini value in case the user chooses to Save all values from the INI columns.
Now, data.h has enable_mixer, and it appears to only be used in options.c as follows:

Code: Select all

process_boolean("enable_mixer", &enable_mixer);
where process_boolean() is:

Code: Select all

#define process_boolean(option_name, target)
if (ini_process_boolean(name, value, option_name, target)) return 1;
There, name and value come from the global_ini_callback() parameters, I guess.

Where/how does all this influence whether a mixer is used and music played...
Actually, I don't think that option is doing anything, because setting it to false doesn't disable music.

Is this an exception or have more options not been implemented yet?

Falcury
Wise Scribe
Wise Scribe
Posts: 326
Joined: June 25th, 2009, 10:01 pm

Re: Settings window

Post by Falcury » November 2nd, 2017, 5:19 pm

Norbert wrote:
November 1st, 2017, 11:16 pm
Where/how does all this influence whether a mixer is used and music played...
Actually, I don't think that option is doing anything, because setting it to false doesn't disable music.

Is this an exception or have more options not been implemented yet?
I think this is an exception. Yeah, it looks like enable_mixer is unimplemented.
(Of course, if we make all of the options toggleable in-game, we'll undoubtedly run into some more bugs. But I expect they should be mostly straightforward to fix.)

In order to disable music at startup, one easy fix is to make this line in load_sound() in seg009.c conditional on enable_mixer:

Code: Select all

if (enable_mixer && !digi_unavailable && result == NULL && index >= 0 && index < max_sound_id) {
Although that doesn't yet allow for toggling the music while in-game.
I could look into it.

Maybe the option should be renamed to enable_music as well?

Falcury
Wise Scribe
Wise Scribe
Posts: 326
Joined: June 25th, 2009, 10:01 pm

Re: Settings window

Post by Falcury » November 14th, 2017, 7:57 pm

I experimented with rendering a menubar as an overlay, on this branch.
None of the menu items do anything, so it's not really usable. But it has been a good exercise, at least.
menubar_screenshot.png
menubar_screenshot.png (7.65 KiB) Viewed 18 times

User avatar
Norbert
The Prince of Persia
The Prince of Persia
Posts: 3139
Joined: April 9th, 2009, 10:58 pm
Contact:

Re: Settings window

Post by Norbert » November 14th, 2017, 8:09 pm

Falcury wrote:
November 14th, 2017, 7:57 pm
I experimented with rendering a menubar as an overlay, on this branch.
The transparency is nice.

Suggestion, maybe we should split this thread in two, one with posts about the Settings window, and one with posts about adding a menu bar.

Post Reply