mirror of
https://github.com/raysan5/raylib.git
synced 2026-01-26 00:59:16 -05:00
Updated Frequently Asked Questions (markdown)
@ -275,16 +275,23 @@ If you're getting `Failed to open file`, see the above question. If you're getti
|
|||||||
It can be removed with a compiler parameter, it depends on the platform and compiler. `gcc` supports `-Wl,--subsystem,windows` or [`-mwindows`](https://gcc.gnu.org/onlinedocs/gcc/x86-Windows-Options.html) compiler options. On Visual Studio, in Configuration Properties > Linker > System > SubSystem choose `Windows (/SUBSYSTEM:WINDOWS)` to avoid console. With other compilers there should be similar options.
|
It can be removed with a compiler parameter, it depends on the platform and compiler. `gcc` supports `-Wl,--subsystem,windows` or [`-mwindows`](https://gcc.gnu.org/onlinedocs/gcc/x86-Windows-Options.html) compiler options. On Visual Studio, in Configuration Properties > Linker > System > SubSystem choose `Windows (/SUBSYSTEM:WINDOWS)` to avoid console. With other compilers there should be similar options.
|
||||||
|
|
||||||
## How do I setup a custom icon for my executable?
|
## How do I setup a custom icon for my executable?
|
||||||
|
### Embedded icon (PE)
|
||||||
|
Icon support on executables is only supported in [PE executables](https://en.wikipedia.org/wiki/Portable_Executable), usually on Windows systems. Icon can be embedded as a resource in code compilation, when creating the executable or it can be changed at runtime on execution.
|
||||||
|
|
||||||
Icon support on executables is only supported [PE executables](https://en.wikipedia.org/wiki/Portable_Executable), usually on Windows systems. Icon can be embedded as a resource in code compilation, when creating the executable or it can be changed at runtime on execution.
|
To embed the icon as a resource on code compilation, a [`resource.rc` file](https://github.com/raysan5/raylib/blob/master/src/raylib.rc) should be created and compiled into an object file to be embedded as a regular code file. To compile that resource file, MinGW provides a tool called `windres.exe`:
|
||||||
|
|
||||||
1. To embed the icon as a resource on code compilation, a [`resource.rc` file](https://github.com/raysan5/raylib/blob/master/src/raylib.rc) should be created and compiled into an object file to be embedded as a regular code file. To compile that resource file, MinGW provides a tool called `windres.exe`:
|
|
||||||
```
|
```
|
||||||
windres resource.rc -o resource.rc.data --target=pe-x86-64
|
windres resource.rc -o resource.rc.data --target=pe-x86-64
|
||||||
```
|
```
|
||||||
With Visual Studio, adding the `resource.rc` file to the project should be enough.
|
With Visual Studio, adding the `resource.rc` file to the project should be enough.
|
||||||
|
|
||||||
2. To change the icon at runtime, raylib provides function `SetWindowIcon(Image image)`, just make sure that `image.format` is `PIXELFORMAT_UNCOMPRESSED_R8G8B8A8`, it's a requirement.
|
### Runtime icon
|
||||||
|
To change the icon at runtime, raylib provides the function `SetWindowIcon(Image image)`. This is the main way to change the icon on other operating systems. Just make sure that `image.format` is `PIXELFORMAT_UNCOMPRESSED_R8G8B8A8`, it's a requirement. Here is an example:
|
||||||
|
```c
|
||||||
|
Image icon = LoadImage("path/to/icon.png");
|
||||||
|
ImageFormat(&icon, PIXELFORMAT_UNCOMPRESSED_R8G8B8A8);
|
||||||
|
SetWindowIcon(icon);
|
||||||
|
UnloadImage(icon);
|
||||||
|
```
|
||||||
|
|
||||||
## How I deal with UTF-16 strings?
|
## How I deal with UTF-16 strings?
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user