0

I'm making a little game using raylib in C++. I am trying to set the window icon using SetWindowIcon(icon), but it doesn't actually set the icon:

const int screenWidth = 1000;
const int screenHeight = 800;
InitWindow(screenWidth, screenHeight, "BulletProof"); 
const char* gameDirectory = GetWorkingDirectory();
std::string iconPath = std::string(gameDirectory) + "/icon.ico";
Image icon = LoadImage(iconPath.c_str());
SetWindowIcon(icon);

It does not give any error while compiling, and the game opens succesfuly, but icon is not changed. My icon is on .ico format. (I also tried a .png format image, but that also did not work).

Ian Boyd
  • 246,734
  • 253
  • 869
  • 1,219
  • Random guess: the working directory is not the same as the one where your icon is. – Botje Jul 06 '23 at 07:55
  • Unrelated: Capital letters are used on the first word of a sentence, not every word. – Botje Jul 06 '23 at 07:56
  • @Botje ,Well I Think It's False, Because I Load Player Sprite(`Player.png`) Using Same Function And It Works. – Merd Ceferzade Jul 06 '23 at 07:56
  • Hence why I marked it as "random guess". This is the most common reason for external resources not being usable. If you included that information in your post we wouldn't have to guess. – Botje Jul 06 '23 at 07:57
  • Next best thing is to whip out the debugger and step into `SetWindowIcon`, I guess. – Botje Jul 06 '23 at 07:58
  • // Set icon for window (only PLATFORM_DESKTOP) // NOTE 1: Image must be in RGBA format, 8bit per channel // NOTE 2: Image is scaled by the OS for all required sizes (This Is What Is Written In Definiton, I'll Try RGBA Format) – Merd Ceferzade Jul 06 '23 at 08:02

0 Answers0