Pages: 1
  Print  
Author Topic: Native Linux Icon Support  (Read 391 times)
Offline (Male) time-killer-games
Posted on: September 03, 2019, 09:08:31 AM

Contributor
Location: Virginia Beach
Joined: Jan 2013
Posts: 1157

View Profile Email
Quote
Well, for the first time in the roughly 10 years the ENIGMA game engine has been around, you can now natively set a PNG icon for your game that will show in the title bar, task manager, system monitor, and Alt+Tab process swapper. No thanks to those fat lards Josh, Robert, and fundies. No offense, I love you guys, but I couldn't take it any longer so I decided to step in and add Linux icon support.

Includes the following functions:

- string window_get_icon() returns the absolute path to the custom icon being used by the game. Returns an empty string "" if there is not one currently used.

- void window_set_icon(string fname) sets the icon to use for the game from the given PNG filename fname.

- void window_set_icon_from_unpacked_sprite(int ind, unsigned subimg, string fname) Want to export your game as a single executable? You can! Exports the internal sprite resource of the given sprite index ind and subimage subimg. Export it to preferably the temp_directory or game_save_id folders with the provided PNG filename fname. The image will be loaded from that exported location and will be displayed as the icon.

- void window_set_icon_from_unpacked_background(int ind, string fname) Similar to the sprite function. Exports the internal backgound resource of the given background index ind. Export it to preferably the temp_directory or game_save_id folders with the provided PNG filename fname. The image will be loaded from that exported location and will be displayed as the icon.

Example project and 64-bit demo executable: animated_icon.zip

As a small side note - this pull request also allows capturing SDL's window handle on linux for widget use. Although I still haven't fixed the SDL bug where the game doesn't respond and then segfaults, if you click the close button in the main game window's title bar over and over while a dialog is open. Not many people will do that so it's not a huge bug.

The pull request this text was copied from can be viewed here, along with the actual code changes and additions:
https://github.com/enigma-dev/enigma-dev/pull/1854

For early access to this update, follow these set of instructions listed below:

1) download and extract this ZIP archive to the folder of your choosing:
https://www.dropbox.com/s/uhi5ic5oscgt8k7/enigma-dev.zip?dl=0
(This dropbox link won't be available anymore after being merged into master officially)

2) Install these dependencies if you haven't already, (copied from the wiki):

Ubuntu/Debian-based distro's:
Code: [Select]
sudo add-apt-repository ppa:maarten-fonville/protobuf
sudo apt-get update
sudo apt-get install g++ libprotobuf-dev protobuf-compiler zlib1g-dev libglew-dev libglm-dev libpng-dev libglu1-mesa-dev libalure-dev libvorbisfile3 libvorbis-dev libbox2d-dev libdumb1-dev libepoxy-dev git default-jre default-jdk make pkg-config wget
Since you aren't installing this the normal way, some of those dependencies and tools are redundant in this case, but that's aside the point of this topic.  :smileycat:

Manjaro/Arch-based Linux (some dependencies are missing on the wiki I got this from - find out the rest on your own; I don't use Arch Linux):
Code: [Select]
sudo pacman -Sy git make gcc zlib glew glm glu mesa alure box2d dumb zenity openal patch wget fakeroot cmake pkgconfig
pacman -S jdk8-openjdk

3) Terminal this:
Code: [Select]
cd /path/to/extracted/enigma-dev
4) Terminal that:
Code: [Select]
make
./install.sh

5) Run LateralGM:
Code: [Select]
java -jar lateralgm.jar
...or install emake as instruncted from the wiki and use that as you would normally.

Please note the aforementioned linux extension has not been written yet. All it will be really is an optional Makefile adding the compiler/linker flags for statically linking the extra dependencies.

Happy coding!
Samuel
« Last Edit: September 12, 2019, 02:23:11 AM by time-killer-games » Logged
Pages: 1
  Print