ENIGMA Forums

Outsourcing saves money => Third Party => Topic started by: time-killer-games on March 30, 2018, 04:41:51 pm

Title: Tiny File Dialogs for ENIGMA (Windows, Mac, and Linux)
Post by: time-killer-games on March 30, 2018, 04:41:51 pm
Some users were having trouble getting GTK+ dialogs to work on Mac and Linux, so I decided to create a quick solution to this problem, based on "Tiny File Dialogs" from SourceForge.net, which was licensed under zlib.

Note: currently only works on Mac and Linux. Will update the code soon, so that it will work on Windows as well, out of the box.

(https://i.imgur.com/5D6rmua.gif)

(https://i.imgur.com/sKpHZzl.gif)

(https://i.imgur.com/P6EkxdD.gif)

As you can see from the screenshots, this extension is also available for GameMaker Studio. It works the same in both.

Here's the progress I've made with the Windows version; (I can't publish it until a certain bug is fixed with MinGW):

(https://i.imgur.com/Szx5MH7.gif)

What you see in the Windows screenshots above, was actually made with Microsoft's compiler, which is why it works in GMStudio but not ENIGMA yet.

All of pre-Studio GameMaker and GameMaker Studio's dialog functions are mirrored with the *_tfd() suffix.

Download here:
[link removed] Note: This ENIGMA extension is now it's own Widget System and is shipped with ENIGMA.

Extract that zip under this directory:
"[YourEnigmaFolder]/enigma-dev/ENIGMAsystem/SHELL/Universal_System/Extensions/"

Comes with an editable GM81 file and two Linux demo executables, (one for 32-bit and one for 64-bit).

To install all of your game's dependencies on Linux, along with the Linux dependencies that are needed to use this extension, use this terminal command:

Code: [Select]
sudo apt-get install g++ zlib1g-dev libglew-dev libglu1-mesa-dev libalure-dev libvorbisfile3 libvorbis-dev libdumb1-dev libbox2d-dev zenity
The only dependencies this modified version of Tiny File Dialogs uses are zenity and GTK, as far as I know.

Cheers.
Samuel
Title: Re: Tiny File Dialogs for ENIGMA (Windows, Mac, and Linux)
Post by: hpg678 on March 30, 2018, 08:29:04 pm
I would like to add that there are two sample files; a gm81 file and a .exe file.  you can remove or copy them to your home folder and run them to see how it works.


Thanks for this!
Title: Re: Tiny File Dialogs for ENIGMA (Windows, Mac, and Linux)
Post by: time-killer-games on March 31, 2018, 05:30:30 pm
You're welcome! :D Updated the code to (hopefully) support Mac. I will announce Mac is supported once someone has verified that it now works.
Title: Re: Tiny File Dialogs for ENIGMA (Windows, Mac, and Linux)
Post by: time-killer-games on April 01, 2018, 09:40:52 pm
Added screenshots for the Linux and Windows version; (Windows version is not released yet due to a bug with MinGW).
Title: Re: Tiny File Dialogs for ENIGMA (Windows, Mac, and Linux)
Post by: time-killer-games on April 04, 2018, 11:26:24 pm
Just wanted to announce that I talked with Josh and there seems to be a good chance this will become the new default widget system for Linux and Mac. That way, it won't be an extension, but a part of the actual engine.  :smileycat:
Title: Re: Tiny File Dialogs for ENIGMA (Windows, Mac, and Linux)
Post by: hpg678 on April 05, 2018, 03:40:00 am
That's great TKG! I'm really happy for you. :clap: :clap: :dance: :dance:


I'd like to mention 2 things. First on my main machine, I've had some black bars present. 2nd the graphics looked 'bare' and some dialogs were in a terminal type shell interface; a far cry from your screen-shots.


This happened for quite while. However since I've installed Gnome3 as an alternative Windows Manager, the graphics have changed to be more similar to your screen-shots.


Maybe I was missing some libraries before. I'm not really sure. Just thought I should mention this.




The machine I'm testing on is
Title: Re: Tiny File Dialogs for ENIGMA (Windows, Mac, and Linux)
Post by: time-killer-games on April 05, 2018, 03:06:41 pm
@hpg678 It sounds like the issue was you didn't have any of the intended libraries installed on your original window manager. I'll contact the author of Tiny File Dialogs and see if he can tell me what specific libraries need to be installed.

It looks like that black on the game screen was because you tried dragging the dialogs - the same thing happens on Windows 7 with ENIGMA's default dialog system. As far as I know, there is no way around that, I'm sorry to say. Seems to be an issue with OpenGL and DirectX. On a newer OS like Windows 10 and Ubuntu 14.04 LTS this issue doesn't exist.

In any case, I added get_color_tfd(defcol) to the list of compatible functions. All that's left function-wise is show_error_tfd(str, abort).
Title: Re: Tiny File Dialogs for ENIGMA (Windows, Mac, and Linux)
Post by: time-killer-games on April 06, 2018, 03:44:51 pm
Added show_error_tfd(str, abort). All that's left to do now is support for file type filters in the 'open' and 'save as' dialogs.
Title: Re: Tiny File Dialogs for ENIGMA (Windows, Mac, and Linux)
Post by: time-killer-games on April 08, 2018, 03:21:39 pm
Special thanks to Josh for this one; I couldn't have done it without him! :D

Added single-file-filter support to Mac and Linux. For example, this works:

get_open_filename_tfd("Sprite Image Files|*.png;*.gif;*.jpg;*.jpeg", "sprite.png");

Multiple-file-filters aren't yet supported on Mac/Linux, so this won't work:

get_open_filename_tfd("PNG Image Files|*.png|GIF Image Files|*.gif|JPEG Image Files|*.jpg;*.jpeg", "sprite.png");

However, both of the above examples work on Windows, you should probably use the earlier example, so that it will work cross-platform. Multiple-file-filters will be added to Mac/Linux as soon as Josh and I figure out how to do that. Hopefully soon.
Title: Re: Tiny File Dialogs for ENIGMA (Windows, Mac, and Linux)
Post by: hpg678 on April 09, 2018, 08:03:21 pm
it's as if both of you are reading my mind!


for my 'Linux Dancing' app, i want to give make the user the option of using their own sprite, so I was looking for a way to implement this with 'Tiny Dialogs'.....and lo and behold, here is what I was looking for.


WOW!


 :woop: :woop:



Title: Re: Tiny File Dialogs for ENIGMA (Windows, Mac, and Linux)
Post by: time-killer-games on April 09, 2018, 08:16:59 pm
Awesome! I'm glad we could help! :D
Title: Re: Tiny File Dialogs for ENIGMA (Windows, Mac, and Linux)
Post by: time-killer-games on April 25, 2018, 07:16:09 pm
Hey, just wanted to let everyone know that I added a new Linux executable to the downloadable zip in the OP. Now there is one executable for 32-bit Linux and one for 64-bit Linux, to make it easier for you to test, standalone, without needing to start up LateralGM and all that jazz. :)

Note: It actually works better on 64-bit Linux because on 64-bit the dialogs actually keep focus over the game window. Since 32-bit Linux is dying, this is not that huge of a deal that it doesn't work as well on 32-bit.
Title: Re: Tiny File Dialogs for ENIGMA (Windows, Mac, and Linux)
Post by: time-killer-games on May 19, 2018, 07:37:02 pm
BUGFIX: Inputbox no longer hides input like a password field when the second argument of get_string_tfd() is an empty string on Linux.
Title: Re: Tiny File Dialogs for ENIGMA (Windows, Mac, and Linux)
Post by: time-killer-games on May 24, 2018, 08:01:33 pm
Added two new functions!

Code: [Select]
// behaves the same as get_string_tfd(str, def); except input is hidden in the textfield (useful for password input).
get_password_tfd(str, def);

// behaves the same as get_integer_tfd(str, def); except input is hidden in the textfield (useful for passcode input).
get_passcode_tfd(str, def);

The second parameter, which is the default hidden string or integer to have in the textbox, is useful for a password or passcode "remember me" feature, similar to those found on website logins.
Title: Re: Tiny File Dialogs for ENIGMA (Windows, Mac, and Linux)
Post by: time-killer-games on May 31, 2018, 03:10:11 pm
Thanks to cheeseboy, this extension now fully supports multiple file filters in the Open and Save As dialog functions!!! :D

With this very special update, please make sure zenity is installed for both yourself and for the end users who play your game:

Code: [Select]
sudo apt-get install zenity
Title: Re: Tiny File Dialogs for ENIGMA (Windows, Mac, and Linux)
Post by: time-killer-games on June 10, 2018, 11:27:02 pm
Great news for those who weren't already aware through GitHub or Discord! :D

This has now been added as an official widgets system for ENIGMA, and therefore, the extension is no longer needed to be downloaded or installed. You can now use all the same functions on Linux and Mac by simply updating ENIGMA and removing the *_tfd suffix from all of your function names that have that suffix. Bug fixes have also been applied, such as support for double quotes in your strings.

But do note Zenity still needs to be installed on both your Linux machine, as well as those who download your game for Linux, as normal.