Przeglądaj źródła

canvas: use GetCurrentProcessId() on Windows

getpid() or _getpid() are not available in UWP builds [1] but we can use
GetCurrentProcessId() instead.

[1] https://learn.microsoft.com/en-us/cpp/cppcx/crt-functions-not-supported-in-universal-windows-platform-apps#unsupported-crt-functions
pull/75/head
Steve Lhomme 2 lat temu
rodzic
commit
d78bdde484
1 zmienionych plików z 8 dodań i 0 usunięć
  1. +8
    -0
      caca/canvas.c

+ 8
- 0
caca/canvas.c Wyświetl plik

@@ -27,6 +27,10 @@
# include <unistd.h>
# endif
#endif
#ifdef _WIN32
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#endif

#include "caca.h"
#include "caca_internals.h"
@@ -351,7 +355,11 @@ int caca_rand(int min, int max)

if(need_init)
{
#ifdef _WIN32
srand(GetCurrentProcessId() + _caca_getticks(&timer));
#else
srand(getpid() + _caca_getticks(&timer));
#endif
need_init = 0;
}



Ładowanie…
Anuluj
Zapisz