diff --git a/bin/CMakeLists.txt b/bin/CMakeLists.txt index 8d3a425..6147c37 100644 --- a/bin/CMakeLists.txt +++ b/bin/CMakeLists.txt @@ -1,9 +1,14 @@ -find_package(Duktape) -find_package(Dukglue) +find_package(Duktapecc) find_package(Raylib) -list(APPEND LIBS raylib duktape dukglue raylib-js-h) -list(APPEND SOURCES raylib-js.cpp ${duktape_SOURCE_DIR}/extras/console/duk_console.c) +list(APPEND LIBS raylib duktapecc raylib-js-h) +list(APPEND SOURCES raylib-js.cpp) add_executable(raylib-js ${SOURCES}) target_link_libraries(raylib-js ${LIBS}) + + +set_target_properties(raylib-js PROPERTIES + CXX_STANDARD 17 + CXX_EXTENSIONS OFF + ) diff --git a/bin/raylib-js.cpp b/bin/raylib-js.cpp index 32784cc..c79a5a1 100644 --- a/bin/raylib-js.cpp +++ b/bin/raylib-js.cpp @@ -2,8 +2,9 @@ #include #include "raylib.h" -#include -#include +#include +#include +#include #include "raylib-js.h" int main(int argc, char *argv[]) @@ -44,19 +45,20 @@ int main(int argc, char *argv[]) } // Construct the Duktape environment. - duk_context* ctx = duk_create_heap_default(); - - // Initialize the console module. - duk_console_init(ctx, 0); + duktape::engine js; + duktape::mod::stdio::define_in(js); + duktape::mod::stdlib::define_in(js); // Initialize the raylib module. - duk_module_raylib_init(ctx); + raylibjs::define_in(js); // Eval the loaded code. - dukglue_peval(ctx, contents.c_str()); - - // Destroy the environment. - duk_destroy_heap(ctx); + try { + js.eval(contents.c_str()); + } + catch (const duktape::script_error& e) { + std::cout << "Caught '" << e.what() << "'" << std::endl; + } return 0; } diff --git a/cmake/FindDukglue.cmake b/cmake/FindDukglue.cmake deleted file mode 100644 index 7702b2c..0000000 --- a/cmake/FindDukglue.cmake +++ /dev/null @@ -1,17 +0,0 @@ -find_package(dukglue 2.5 QUIET) -if (NOT dukglue_FOUND) - include(FetchContent) - FetchContent_Declare( - dukglue - GIT_REPOSITORY https://github.com/Aloshi/dukglue.git - GIT_TAG 7b3a4f5edc0df5df5c206d101c40c5656bc90aef - ) - FetchContent_GetProperties(dukglue) - if (NOT dukglue_POPULATED) # Have we downloaded raylib yet? - set(FETCHCONTENT_QUIET NO) - FetchContent_Populate(dukglue) - set(BUILD_EXAMPLES OFF CACHE BOOL "" FORCE) # don't build the supplied examples - set(BUILD_GAMES OFF CACHE BOOL "" FORCE) # or games - add_subdirectory(${dukglue_SOURCE_DIR} ${dukglue_BINARY_DIR}) - endif() -endif() \ No newline at end of file diff --git a/cmake/FindDuktape.cmake b/cmake/FindDuktape.cmake deleted file mode 100644 index 3f94996..0000000 --- a/cmake/FindDuktape.cmake +++ /dev/null @@ -1,24 +0,0 @@ -find_package(duktape 2.4 QUIET) -if (NOT duktape_FOUND) - include(FetchContent) - FetchContent_Declare( - duktape - GIT_REPOSITORY https://github.com/svaarala/duktape-releases.git - GIT_TAG a4b0358f26bfb02a314db048e036f69c7250504f - ) - FetchContent_GetProperties(duktape) - if (NOT duktape_POPULATED) - set(FETCHCONTENT_QUIET NO) - FetchContent_Populate(duktape) - - add_library(duktape STATIC ${duktape_SOURCE_DIR}/src/duktape.c) - - if("${CMAKE_SYSTEM_NAME}" MATCHES "Linux") - target_link_libraries(duktape - m dl rt - ) - endif() - - target_include_directories(duktape PUBLIC ${duktape_SOURCE_DIR}/src ${duktape_SOURCE_DIR}/extras) - endif() -endif() diff --git a/cmake/FindDuktapecc.cmake b/cmake/FindDuktapecc.cmake new file mode 100644 index 0000000..f882445 --- /dev/null +++ b/cmake/FindDuktapecc.cmake @@ -0,0 +1,16 @@ +find_package(duktapecc 2.5 QUIET) +if (NOT duktapecc_FOUND) + include(FetchContent) + FetchContent_Declare( + duktapecc + GIT_REPOSITORY https://github.com/stfwi/duktape-cc.git + GIT_TAG 4b8d73dc8501779ed85a38c5586bc34ba14eca61 + ) + FetchContent_GetProperties(duktapecc) + if (NOT duktapecc_POPULATED) # Have we downloaded raylib yet? + set(FETCHCONTENT_QUIET NO) + FetchContent_Populate(duktapecc) + add_library(duktapecc ${duktapecc_SOURCE_DIR}/duktape/duktape.c) + target_include_directories(duktapecc PUBLIC ${duktapecc_SOURCE_DIR}) + endif() +endif() diff --git a/cmake/FindRaylib.cmake b/cmake/FindRaylib.cmake index cc7b992..7cb6a60 100644 --- a/cmake/FindRaylib.cmake +++ b/cmake/FindRaylib.cmake @@ -4,7 +4,7 @@ if (NOT raylib_FOUND) FetchContent_Declare( raylib GIT_REPOSITORY https://github.com/raysan5/raylib.git - GIT_TAG f3555a1016ec67105d67959a55b0fd9fda29fd25 + GIT_TAG 5d9df629d79458423faf249b952e595ed68d669b ) FetchContent_GetProperties(raylib) if (NOT raylib_POPULATED) # Have we downloaded raylib yet? diff --git a/include/CMakeLists.txt b/include/CMakeLists.txt index 1979ce0..1f3cccb 100644 --- a/include/CMakeLists.txt +++ b/include/CMakeLists.txt @@ -12,3 +12,5 @@ install(FILES ) target_include_directories(raylib-js-h INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}) + +add_dependencies(raylib-js-h duktapecc) diff --git a/include/raylib-js-functions.h b/include/raylib-js-functions.h index ef6dd59..fd36be2 100644 --- a/include/raylib-js-functions.h +++ b/include/raylib-js-functions.h @@ -2,438 +2,439 @@ #define RAYLIB_JS_FUNCTIONS_H__ #include -#include -#include +#include #include "raylib-js-structs.h" -void raylib_js_register_functions(duk_context* ctx) { - dukglue_register_function(ctx, &InitWindow, "InitWindow"); - dukglue_register_function(ctx, &WindowShouldClose, "WindowShouldClose"); - dukglue_register_function(ctx, &CloseWindow, "CloseWindow"); - dukglue_register_function(ctx, &IsWindowReady, "IsWindowReady"); - dukglue_register_function(ctx, &IsWindowMinimized, "IsWindowMinimized"); - dukglue_register_function(ctx, &IsWindowResized, "IsWindowResized"); - dukglue_register_function(ctx, &IsWindowHidden, "IsWindowHidden"); - dukglue_register_function(ctx, &ToggleFullscreen, "ToggleFullscreen"); - dukglue_register_function(ctx, &UnhideWindow, "UnhideWindow"); - dukglue_register_function(ctx, &HideWindow, "HideWindow"); - dukglue_register_function(ctx, &SetWindowIcon, "SetWindowIcon"); - dukglue_register_function(ctx, &SetWindowTitle, "SetWindowTitle"); - dukglue_register_function(ctx, &SetWindowPosition, "SetWindowPosition"); - dukglue_register_function(ctx, &SetWindowMonitor, "SetWindowMonitor"); - dukglue_register_function(ctx, &SetWindowMinSize, "SetWindowMinSize"); - dukglue_register_function(ctx, &SetWindowSize, "SetWindowSize"); - //dukglue_register_function(ctx, &GetWindowHandle, "GetWindowHandle"); - dukglue_register_function(ctx, &GetScreenWidth, "GetScreenWidth"); - dukglue_register_function(ctx, &GetScreenHeight, "GetScreenHeight"); - dukglue_register_function(ctx, &GetMonitorCount, "GetMonitorCount"); - dukglue_register_function(ctx, &GetMonitorWidth, "GetMonitorWidth"); - dukglue_register_function(ctx, &GetMonitorHeight, "GetMonitorHeight"); - dukglue_register_function(ctx, &GetMonitorPhysicalWidth, "GetMonitorPhysicalWidth"); - dukglue_register_function(ctx, &GetMonitorPhysicalHeight, "GetMonitorPhysicalHeight"); - dukglue_register_function(ctx, &GetMonitorName, "GetMonitorName"); - dukglue_register_function(ctx, &GetClipboardText, "GetClipboardText"); - dukglue_register_function(ctx, &SetClipboardText, "SetClipboardText"); - dukglue_register_function(ctx, &HideCursor, "HideCursor"); - dukglue_register_function(ctx, &IsCursorHidden, "IsCursorHidden"); - dukglue_register_function(ctx, &EnableCursor, "EnableCursor"); - dukglue_register_function(ctx, &DisableCursor, "DisableCursor"); - dukglue_register_function(ctx, &ClearBackground, "ClearBackground"); - dukglue_register_function(ctx, &BeginDrawing, "BeginDrawing"); - dukglue_register_function(ctx, &EndDrawing, "EndDrawing"); +namespace raylibjs { +template + static void define_functions(duktape::engine& js) { + js.define("InitWindow", InitWindow); + js.define("WindowShouldClose", WindowShouldClose); + js.define("CloseWindow", CloseWindow); + js.define("IsWindowReady", IsWindowReady); + // dukglue_register_function(ctx, &IsWindowMinimized, "IsWindowMinimized"); + // dukglue_register_function(ctx, &IsWindowResized, "IsWindowResized"); + // dukglue_register_function(ctx, &IsWindowHidden, "IsWindowHidden"); + // dukglue_register_function(ctx, &ToggleFullscreen, "ToggleFullscreen"); + // dukglue_register_function(ctx, &UnhideWindow, "UnhideWindow"); + // dukglue_register_function(ctx, &HideWindow, "HideWindow"); + // dukglue_register_function(ctx, &SetWindowIcon, "SetWindowIcon"); + // dukglue_register_function(ctx, &SetWindowTitle, "SetWindowTitle"); + // dukglue_register_function(ctx, &SetWindowPosition, "SetWindowPosition"); + // dukglue_register_function(ctx, &SetWindowMonitor, "SetWindowMonitor"); + // dukglue_register_function(ctx, &SetWindowMinSize, "SetWindowMinSize"); + // dukglue_register_function(ctx, &SetWindowSize, "SetWindowSize"); + // //dukglue_register_function(ctx, &GetWindowHandle, "GetWindowHandle"); + // dukglue_register_function(ctx, &GetScreenWidth, "GetScreenWidth"); + // dukglue_register_function(ctx, &GetScreenHeight, "GetScreenHeight"); + // dukglue_register_function(ctx, &GetMonitorCount, "GetMonitorCount"); + // dukglue_register_function(ctx, &GetMonitorWidth, "GetMonitorWidth"); + // dukglue_register_function(ctx, &GetMonitorHeight, "GetMonitorHeight"); + // dukglue_register_function(ctx, &GetMonitorPhysicalWidth, "GetMonitorPhysicalWidth"); + // dukglue_register_function(ctx, &GetMonitorPhysicalHeight, "GetMonitorPhysicalHeight"); + // dukglue_register_function(ctx, &GetMonitorName, "GetMonitorName"); + // dukglue_register_function(ctx, &GetClipboardText, "GetClipboardText"); + // dukglue_register_function(ctx, &SetClipboardText, "SetClipboardText"); + // dukglue_register_function(ctx, &HideCursor, "HideCursor"); + // dukglue_register_function(ctx, &IsCursorHidden, "IsCursorHidden"); + // dukglue_register_function(ctx, &EnableCursor, "EnableCursor"); + // dukglue_register_function(ctx, &DisableCursor, "DisableCursor"); + // dukglue_register_function(ctx, &ClearBackground, "ClearBackground"); + // dukglue_register_function(ctx, &BeginDrawing, "BeginDrawing"); + // dukglue_register_function(ctx, &EndDrawing, "EndDrawing"); - //dukglue_register_constructor(ctx, "Camera"); - //dukglue_set_base_class(ctx); + // //dukglue_register_constructor(ctx, "Camera"); + // //dukglue_set_base_class(ctx); - dukglue_register_function(ctx, &BeginMode2D, "BeginMode2D"); - dukglue_register_function(ctx, &EndMode2D, "EndMode2D"); - //dukglue_register_function(ctx, &BeginMode3D, "BeginMode3D"); - dukglue_register_function(ctx, &EndMode3D, "EndMode3D"); - //dukglue_register_function(ctx, &BeginTextureMode, "BeginTextureMode"); - dukglue_register_function(ctx, &EndTextureMode, "EndTextureMode"); - //dukglue_register_function(ctx, &GetMouseRay, "GetMouseRay"); - //dukglue_register_function(ctx, &GetWorldToScreen, "GetWorldToScreen"); - //dukglue_register_function(ctx, &GetCameraMatrix, "GetCameraMatrix"); - dukglue_register_function(ctx, &SetTargetFPS, "SetTargetFPS"); - dukglue_register_function(ctx, &GetFPS, "GetFPS"); - dukglue_register_function(ctx, &GetFrameTime, "GetFrameTime"); - dukglue_register_function(ctx, &GetTime, "GetTime"); - dukglue_register_function(ctx, &ColorToInt, "ColorToInt"); - dukglue_register_function(ctx, &ColorNormalize, "ColorNormalize"); - dukglue_register_function(ctx, &ColorToHSV, "ColorToHSV"); - dukglue_register_function(ctx, &ColorFromHSV, "ColorFromHSV"); - dukglue_register_function(ctx, &GetColor, "GetColor"); - dukglue_register_function(ctx, &Fade, "Fade"); + // dukglue_register_function(ctx, &BeginMode2D, "BeginMode2D"); + // dukglue_register_function(ctx, &EndMode2D, "EndMode2D"); + // //dukglue_register_function(ctx, &BeginMode3D, "BeginMode3D"); + // dukglue_register_function(ctx, &EndMode3D, "EndMode3D"); + // //dukglue_register_function(ctx, &BeginTextureMode, "BeginTextureMode"); + // dukglue_register_function(ctx, &EndTextureMode, "EndTextureMode"); + // //dukglue_register_function(ctx, &GetMouseRay, "GetMouseRay"); + // //dukglue_register_function(ctx, &GetWorldToScreen, "GetWorldToScreen"); + // //dukglue_register_function(ctx, &GetCameraMatrix, "GetCameraMatrix"); + // dukglue_register_function(ctx, &SetTargetFPS, "SetTargetFPS"); + // dukglue_register_function(ctx, &GetFPS, "GetFPS"); + // dukglue_register_function(ctx, &GetFrameTime, "GetFrameTime"); + // dukglue_register_function(ctx, &GetTime, "GetTime"); + // dukglue_register_function(ctx, &ColorToInt, "ColorToInt"); + // dukglue_register_function(ctx, &ColorNormalize, "ColorNormalize"); + // dukglue_register_function(ctx, &ColorToHSV, "ColorToHSV"); + // dukglue_register_function(ctx, &ColorFromHSV, "ColorFromHSV"); + // dukglue_register_function(ctx, &GetColor, "GetColor"); + // dukglue_register_function(ctx, &Fade, "Fade"); - /* - dukglue_register_function(ctx, &SetConfigFlags, "SetConfigFlags"); - dukglue_register_function(ctx, &SetTraceLogLevel, "SetTraceLogLevel"); - dukglue_register_function(ctx, &SetTraceLogExit, "SetTraceLogExit"); - dukglue_register_function(ctx, &SetTraceLogCallback, "SetTraceLogCallback"); - dukglue_register_function(ctx, &TraceLog, "TraceLog"); - */ + // /* + // dukglue_register_function(ctx, &SetConfigFlags, "SetConfigFlags"); + // dukglue_register_function(ctx, &SetTraceLogLevel, "SetTraceLogLevel"); + // dukglue_register_function(ctx, &SetTraceLogExit, "SetTraceLogExit"); + // dukglue_register_function(ctx, &SetTraceLogCallback, "SetTraceLogCallback"); + // dukglue_register_function(ctx, &TraceLog, "TraceLog"); + // */ - dukglue_register_function(ctx, &TakeScreenshot, "TakeScreenshot"); - dukglue_register_function(ctx, &GetRandomValue, "GetRandomValue"); - dukglue_register_function(ctx, &FileExists, "FileExists"); - dukglue_register_function(ctx, &IsFileExtension, "IsFileExtension"); - dukglue_register_function(ctx, &DirectoryExists, "DirectoryExists"); - dukglue_register_function(ctx, &GetExtension, "GetExtension"); - dukglue_register_function(ctx, &GetFileName, "GetFileName"); - dukglue_register_function(ctx, &GetFileNameWithoutExt, "GetFileNameWithoutExt"); - dukglue_register_function(ctx, &GetDirectoryPath, "GetDirectoryPath"); - dukglue_register_function(ctx, &GetPrevDirectoryPath, "GetPrevDirectoryPath"); - dukglue_register_function(ctx, &GetWorkingDirectory, "GetWorkingDirectory"); - //dukglue_register_function(ctx, &GetDirectoryFiles, "GetDirectoryFiles"); - dukglue_register_function(ctx, &ClearDirectoryFiles, "ClearDirectoryFiles"); - dukglue_register_function(ctx, &ChangeDirectory, "ChangeDirectory"); - dukglue_register_function(ctx, &IsFileDropped, "IsFileDropped"); - //dukglue_register_function(ctx, &GetDroppedFiles, "GetDroppedFiles"); - dukglue_register_function(ctx, &ClearDroppedFiles, "ClearDroppedFiles"); - dukglue_register_function(ctx, &GetFileModTime, "GetFileModTime"); - dukglue_register_function(ctx, &StorageSaveValue, "StorageSaveValue"); - dukglue_register_function(ctx, &StorageLoadValue, "StorageLoadValue"); - dukglue_register_function(ctx, &OpenURL, "OpenURL"); - dukglue_register_function(ctx, &IsKeyPressed, "IsKeyPressed"); - dukglue_register_function(ctx, &IsKeyDown, "IsKeyDown"); - dukglue_register_function(ctx, &IsKeyReleased, "IsKeyReleased"); - dukglue_register_function(ctx, &IsKeyUp, "IsKeyUp"); - dukglue_register_function(ctx, &GetKeyPressed, "GetKeyPressed"); - dukglue_register_function(ctx, &SetExitKey, "SetExitKey"); - dukglue_register_function(ctx, &IsGamepadAvailable, "IsGamepadAvailable"); - dukglue_register_function(ctx, &IsGamepadName, "IsGamepadName"); - dukglue_register_function(ctx, &GetGamepadName, "GetGamepadName"); - dukglue_register_function(ctx, &IsGamepadButtonPressed, "IsGamepadButtonPressed"); - dukglue_register_function(ctx, &IsGamepadButtonDown, "IsGamepadButtonDown"); - dukglue_register_function(ctx, &IsGamepadButtonReleased, "IsGamepadButtonReleased"); - dukglue_register_function(ctx, &IsGamepadButtonUp, "IsGamepadButtonUp"); - dukglue_register_function(ctx, &GetGamepadButtonPressed, "GetGamepadButtonPressed"); - dukglue_register_function(ctx, &GetGamepadAxisCount, "GetGamepadAxisCount"); - dukglue_register_function(ctx, &GetGamepadAxisMovement, "GetGamepadAxisMovement"); - dukglue_register_function(ctx, &IsMouseButtonPressed, "IsMouseButtonPressed"); - dukglue_register_function(ctx, &IsMouseButtonDown, "IsMouseButtonDown"); - dukglue_register_function(ctx, &IsMouseButtonReleased, "IsMouseButtonReleased"); - dukglue_register_function(ctx, &IsMouseButtonUp, "IsMouseButtonUp"); - dukglue_register_function(ctx, &GetMouseX, "GetMouseX"); - dukglue_register_function(ctx, &GetMouseY, "GetMouseY"); - dukglue_register_function(ctx, &GetMousePosition, "GetMousePosition"); - dukglue_register_function(ctx, &SetMousePosition, "SetMousePosition"); - dukglue_register_function(ctx, &SetMouseOffset, "SetMouseOffset"); - dukglue_register_function(ctx, &SetMouseScale, "SetMouseScale"); - dukglue_register_function(ctx, &GetMouseWheelMove, "GetMouseWheelMove"); - dukglue_register_function(ctx, &GetTouchX, "GetTouchX"); - dukglue_register_function(ctx, &GetTouchY, "GetTouchY"); - dukglue_register_function(ctx, &GetTouchPosition, "GetTouchPosition"); - dukglue_register_function(ctx, &SetGesturesEnabled, "SetGesturesEnabled"); - dukglue_register_function(ctx, &IsGestureDetected, "IsGestureDetected"); - dukglue_register_function(ctx, &GetGestureDetected, "GetGestureDetected"); - dukglue_register_function(ctx, &GetTouchPointsCount, "GetTouchPointsCount"); - dukglue_register_function(ctx, &GetGestureHoldDuration, "GetGestureHoldDuration"); - dukglue_register_function(ctx, &GetGestureDragVector, "GetGestureDragVector"); - dukglue_register_function(ctx, &GetGestureDragAngle, "GetGestureDragAngle"); - dukglue_register_function(ctx, &GetGesturePinchVector, "GetGesturePinchVector"); - dukglue_register_function(ctx, &GetGesturePinchAngle, "GetGesturePinchAngle"); - //dukglue_register_function(ctx, &SetCameraMode, "SetCameraMode"); - //dukglue_register_function(ctx, &UpdateCamera, "UpdateCamera"); - //dukglue_register_function(ctx, &SetCameraPanControl, "SetCameraPanControl"); - //dukglue_register_function(ctx, &SetCameraAltControl, "SetCameraAltControl"); - //dukglue_register_function(ctx, &SetCameraSmoothZoomControl, "SetCameraSmoothZoomControl"); - //dukglue_register_function(ctx, &SetCameraMoveControls, "SetCameraMoveControls"); - dukglue_register_function(ctx, &DrawPixel, "DrawPixel"); - dukglue_register_function(ctx, &DrawPixelV, "DrawPixelV"); - dukglue_register_function(ctx, &DrawLine, "DrawLine"); - dukglue_register_function(ctx, &DrawLineV, "DrawLineV"); - //dukglue_register_function(ctx, &DrawLineEx, "DrawLineEx"); - dukglue_register_function(ctx, &DrawLineBezier, "DrawLineBezier"); - //dukglue_register_function(ctx, &DrawLineStrip, "DrawLineStrip"); - dukglue_register_function(ctx, &DrawCircle, "DrawCircle"); - dukglue_register_function(ctx, &DrawCircleSector, "DrawCircleSector"); - dukglue_register_function(ctx, &DrawCircleSectorLines, "DrawCircleSectorLines"); - dukglue_register_function(ctx, &DrawCircleGradient, "DrawCircleGradient"); - dukglue_register_function(ctx, &DrawCircleV, "DrawCircleV"); - dukglue_register_function(ctx, &DrawCircleLines, "DrawCircleLines"); - dukglue_register_function(ctx, &DrawRing, "DrawRing"); - dukglue_register_function(ctx, &DrawRingLines, "DrawRingLines"); - dukglue_register_function(ctx, &DrawRectangle, "DrawRectangle"); - dukglue_register_function(ctx, &DrawRectangleV, "DrawRectangleV"); - dukglue_register_function(ctx, &DrawRectangleRec, "DrawRectangleRec"); - dukglue_register_function(ctx, &DrawRectanglePro, "DrawRectanglePro"); - dukglue_register_function(ctx, &DrawRectangleGradientV, "DrawRectangleGradientV"); - dukglue_register_function(ctx, &DrawRectangleGradientH, "DrawRectangleGradientH"); - dukglue_register_function(ctx, &DrawRectangleGradientEx, "DrawRectangleGradientEx"); - dukglue_register_function(ctx, &DrawRectangleLines, "DrawRectangleLines"); - dukglue_register_function(ctx, &DrawRectangleLinesEx, "DrawRectangleLinesEx"); - dukglue_register_function(ctx, &DrawRectangleRounded, "DrawRectangleRounded"); - dukglue_register_function(ctx, &DrawRectangleRoundedLines, "DrawRectangleRoundedLines"); - dukglue_register_function(ctx, &DrawTriangle, "DrawTriangle"); - dukglue_register_function(ctx, &DrawTriangleLines, "DrawTriangleLines"); - //dukglue_register_function(ctx, &DrawTriangleFan, "DrawTriangleFan"); - //dukglue_register_function(ctx, &DrawTriangleStrip, "DrawTriangleStrip"); - dukglue_register_function(ctx, &DrawPoly, "DrawPoly"); - dukglue_register_function(ctx, &SetShapesTexture, "SetShapesTexture"); - dukglue_register_function(ctx, &CheckCollisionRecs, "CheckCollisionRecs"); - dukglue_register_function(ctx, &CheckCollisionCircles, "CheckCollisionCircles"); - dukglue_register_function(ctx, &CheckCollisionCircleRec, "CheckCollisionCircleRec"); - dukglue_register_function(ctx, &GetCollisionRec, "GetCollisionRec"); - dukglue_register_function(ctx, &CheckCollisionPointRec, "CheckCollisionPointRec"); - dukglue_register_function(ctx, &CheckCollisionPointCircle, "CheckCollisionPointCircle"); - dukglue_register_function(ctx, &CheckCollisionPointTriangle, "CheckCollisionPointTriangle"); - dukglue_register_function(ctx, &LoadImage, "LoadImage"); - //dukglue_register_function(ctx, &LoadImageEx, "LoadImageEx"); - //dukglue_register_function(ctx, &LoadImagePro, "LoadImagePro"); - dukglue_register_function(ctx, &LoadImageRaw, "LoadImageRaw"); - dukglue_register_function(ctx, &ExportImage, "ExportImage"); - dukglue_register_function(ctx, &ExportImageAsCode, "ExportImageAsCode"); - dukglue_register_function(ctx, &LoadTexture, "LoadTexture"); - dukglue_register_function(ctx, &LoadTextureFromImage, "LoadTextureFromImage"); - dukglue_register_function(ctx, &LoadTextureCubemap, "LoadTextureCubemap"); - //dukglue_register_function(ctx, &LoadRenderTexture, "LoadRenderTexture"); - dukglue_register_function(ctx, &UnloadImage, "UnloadImage"); - dukglue_register_function(ctx, &UnloadTexture, "UnloadTexture"); - //dukglue_register_function(ctx, &UnloadRenderTexture, "UnloadRenderTexture"); - //dukglue_register_function(ctx, &GetImageData, "GetImageData"); - //dukglue_register_function(ctx, &GetImageDataNormalized, "GetImageDataNormalized"); - //dukglue_register_function(ctx, &GetImageAlphaBorder, "GetImageAlphaBorder"); - //dukglue_register_function(ctx, &GetPixelDataSize, "GetPixelDataSize"); - //dukglue_register_function(ctx, &GetTextureData, "GetTextureData"); - //dukglue_register_function(ctx, &GetScreenData, "GetScreenData"); - //dukglue_register_function(ctx, &UpdateTexture, "UpdateTexture"); - //dukglue_register_function(ctx, &ImageCopy, "ImageCopy"); - //dukglue_register_function(ctx, &ImageFromImage, "ImageFromImage"); - /* - dukglue_register_function(ctx, &ImageToPOT, "ImageToPOT"); - dukglue_register_function(ctx, &ImageFormat, "ImageFormat"); - dukglue_register_function(ctx, &ImageAlphaMask, "ImageAlphaMask"); - dukglue_register_function(ctx, &ImageAlphaClear, "ImageAlphaClear"); - dukglue_register_function(ctx, &ImageAlphaCrop, "ImageAlphaCrop"); - dukglue_register_function(ctx, &ImageAlphaPremultiply, "ImageAlphaPremultiply"); - dukglue_register_function(ctx, &ImageCrop, "ImageCrop"); - dukglue_register_function(ctx, &ImageResize, "ImageResize"); - dukglue_register_function(ctx, &ImageResizeNN, "ImageResizeNN"); - dukglue_register_function(ctx, &ImageResizeCanvas, "ImageResizeCanvas"); - dukglue_register_function(ctx, &ImageMipmaps, "ImageMipmaps"); - dukglue_register_function(ctx, &ImageDither, "ImageDither"); - dukglue_register_function(ctx, &ImageExtractPalette, "ImageExtractPalette"); - dukglue_register_function(ctx, &ImageText, "ImageText"); - dukglue_register_function(ctx, &ImageTextEx, "ImageTextEx"); - dukglue_register_function(ctx, &ImageDraw, "ImageDraw"); - dukglue_register_function(ctx, &ImageDrawRectangle, "ImageDrawRectangle"); - dukglue_register_function(ctx, &ImageDrawRectangleLines, "ImageDrawRectangleLines"); - dukglue_register_function(ctx, &ImageDrawText, "ImageDrawText"); - dukglue_register_function(ctx, &ImageDrawTextEx, "ImageDrawTextEx"); - dukglue_register_function(ctx, &ImageFlipVertical, "ImageFlipVertical"); - dukglue_register_function(ctx, &ImageFlipHorizontal, "ImageFlipHorizontal"); - dukglue_register_function(ctx, &ImageRotateCW, "ImageRotateCW"); - dukglue_register_function(ctx, &ImageRotateCCW, "ImageRotateCCW"); - dukglue_register_function(ctx, &ImageColorTint, "ImageColorTint"); - dukglue_register_function(ctx, &ImageColorInvert, "ImageColorInvert"); - dukglue_register_function(ctx, &ImageColorGrayscale, "ImageColorGrayscale"); - dukglue_register_function(ctx, &ImageColorContrast, "ImageColorContrast"); - dukglue_register_function(ctx, &ImageColorBrightness, "ImageColorBrightness"); - dukglue_register_function(ctx, &ImageColorReplace, "ImageColorReplace"); - */ - dukglue_register_function(ctx, &GenImageColor, "GenImageColor"); - dukglue_register_function(ctx, &GenImageGradientV, "GenImageGradientV"); - dukglue_register_function(ctx, &GenImageGradientH, "GenImageGradientH"); - dukglue_register_function(ctx, &GenImageGradientRadial, "GenImageGradientRadial"); - dukglue_register_function(ctx, &GenImageChecked, "GenImageChecked"); - dukglue_register_function(ctx, &GenImageWhiteNoise, "GenImageWhiteNoise"); - dukglue_register_function(ctx, &GenImagePerlinNoise, "GenImagePerlinNoise"); - dukglue_register_function(ctx, &GenImageCellular, "GenImageCellular"); - //dukglue_register_function(ctx, &GenTextureMipmaps, "GenTextureMipmaps"); - dukglue_register_function(ctx, &SetTextureFilter, "SetTextureFilter"); - dukglue_register_function(ctx, &SetTextureWrap, "SetTextureWrap"); - dukglue_register_function(ctx, &DrawTexture, "DrawTexture"); - //dukglue_register_function(ctx, &DrawTextureV, "DrawTextureV"); - //dukglue_register_function(ctx, &DrawTextureEx, "DrawTextureEx"); - //dukglue_register_function(ctx, &DrawTextureRec, "DrawTextureRec"); - //dukglue_register_function(ctx, &DrawTextureQuad, "DrawTextureQuad"); - //dukglue_register_function(ctx, &DrawTexturePro, "DrawTexturePro"); - //dukglue_register_function(ctx, &DrawTextureNPatch, "DrawTextureNPatch"); - //dukglue_register_function(ctx, &GetFontDefault, "GetFontDefault"); - //dukglue_register_function(ctx, &LoadFont, "LoadFont"); - //dukglue_register_function(ctx, &LoadFontEx, "LoadFontEx"); - //dukglue_register_function(ctx, &LoadFontFromImage, "LoadFontFromImage"); - //dukglue_register_function(ctx, &LoadFontData, "LoadFontData"); - //dukglue_register_function(ctx, &GenImageFontAtlas, "GenImageFontAtlas"); - //dukglue_register_function(ctx, &UnloadFont, "UnloadFont"); - dukglue_register_function(ctx, &DrawFPS, "DrawFPS"); - dukglue_register_function(ctx, &DrawText, "DrawText"); - //dukglue_register_function(ctx, &DrawTextEx, "DrawTextEx"); - //dukglue_register_function(ctx, &DrawTextRec, "DrawTextRec"); - //dukglue_register_function(ctx, &DrawTextRecEx, "DrawTextRecEx"); - dukglue_register_function(ctx, &MeasureText, "MeasureText"); - //dukglue_register_function(ctx, &MeasureTextEx, "MeasureTextEx"); - //dukglue_register_function(ctx, &GetGlyphIndex, "GetGlyphIndex"); - //dukglue_register_function(ctx, &GetNextCodepoint, "GetNextCodepoint"); - dukglue_register_function(ctx, &TextIsEqual, "TextIsEqual"); - dukglue_register_function(ctx, &TextLength, "TextLength"); - dukglue_register_function(ctx, &TextCountCodepoints, "TextCountCodepoints"); - //dukglue_register_function(ctx, &TextFormat, "TextFormat"); - dukglue_register_function(ctx, &TextSubtext, "TextSubtext"); - //dukglue_register_function(ctx, &TextReplace, "TextReplace"); - //dukglue_register_function(ctx, &TextInsert, "TextInsert"); - //dukglue_register_function(ctx, &TextJoin, "TextJoin"); - //dukglue_register_function(ctx, &TextSplit, "TextSplit"); - //dukglue_register_function(ctx, &TextAppend, "TextAppend"); - //dukglue_register_function(ctx, &TextFindIndex, "TextFindIndex"); - dukglue_register_function(ctx, &TextToUpper, "TextToUpper"); - dukglue_register_function(ctx, &TextToLower, "TextToLower"); - dukglue_register_function(ctx, &TextToPascal, "TextToPascal"); - dukglue_register_function(ctx, &TextToInteger, "TextToInteger"); - dukglue_register_function(ctx, &DrawLine3D, "DrawLine3D"); - dukglue_register_function(ctx, &DrawCircle3D, "DrawCircle3D"); - dukglue_register_function(ctx, &DrawCube, "DrawCube"); - dukglue_register_function(ctx, &DrawCubeV, "DrawCubeV"); - dukglue_register_function(ctx, &DrawCubeWires, "DrawCubeWires"); - dukglue_register_function(ctx, &DrawCubeWiresV, "DrawCubeWiresV"); - dukglue_register_function(ctx, &DrawCubeTexture, "DrawCubeTexture"); - dukglue_register_function(ctx, &DrawSphere, "DrawSphere"); - //dukglue_register_function(ctx, &DrawSphereEx, "DrawSphereEx"); - dukglue_register_function(ctx, &DrawSphereWires, "DrawSphereWires"); - dukglue_register_function(ctx, &DrawCylinder, "DrawCylinder"); - dukglue_register_function(ctx, &DrawCylinderWires, "DrawCylinderWires"); - dukglue_register_function(ctx, &DrawPlane, "DrawPlane"); - //dukglue_register_function(ctx, &DrawRay, "DrawRay"); - dukglue_register_function(ctx, &DrawGrid, "DrawGrid"); - dukglue_register_function(ctx, &DrawGizmo, "DrawGizmo"); - /* - dukglue_register_function(ctx, &LoadModel, "LoadModel"); - dukglue_register_function(ctx, &LoadModelFromMesh, "LoadModelFromMesh"); - dukglue_register_function(ctx, &UnloadModel, "UnloadModel"); - dukglue_register_function(ctx, &LoadMeshes, "LoadMeshes"); - dukglue_register_function(ctx, &ExportMesh, "ExportMesh"); - dukglue_register_function(ctx, &UnloadMesh, "UnloadMesh"); - dukglue_register_function(ctx, &LoadMaterials, "LoadMaterials"); - dukglue_register_function(ctx, &LoadMaterialDefault, "LoadMaterialDefault"); - dukglue_register_function(ctx, &UnloadMaterial, "UnloadMaterial"); - dukglue_register_function(ctx, &SetMaterialTexture, "SetMaterialTexture"); - dukglue_register_function(ctx, &SetModelMeshMaterial, "SetModelMeshMaterial"); - dukglue_register_function(ctx, &LoadModelAnimations, "LoadModelAnimations"); - dukglue_register_function(ctx, &UpdateModelAnimation, "UpdateModelAnimation"); - dukglue_register_function(ctx, &UnloadModelAnimation, "UnloadModelAnimation"); - dukglue_register_function(ctx, &IsModelAnimationValid, "IsModelAnimationValid"); - dukglue_register_function(ctx, &GenMeshPoly, "GenMeshPoly"); - dukglue_register_function(ctx, &GenMeshPlane, "GenMeshPlane"); - dukglue_register_function(ctx, &GenMeshCube, "GenMeshCube"); - dukglue_register_function(ctx, &GenMeshSphere, "GenMeshSphere"); - dukglue_register_function(ctx, &GenMeshHemiSphere, "GenMeshHemiSphere"); - dukglue_register_function(ctx, &GenMeshCylinder, "GenMeshCylinder"); - dukglue_register_function(ctx, &GenMeshTorus, "GenMeshTorus"); - dukglue_register_function(ctx, &GenMeshKnot, "GenMeshKnot"); - dukglue_register_function(ctx, &GenMeshHeightmap, "GenMeshHeightmap"); - dukglue_register_function(ctx, &GenMeshCubicmap, "GenMeshCubicmap"); - dukglue_register_function(ctx, &MeshBoundingBox, "MeshBoundingBox"); - dukglue_register_function(ctx, &MeshTangents, "MeshTangents"); - dukglue_register_function(ctx, &MeshBinormals, "MeshBinormals"); - */ + // dukglue_register_function(ctx, &TakeScreenshot, "TakeScreenshot"); + // dukglue_register_function(ctx, &GetRandomValue, "GetRandomValue"); + // dukglue_register_function(ctx, &FileExists, "FileExists"); + // dukglue_register_function(ctx, &IsFileExtension, "IsFileExtension"); + // dukglue_register_function(ctx, &DirectoryExists, "DirectoryExists"); + // dukglue_register_function(ctx, &GetExtension, "GetExtension"); + // dukglue_register_function(ctx, &GetFileName, "GetFileName"); + // dukglue_register_function(ctx, &GetFileNameWithoutExt, "GetFileNameWithoutExt"); + // dukglue_register_function(ctx, &GetDirectoryPath, "GetDirectoryPath"); + // dukglue_register_function(ctx, &GetPrevDirectoryPath, "GetPrevDirectoryPath"); + // dukglue_register_function(ctx, &GetWorkingDirectory, "GetWorkingDirectory"); + // //dukglue_register_function(ctx, &GetDirectoryFiles, "GetDirectoryFiles"); + // dukglue_register_function(ctx, &ClearDirectoryFiles, "ClearDirectoryFiles"); + // dukglue_register_function(ctx, &ChangeDirectory, "ChangeDirectory"); + // dukglue_register_function(ctx, &IsFileDropped, "IsFileDropped"); + // //dukglue_register_function(ctx, &GetDroppedFiles, "GetDroppedFiles"); + // dukglue_register_function(ctx, &ClearDroppedFiles, "ClearDroppedFiles"); + // dukglue_register_function(ctx, &GetFileModTime, "GetFileModTime"); + // dukglue_register_function(ctx, &StorageSaveValue, "StorageSaveValue"); + // dukglue_register_function(ctx, &StorageLoadValue, "StorageLoadValue"); + // dukglue_register_function(ctx, &OpenURL, "OpenURL"); + // dukglue_register_function(ctx, &IsKeyPressed, "IsKeyPressed"); + // dukglue_register_function(ctx, &IsKeyDown, "IsKeyDown"); + // dukglue_register_function(ctx, &IsKeyReleased, "IsKeyReleased"); + // dukglue_register_function(ctx, &IsKeyUp, "IsKeyUp"); + // dukglue_register_function(ctx, &GetKeyPressed, "GetKeyPressed"); + // dukglue_register_function(ctx, &SetExitKey, "SetExitKey"); + // dukglue_register_function(ctx, &IsGamepadAvailable, "IsGamepadAvailable"); + // dukglue_register_function(ctx, &IsGamepadName, "IsGamepadName"); + // dukglue_register_function(ctx, &GetGamepadName, "GetGamepadName"); + // dukglue_register_function(ctx, &IsGamepadButtonPressed, "IsGamepadButtonPressed"); + // dukglue_register_function(ctx, &IsGamepadButtonDown, "IsGamepadButtonDown"); + // dukglue_register_function(ctx, &IsGamepadButtonReleased, "IsGamepadButtonReleased"); + // dukglue_register_function(ctx, &IsGamepadButtonUp, "IsGamepadButtonUp"); + // dukglue_register_function(ctx, &GetGamepadButtonPressed, "GetGamepadButtonPressed"); + // dukglue_register_function(ctx, &GetGamepadAxisCount, "GetGamepadAxisCount"); + // dukglue_register_function(ctx, &GetGamepadAxisMovement, "GetGamepadAxisMovement"); + // dukglue_register_function(ctx, &IsMouseButtonPressed, "IsMouseButtonPressed"); + // dukglue_register_function(ctx, &IsMouseButtonDown, "IsMouseButtonDown"); + // dukglue_register_function(ctx, &IsMouseButtonReleased, "IsMouseButtonReleased"); + // dukglue_register_function(ctx, &IsMouseButtonUp, "IsMouseButtonUp"); + // dukglue_register_function(ctx, &GetMouseX, "GetMouseX"); + // dukglue_register_function(ctx, &GetMouseY, "GetMouseY"); + // dukglue_register_function(ctx, &GetMousePosition, "GetMousePosition"); + // dukglue_register_function(ctx, &SetMousePosition, "SetMousePosition"); + // dukglue_register_function(ctx, &SetMouseOffset, "SetMouseOffset"); + // dukglue_register_function(ctx, &SetMouseScale, "SetMouseScale"); + // dukglue_register_function(ctx, &GetMouseWheelMove, "GetMouseWheelMove"); + // dukglue_register_function(ctx, &GetTouchX, "GetTouchX"); + // dukglue_register_function(ctx, &GetTouchY, "GetTouchY"); + // dukglue_register_function(ctx, &GetTouchPosition, "GetTouchPosition"); + // dukglue_register_function(ctx, &SetGesturesEnabled, "SetGesturesEnabled"); + // dukglue_register_function(ctx, &IsGestureDetected, "IsGestureDetected"); + // dukglue_register_function(ctx, &GetGestureDetected, "GetGestureDetected"); + // dukglue_register_function(ctx, &GetTouchPointsCount, "GetTouchPointsCount"); + // dukglue_register_function(ctx, &GetGestureHoldDuration, "GetGestureHoldDuration"); + // dukglue_register_function(ctx, &GetGestureDragVector, "GetGestureDragVector"); + // dukglue_register_function(ctx, &GetGestureDragAngle, "GetGestureDragAngle"); + // dukglue_register_function(ctx, &GetGesturePinchVector, "GetGesturePinchVector"); + // dukglue_register_function(ctx, &GetGesturePinchAngle, "GetGesturePinchAngle"); + // //dukglue_register_function(ctx, &SetCameraMode, "SetCameraMode"); + // //dukglue_register_function(ctx, &UpdateCamera, "UpdateCamera"); + // //dukglue_register_function(ctx, &SetCameraPanControl, "SetCameraPanControl"); + // //dukglue_register_function(ctx, &SetCameraAltControl, "SetCameraAltControl"); + // //dukglue_register_function(ctx, &SetCameraSmoothZoomControl, "SetCameraSmoothZoomControl"); + // //dukglue_register_function(ctx, &SetCameraMoveControls, "SetCameraMoveControls"); + // dukglue_register_function(ctx, &DrawPixel, "DrawPixel"); + // dukglue_register_function(ctx, &DrawPixelV, "DrawPixelV"); + // dukglue_register_function(ctx, &DrawLine, "DrawLine"); + // dukglue_register_function(ctx, &DrawLineV, "DrawLineV"); + // //dukglue_register_function(ctx, &DrawLineEx, "DrawLineEx"); + // dukglue_register_function(ctx, &DrawLineBezier, "DrawLineBezier"); + // //dukglue_register_function(ctx, &DrawLineStrip, "DrawLineStrip"); + // dukglue_register_function(ctx, &DrawCircle, "DrawCircle"); + // dukglue_register_function(ctx, &DrawCircleSector, "DrawCircleSector"); + // dukglue_register_function(ctx, &DrawCircleSectorLines, "DrawCircleSectorLines"); + // dukglue_register_function(ctx, &DrawCircleGradient, "DrawCircleGradient"); + // dukglue_register_function(ctx, &DrawCircleV, "DrawCircleV"); + // dukglue_register_function(ctx, &DrawCircleLines, "DrawCircleLines"); + // dukglue_register_function(ctx, &DrawRing, "DrawRing"); + // dukglue_register_function(ctx, &DrawRingLines, "DrawRingLines"); + // dukglue_register_function(ctx, &DrawRectangle, "DrawRectangle"); + // dukglue_register_function(ctx, &DrawRectangleV, "DrawRectangleV"); + // dukglue_register_function(ctx, &DrawRectangleRec, "DrawRectangleRec"); + // dukglue_register_function(ctx, &DrawRectanglePro, "DrawRectanglePro"); + // dukglue_register_function(ctx, &DrawRectangleGradientV, "DrawRectangleGradientV"); + // dukglue_register_function(ctx, &DrawRectangleGradientH, "DrawRectangleGradientH"); + // dukglue_register_function(ctx, &DrawRectangleGradientEx, "DrawRectangleGradientEx"); + // dukglue_register_function(ctx, &DrawRectangleLines, "DrawRectangleLines"); + // dukglue_register_function(ctx, &DrawRectangleLinesEx, "DrawRectangleLinesEx"); + // dukglue_register_function(ctx, &DrawRectangleRounded, "DrawRectangleRounded"); + // dukglue_register_function(ctx, &DrawRectangleRoundedLines, "DrawRectangleRoundedLines"); + // dukglue_register_function(ctx, &DrawTriangle, "DrawTriangle"); + // dukglue_register_function(ctx, &DrawTriangleLines, "DrawTriangleLines"); + // //dukglue_register_function(ctx, &DrawTriangleFan, "DrawTriangleFan"); + // //dukglue_register_function(ctx, &DrawTriangleStrip, "DrawTriangleStrip"); + // dukglue_register_function(ctx, &DrawPoly, "DrawPoly"); + // dukglue_register_function(ctx, &SetShapesTexture, "SetShapesTexture"); + // dukglue_register_function(ctx, &CheckCollisionRecs, "CheckCollisionRecs"); + // dukglue_register_function(ctx, &CheckCollisionCircles, "CheckCollisionCircles"); + // dukglue_register_function(ctx, &CheckCollisionCircleRec, "CheckCollisionCircleRec"); + // dukglue_register_function(ctx, &GetCollisionRec, "GetCollisionRec"); + // dukglue_register_function(ctx, &CheckCollisionPointRec, "CheckCollisionPointRec"); + // dukglue_register_function(ctx, &CheckCollisionPointCircle, "CheckCollisionPointCircle"); + // dukglue_register_function(ctx, &CheckCollisionPointTriangle, "CheckCollisionPointTriangle"); + // dukglue_register_function(ctx, &LoadImage, "LoadImage"); + // //dukglue_register_function(ctx, &LoadImageEx, "LoadImageEx"); + // //dukglue_register_function(ctx, &LoadImagePro, "LoadImagePro"); + // dukglue_register_function(ctx, &LoadImageRaw, "LoadImageRaw"); + // dukglue_register_function(ctx, &ExportImage, "ExportImage"); + // dukglue_register_function(ctx, &ExportImageAsCode, "ExportImageAsCode"); + // dukglue_register_function(ctx, &LoadTexture, "LoadTexture"); + // dukglue_register_function(ctx, &LoadTextureFromImage, "LoadTextureFromImage"); + // dukglue_register_function(ctx, &LoadTextureCubemap, "LoadTextureCubemap"); + // //dukglue_register_function(ctx, &LoadRenderTexture, "LoadRenderTexture"); + // dukglue_register_function(ctx, &UnloadImage, "UnloadImage"); + // dukglue_register_function(ctx, &UnloadTexture, "UnloadTexture"); + // //dukglue_register_function(ctx, &UnloadRenderTexture, "UnloadRenderTexture"); + // //dukglue_register_function(ctx, &GetImageData, "GetImageData"); + // //dukglue_register_function(ctx, &GetImageDataNormalized, "GetImageDataNormalized"); + // //dukglue_register_function(ctx, &GetImageAlphaBorder, "GetImageAlphaBorder"); + // //dukglue_register_function(ctx, &GetPixelDataSize, "GetPixelDataSize"); + // //dukglue_register_function(ctx, &GetTextureData, "GetTextureData"); + // //dukglue_register_function(ctx, &GetScreenData, "GetScreenData"); + // //dukglue_register_function(ctx, &UpdateTexture, "UpdateTexture"); + // //dukglue_register_function(ctx, &ImageCopy, "ImageCopy"); + // //dukglue_register_function(ctx, &ImageFromImage, "ImageFromImage"); - /* - dukglue_register_function(ctx, &DrawModel, "DrawModel"); - dukglue_register_function(ctx, &DrawModelEx, "DrawModelEx"); - dukglue_register_function(ctx, &DrawModelWires, "DrawModelWires"); - dukglue_register_function(ctx, &DrawModelWiresEx, "DrawModelWiresEx"); - dukglue_register_function(ctx, &DrawBoundingBox, "DrawBoundingBox"); - dukglue_register_function(ctx, &DrawBillboard, "DrawBillboard"); - dukglue_register_function(ctx, &DrawBillboardRec, "DrawBillboardRec"); - dukglue_register_function(ctx, &CheckCollisionSpheres, "CheckCollisionSpheres"); - dukglue_register_function(ctx, &CheckCollisionBoxes, "CheckCollisionBoxes"); - dukglue_register_function(ctx, &CheckCollisionBoxSphere, "CheckCollisionBoxSphere"); - dukglue_register_function(ctx, &CheckCollisionRaySphere, "CheckCollisionRaySphere"); - dukglue_register_function(ctx, &CheckCollisionRaySphereEx, "CheckCollisionRaySphereEx"); - dukglue_register_function(ctx, &CheckCollisionRayBox, "CheckCollisionRayBox"); - dukglue_register_function(ctx, &GetCollisionRayModel, "GetCollisionRayModel"); - dukglue_register_function(ctx, &GetCollisionRayTriangle, "GetCollisionRayTriangle"); - dukglue_register_function(ctx, &GetCollisionRayGround, "GetCollisionRayGround"); - */ - //dukglue_register_function(ctx, &LoadText, "LoadText"); - /* - dukglue_register_function(ctx, &LoadShader, "LoadShader"); - dukglue_register_function(ctx, &LoadShaderCode, "LoadShaderCode"); - dukglue_register_function(ctx, &UnloadShader, "UnloadShader"); - dukglue_register_function(ctx, &GetShaderDefault, "GetShaderDefault"); - dukglue_register_function(ctx, &GetTextureDefault, "GetTextureDefault"); - dukglue_register_function(ctx, &GetShaderLocation, "GetShaderLocation"); - dukglue_register_function(ctx, &SetShaderValue, "SetShaderValue"); - dukglue_register_function(ctx, &SetShaderValueV, "SetShaderValueV"); - dukglue_register_function(ctx, &SetShaderValueMatrix, "SetShaderValueMatrix"); - dukglue_register_function(ctx, &SetShaderValueTexture, "SetShaderValueTexture"); - dukglue_register_function(ctx, &SetMatrixProjection, "SetMatrixProjection"); - dukglue_register_function(ctx, &SetMatrixModelview, "SetMatrixModelview"); - dukglue_register_function(ctx, &GetMatrixModelview, "GetMatrixModelview"); - dukglue_register_function(ctx, &GenTextureCubemap, "GenTextureCubemap"); - dukglue_register_function(ctx, &GenTextureIrradiance, "GenTextureIrradiance"); - dukglue_register_function(ctx, &GenTexturePrefilter, "GenTexturePrefilter"); - dukglue_register_function(ctx, &GenTextureBRDF, "GenTextureBRDF"); - dukglue_register_function(ctx, &BeginShaderMode, "BeginShaderMode"); - dukglue_register_function(ctx, &EndShaderMode, "EndShaderMode"); - dukglue_register_function(ctx, &BeginBlendMode, "BeginBlendMode"); - dukglue_register_function(ctx, &EndBlendMode, "EndBlendMode"); - dukglue_register_function(ctx, &BeginScissorMode, "BeginScissorMode"); - dukglue_register_function(ctx, &EndScissorMode, "EndScissorMode"); - dukglue_register_function(ctx, &InitVrSimulator, "InitVrSimulator"); - dukglue_register_function(ctx, &CloseVrSimulator, "CloseVrSimulator"); - dukglue_register_function(ctx, &UpdateVrTracking, "UpdateVrTracking"); - dukglue_register_function(ctx, &SetVrConfiguration, "SetVrConfiguration"); - dukglue_register_function(ctx, &IsVrSimulatorReady, "IsVrSimulatorReady"); - dukglue_register_function(ctx, &ToggleVrMode, "ToggleVrMode"); - dukglue_register_function(ctx, &BeginVrDrawing, "BeginVrDrawing"); - dukglue_register_function(ctx, &EndVrDrawing, "EndVrDrawing"); - */ - dukglue_register_function(ctx, &InitAudioDevice, "InitAudioDevice"); - dukglue_register_function(ctx, &CloseAudioDevice, "CloseAudioDevice"); + // dukglue_register_function(ctx, &ImageToPOT, "ImageToPOT"); + // dukglue_register_function(ctx, &ImageFormat, "ImageFormat"); + // dukglue_register_function(ctx, &ImageAlphaMask, "ImageAlphaMask"); + // dukglue_register_function(ctx, &ImageAlphaClear, "ImageAlphaClear"); + // dukglue_register_function(ctx, &ImageAlphaCrop, "ImageAlphaCrop"); + // dukglue_register_function(ctx, &ImageAlphaPremultiply, "ImageAlphaPremultiply"); + // dukglue_register_function(ctx, &ImageCrop, "ImageCrop"); + // dukglue_register_function(ctx, &ImageResize, "ImageResize"); + // dukglue_register_function(ctx, &ImageResizeNN, "ImageResizeNN"); + // dukglue_register_function(ctx, &ImageResizeCanvas, "ImageResizeCanvas"); + // dukglue_register_function(ctx, &ImageMipmaps, "ImageMipmaps"); + // dukglue_register_function(ctx, &ImageDither, "ImageDither"); + // dukglue_register_function(ctx, &ImageExtractPalette, "ImageExtractPalette"); + // dukglue_register_function(ctx, &ImageText, "ImageText"); + // dukglue_register_function(ctx, &ImageTextEx, "ImageTextEx"); + // dukglue_register_function(ctx, &ImageDraw, "ImageDraw"); + // dukglue_register_function(ctx, &ImageDrawRectangle, "ImageDrawRectangle"); + // dukglue_register_function(ctx, &ImageDrawRectangleLines, "ImageDrawRectangleLines"); + // dukglue_register_function(ctx, &ImageDrawText, "ImageDrawText"); + // dukglue_register_function(ctx, &ImageDrawTextEx, "ImageDrawTextEx"); + // dukglue_register_function(ctx, &ImageFlipVertical, "ImageFlipVertical"); + // dukglue_register_function(ctx, &ImageFlipHorizontal, "ImageFlipHorizontal"); + // dukglue_register_function(ctx, &ImageRotateCW, "ImageRotateCW"); + // dukglue_register_function(ctx, &ImageRotateCCW, "ImageRotateCCW"); + // dukglue_register_function(ctx, &ImageColorTint, "ImageColorTint"); + // dukglue_register_function(ctx, &ImageColorInvert, "ImageColorInvert"); + // dukglue_register_function(ctx, &ImageColorGrayscale, "ImageColorGrayscale"); + // dukglue_register_function(ctx, &ImageColorContrast, "ImageColorContrast"); + // dukglue_register_function(ctx, &ImageColorBrightness, "ImageColorBrightness"); + // dukglue_register_function(ctx, &ImageColorReplace, "ImageColorReplace"); - /* - dukglue_register_function(ctx, &IsAudioDeviceReady, "IsAudioDeviceReady"); - dukglue_register_function(ctx, &SetMasterVolume, "SetMasterVolume"); - dukglue_register_function(ctx, &LoadWave, "LoadWave"); - dukglue_register_function(ctx, &LoadSound, "LoadSound"); - dukglue_register_function(ctx, &LoadSoundFromWave, "LoadSoundFromWave"); - dukglue_register_function(ctx, &UpdateSound, "UpdateSound"); - dukglue_register_function(ctx, &UnloadWave, "UnloadWave"); - dukglue_register_function(ctx, &UnloadSound, "UnloadSound"); - dukglue_register_function(ctx, &ExportWave, "ExportWave"); - dukglue_register_function(ctx, &ExportWaveAsCode, "ExportWaveAsCode"); - dukglue_register_function(ctx, &PlaySound, "PlaySound"); - dukglue_register_function(ctx, &StopSound, "StopSound"); - dukglue_register_function(ctx, &PauseSound, "PauseSound"); - dukglue_register_function(ctx, &ResumeSound, "ResumeSound"); - dukglue_register_function(ctx, &PlaySoundMulti, "PlaySoundMulti"); - dukglue_register_function(ctx, &StopSoundMulti, "StopSoundMulti"); - dukglue_register_function(ctx, &GetSoundsPlaying, "GetSoundsPlaying"); - dukglue_register_function(ctx, &IsSoundPlaying, "IsSoundPlaying"); - dukglue_register_function(ctx, &SetSoundVolume, "SetSoundVolume"); - dukglue_register_function(ctx, &SetSoundPitch, "SetSoundPitch"); - dukglue_register_function(ctx, &WaveFormat, "WaveFormat"); - dukglue_register_function(ctx, &WaveCopy, "WaveCopy"); - dukglue_register_function(ctx, &WaveCrop, "WaveCrop"); - dukglue_register_function(ctx, &GetWaveData, "GetWaveData"); - dukglue_register_function(ctx, &LoadMusicStream, "LoadMusicStream"); - dukglue_register_function(ctx, &UnloadMusicStream, "UnloadMusicStream"); - dukglue_register_function(ctx, &PlayMusicStream, "PlayMusicStream"); - dukglue_register_function(ctx, &UpdateMusicStream, "UpdateMusicStream"); - dukglue_register_function(ctx, &StopMusicStream, "StopMusicStream"); - dukglue_register_function(ctx, &PauseMusicStream, "PauseMusicStream"); - dukglue_register_function(ctx, &ResumeMusicStream, "ResumeMusicStream"); - dukglue_register_function(ctx, &IsMusicPlaying, "IsMusicPlaying"); - dukglue_register_function(ctx, &SetMusicVolume, "SetMusicVolume"); - dukglue_register_function(ctx, &SetMusicPitch, "SetMusicPitch"); - dukglue_register_function(ctx, &SetMusicLoopCount, "SetMusicLoopCount"); - dukglue_register_function(ctx, &GetMusicTimeLength, "GetMusicTimeLength"); - dukglue_register_function(ctx, &GetMusicTimePlayed, "GetMusicTimePlayed"); - dukglue_register_function(ctx, &InitAudioStream, "InitAudioStream"); - dukglue_register_function(ctx, &UpdateAudioStream, "UpdateAudioStream"); - dukglue_register_function(ctx, &CloseAudioStream, "CloseAudioStream"); - dukglue_register_function(ctx, &IsAudioBufferProcessed, "IsAudioBufferProcessed"); - dukglue_register_function(ctx, &PlayAudioStream, "PlayAudioStream"); - dukglue_register_function(ctx, &PauseAudioStream, "PauseAudioStream"); - dukglue_register_function(ctx, &ResumeAudioStream, "ResumeAudioStream"); - dukglue_register_function(ctx, &IsAudioStreamPlaying, "IsAudioStreamPlaying"); - dukglue_register_function(ctx, &StopAudioStream, "StopAudioStream"); - dukglue_register_function(ctx, &SetAudioStreamVolume, "SetAudioStreamVolume"); - dukglue_register_function(ctx, &SetAudioStreamPitch, "SetAudioStreamPitch"); - */ + // dukglue_register_function(ctx, &GenImageColor, "GenImageColor"); + // dukglue_register_function(ctx, &GenImageGradientV, "GenImageGradientV"); + // dukglue_register_function(ctx, &GenImageGradientH, "GenImageGradientH"); + // dukglue_register_function(ctx, &GenImageGradientRadial, "GenImageGradientRadial"); + // dukglue_register_function(ctx, &GenImageChecked, "GenImageChecked"); + // dukglue_register_function(ctx, &GenImageWhiteNoise, "GenImageWhiteNoise"); + // dukglue_register_function(ctx, &GenImagePerlinNoise, "GenImagePerlinNoise"); + // dukglue_register_function(ctx, &GenImageCellular, "GenImageCellular"); + // //dukglue_register_function(ctx, &GenTextureMipmaps, "GenTextureMipmaps"); + // dukglue_register_function(ctx, &SetTextureFilter, "SetTextureFilter"); + // dukglue_register_function(ctx, &SetTextureWrap, "SetTextureWrap"); + // dukglue_register_function(ctx, &DrawTexture, "DrawTexture"); + // //dukglue_register_function(ctx, &DrawTextureV, "DrawTextureV"); + // //dukglue_register_function(ctx, &DrawTextureEx, "DrawTextureEx"); + // //dukglue_register_function(ctx, &DrawTextureRec, "DrawTextureRec"); + // //dukglue_register_function(ctx, &DrawTextureQuad, "DrawTextureQuad"); + // //dukglue_register_function(ctx, &DrawTexturePro, "DrawTexturePro"); + // //dukglue_register_function(ctx, &DrawTextureNPatch, "DrawTextureNPatch"); + // //dukglue_register_function(ctx, &GetFontDefault, "GetFontDefault"); + // //dukglue_register_function(ctx, &LoadFont, "LoadFont"); + // //dukglue_register_function(ctx, &LoadFontEx, "LoadFontEx"); + // //dukglue_register_function(ctx, &LoadFontFromImage, "LoadFontFromImage"); + // //dukglue_register_function(ctx, &LoadFontData, "LoadFontData"); + // //dukglue_register_function(ctx, &GenImageFontAtlas, "GenImageFontAtlas"); + // //dukglue_register_function(ctx, &UnloadFont, "UnloadFont"); + // dukglue_register_function(ctx, &DrawFPS, "DrawFPS"); + // dukglue_register_function(ctx, &DrawText, "DrawText"); + // //dukglue_register_function(ctx, &DrawTextEx, "DrawTextEx"); + // //dukglue_register_function(ctx, &DrawTextRec, "DrawTextRec"); + // //dukglue_register_function(ctx, &DrawTextRecEx, "DrawTextRecEx"); + // dukglue_register_function(ctx, &MeasureText, "MeasureText"); + // //dukglue_register_function(ctx, &MeasureTextEx, "MeasureTextEx"); + // //dukglue_register_function(ctx, &GetGlyphIndex, "GetGlyphIndex"); + // //dukglue_register_function(ctx, &GetNextCodepoint, "GetNextCodepoint"); + // dukglue_register_function(ctx, &TextIsEqual, "TextIsEqual"); + // dukglue_register_function(ctx, &TextLength, "TextLength"); + // dukglue_register_function(ctx, &TextCountCodepoints, "TextCountCodepoints"); + // //dukglue_register_function(ctx, &TextFormat, "TextFormat"); + // dukglue_register_function(ctx, &TextSubtext, "TextSubtext"); + // //dukglue_register_function(ctx, &TextReplace, "TextReplace"); + // //dukglue_register_function(ctx, &TextInsert, "TextInsert"); + // //dukglue_register_function(ctx, &TextJoin, "TextJoin"); + // //dukglue_register_function(ctx, &TextSplit, "TextSplit"); + // //dukglue_register_function(ctx, &TextAppend, "TextAppend"); + // //dukglue_register_function(ctx, &TextFindIndex, "TextFindIndex"); + // dukglue_register_function(ctx, &TextToUpper, "TextToUpper"); + // dukglue_register_function(ctx, &TextToLower, "TextToLower"); + // dukglue_register_function(ctx, &TextToPascal, "TextToPascal"); + // dukglue_register_function(ctx, &TextToInteger, "TextToInteger"); + // dukglue_register_function(ctx, &DrawLine3D, "DrawLine3D"); + // dukglue_register_function(ctx, &DrawCircle3D, "DrawCircle3D"); + // dukglue_register_function(ctx, &DrawCube, "DrawCube"); + // dukglue_register_function(ctx, &DrawCubeV, "DrawCubeV"); + // dukglue_register_function(ctx, &DrawCubeWires, "DrawCubeWires"); + // dukglue_register_function(ctx, &DrawCubeWiresV, "DrawCubeWiresV"); + // dukglue_register_function(ctx, &DrawCubeTexture, "DrawCubeTexture"); + // dukglue_register_function(ctx, &DrawSphere, "DrawSphere"); + // //dukglue_register_function(ctx, &DrawSphereEx, "DrawSphereEx"); + // dukglue_register_function(ctx, &DrawSphereWires, "DrawSphereWires"); + // dukglue_register_function(ctx, &DrawCylinder, "DrawCylinder"); + // dukglue_register_function(ctx, &DrawCylinderWires, "DrawCylinderWires"); + // dukglue_register_function(ctx, &DrawPlane, "DrawPlane"); + // //dukglue_register_function(ctx, &DrawRay, "DrawRay"); + // dukglue_register_function(ctx, &DrawGrid, "DrawGrid"); + // dukglue_register_function(ctx, &DrawGizmo, "DrawGizmo"); + // /* + // dukglue_register_function(ctx, &LoadModel, "LoadModel"); + // dukglue_register_function(ctx, &LoadModelFromMesh, "LoadModelFromMesh"); + // dukglue_register_function(ctx, &UnloadModel, "UnloadModel"); + // dukglue_register_function(ctx, &LoadMeshes, "LoadMeshes"); + // dukglue_register_function(ctx, &ExportMesh, "ExportMesh"); + // dukglue_register_function(ctx, &UnloadMesh, "UnloadMesh"); + // dukglue_register_function(ctx, &LoadMaterials, "LoadMaterials"); + // dukglue_register_function(ctx, &LoadMaterialDefault, "LoadMaterialDefault"); + // dukglue_register_function(ctx, &UnloadMaterial, "UnloadMaterial"); + // dukglue_register_function(ctx, &SetMaterialTexture, "SetMaterialTexture"); + // dukglue_register_function(ctx, &SetModelMeshMaterial, "SetModelMeshMaterial"); + // dukglue_register_function(ctx, &LoadModelAnimations, "LoadModelAnimations"); + // dukglue_register_function(ctx, &UpdateModelAnimation, "UpdateModelAnimation"); + // dukglue_register_function(ctx, &UnloadModelAnimation, "UnloadModelAnimation"); + // dukglue_register_function(ctx, &IsModelAnimationValid, "IsModelAnimationValid"); + // dukglue_register_function(ctx, &GenMeshPoly, "GenMeshPoly"); + // dukglue_register_function(ctx, &GenMeshPlane, "GenMeshPlane"); + // dukglue_register_function(ctx, &GenMeshCube, "GenMeshCube"); + // dukglue_register_function(ctx, &GenMeshSphere, "GenMeshSphere"); + // dukglue_register_function(ctx, &GenMeshHemiSphere, "GenMeshHemiSphere"); + // dukglue_register_function(ctx, &GenMeshCylinder, "GenMeshCylinder"); + // dukglue_register_function(ctx, &GenMeshTorus, "GenMeshTorus"); + // dukglue_register_function(ctx, &GenMeshKnot, "GenMeshKnot"); + // dukglue_register_function(ctx, &GenMeshHeightmap, "GenMeshHeightmap"); + // dukglue_register_function(ctx, &GenMeshCubicmap, "GenMeshCubicmap"); + // dukglue_register_function(ctx, &MeshBoundingBox, "MeshBoundingBox"); + // dukglue_register_function(ctx, &MeshTangents, "MeshTangents"); + // dukglue_register_function(ctx, &MeshBinormals, "MeshBinormals"); + // */ -} + // /* + // dukglue_register_function(ctx, &DrawModel, "DrawModel"); + // dukglue_register_function(ctx, &DrawModelEx, "DrawModelEx"); + // dukglue_register_function(ctx, &DrawModelWires, "DrawModelWires"); + // dukglue_register_function(ctx, &DrawModelWiresEx, "DrawModelWiresEx"); + // dukglue_register_function(ctx, &DrawBoundingBox, "DrawBoundingBox"); + // dukglue_register_function(ctx, &DrawBillboard, "DrawBillboard"); + // dukglue_register_function(ctx, &DrawBillboardRec, "DrawBillboardRec"); + // dukglue_register_function(ctx, &CheckCollisionSpheres, "CheckCollisionSpheres"); + // dukglue_register_function(ctx, &CheckCollisionBoxes, "CheckCollisionBoxes"); + // dukglue_register_function(ctx, &CheckCollisionBoxSphere, "CheckCollisionBoxSphere"); + // dukglue_register_function(ctx, &CheckCollisionRaySphere, "CheckCollisionRaySphere"); + // dukglue_register_function(ctx, &CheckCollisionRaySphereEx, "CheckCollisionRaySphereEx"); + // dukglue_register_function(ctx, &CheckCollisionRayBox, "CheckCollisionRayBox"); + // dukglue_register_function(ctx, &GetCollisionRayModel, "GetCollisionRayModel"); + // dukglue_register_function(ctx, &GetCollisionRayTriangle, "GetCollisionRayTriangle"); + // dukglue_register_function(ctx, &GetCollisionRayGround, "GetCollisionRayGround"); + // */ + // //dukglue_register_function(ctx, &LoadText, "LoadText"); + // /* + // dukglue_register_function(ctx, &LoadShader, "LoadShader"); + // dukglue_register_function(ctx, &LoadShaderCode, "LoadShaderCode"); + // dukglue_register_function(ctx, &UnloadShader, "UnloadShader"); + // dukglue_register_function(ctx, &GetShaderDefault, "GetShaderDefault"); + // dukglue_register_function(ctx, &GetTextureDefault, "GetTextureDefault"); + // dukglue_register_function(ctx, &GetShaderLocation, "GetShaderLocation"); + // dukglue_register_function(ctx, &SetShaderValue, "SetShaderValue"); + // dukglue_register_function(ctx, &SetShaderValueV, "SetShaderValueV"); + // dukglue_register_function(ctx, &SetShaderValueMatrix, "SetShaderValueMatrix"); + // dukglue_register_function(ctx, &SetShaderValueTexture, "SetShaderValueTexture"); + // dukglue_register_function(ctx, &SetMatrixProjection, "SetMatrixProjection"); + // dukglue_register_function(ctx, &SetMatrixModelview, "SetMatrixModelview"); + // dukglue_register_function(ctx, &GetMatrixModelview, "GetMatrixModelview"); + // dukglue_register_function(ctx, &GenTextureCubemap, "GenTextureCubemap"); + // dukglue_register_function(ctx, &GenTextureIrradiance, "GenTextureIrradiance"); + // dukglue_register_function(ctx, &GenTexturePrefilter, "GenTexturePrefilter"); + // dukglue_register_function(ctx, &GenTextureBRDF, "GenTextureBRDF"); + // dukglue_register_function(ctx, &BeginShaderMode, "BeginShaderMode"); + // dukglue_register_function(ctx, &EndShaderMode, "EndShaderMode"); + // dukglue_register_function(ctx, &BeginBlendMode, "BeginBlendMode"); + // dukglue_register_function(ctx, &EndBlendMode, "EndBlendMode"); + // dukglue_register_function(ctx, &BeginScissorMode, "BeginScissorMode"); + // dukglue_register_function(ctx, &EndScissorMode, "EndScissorMode"); + // dukglue_register_function(ctx, &InitVrSimulator, "InitVrSimulator"); + // dukglue_register_function(ctx, &CloseVrSimulator, "CloseVrSimulator"); + // dukglue_register_function(ctx, &UpdateVrTracking, "UpdateVrTracking"); + // dukglue_register_function(ctx, &SetVrConfiguration, "SetVrConfiguration"); + // dukglue_register_function(ctx, &IsVrSimulatorReady, "IsVrSimulatorReady"); + // dukglue_register_function(ctx, &ToggleVrMode, "ToggleVrMode"); + // dukglue_register_function(ctx, &BeginVrDrawing, "BeginVrDrawing"); + // dukglue_register_function(ctx, &EndVrDrawing, "EndVrDrawing"); + // */ + // dukglue_register_function(ctx, &InitAudioDevice, "InitAudioDevice"); + // dukglue_register_function(ctx, &CloseAudioDevice, "CloseAudioDevice"); + + // /* + // dukglue_register_function(ctx, &IsAudioDeviceReady, "IsAudioDeviceReady"); + // dukglue_register_function(ctx, &SetMasterVolume, "SetMasterVolume"); + // dukglue_register_function(ctx, &LoadWave, "LoadWave"); + // dukglue_register_function(ctx, &LoadSound, "LoadSound"); + // dukglue_register_function(ctx, &LoadSoundFromWave, "LoadSoundFromWave"); + // dukglue_register_function(ctx, &UpdateSound, "UpdateSound"); + // dukglue_register_function(ctx, &UnloadWave, "UnloadWave"); + // dukglue_register_function(ctx, &UnloadSound, "UnloadSound"); + // dukglue_register_function(ctx, &ExportWave, "ExportWave"); + // dukglue_register_function(ctx, &ExportWaveAsCode, "ExportWaveAsCode"); + // dukglue_register_function(ctx, &PlaySound, "PlaySound"); + // dukglue_register_function(ctx, &StopSound, "StopSound"); + // dukglue_register_function(ctx, &PauseSound, "PauseSound"); + // dukglue_register_function(ctx, &ResumeSound, "ResumeSound"); + // dukglue_register_function(ctx, &PlaySoundMulti, "PlaySoundMulti"); + // dukglue_register_function(ctx, &StopSoundMulti, "StopSoundMulti"); + // dukglue_register_function(ctx, &GetSoundsPlaying, "GetSoundsPlaying"); + // dukglue_register_function(ctx, &IsSoundPlaying, "IsSoundPlaying"); + // dukglue_register_function(ctx, &SetSoundVolume, "SetSoundVolume"); + // dukglue_register_function(ctx, &SetSoundPitch, "SetSoundPitch"); + // dukglue_register_function(ctx, &WaveFormat, "WaveFormat"); + // dukglue_register_function(ctx, &WaveCopy, "WaveCopy"); + // dukglue_register_function(ctx, &WaveCrop, "WaveCrop"); + // dukglue_register_function(ctx, &GetWaveData, "GetWaveData"); + // dukglue_register_function(ctx, &LoadMusicStream, "LoadMusicStream"); + // dukglue_register_function(ctx, &UnloadMusicStream, "UnloadMusicStream"); + // dukglue_register_function(ctx, &PlayMusicStream, "PlayMusicStream"); + // dukglue_register_function(ctx, &UpdateMusicStream, "UpdateMusicStream"); + // dukglue_register_function(ctx, &StopMusicStream, "StopMusicStream"); + // dukglue_register_function(ctx, &PauseMusicStream, "PauseMusicStream"); + // dukglue_register_function(ctx, &ResumeMusicStream, "ResumeMusicStream"); + // dukglue_register_function(ctx, &IsMusicPlaying, "IsMusicPlaying"); + // dukglue_register_function(ctx, &SetMusicVolume, "SetMusicVolume"); + // dukglue_register_function(ctx, &SetMusicPitch, "SetMusicPitch"); + // dukglue_register_function(ctx, &SetMusicLoopCount, "SetMusicLoopCount"); + // dukglue_register_function(ctx, &GetMusicTimeLength, "GetMusicTimeLength"); + // dukglue_register_function(ctx, &GetMusicTimePlayed, "GetMusicTimePlayed"); + // dukglue_register_function(ctx, &InitAudioStream, "InitAudioStream"); + // dukglue_register_function(ctx, &UpdateAudioStream, "UpdateAudioStream"); + // dukglue_register_function(ctx, &CloseAudioStream, "CloseAudioStream"); + // dukglue_register_function(ctx, &IsAudioBufferProcessed, "IsAudioBufferProcessed"); + // dukglue_register_function(ctx, &PlayAudioStream, "PlayAudioStream"); + // dukglue_register_function(ctx, &PauseAudioStream, "PauseAudioStream"); + // dukglue_register_function(ctx, &ResumeAudioStream, "ResumeAudioStream"); + // dukglue_register_function(ctx, &IsAudioStreamPlaying, "IsAudioStreamPlaying"); + // dukglue_register_function(ctx, &StopAudioStream, "StopAudioStream"); + // dukglue_register_function(ctx, &SetAudioStreamVolume, "SetAudioStreamVolume"); + // dukglue_register_function(ctx, &SetAudioStreamPitch, "SetAudioStreamPitch"); + // */ +} +} #endif diff --git a/include/raylib-js-globals.h b/include/raylib-js-globals.h index ffd4061..d47a3eb 100644 --- a/include/raylib-js-globals.h +++ b/include/raylib-js-globals.h @@ -2,275 +2,258 @@ #define RAYLIB_JS_GLOBALS_H__ #include -#include +#include -void raylib_js_globals(duk_context* ctx) { - dukglue_register_global(ctx, LIGHTGRAY, "LIGHTGRAY"); - dukglue_register_global(ctx, GRAY, "GRAY"); - dukglue_register_global(ctx, DARKGRAY, "DARKGRAY"); - dukglue_register_global(ctx, YELLOW, "YELLOW"); - dukglue_register_global(ctx, GOLD, "GOLD"); - dukglue_register_global(ctx, ORANGE, "ORANGE"); - dukglue_register_global(ctx, PINK, "PINK"); - dukglue_register_global(ctx, RED, "RED"); - dukglue_register_global(ctx, MAROON, "MAROON"); - dukglue_register_global(ctx, GREEN, "GREEN"); - dukglue_register_global(ctx, LIME, "LIME"); - dukglue_register_global(ctx, DARKGREEN, "DARKGREEN"); - dukglue_register_global(ctx, SKYBLUE, "SKYBLUE"); - dukglue_register_global(ctx, BLUE, "BLUE"); - dukglue_register_global(ctx, DARKBLUE, "DARKBLUE"); - dukglue_register_global(ctx, PURPLE, "PURPLE"); - dukglue_register_global(ctx, VIOLET, "VIOLET"); - dukglue_register_global(ctx, DARKPURPLE, "DARKPURPLE"); - dukglue_register_global(ctx, BEIGE, "BEIGE"); - dukglue_register_global(ctx, BROWN, "BROWN"); - dukglue_register_global(ctx, DARKBROWN, "DARKBROWN"); - dukglue_register_global(ctx, WHITE, "WHITE"); - dukglue_register_global(ctx, BLACK, "BLACK"); - dukglue_register_global(ctx, BLANK, "BLANK"); - dukglue_register_global(ctx, MAGENTA, "MAGENTA"); - dukglue_register_global(ctx, RAYWHITE, "RAYWHITE"); - - dukglue_register_global(ctx, (float)PI, "PI"); - dukglue_register_global(ctx, (int)MAX_TOUCH_POINTS, "MAX_TOUCH_POINTS"); - dukglue_register_global(ctx, (int)FLAG_SHOW_LOGO, "FLAG_SHOW_LOGO"); - dukglue_register_global(ctx, (int)FLAG_FULLSCREEN_MODE, "FLAG_FULLSCREEN_MODE"); - dukglue_register_global(ctx, (int)FLAG_WINDOW_RESIZABLE, "FLAG_WINDOW_RESIZABLE"); - dukglue_register_global(ctx, (int)FLAG_WINDOW_UNDECORATED, "FLAG_WINDOW_UNDECORATED"); - dukglue_register_global(ctx, (int)FLAG_WINDOW_TRANSPARENT, "FLAG_WINDOW_TRANSPARENT"); - dukglue_register_global(ctx, (int)FLAG_MSAA_4X_HINT, "FLAG_MSAA_4X_HINT"); - dukglue_register_global(ctx, (int)FLAG_VSYNC_HINT, "FLAG_VSYNC_HINT"); - dukglue_register_global(ctx, (int)LOG_ALL, "LOG_ALL"); - dukglue_register_global(ctx, (int)LOG_TRACE, "LOG_TRACE"); - dukglue_register_global(ctx, (int)LOG_DEBUG, "LOG_DEBUG"); - dukglue_register_global(ctx, (int)LOG_INFO, "LOG_INFO"); - dukglue_register_global(ctx, (int)LOG_WARNING, "LOG_WARNING"); - dukglue_register_global(ctx, (int)LOG_ERROR, "LOG_ERROR"); - dukglue_register_global(ctx, (int)LOG_FATAL, "LOG_FATAL"); - dukglue_register_global(ctx, (int)LOG_NONE, "LOG_NONE"); - dukglue_register_global(ctx, (int)KEY_APOSTROPHE, "KEY_APOSTROPHE"); - dukglue_register_global(ctx, (int)KEY_COMMA, "KEY_COMMA"); - dukglue_register_global(ctx, (int)KEY_MINUS, "KEY_MINUS"); - dukglue_register_global(ctx, (int)KEY_PERIOD, "KEY_PERIOD"); - dukglue_register_global(ctx, (int)KEY_SLASH, "KEY_SLASH"); - dukglue_register_global(ctx, (int)KEY_ZERO, "KEY_ZERO"); - dukglue_register_global(ctx, (int)KEY_ONE, "KEY_ONE"); - dukglue_register_global(ctx, (int)KEY_TWO, "KEY_TWO"); - dukglue_register_global(ctx, (int)KEY_THREE, "KEY_THREE"); - dukglue_register_global(ctx, (int)KEY_FOUR, "KEY_FOUR"); - dukglue_register_global(ctx, (int)KEY_FIVE, "KEY_FIVE"); - dukglue_register_global(ctx, (int)KEY_SIX, "KEY_SIX"); - dukglue_register_global(ctx, (int)KEY_SEVEN, "KEY_SEVEN"); - dukglue_register_global(ctx, (int)KEY_EIGHT, "KEY_EIGHT"); - dukglue_register_global(ctx, (int)KEY_NINE, "KEY_NINE"); - dukglue_register_global(ctx, (int)KEY_SEMICOLON, "KEY_SEMICOLON"); - dukglue_register_global(ctx, (int)KEY_EQUAL, "KEY_EQUAL"); - dukglue_register_global(ctx, (int)KEY_A, "KEY_A"); - dukglue_register_global(ctx, (int)KEY_B, "KEY_B"); - dukglue_register_global(ctx, (int)KEY_C, "KEY_C"); - dukglue_register_global(ctx, (int)KEY_D, "KEY_D"); - dukglue_register_global(ctx, (int)KEY_E, "KEY_E"); - dukglue_register_global(ctx, (int)KEY_F, "KEY_F"); - dukglue_register_global(ctx, (int)KEY_G, "KEY_G"); - dukglue_register_global(ctx, (int)KEY_H, "KEY_H"); - dukglue_register_global(ctx, (int)KEY_I, "KEY_I"); - dukglue_register_global(ctx, (int)KEY_J, "KEY_J"); - dukglue_register_global(ctx, (int)KEY_K, "KEY_K"); - dukglue_register_global(ctx, (int)KEY_L, "KEY_L"); - dukglue_register_global(ctx, (int)KEY_M, "KEY_M"); - dukglue_register_global(ctx, (int)KEY_N, "KEY_N"); - dukglue_register_global(ctx, (int)KEY_O, "KEY_O"); - dukglue_register_global(ctx, (int)KEY_P, "KEY_P"); - dukglue_register_global(ctx, (int)KEY_Q, "KEY_Q"); - dukglue_register_global(ctx, (int)KEY_R, "KEY_R"); - dukglue_register_global(ctx, (int)KEY_S, "KEY_S"); - dukglue_register_global(ctx, (int)KEY_T, "KEY_T"); - dukglue_register_global(ctx, (int)KEY_U, "KEY_U"); - dukglue_register_global(ctx, (int)KEY_V, "KEY_V"); - dukglue_register_global(ctx, (int)KEY_W, "KEY_W"); - dukglue_register_global(ctx, (int)KEY_X, "KEY_X"); - dukglue_register_global(ctx, (int)KEY_Y, "KEY_Y"); - dukglue_register_global(ctx, (int)KEY_Z, "KEY_Z"); - dukglue_register_global(ctx, (int)KEY_SPACE, "KEY_SPACE"); - dukglue_register_global(ctx, (int)KEY_ESCAPE, "KEY_ESCAPE"); - dukglue_register_global(ctx, (int)KEY_ENTER, "KEY_ENTER"); - dukglue_register_global(ctx, (int)KEY_TAB, "KEY_TAB"); - dukglue_register_global(ctx, (int)KEY_BACKSPACE, "KEY_BACKSPACE"); - dukglue_register_global(ctx, (int)KEY_INSERT, "KEY_INSERT"); - dukglue_register_global(ctx, (int)KEY_DELETE, "KEY_DELETE"); - dukglue_register_global(ctx, (int)KEY_RIGHT, "KEY_RIGHT"); - dukglue_register_global(ctx, (int)KEY_LEFT, "KEY_LEFT"); - dukglue_register_global(ctx, (int)KEY_DOWN, "KEY_DOWN"); - dukglue_register_global(ctx, (int)KEY_UP, "KEY_UP"); - dukglue_register_global(ctx, (int)KEY_PAGE_UP, "KEY_PAGE_UP"); - dukglue_register_global(ctx, (int)KEY_PAGE_DOWN, "KEY_PAGE_DOWN"); - dukglue_register_global(ctx, (int)KEY_HOME, "KEY_HOME"); - dukglue_register_global(ctx, (int)KEY_END, "KEY_END"); - dukglue_register_global(ctx, (int)KEY_CAPS_LOCK, "KEY_CAPS_LOCK"); - dukglue_register_global(ctx, (int)KEY_SCROLL_LOCK, "KEY_SCROLL_LOCK"); - dukglue_register_global(ctx, (int)KEY_NUM_LOCK, "KEY_NUM_LOCK"); - dukglue_register_global(ctx, (int)KEY_PRINT_SCREEN, "KEY_PRINT_SCREEN"); - dukglue_register_global(ctx, (int)KEY_PAUSE, "KEY_PAUSE"); - dukglue_register_global(ctx, (int)KEY_F1, "KEY_F1"); - dukglue_register_global(ctx, (int)KEY_F2, "KEY_F2"); - dukglue_register_global(ctx, (int)KEY_F3, "KEY_F3"); - dukglue_register_global(ctx, (int)KEY_F4, "KEY_F4"); - dukglue_register_global(ctx, (int)KEY_F5, "KEY_F5"); - dukglue_register_global(ctx, (int)KEY_F6, "KEY_F6"); - dukglue_register_global(ctx, (int)KEY_F7, "KEY_F7"); - dukglue_register_global(ctx, (int)KEY_F8, "KEY_F8"); - dukglue_register_global(ctx, (int)KEY_F9, "KEY_F9"); - dukglue_register_global(ctx, (int)KEY_F10, "KEY_F10"); - dukglue_register_global(ctx, (int)KEY_F11, "KEY_F11"); - dukglue_register_global(ctx, (int)KEY_F12, "KEY_F12"); - dukglue_register_global(ctx, (int)KEY_LEFT_SHIFT, "KEY_LEFT_SHIFT"); - dukglue_register_global(ctx, (int)KEY_LEFT_CONTROL, "KEY_LEFT_CONTROL"); - dukglue_register_global(ctx, (int)KEY_LEFT_ALT, "KEY_LEFT_ALT"); - dukglue_register_global(ctx, (int)KEY_LEFT_SUPER, "KEY_LEFT_SUPER"); - dukglue_register_global(ctx, (int)KEY_RIGHT_SHIFT, "KEY_RIGHT_SHIFT"); - dukglue_register_global(ctx, (int)KEY_RIGHT_CONTROL, "KEY_RIGHT_CONTROL"); - dukglue_register_global(ctx, (int)KEY_RIGHT_ALT, "KEY_RIGHT_ALT"); - dukglue_register_global(ctx, (int)KEY_RIGHT_SUPER, "KEY_RIGHT_SUPER"); - dukglue_register_global(ctx, (int)KEY_KB_MENU, "KEY_KB_MENU"); - dukglue_register_global(ctx, (int)KEY_LEFT_BRACKET, "KEY_LEFT_BRACKET"); - dukglue_register_global(ctx, (int)KEY_BACKSLASH, "KEY_BACKSLASH"); - dukglue_register_global(ctx, (int)KEY_RIGHT_BRACKET, "KEY_RIGHT_BRACKET"); - dukglue_register_global(ctx, (int)KEY_GRAVE, "KEY_GRAVE"); - dukglue_register_global(ctx, (int)KEY_KP_0, "KEY_KP_0"); - dukglue_register_global(ctx, (int)KEY_KP_1, "KEY_KP_1"); - dukglue_register_global(ctx, (int)KEY_KP_2, "KEY_KP_2"); - dukglue_register_global(ctx, (int)KEY_KP_3, "KEY_KP_3"); - dukglue_register_global(ctx, (int)KEY_KP_4, "KEY_KP_4"); - dukglue_register_global(ctx, (int)KEY_KP_5, "KEY_KP_5"); - dukglue_register_global(ctx, (int)KEY_KP_6, "KEY_KP_6"); - dukglue_register_global(ctx, (int)KEY_KP_7, "KEY_KP_7"); - dukglue_register_global(ctx, (int)KEY_KP_8, "KEY_KP_8"); - dukglue_register_global(ctx, (int)KEY_KP_9, "KEY_KP_9"); - dukglue_register_global(ctx, (int)KEY_KP_DECIMAL, "KEY_KP_DECIMAL"); - dukglue_register_global(ctx, (int)KEY_KP_DIVIDE, "KEY_KP_DIVIDE"); - dukglue_register_global(ctx, (int)KEY_KP_MULTIPLY, "KEY_KP_MULTIPLY"); - dukglue_register_global(ctx, (int)KEY_KP_SUBTRACT, "KEY_KP_SUBTRACT"); - dukglue_register_global(ctx, (int)KEY_KP_ADD, "KEY_KP_ADD"); - dukglue_register_global(ctx, (int)KEY_KP_ENTER, "KEY_KP_ENTER"); - dukglue_register_global(ctx, (int)KEY_KP_EQUAL, "KEY_KP_EQUAL"); - dukglue_register_global(ctx, (int)KEY_BACK, "KEY_BACK"); - dukglue_register_global(ctx, (int)KEY_MENU, "KEY_MENU"); - dukglue_register_global(ctx, (int)KEY_VOLUME_UP, "KEY_VOLUME_UP"); - dukglue_register_global(ctx, (int)KEY_VOLUME_DOWN, "KEY_VOLUME_DOWN"); - dukglue_register_global(ctx, (int)MOUSE_LEFT_BUTTON, "MOUSE_LEFT_BUTTON"); - dukglue_register_global(ctx, (int)MOUSE_RIGHT_BUTTON, "MOUSE_RIGHT_BUTTON"); - dukglue_register_global(ctx, (int)MOUSE_MIDDLE_BUTTON, "MOUSE_MIDDLE_BUTTON"); - dukglue_register_global(ctx, (int)GAMEPAD_PLAYER1, "GAMEPAD_PLAYER1"); - dukglue_register_global(ctx, (int)GAMEPAD_PLAYER2, "GAMEPAD_PLAYER2"); - dukglue_register_global(ctx, (int)GAMEPAD_PLAYER3, "GAMEPAD_PLAYER3"); - dukglue_register_global(ctx, (int)GAMEPAD_PLAYER4, "GAMEPAD_PLAYER4"); - - // GamepadButton - dukglue_register_global(ctx, (int)GAMEPAD_BUTTON_UNKNOWN, "GAMEPAD_BUTTON_UNKNOWN"); - dukglue_register_global(ctx, (int)GAMEPAD_BUTTON_LEFT_FACE_UP, "GAMEPAD_BUTTON_LEFT_FACE_UP"); - dukglue_register_global(ctx, (int)GAMEPAD_BUTTON_LEFT_FACE_RIGHT, "GAMEPAD_BUTTON_LEFT_FACE_RIGHT"); - dukglue_register_global(ctx, (int)GAMEPAD_BUTTON_LEFT_FACE_DOWN, "GAMEPAD_BUTTON_LEFT_FACE_DOWN"); - dukglue_register_global(ctx, (int)GAMEPAD_BUTTON_LEFT_FACE_LEFT, "GAMEPAD_BUTTON_LEFT_FACE_LEFT"); - dukglue_register_global(ctx, (int)GAMEPAD_BUTTON_RIGHT_FACE_UP, "GAMEPAD_BUTTON_RIGHT_FACE_UP"); - dukglue_register_global(ctx, (int)GAMEPAD_BUTTON_RIGHT_FACE_RIGHT, "GAMEPAD_BUTTON_RIGHT_FACE_RIGHT"); - dukglue_register_global(ctx, (int)GAMEPAD_BUTTON_RIGHT_FACE_DOWN, "GAMEPAD_BUTTON_RIGHT_FACE_DOWN"); - dukglue_register_global(ctx, (int)GAMEPAD_BUTTON_RIGHT_FACE_LEFT, "GAMEPAD_BUTTON_RIGHT_FACE_LEFT"); - dukglue_register_global(ctx, (int)GAMEPAD_BUTTON_LEFT_TRIGGER_1, "GAMEPAD_BUTTON_LEFT_TRIGGER_1"); - dukglue_register_global(ctx, (int)GAMEPAD_BUTTON_LEFT_TRIGGER_2, "GAMEPAD_BUTTON_LEFT_TRIGGER_2"); - dukglue_register_global(ctx, (int)GAMEPAD_BUTTON_RIGHT_TRIGGER_1, "GAMEPAD_BUTTON_RIGHT_TRIGGER_1"); - dukglue_register_global(ctx, (int)GAMEPAD_BUTTON_RIGHT_TRIGGER_2, "GAMEPAD_BUTTON_RIGHT_TRIGGER_2"); - dukglue_register_global(ctx, (int)GAMEPAD_BUTTON_MIDDLE_LEFT, "GAMEPAD_BUTTON_MIDDLE_LEFT"); - dukglue_register_global(ctx, (int)GAMEPAD_BUTTON_MIDDLE, "GAMEPAD_BUTTON_MIDDLE"); - dukglue_register_global(ctx, (int)GAMEPAD_BUTTON_MIDDLE_RIGHT, "GAMEPAD_BUTTON_MIDDLE_RIGHT"); - dukglue_register_global(ctx, (int)GAMEPAD_BUTTON_LEFT_THUMB, "GAMEPAD_BUTTON_LEFT_THUMB"); - dukglue_register_global(ctx, (int)GAMEPAD_BUTTON_RIGHT_THUMB, "GAMEPAD_BUTTON_RIGHT_THUMB"); - - // GamepadAxis - dukglue_register_global(ctx, (int)GAMEPAD_AXIS_UNKNOWN, "GAMEPAD_AXIS_UNKNOWN"); - dukglue_register_global(ctx, (int)GAMEPAD_AXIS_LEFT_X, "GAMEPAD_AXIS_LEFT_X"); - dukglue_register_global(ctx, (int)GAMEPAD_AXIS_LEFT_Y, "GAMEPAD_AXIS_LEFT_Y"); - dukglue_register_global(ctx, (int)GAMEPAD_AXIS_RIGHT_X, "GAMEPAD_AXIS_RIGHT_X"); - dukglue_register_global(ctx, (int)GAMEPAD_AXIS_RIGHT_Y, "GAMEPAD_AXIS_RIGHT_Y"); - dukglue_register_global(ctx, (int)GAMEPAD_AXIS_LEFT_TRIGGER, "GAMEPAD_AXIS_LEFT_TRIGGER"); - dukglue_register_global(ctx, (int)GAMEPAD_AXIS_RIGHT_TRIGGER, "GAMEPAD_AXIS_RIGHT_TRIGGER"); - - // TODO: Add ShaderUniformDataType, MaterialMapType, TexmapIndex, PixelFormat, TextureFilterMode. - - // ShaderLocationIndex - dukglue_register_global(ctx, (int)LOC_VERTEX_POSITION, "LOC_VERTEX_POSITION"); - dukglue_register_global(ctx, (int)LOC_VERTEX_TEXCOORD01, "LOC_VERTEX_TEXCOORD01"); - dukglue_register_global(ctx, (int)LOC_VERTEX_TEXCOORD02, "LOC_VERTEX_TEXCOORD02"); - dukglue_register_global(ctx, (int)LOC_VERTEX_NORMAL, "LOC_VERTEX_NORMAL"); - dukglue_register_global(ctx, (int)LOC_VERTEX_TANGENT, "LOC_VERTEX_TANGENT"); - dukglue_register_global(ctx, (int)LOC_VERTEX_COLOR, "LOC_VERTEX_COLOR"); - dukglue_register_global(ctx, (int)LOC_MATRIX_MVP, "LOC_MATRIX_MVP"); - dukglue_register_global(ctx, (int)LOC_MATRIX_MODEL, "LOC_MATRIX_MODEL"); - dukglue_register_global(ctx, (int)LOC_MATRIX_VIEW, "LOC_MATRIX_VIEW"); - dukglue_register_global(ctx, (int)LOC_MATRIX_PROJECTION, "LOC_MATRIX_PROJECTION"); - dukglue_register_global(ctx, (int)LOC_VECTOR_VIEW, "LOC_VECTOR_VIEW"); - dukglue_register_global(ctx, (int)LOC_COLOR_DIFFUSE, "LOC_COLOR_DIFFUSE"); - dukglue_register_global(ctx, (int)LOC_COLOR_SPECULAR, "LOC_COLOR_SPECULAR"); - dukglue_register_global(ctx, (int)LOC_COLOR_AMBIENT, "LOC_COLOR_AMBIENT"); - dukglue_register_global(ctx, (int)LOC_MAP_ALBEDO, "LOC_MAP_ALBEDO"); - dukglue_register_global(ctx, (int)LOC_MAP_METALNESS, "LOC_MAP_METALNESS"); - dukglue_register_global(ctx, (int)LOC_MAP_NORMAL, "LOC_MAP_NORMAL"); - dukglue_register_global(ctx, (int)LOC_MAP_ROUGHNESS, "LOC_MAP_ROUGHNESS"); - dukglue_register_global(ctx, (int)LOC_MAP_OCCLUSION, "LOC_MAP_OCCLUSION"); - dukglue_register_global(ctx, (int)LOC_MAP_EMISSION, "LOC_MAP_EMISSION"); - dukglue_register_global(ctx, (int)LOC_MAP_HEIGHT, "LOC_MAP_HEIGHT"); - dukglue_register_global(ctx, (int)LOC_MAP_CUBEMAP, "LOC_MAP_CUBEMAP"); - dukglue_register_global(ctx, (int)LOC_MAP_IRRADIANCE, "LOC_MAP_IRRADIANCE"); - dukglue_register_global(ctx, (int)LOC_MAP_PREFILTER, "LOC_MAP_PREFILTER"); - dukglue_register_global(ctx, (int)LOC_MAP_BRDF, "LOC_MAP_BRDF"); - dukglue_register_global(ctx, (int)LOC_MAP_DIFFUSE, "LOC_MAP_DIFFUSE"); - dukglue_register_global(ctx, (int)LOC_MAP_SPECULAR, "LOC_MAP_SPECULAR"); - - // Texture parameters: wrap mode - dukglue_register_global(ctx, (int)WRAP_REPEAT, "WRAP_REPEAT"); - dukglue_register_global(ctx, (int)WRAP_CLAMP, "WRAP_CLAMP"); - dukglue_register_global(ctx, (int)WRAP_MIRROR_REPEAT, "WRAP_MIRROR_REPEAT"); - dukglue_register_global(ctx, (int)WRAP_MIRROR_CLAMP, "WRAP_MIRROR_CLAMP"); - - // Font type, defines generation method - dukglue_register_global(ctx, (int)FONT_DEFAULT, "FONT_DEFAULT"); - dukglue_register_global(ctx, (int)FONT_BITMAP, "FONT_BITMAP"); - dukglue_register_global(ctx, (int)FONT_SDF, "FONT_SDF"); - - // Color blending modes (pre-defined) - dukglue_register_global(ctx, (int)BLEND_ALPHA, "BLEND_ALPHA"); - dukglue_register_global(ctx, (int)BLEND_ADDITIVE, "BLEND_ADDITIVE"); - dukglue_register_global(ctx, (int)BLEND_MULTIPLIED, "BLEND_MULTIPLIED"); - - // Gestures type - dukglue_register_global(ctx, (int)GESTURE_NONE, "GESTURE_NONE"); - dukglue_register_global(ctx, (int)GESTURE_TAP, "GESTURE_TAP"); - dukglue_register_global(ctx, (int)GESTURE_DOUBLETAP, "GESTURE_DOUBLETAP"); - dukglue_register_global(ctx, (int)GESTURE_HOLD, "GESTURE_HOLD"); - dukglue_register_global(ctx, (int)GESTURE_DRAG, "GESTURE_DRAG"); - dukglue_register_global(ctx, (int)GESTURE_SWIPE_RIGHT, "GESTURE_SWIPE_RIGHT"); - dukglue_register_global(ctx, (int)GESTURE_SWIPE_LEFT, "GESTURE_SWIPE_LEFT"); - dukglue_register_global(ctx, (int)GESTURE_SWIPE_UP, "GESTURE_SWIPE_UP"); - dukglue_register_global(ctx, (int)GESTURE_SWIPE_DOWN, "GESTURE_SWIPE_DOWN"); - dukglue_register_global(ctx, (int)GESTURE_PINCH_IN, "GESTURE_PINCH_IN"); - dukglue_register_global(ctx, (int)GESTURE_PINCH_OUT, "GESTURE_PINCH_OUT"); - - // Camera system modes - dukglue_register_global(ctx, (int)CAMERA_CUSTOM, "CAMERA_CUSTOM"); - dukglue_register_global(ctx, (int)CAMERA_FREE, "CAMERA_FREE"); - dukglue_register_global(ctx, (int)CAMERA_ORBITAL, "CAMERA_ORBITAL"); - dukglue_register_global(ctx, (int)CAMERA_FIRST_PERSON, "CAMERA_FIRST_PERSON"); - dukglue_register_global(ctx, (int)CAMERA_THIRD_PERSON, "CAMERA_THIRD_PERSON"); - - // Camera projection modes - dukglue_register_global(ctx, (int)CAMERA_PERSPECTIVE, "CAMERA_PERSPECTIVE"); - dukglue_register_global(ctx, (int)CAMERA_ORTHOGRAPHIC, "CAMERA_ORTHOGRAPHIC"); - - // Type of n-patch - dukglue_register_global(ctx, (int)NPT_9PATCH, "NPT_9PATCH"); - dukglue_register_global(ctx, (int)NPT_3PATCH_VERTICAL, "NPT_3PATCH_VERTICAL"); - dukglue_register_global(ctx, (int)NPT_3PATCH_HORIZONTAL, "NPT_3PATCH_HORIZONTAL"); +namespace raylibjs { +template +static void define_globals(duktape::engine& js) { + /* + js.define("LIGHTGRAY", LIGHTGRAY); + js.define("GRAY", GRAY); + js.define("DARKGRAY", DARKGRAY); + js.define("YELLOW", YELLOW); + js.define("GOLD", GOLD); + js.define("ORANGE", ORANGE); + js.define("PINK", PINK); + js.define("RED", RED); + js.define("MAROON", MAROON); + js.define("GREEN", GREEN); + js.define("LIME", LIME); + js.define("DARKGREEN", DARKGREEN); + js.define("SKYBLUE", SKYBLUE); + js.define("BLUE", BLUE); + js.define("DARKBLUE", DARKBLUE); + js.define("PURPLE", PURPLE); + js.define("VIOLET", VIOLET); + js.define("DARKPURPLE", DARKPURPLE); + js.define("BEIGE", BEIGE); + js.define("BROWN", BROWN); + js.define("DARKBROWN", DARKBROWN); + js.define("WHITE", WHITE); + js.define("BLACK", BLACK); + js.define("BLANK", BLANK); + js.define("MAGENTA", MAGENTA); + js.define("RAYWHITE", RAYWHITE); + */ + js.define("PI", (float)PI); + js.define("MAX_TOUCH_POINTS", (int)MAX_TOUCH_POINTS); + //js.define("FLAG_SHOW_LOGO", (int)FLAG_SHOW_LOGO); + js.define("FLAG_FULLSCREEN_MODE", (int)FLAG_FULLSCREEN_MODE); + js.define("FLAG_WINDOW_RESIZABLE", (int)FLAG_WINDOW_RESIZABLE); + js.define("FLAG_WINDOW_UNDECORATED", (int)FLAG_WINDOW_UNDECORATED); + js.define("FLAG_WINDOW_TRANSPARENT", (int)FLAG_WINDOW_TRANSPARENT); + js.define("FLAG_MSAA_4X_HINT", (int)FLAG_MSAA_4X_HINT); + js.define("FLAG_VSYNC_HINT", (int)FLAG_VSYNC_HINT); + //js.define("LOG_ALL", (int)LOG_ALL); + js.define("LOG_TRACE", (int)LOG_TRACE); + js.define("LOG_DEBUG", (int)LOG_DEBUG); + js.define("LOG_INFO", (int)LOG_INFO); + js.define("LOG_WARNING", (int)LOG_WARNING); + js.define("LOG_ERROR", (int)LOG_ERROR); + js.define("LOG_FATAL", (int)LOG_FATAL); + js.define("LOG_NONE", (int)LOG_NONE); + js.define("KEY_APOSTROPHE", (int)KEY_APOSTROPHE); + js.define("KEY_COMMA", (int)KEY_COMMA); + js.define("KEY_MINUS", (int)KEY_MINUS); + js.define("KEY_PERIOD", (int)KEY_PERIOD); + js.define("KEY_SLASH", (int)KEY_SLASH); + js.define("KEY_ZERO", (int)KEY_ZERO); + js.define("KEY_ONE", (int)KEY_ONE); + js.define("KEY_TWO", (int)KEY_TWO); + js.define("KEY_THREE", (int)KEY_THREE); + js.define("KEY_FOUR", (int)KEY_FOUR); + js.define("KEY_FIVE", (int)KEY_FIVE); + js.define("KEY_SIX", (int)KEY_SIX); + js.define("KEY_SEVEN", (int)KEY_SEVEN); + js.define("KEY_EIGHT", (int)KEY_EIGHT); + js.define("KEY_NINE", (int)KEY_NINE); + js.define("KEY_SEMICOLON", (int)KEY_SEMICOLON); + js.define("KEY_EQUAL", (int)KEY_EQUAL); + js.define("KEY_A", (int)KEY_A); + js.define("KEY_B", (int)KEY_B); + js.define("KEY_C", (int)KEY_C); + js.define("KEY_D", (int)KEY_D); + js.define("KEY_E", (int)KEY_E); + js.define("KEY_F", (int)KEY_F); + js.define("KEY_G", (int)KEY_G); + js.define("KEY_H", (int)KEY_H); + js.define("KEY_I", (int)KEY_I); + js.define("KEY_J", (int)KEY_J); + js.define("KEY_K", (int)KEY_K); + js.define("KEY_L", (int)KEY_L); + js.define("KEY_M", (int)KEY_M); + js.define("KEY_N", (int)KEY_N); + js.define("KEY_O", (int)KEY_O); + js.define("KEY_P", (int)KEY_P); + js.define("KEY_Q", (int)KEY_Q); + js.define("KEY_R", (int)KEY_R); + js.define("KEY_S", (int)KEY_S); + js.define("KEY_T", (int)KEY_T); + js.define("KEY_U", (int)KEY_U); + js.define("KEY_V", (int)KEY_V); + js.define("KEY_W", (int)KEY_W); + js.define("KEY_X", (int)KEY_X); + js.define("KEY_Y", (int)KEY_Y); + js.define("KEY_Z", (int)KEY_Z); + js.define("KEY_SPACE", (int)KEY_SPACE); + js.define("KEY_ESCAPE", (int)KEY_ESCAPE); + js.define("KEY_ENTER", (int)KEY_ENTER); + js.define("KEY_TAB", (int)KEY_TAB); + js.define("KEY_BACKSPACE", (int)KEY_BACKSPACE); + js.define("KEY_INSERT", (int)KEY_INSERT); + js.define("KEY_DELETE", (int)KEY_DELETE); + js.define("KEY_RIGHT", (int)KEY_RIGHT); + js.define("KEY_LEFT", (int)KEY_LEFT); + js.define("KEY_DOWN", (int)KEY_DOWN); + js.define("KEY_UP", (int)KEY_UP); + js.define("KEY_PAGE_UP", (int)KEY_PAGE_UP); + js.define("KEY_PAGE_DOWN", (int)KEY_PAGE_DOWN); + js.define("KEY_HOME", (int)KEY_HOME); + js.define("KEY_END", (int)KEY_END); + js.define("KEY_CAPS_LOCK", (int)KEY_CAPS_LOCK); + js.define("KEY_SCROLL_LOCK", (int)KEY_SCROLL_LOCK); + js.define("KEY_NUM_LOCK", (int)KEY_NUM_LOCK); + js.define("KEY_PRINT_SCREEN", (int)KEY_PRINT_SCREEN); + js.define("KEY_PAUSE", (int)KEY_PAUSE); + js.define("KEY_F1", (int)KEY_F1); + js.define("KEY_F2", (int)KEY_F2); + js.define("KEY_F3", (int)KEY_F3); + js.define("KEY_F4", (int)KEY_F4); + js.define("KEY_F5", (int)KEY_F5); + js.define("KEY_F6", (int)KEY_F6); + js.define("KEY_F7", (int)KEY_F7); + js.define("KEY_F8", (int)KEY_F8); + js.define("KEY_F9", (int)KEY_F9); + js.define("KEY_F10", (int)KEY_F10); + js.define("KEY_F11", (int)KEY_F11); + js.define("KEY_F12", (int)KEY_F12); + js.define("KEY_LEFT_SHIFT", (int)KEY_LEFT_SHIFT); + js.define("KEY_LEFT_CONTROL", (int)KEY_LEFT_CONTROL); + js.define("KEY_LEFT_ALT", (int)KEY_LEFT_ALT); + js.define("KEY_LEFT_SUPER", (int)KEY_LEFT_SUPER); + js.define("KEY_RIGHT_SHIFT", (int)KEY_RIGHT_SHIFT); + js.define("KEY_RIGHT_CONTROL", (int)KEY_RIGHT_CONTROL); + js.define("KEY_RIGHT_ALT", (int)KEY_RIGHT_ALT); + js.define("KEY_RIGHT_SUPER", (int)KEY_RIGHT_SUPER); + js.define("KEY_KB_MENU", (int)KEY_KB_MENU); + js.define("KEY_LEFT_BRACKET", (int)KEY_LEFT_BRACKET); + js.define("KEY_BACKSLASH", (int)KEY_BACKSLASH); + js.define("KEY_RIGHT_BRACKET", (int)KEY_RIGHT_BRACKET); + js.define("KEY_GRAVE", (int)KEY_GRAVE); + js.define("KEY_KP_0", (int)KEY_KP_0); + js.define("KEY_KP_1", (int)KEY_KP_1); + js.define("KEY_KP_2", (int)KEY_KP_2); + js.define("KEY_KP_3", (int)KEY_KP_3); + js.define("KEY_KP_4", (int)KEY_KP_4); + js.define("KEY_KP_5", (int)KEY_KP_5); + js.define("KEY_KP_6", (int)KEY_KP_6); + js.define("KEY_KP_7", (int)KEY_KP_7); + js.define("KEY_KP_8", (int)KEY_KP_8); + js.define("KEY_KP_9", (int)KEY_KP_9); + js.define("KEY_KP_DECIMAL", (int)KEY_KP_DECIMAL); + js.define("KEY_KP_DIVIDE", (int)KEY_KP_DIVIDE); + js.define("KEY_KP_MULTIPLY", (int)KEY_KP_MULTIPLY); + js.define("KEY_KP_SUBTRACT", (int)KEY_KP_SUBTRACT); + js.define("KEY_KP_ADD", (int)KEY_KP_ADD); + js.define("KEY_KP_ENTER", (int)KEY_KP_ENTER); + js.define("KEY_KP_EQUAL", (int)KEY_KP_EQUAL); + js.define("KEY_BACK", (int)KEY_BACK); + js.define("KEY_MENU", (int)KEY_MENU); + js.define("KEY_VOLUME_UP", (int)KEY_VOLUME_UP); + js.define("KEY_VOLUME_DOWN", (int)KEY_VOLUME_DOWN); + //js.define("MOUSE_LEFT_BUTTON", (int)MOUSE_LEFT_BUTTON); + js.define("MOUSE_RIGHT_BUTTON", (int)MOUSE_RIGHT_BUTTON); + js.define("MOUSE_MIDDLE_BUTTON", (int)MOUSE_MIDDLE_BUTTON); + //js.define("GAMEPAD_PLAYER1", (int)GAMEPAD_PLAYER1); + js.define("GAMEPAD_PLAYER2", (int)GAMEPAD_PLAYER2); + js.define("GAMEPAD_PLAYER3", (int)GAMEPAD_PLAYER3); + js.define("GAMEPAD_PLAYER4", (int)GAMEPAD_PLAYER4); + //js.define("GAMEPAD_BUTTON_UNKNOWN", (int)GAMEPAD_BUTTON_UNKNOWN); + js.define("GAMEPAD_BUTTON_LEFT_FACE_UP", (int)GAMEPAD_BUTTON_LEFT_FACE_UP); + js.define("GAMEPAD_BUTTON_LEFT_FACE_RIGHT", (int)GAMEPAD_BUTTON_LEFT_FACE_RIGHT); + js.define("GAMEPAD_BUTTON_LEFT_FACE_DOWN", (int)GAMEPAD_BUTTON_LEFT_FACE_DOWN); + js.define("GAMEPAD_BUTTON_LEFT_FACE_LEFT", (int)GAMEPAD_BUTTON_LEFT_FACE_LEFT); + js.define("GAMEPAD_BUTTON_RIGHT_FACE_UP", (int)GAMEPAD_BUTTON_RIGHT_FACE_UP); + js.define("GAMEPAD_BUTTON_RIGHT_FACE_RIGHT", (int)GAMEPAD_BUTTON_RIGHT_FACE_RIGHT); + js.define("GAMEPAD_BUTTON_RIGHT_FACE_DOWN", (int)GAMEPAD_BUTTON_RIGHT_FACE_DOWN); + js.define("GAMEPAD_BUTTON_RIGHT_FACE_LEFT", (int)GAMEPAD_BUTTON_RIGHT_FACE_LEFT); + js.define("GAMEPAD_BUTTON_LEFT_TRIGGER_1", (int)GAMEPAD_BUTTON_LEFT_TRIGGER_1); + js.define("GAMEPAD_BUTTON_LEFT_TRIGGER_2", (int)GAMEPAD_BUTTON_LEFT_TRIGGER_2); + js.define("GAMEPAD_BUTTON_RIGHT_TRIGGER_1", (int)GAMEPAD_BUTTON_RIGHT_TRIGGER_1); + js.define("GAMEPAD_BUTTON_RIGHT_TRIGGER_2", (int)GAMEPAD_BUTTON_RIGHT_TRIGGER_2); + js.define("GAMEPAD_BUTTON_MIDDLE_LEFT", (int)GAMEPAD_BUTTON_MIDDLE_LEFT); + js.define("GAMEPAD_BUTTON_MIDDLE", (int)GAMEPAD_BUTTON_MIDDLE); + js.define("GAMEPAD_BUTTON_MIDDLE_RIGHT", (int)GAMEPAD_BUTTON_MIDDLE_RIGHT); + js.define("GAMEPAD_BUTTON_LEFT_THUMB", (int)GAMEPAD_BUTTON_LEFT_THUMB); + js.define("GAMEPAD_BUTTON_RIGHT_THUMB", (int)GAMEPAD_BUTTON_RIGHT_THUMB); + //js.define("GAMEPAD_AXIS_UNKNOWN", (int)GAMEPAD_AXIS_UNKNOWN); + js.define("GAMEPAD_AXIS_LEFT_X", (int)GAMEPAD_AXIS_LEFT_X); + js.define("GAMEPAD_AXIS_LEFT_Y", (int)GAMEPAD_AXIS_LEFT_Y); + js.define("GAMEPAD_AXIS_RIGHT_X", (int)GAMEPAD_AXIS_RIGHT_X); + js.define("GAMEPAD_AXIS_RIGHT_Y", (int)GAMEPAD_AXIS_RIGHT_Y); + js.define("GAMEPAD_AXIS_LEFT_TRIGGER", (int)GAMEPAD_AXIS_LEFT_TRIGGER); + js.define("GAMEPAD_AXIS_RIGHT_TRIGGER", (int)GAMEPAD_AXIS_RIGHT_TRIGGER); + //js.define("LOC_VERTEX_POSITION", (int)LOC_VERTEX_POSITION); + js.define("LOC_VERTEX_TEXCOORD01", (int)LOC_VERTEX_TEXCOORD01); + js.define("LOC_VERTEX_TEXCOORD02", (int)LOC_VERTEX_TEXCOORD02); + js.define("LOC_VERTEX_NORMAL", (int)LOC_VERTEX_NORMAL); + js.define("LOC_VERTEX_TANGENT", (int)LOC_VERTEX_TANGENT); + js.define("LOC_VERTEX_COLOR", (int)LOC_VERTEX_COLOR); + js.define("LOC_MATRIX_MVP", (int)LOC_MATRIX_MVP); + js.define("LOC_MATRIX_MODEL", (int)LOC_MATRIX_MODEL); + js.define("LOC_MATRIX_VIEW", (int)LOC_MATRIX_VIEW); + js.define("LOC_MATRIX_PROJECTION", (int)LOC_MATRIX_PROJECTION); + js.define("LOC_VECTOR_VIEW", (int)LOC_VECTOR_VIEW); + js.define("LOC_COLOR_DIFFUSE", (int)LOC_COLOR_DIFFUSE); + js.define("LOC_COLOR_SPECULAR", (int)LOC_COLOR_SPECULAR); + js.define("LOC_COLOR_AMBIENT", (int)LOC_COLOR_AMBIENT); + js.define("LOC_MAP_ALBEDO", (int)LOC_MAP_ALBEDO); + js.define("LOC_MAP_METALNESS", (int)LOC_MAP_METALNESS); + js.define("LOC_MAP_NORMAL", (int)LOC_MAP_NORMAL); + js.define("LOC_MAP_ROUGHNESS", (int)LOC_MAP_ROUGHNESS); + js.define("LOC_MAP_OCCLUSION", (int)LOC_MAP_OCCLUSION); + js.define("LOC_MAP_EMISSION", (int)LOC_MAP_EMISSION); + js.define("LOC_MAP_HEIGHT", (int)LOC_MAP_HEIGHT); + js.define("LOC_MAP_CUBEMAP", (int)LOC_MAP_CUBEMAP); + js.define("LOC_MAP_IRRADIANCE", (int)LOC_MAP_IRRADIANCE); + js.define("LOC_MAP_PREFILTER", (int)LOC_MAP_PREFILTER); + js.define("LOC_MAP_BRDF", (int)LOC_MAP_BRDF); + js.define("LOC_MAP_DIFFUSE", (int)LOC_MAP_DIFFUSE); + js.define("LOC_MAP_SPECULAR", (int)LOC_MAP_SPECULAR); + /*js.define("WRAP_REPEAT", (int)WRAP_REPEAT); + js.define("WRAP_CLAMP", (int)WRAP_CLAMP); + js.define("WRAP_MIRROR_REPEAT", (int)WRAP_MIRROR_REPEAT); + js.define("WRAP_MIRROR_CLAMP", (int)WRAP_MIRROR_CLAMP); + js.define("FONT_DEFAULT", (int)FONT_DEFAULT); + js.define("FONT_BITMAP", (int)FONT_BITMAP); + js.define("FONT_SDF", (int)FONT_SDF); + js.define("BLEND_ALPHA", (int)BLEND_ALPHA); + js.define("BLEND_ADDITIVE", (int)BLEND_ADDITIVE); + js.define("BLEND_MULTIPLIED", (int)BLEND_MULTIPLIED); + js.define("GESTURE_NONE", (int)GESTURE_NONE); + js.define("GESTURE_TAP", (int)GESTURE_TAP); + js.define("GESTURE_DOUBLETAP", (int)GESTURE_DOUBLETAP); + js.define("GESTURE_HOLD", (int)GESTURE_HOLD); + js.define("GESTURE_DRAG", (int)GESTURE_DRAG); + js.define("GESTURE_SWIPE_RIGHT", (int)GESTURE_SWIPE_RIGHT); + js.define("GESTURE_SWIPE_LEFT", (int)GESTURE_SWIPE_LEFT); + js.define("GESTURE_SWIPE_UP", (int)GESTURE_SWIPE_UP); + js.define("GESTURE_SWIPE_DOWN", (int)GESTURE_SWIPE_DOWN); + js.define("GESTURE_PINCH_IN", (int)GESTURE_PINCH_IN); + js.define("GESTURE_PINCH_OUT", (int)GESTURE_PINCH_OUT); + js.define("CAMERA_CUSTOM", (int)CAMERA_CUSTOM); + js.define("CAMERA_FREE", (int)CAMERA_FREE); + js.define("CAMERA_ORBITAL", (int)CAMERA_ORBITAL); + js.define("CAMERA_FIRST_PERSON", (int)CAMERA_FIRST_PERSON); + js.define("CAMERA_THIRD_PERSON", (int)CAMERA_THIRD_PERSON); + js.define("CAMERA_PERSPECTIVE", (int)CAMERA_PERSPECTIVE); + js.define("CAMERA_ORTHOGRAPHIC", (int)CAMERA_ORTHOGRAPHIC); + js.define("NPT_9PATCH", (int)NPT_9PATCH); + js.define("NPT_3PATCH_VERTICAL", (int)NPT_3PATCH_VERTICAL); + js.define("NPT_3PATCH_HORIZONTAL", (int)NPT_3PATCH_HORIZONTAL); + */ } +} #endif diff --git a/include/raylib-js-structs.h b/include/raylib-js-structs.h index 9530994..7570dfa 100644 --- a/include/raylib-js-structs.h +++ b/include/raylib-js-structs.h @@ -2,13 +2,119 @@ #define RAYLIB_JS_STRUCTS_H__ #include -#include -#include -#include +#include -namespace dukglue { -namespace types { +namespace raylibjs { +static void define_structs_vector2(duktape::engine& js) { + js.define( + duktape::native_object("Vector2") + .method("toString", [](duktape::api& stack, Vector2& instance) { + stack.push(std::string("Vector2{x:") + + std::to_string(instance.x) + + std::string(",y:") + + std::to_string(instance.y) + + std::string("}")); + return 1; + }) + /*.constructor([](duktape::api& stack) { + if(stack.top()==0) { + Vector2 v; + return v; + } else if(stack.top()==2) { + Vector2 v; + v.x = stack.get(0); + v.y = stack.get(1); + return v; + } else { + throw duktape::script_error("Vector2 constructor needs either none or two arguments (x,y)"); + } + }) + .getter("x", [](duktape::api& stack, Vector2& instance){ + stack.push(instance.x); + }) + .getter("y", [](duktape::api& stack, Vector2& instance){ + stack.push(instance.y); + }) + .setter("x", [](duktape::api& stack, Vector2& instance){ + instance.x = stack.get(-1); + }) + .setter("y", [](duktape::api& stack, Vector2& instance){ + instance.y = stack.get(-1); + })*/ + ); +}; + + +template +static void define_structs(duktape::engine& js) { + define_structs_vector2(js); +}; + +} + +/* +template <> struct conv +{ + using type = Vector2; + + static constexpr const char* cc_name() noexcept + { + return "Vector2"; + } + + static constexpr const char* ecma_name() noexcept + { + return "Vector2"; + } + + static constexpr int nret() noexcept + { + return 1; + } + + static bool is(duk_context* ctx, int index) + { + auto js = duktape::api(ctx); + return js.is_object(index) && js.has_prop_string(index, "x") && js.has_prop_string(index, "y"); + } + + static type get(duk_context* ctx, int index) + { + type out; + auto js = duktape::api(ctx); + js.get_prop_string(index, "x"); + out.x = js.get_number(-1); + js.get_prop_string(index, "y"); + out.y = js.get_number(-1); + return out; + } + + static type req(duk_context* ctx, int index) + { + return get(ctx, index); + } + + static type to(duk_context* ctx, int index) + { + return get(ctx, index); + } + + static void push(duk_context* ctx, type val) + { + auto js = duktape::api(ctx); + + js.push_object(); + js.push_number(ctx, value.x); + js.put_prop_string(ctx, "x"); + js.push_number(ctx, value.y); + js.put_prop_string(ctx, "y"); + + } +}; +*/ + +/* template<> struct DukType<::Vector2> { typedef std::true_type IsValueType; @@ -383,6 +489,7 @@ struct DukType { duk_put_prop_string(ctx, obj_idx, "zoom"); } }; +*/ // TODO: Add Font // TODO: Add RenderTexture2D @@ -407,7 +514,4 @@ struct DukType { // TODO: Add Music // TODO: Add VrDeviceInfo -} -} - #endif diff --git a/include/raylib-js.h b/include/raylib-js.h index c93c3af..7fb7602 100644 --- a/include/raylib-js.h +++ b/include/raylib-js.h @@ -3,17 +3,19 @@ #include -#include -#include -#include +#include #include "raylib-js-structs.h" #include "raylib-js-globals.h" #include "raylib-js-functions.h" -void duk_module_raylib_init(duk_context* ctx) { - raylib_js_globals(ctx); - raylib_js_register_functions(ctx); +namespace raylibjs { + template + static void define_in(duktape::engine& js) { + define_globals(js); + define_functions(js); + define_structs(js); + } } #endif diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 019839d..3c4a3a1 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -29,11 +29,10 @@ macro(ADD_CATCH_TESTS executable) endmacro() -find_package(Duktape) -find_package(Dukglue) +find_package(Duktapecc) find_package(Raylib) -list(APPEND LIBS raylib duktape dukglue raylib-js-h) +list(APPEND LIBS raylib duktapecc raylib-js-h) list(APPEND SOURCES raylib-js-test.cpp) add_executable(raylib-js-test ${SOURCES}) diff --git a/tests/raylib-js-test.cpp b/tests/raylib-js-test.cpp index bfe154e..6ad6e7a 100644 --- a/tests/raylib-js-test.cpp +++ b/tests/raylib-js-test.cpp @@ -1,32 +1,36 @@ #define CATCH_CONFIG_MAIN #include "catch.hpp" #include "raylib.h" -#include -#include +#include #include "raylib-js.h" TEST_CASE("raylib-js", "[raylib-js]") { // Create the Duktape environment. - duk_context* ctx = duk_create_heap_default(); + duktape::engine js; // Register the raylib.js context. - duk_module_raylib_init(ctx); + raylibjs::define_in(js); + + SECTION("Vector2") { + float x = js.eval("var v = Vector2(200, 100); return v.x;") + REQUIRE(x == 200); + } + + SECTION("Color") { + int r = js.eval("RAYWHITE.r"); + REQUIRE(r == RAYWHITE.r); + } SECTION("IsWindowReady()") { - bool output = dukglue_peval(ctx, "IsWindowReady()"); + bool output = js.eval("IsWindowReady()"); REQUIRE(output == false); } SECTION("GetRandomValue(10,20)") { - int output = dukglue_peval(ctx, "GetRandomValue(10,20)"); + int output = js.eval("GetRandomValue(10,20)"); REQUIRE(output >= 10); REQUIRE(output <= 20); } - SECTION("Color") { - int r = dukglue_peval(ctx, "RAYWHITE.r"); - REQUIRE(r == RAYWHITE.r); - } - duk_destroy_heap(ctx); }