@@ -1009,6 +1009,36 @@ static Janet cfun_GetFileNameWithoutExt(int32_t argc, Janet *argv) {
1009
1009
return janet_wrap_string (GetFileNameWithoutExt (filepath ));
1010
1010
}
1011
1011
1012
+ static Janet cfun_LoadRandomSequence (int32_t argc , Janet * argv ) {
1013
+ janet_fixarity (argc , 3 );
1014
+ unsigned int count = janet_getinteger (argv , 0 );
1015
+ int min = janet_getinteger (argv , 1 );
1016
+ int max = janet_getinteger (argv , 2 );
1017
+ int * sequence = LoadRandomSequence (count , min , max );
1018
+ JanetArray * array = janet_array (0 );
1019
+ for (int i = 0 ; i < count ; ++ i ) {
1020
+ janet_array_push (array , janet_wrap_integer (sequence [i ]));
1021
+ }
1022
+ }
1023
+
1024
+ static Janet cfun_ExportDataAsCode (int32_t argc , Janet * argv ) {
1025
+ janet_fixarity (argc , 3 );
1026
+ const unsigned char * data = janet_getcstring (argv , 0 );
1027
+ int datasize = janet_getinteger (argv , 1 );
1028
+ const char * filename = janet_getcstring (argv , 2 );
1029
+ return janet_wrap_boolean (ExportDataAsCode (data , datasize , filename ));
1030
+ }
1031
+
1032
+ static Janet cfun_SetGamepadVibration (int32_t argc , Janet * argv ) {
1033
+ janet_fixarity (argc , 4 );
1034
+ int gamepad = janet_getinteger (argv , 0 );
1035
+ float leftmotor = janet_getnumber (argv , 1 );
1036
+ float rightmotor = janet_getnumber (argv , 2 );
1037
+ float duration = janet_getnumber (argv , 3 );
1038
+ SetGamepadVibration (gamepad , leftmotor , rightmotor , duration );
1039
+ return janet_wrap_nil ();
1040
+ }
1041
+
1012
1042
static JanetReg core_cfuns [] = {
1013
1043
{
1014
1044
"init-window" , cfun_InitWindow ,
@@ -1555,7 +1585,7 @@ static JanetReg core_cfuns[] = {
1555
1585
},
1556
1586
{
1557
1587
"get-application-directory" , cfun_GetApplicationDirectory ,
1558
- "(get-application-directory)\n\n" ,
1588
+ "(get-application-directory)\n\n"
1559
1589
"Get the directory of the running application."
1560
1590
},
1561
1591
{
@@ -1568,5 +1598,10 @@ static JanetReg core_cfuns[] = {
1568
1598
"(get-file-name-without-ext filepath)\n\n"
1569
1599
"Get filename string without extension."
1570
1600
},
1601
+ {
1602
+ "load-random-sequence" , cfun_LoadRandomSequence ,
1603
+ "(load-random-sequence count min max)\n\n"
1604
+ "Load random values sequence, no values repeated, min and max included."
1605
+ },
1571
1606
{NULL , NULL , NULL }
1572
1607
};
0 commit comments