mirror of
https://github.com/raylib-cs/raylib-cs
synced 2025-06-30 19:03:42 -04:00
Merge branch 'master' of https://github.com/ChrisDill/Raylib-cs
This commit is contained in:
@ -1,6 +1,7 @@
|
||||
// Raylib - https://github.com/raysan5/raylib/blob/master/src/raylib.h
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
@ -1197,7 +1198,43 @@ namespace Raylib
|
||||
|
||||
// Get dropped files names
|
||||
[DllImport(nativeLibName,CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern string[] GetDroppedFiles(ref int count);
|
||||
private static extern IntPtr GetDroppedFiles( ref int count);
|
||||
// Get Dropped files Pointer translation
|
||||
public static string[] GetDroppedFiles()
|
||||
{
|
||||
int count = 0;
|
||||
IntPtr pointer = GetDroppedFiles(ref count);
|
||||
|
||||
string[] s = new string[count];
|
||||
char[] word;
|
||||
int i, j, size;
|
||||
|
||||
//TODO: this is a mess, find a better way
|
||||
unsafe
|
||||
{
|
||||
byte** str = (byte**)pointer.ToPointer();
|
||||
|
||||
i = 0;
|
||||
while (i < count)
|
||||
{
|
||||
j = 0;
|
||||
while (str[i][j] != 0)
|
||||
j++;
|
||||
size = j;
|
||||
word = new char[size];
|
||||
j = 0;
|
||||
while (str[i][j] != 0)
|
||||
{
|
||||
word[j] = (char)str[i][j];
|
||||
j++;
|
||||
}
|
||||
s[i] = new string(word);
|
||||
|
||||
i++;
|
||||
}
|
||||
}
|
||||
return s;
|
||||
}
|
||||
|
||||
// Clear dropped files paths buffer
|
||||
[DllImport(nativeLibName,CallingConvention = CallingConvention.Cdecl)]
|
||||
|
Reference in New Issue
Block a user