GuiLoadIcons method

  1. @override
List<String> GuiLoadIcons(
  1. String fileName,
  2. bool loadIconsName
)
override

Implementation

@override
List<String> GuiLoadIcons(
  String fileName,
  bool loadIconsName,
) => run(
  () => RaylibDebugLabels.GuiLoadIcons(fileName, loadIconsName),
  () {
    final valuesPtr = rl.Gui.GuiLoadIcons.run2(
      fileName.toJS,
      loadIconsName.toJS,
    ).toInt();
    if (!loadIconsName || valuesPtr == 0) return [];

    final bytes = Uint8List.fromList(rl.CoreD.LoadFileData(fileName));
    if (bytes.length < 10) return [];

    // read iconCount from file header (2 bytes short at offset 8)
    final iconCount = ByteData.sublistView(bytes).getInt16(8, Endian.little);

    final icons = WasmStringPointerPointer(valuesPtr).readStrings(iconCount);
    WasmMemory.free(valuesPtr);
    return icons;
  },
);