• Dear Cerberus X User!

    As we prepare to transition the forum ownership from Mike to Phil (TripleHead GmbH), we need your explicit consent to transfer your user data in accordance with our amended Terms and Rules in order to be compliant with data protection laws.

    Important: If you accept the amended Terms and Rules, you agree to the transfer of your user data to the future forum owner!

    Please read the new Terms and Rules below, check the box to agree, and click "Accept" to continue enjoying your Cerberus X Forum experience. The deadline for consent is April 5, 2024.

    Do not accept the amended Terms and Rules if you do not wish your personal data to be transferred to the future forum owner!

    Accepting ensures:

    - Continued access to your account with a short break for the actual transfer.

    - Retention of your data under the same terms.

    Without consent:

    - You don't have further access to your forum user account.

    - Your account and personal data will be deleted after April 5, 2024.

    - Public posts remain, but usernames indicating real identity will be anonymized. If you disagree with a fictitious name you have the option to contact us so we can find a name that is acceptable to you.

    We hope to keep you in our community and see you on the forum soon!

    All the best

    Your Cerberus X Team

Easy way to change desktop game icon

muruba

New member
CX Code Contributor
3rd Party Module Dev
Tutorial Author
Patreon Silver
Joined
Jul 5, 2017
Messages
230
Subj, basically
 
I mean it would be good to have an easy way to change glfw target app icon. I found mx tutorials for it (which failed for me) but even then it was windows-only...
 
Actually it seems pretty easy to do:

1. Create default ICO file with CX default icon in multiple resolutions.
2. Create RES file
3. Update makefile to include RES file during linking stage.

and voila!

I tried with GCC and a hello world app and it seems to work fine (outside of CX build pipeline for now).

As a bonus we can add application info along with icon so it gets included to the final EXE file as well (things like company info/copyright/version etc).

https://stackoverflow.com/questions/708238/how-do-i-add-an-icon-to-a-mingw-gcc-compiled-executable

I might try my contribution wings with this, but need to finish my website and release my too-awesome-to-be-true game on IOS first as the icon is somewhat in "who cares" category I believe :)
 
aargh, what I said is true for the exe file, not the icon when the application is running, anyways... :eek:
 
You are talking about the icon in the taskbar and the corner of the window? I did it about a year ago with the tutorial in the old forum and it worked here. Will investigate...
These kind of tasks should definitely be automated in the ide or with some kind of tool. I hate it, if I solved a problem and after a few month I face the fact, that it will be nearly as hard to do as it was the first time.

Now I found the link to the mx forum Topic I was using.
 
Last edited:
Yes, using your method the icon of the EXE file is updated (in windows explorer view), however when the app runs it is showing win's default icon in the corner as well as when ALT-TABing it, so I guess it requires glfwSetWindowIcon on top of it...
 
My old build shows the new icon everywhere - None of the issues you described. I will try a new build with Cerberus soon
 
Ok. Here (Win10) it works with Cerberus. Both 32 and 64 bit.
The only problem I ran into was, that I couldn't use the old res-file (32 bit) for the 64 bit build.
And I had to use the windres of the 64 bit MinGW Version.

@muruba Did you use the rc-file mentioned in the tutorial with the two icons?
 
Ok. Here (Win10) it works with Cerberus. Both 32 and 64 bit.
@muruba Did you use the rc-file mentioned in the tutorial with the two icons?

No! Now all good, thanks a lot for your help! :)

upload_2017-8-9_11-4-23.png
 

Attachments

  • upload_2017-8-9_11-3-57.png
    upload_2017-8-9_11-3-57.png
    63.4 KB · Views: 357
TMP=build/$(dir $(OUT))

OBJS=$(patsubst %.o,$(TMP)%.o,$(OBJS0)) my.res

all : $(OUT)
 
I remember that used to be a PITA even with MSVC. I think the icons had to be poked into the .exe resources in the right order or something.

Knowing MS, whatever quirks were present on Windows 1.3 are still there in Windows 10.
 
Hi,
I'm trying to add icons to my Win32 or Win64 apps with no success.
I made a res file using the method above (windres), compiled the Debug64 app and put my icon.res file inside the ..\glfw3\gcc_winnt\build\Debug64 folder
Then I modified makefile like this
Code:
(...)

OBJS0=\
context.o \
egl_context.o \
init.o \
input.o \
monitor.o \
osmesa_context.o \
vulkan.o \
wgl_context.o \
win32_init.o \
win32_joystick.o \
win32_monitor.o \
win32_time.o \
win32_thread.o \
win32_window.o \
window.o \
stb_vorbis.o \
stb_image.o \
icon.res \
main.o

(...)

and I get this error message :
mingw32-make: *** No rule to make target 'icon.res', needed by 'Debug64/CerberusGame'. Stop.
TRANS FAILED: Error executing 'mingw32-make CCOPTS=" -m64 -O0" LDOPTS=" -m64 -LC:/Cerberus_18-4/libs/Win64" LIBOPTS=" -lopenal32" OUT="Debug64/CerberusGame"', return code=2
Abnormal program termination.
Exit code: -1

Any idea?
Thanks!

(EDIT : adding icons to MSVC projects is quite easy but I must use gcc this time)
 
The problem is icon.res, which is a MSVC compiled resource file.
The icon needs to be compiled with windres first to generate a object (.o) file, so the MinGW linker can include it into the final executable. Microsoft object files are not interchangeable with MinGW, even when the MinGW documentation states that you can use MSVC .lib files. This was why TDM-MinGW versions greater than 4.9 couldn't deal with the OpenAL32 export library (.lib) files supplied with MonkeyX/Cerberus.
 
Thanks dawlane it works!
Now I understand windres parameters better thank you.
I had to name my output file icon.o instead of icon.res and I also found out that i had to add -F pe-i386 if I intended to compile a 32bit app
What worked for my 32bit compilation was generating an icon.o file using windres
Code:
C:\TDM-GCC-64\bin\windres.exe -i C:\...\icon.rc -F pe-i386 -O coff -o C:\...\icon.o
Then copying the icon.o inside the C:\...\xxx.buildv2018-04-21\glfw3\gcc_winnt\build\Debug32 folder
And then adding
Code:
icon.o \
just before main.o
in the OBJS0=\ section of my C:\...\xxx.buildv2018-04-21\glfw3\gcc_winnt\Makefile

Now that I know how to do it, it looks simple but I couldn't have found it out without your help.
 
Last edited:
Back
Top Bottom