@@ -272,14 +272,6 @@ static Janet cfun_SetClipboardText(int32_t argc, Janet *argv) {
272
272
return janet_wrap_nil ();
273
273
}
274
274
275
- static Janet cfun_GetClipboardImage (int32_t argc , Janet * argv ) {
276
- (void ) argv ;
277
- janet_fixarity (argc , 0 );
278
- Image * image = janet_abstract (& AT_Image , sizeof (Image ));
279
- * image = GetClipboardImage ();
280
- return janet_wrap_abstract (image );
281
- }
282
-
283
275
static Janet cfun_EnableEventWaiting (int32_t argc , Janet * argv ) {
284
276
(void ) argv ;
285
277
janet_fixarity (argc , 0 );
@@ -923,6 +915,14 @@ static Janet cfun_EndScissorMode(int32_t argc, Janet *argv) {
923
915
return janet_wrap_nil ();
924
916
}
925
917
918
+ static Janet cfun_GetClipboardImage (int32_t argc , Janet * argv ) {
919
+ (void ) argv ;
920
+ janet_fixarity (argc , 0 );
921
+ Image * image = janet_abstract (& AT_Image , sizeof (Image ));
922
+ * image = GetClipboardImage ();
923
+ return janet_wrap_abstract (image );
924
+ }
925
+
926
926
static Janet cfun_MakeDirectory (int32_t argc , Janet * argv ) {
927
927
janet_fixarity (argc , 1 );
928
928
const char * dirPath = janet_getcstring (argv , 0 );
@@ -966,6 +966,49 @@ static Janet cfun_IsFileNameValid(int32_t argc, Janet *argv) {
966
966
return janet_wrap_boolean (IsFileNameValid (filename ));
967
967
}
968
968
969
+ static Janet cfun_GetScreenToWorldRay (int32_t argc , Janet * argv ) {
970
+ janet_fixarity (argc , 2 );
971
+ Vector2 position = jaylib_unwrap_vec2 (argv [0 ]);
972
+ Camera * camera = jaylib_getcamera3d (argv , 1 );
973
+ Ray result = GetScreenToWorldRay (position , * camera );
974
+ return jaylib_wrap_ray (result );
975
+ }
976
+
977
+ static Janet cfun_GetScreenToWorldRayEx (int32_t argc , Janet * argv ) {
978
+ janet_fixarity (argc , 4 );
979
+ Vector2 position = jaylib_unwrap_vec2 (argv [0 ]);
980
+ Camera * camera = jaylib_getcamera3d (argv , 1 );
981
+ int width = janet_getinteger (argv , 2 );
982
+ int height = janet_getinteger (argv , 3 );
983
+ Ray result = GetScreenToWorldRayEx (position , * camera , width , height );
984
+ return jaylib_wrap_ray (result );
985
+ }
986
+
987
+ static Janet cfun_GetApplicationDirectory (int32_t argc , Janet * argv ) {
988
+ (void )argv ;
989
+ janet_fixarity (argc , 0 );
990
+ return janet_wrap_string (GetApplicationDirectory ());
991
+ }
992
+
993
+ static Janet cfun_LoadDirectoryFilesEx (int32_t argc , Janet * argv ) {
994
+ janet_fixarity (argc , 3 );
995
+ const char * basepath = janet_getcstring (argv , 0 );
996
+ const char * filter = janet_getcstring (argv , 1 );
997
+ bool scansubdirs = janet_getboolean (argv , 2 );
998
+ FilePathList files = LoadDirectoryFilesEx (basepath , filter , scansubdirs );
999
+ JanetArray * array = janet_array (0 );
1000
+ for (int i = 0 ; i < files .count ; ++ i ) {
1001
+ janet_array_push (array , janet_cstringv (files .paths [i ]));
1002
+ }
1003
+ return janet_wrap_array (array );
1004
+ }
1005
+
1006
+ static Janet cfun_GetFileNameWithoutExt (int32_t argc , Janet * argv ) {
1007
+ janet_fixarity (argc , 1 );
1008
+ const char * filepath = janet_getcstring (argv , 0 );
1009
+ return janet_wrap_string (GetFileNameWithoutExt (filepath ));
1010
+ }
1011
+
969
1012
static JanetReg core_cfuns [] = {
970
1013
{
971
1014
"init-window" , cfun_InitWindow ,
@@ -1122,11 +1165,6 @@ static JanetReg core_cfuns[] = {
1122
1165
"(set-clipboard-text text)\n\n"
1123
1166
"Set clipboard text content"
1124
1167
},
1125
- {
1126
- "get-clipboard-image" , cfun_GetClipboardImage ,
1127
- "(get-clipboard-image)\n\n"
1128
- "Get clipboard image content"
1129
- },
1130
1168
{
1131
1169
"enable-event-waiting" , cfun_EnableEventWaiting ,
1132
1170
"(enable-event-waiting)\n\n"
@@ -1475,6 +1513,11 @@ static JanetReg core_cfuns[] = {
1475
1513
"(end-scissor-mode)\n\n"
1476
1514
"Ends scissor mode. See `begin-scissor-mode`."
1477
1515
},
1516
+ {
1517
+ "get-clipboard-image" , cfun_GetClipboardImage ,
1518
+ "(get-clipboard-image)\n\n"
1519
+ "Get clipboard image content"
1520
+ },
1478
1521
{
1479
1522
"make-directory" , cfun_MakeDirectory ,
1480
1523
"(make-directory dirpath)\n\n"
@@ -1500,5 +1543,30 @@ static JanetReg core_cfuns[] = {
1500
1543
"(file-name-valid? filename)\n\n"
1501
1544
"Check if filename is valid for platform/OS."
1502
1545
},
1546
+ {
1547
+ "get-screen-to-world-ray" , cfun_GetScreenToWorldRay ,
1548
+ "(get-screen-to-world-ray position camera)\n\n"
1549
+ "Get a ray trace from screen position."
1550
+ },
1551
+ {
1552
+ "get-screen-to-world-ray-ex" , cfun_GetScreenToWorldRayEx ,
1553
+ "(get-screen-to-world-ray-ex position camera width height)\n\n"
1554
+ "Get a ray trace from screen position."
1555
+ },
1556
+ {
1557
+ "get-application-directory" , cfun_GetApplicationDirectory ,
1558
+ "(get-application-directory)\n\n" ,
1559
+ "Get the directory of the running application."
1560
+ },
1561
+ {
1562
+ "load-directory-files-ex" , cfun_LoadDirectoryFilesEx ,
1563
+ "(load-directory-files-ex basepath filter scansubdirs)\n\n"
1564
+ "Load directory filepaths with extension filtering and recursive directory scan."
1565
+ },
1566
+ {
1567
+ "get-file-name-without-ext" , cfun_GetFileNameWithoutExt ,
1568
+ "(get-file-name-without-ext filepath)\n\n"
1569
+ "Get filename string without extension."
1570
+ },
1503
1571
{NULL , NULL , NULL }
1504
1572
};
0 commit comments