diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..d3a2b4e --- /dev/null +++ b/.travis.yml @@ -0,0 +1,70 @@ +language: c +dist: xenial + +git: + depth: 3 + +matrix: + include: + - os: linux + - os: osx + - os: windows + +addons: + artifacts: + paths: + - build + apt: + packages: + - gcc-multilib + - libasound2-dev + - libxcursor-dev + - libxinerama-dev + - mesa-common-dev + - libx11-dev + - libxrandr-dev + - libxrandr2 + - libxi-dev + - libgl1-mesa-dev + - libglu1-mesa-dev + +before_cache: + - case $TRAVIS_OS_NAME in + windows) + $msys2 pacman --sync --clean --noconfirm + ;; + esac + +cache: + directories: + - $HOME/AppData/Local/Temp/chocolatey + - /C/tools/msys64 + +before_install: + - export MAKE=make + - case $TRAVIS_OS_NAME in + windows) + [[ ! -f C:/tools/msys64/msys2_shell.cmd ]] && rm -rf C:/tools/msys64 + choco uninstall -y mingw + choco upgrade --no-progress -y msys2 + export msys2='cmd //C RefreshEnv.cmd ' + export msys2+='& set MSYS=winsymlinks:nativestrict ' + export msys2+='& C:\\tools\\msys64\\msys2_shell.cmd -defterm -no-start' + export mingw64="$msys2 -mingw64 -full-path -here -c "\"\$@"\" --" + export msys2+=" -msys2 -c "\"\$@"\" --" + $msys2 pacman --sync --noconfirm --needed mingw-w64-x86_64-toolchain + taskkill //IM gpg-agent.exe //F + export PATH=/C/tools/msys64/mingw64/bin:$PATH + export MAKE="$mingw64 make" + $msys2 pacman -S mingw-w64-x86_64-toolchain + ;; + esac + - mkdir build + - $RUNNER $CC --version + +before_script: + +script: + - $RUNNER $MAKE + - mv raylua_s build/ + - mv raylua_e build/ diff --git a/examples/embedding/main.lua b/examples/embedding/main.lua new file mode 100644 index 0000000..52b4477 --- /dev/null +++ b/examples/embedding/main.lua @@ -0,0 +1,23 @@ +local width, height = 800, 450 + +rl.SetConfigFlags(rl.FLAG_VSYNC_HINT) +rl.InitWindow(800, 450, "raylib [shapes] example - basic shapes drawing") +rl.InitAudioDevice() + +local logo = rl.LoadTexture "ressources/logo.png" +local music = rl.LoadSound "ressources/mini1111.ogg" + +rl.PlaySound(music) + +while not rl.WindowShouldClose() do + rl.BeginDrawing() + rl.ClearBackground(rl.RAYWHITE) + + rl.DrawTexture(logo, width/2 - logo.width/2, height/2 - logo.height/2, rl.WHITE) + rl.DrawText("this is a texture!", 350, 370, 10, rl.GRAY) + + rl.EndDrawing() +end + +rl.CloseAudioDevice() +rl.CloseWindow() diff --git a/examples/embedding/ressources/logo.png b/examples/embedding/ressources/logo.png new file mode 100644 index 0000000..a8bedc4 Binary files /dev/null and b/examples/embedding/ressources/logo.png differ diff --git a/examples/embedding/ressources/mini1111.ogg b/examples/embedding/ressources/mini1111.ogg new file mode 100644 index 0000000..2058d4d Binary files /dev/null and b/examples/embedding/ressources/mini1111.ogg differ diff --git a/examples/embedding/ressources/mini1111.xm b/examples/embedding/ressources/mini1111.xm new file mode 100644 index 0000000..a185c1a Binary files /dev/null and b/examples/embedding/ressources/mini1111.xm differ diff --git a/examples/models_waving_cubes.lua b/examples/models_waving_cubes.lua index eedcca1..ef6767a 100644 --- a/examples/models_waving_cubes.lua +++ b/examples/models_waving_cubes.lua @@ -48,9 +48,7 @@ while not rl.WindowShouldClose() do (z - num_blocks / 2) * (scale * 3.0) + scatter) local cube_color = rl.ColorFromHSV( - rl.new("Vector3", - (((x + y + z) * 18) % 360), 0.75, 0.9 - ) + (((x + y + z) * 18) % 360), 0.75, 0.9 ) local cube_size = (2.4 - scale) * block_scale diff --git a/makefile b/makefile index 4a6a85f..6bbc97f 100644 --- a/makefile +++ b/makefile @@ -7,10 +7,17 @@ LUA ?= luajit/src/luajit WINDRES ?= windres CFLAGS += -Iluajit/src -Iraylib/src -Iraygui/src -LDFLAGS += -Lluajit/src -Lraylib -lraylib +LDFLAGS += luajit/src/libluajit.a raylib/src/libraylib.a MODULES := raymath rlgl easings gestures physac raygui +# raylib settings +PLATFORM ?= PLATFORM_DESKTOP +GRAPHICS ?= GRAPHICS_API_OPENGL_33 + +USE_WAYLAND_DISPLAY ?= FALSE +USE_EXTERNAL_GLFW ?= FALSE + ifeq ($(OS),Windows_NT) LDFLAGS += -lopengl32 -lgdi32 -lwinmm -static EXTERNAL_FILES := src/res/icon.res @@ -20,7 +27,12 @@ else ifeq ($(shell uname),Darwin) -Wl,-pagezero_size,10000,-image_base,100000000 EXTERNAL_FILES := else - LDFLAGS += -ldl -lX11 -lpthread + LDFLAGS += -ldl -lpthread + ifeq ($(PLATFORM),PLATFORM_DRM) + LDFLAGS += -ldrm -lGLESv2 -lEGL -lgbm + else + LDFLAGS += -lX11 + endif EXTERNAL_FILES := endif @@ -30,10 +42,17 @@ all: raylua_s raylua_e luajit raylib $(CC) -c -o $@ $< $(CFLAGS) luajit: - $(MAKE) -C luajit amalg CC=$(CC) BUILDMODE=static MACOSX_DEPLOYMENT_TARGET=10.13 + $(MAKE) -C luajit amalg \ + CC=$(CC) BUILDMODE=static \ + MACOSX_DEPLOYMENT_TARGET=10.13 raylib: - $(MAKE) CC=$(CC) CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)" -C raylib/src + $(MAKE) -C raylib/src \ + CC=$(CC) AR=$(AR) CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)" \ + USE_WAYLAND_DISPLAY="$(USE_WAYLAND_DISPLAY)" \ + USE_EXTERNAL_GLFW="$(USE_EXTERNAL_GLFW)" \ + PLATFORM="$(PLATFORM)" GRAPHICS="$(GRAPHICS)" + raylua_s: src/raylua_s.o $(EXTERNAL_FILES) libraylua.a $(CC) -o $@ $^ $(LDFLAGS) luajit/src/libluajit.a @@ -73,6 +92,7 @@ clean: src/lib/miniz.o $(MAKE) -C luajit clean $(MAKE) -C raylib/src clean + rm -f raylib/libraylib.a .PHONY: all src/autogen/bind.c src/autogen/boot.c raylua_s raylua_e luajit \ raylib clean diff --git a/raylib b/raylib index be03613..51e75be 160000 --- a/raylib +++ b/raylib @@ -1 +1 @@ -Subproject commit be03613d1b6f9b0051d78c790f97df069150c65f +Subproject commit 51e75be9d1ffeaf6d47d3670017cca36f4785a17 diff --git a/src/compat.lua b/src/compat.lua index bd5ad47..2c42f17 100644 --- a/src/compat.lua +++ b/src/compat.lua @@ -14,22 +14,67 @@ CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ]] --- LoadImageEx removed function -rawset(rl, "LoadImageEx", function (pixels, width, height) - local image = rl.new "Image" - image.width = width - image.height = height - image.data = pixels - image.format = rl.UNCOMPRESSED_R8G8B8A8 - return image -end) - --- rlUnproject moved to Vector3Unproject -rawset(rl, "rlUnproject", rl.Vector3Unproject) - --- math metamethods local new = ffi.new +-- Load*() wrappers. +if raylua.loadfile then + local LoadImage = rl.LoadImage + function rl.LoadImage(path) + local f, err = raylua.loadfile(path) + + if f then + local ext = path:gsub(".+%.", "") + + return rl.LoadImageFromMemory(ext, f, #f) + else + print(("RAYLUA: %s"):format(err)) + return LoadImage(path) + end + end + + function rl.LoadTexture(path) + return rl.LoadTextureFromImage(rl.LoadImage(path)) + end + + local LoadFont, LoadFontEx = rl.LoadFont, rl.LoadFontEx + function rl.LoadFontEx(path, sz, chars, count) + local f, err = raylua.loadfile(path) + + if f then + local ext = path:gsub(".+%.", "") + + return rl.LoadFontFromMemory(ext, f, #f, sz, chars, count) + else + return LoadFontEx(sz, chars, count) + end + end + + function rl.LoadFont(path) + -- HACK: Hardcoded values (FONT_TTF_DEFAULT_SIZE, + -- FONT_TTF_DEFAULT_NUMCHARS) + return rl.LoadFontEx(path, 32, nil, 95) + end + + local LoadWave = rl.LoadWave + function rl.LoadWave(path) + local f, err = raylua.loadfile(path) + + if f then + local ext = path:gsub(".+%.", "") + + return rl.LoadWaveFromMemory(ext, f, #f) + else + print(("RAYLUA: %s"):format(err)) + return LoadWave(path) + end + end + + function rl.LoadSound(path) + return rl.LoadSoundFromWave(rl.LoadWave(path)) + end +end + +-- math metamethods ffi.metatype("Vector2", { __add = function (a, b) if ffi.istype("Vector2", b) then diff --git a/src/raylib.lua b/src/raylib.lua index 8549824..3ebcea9 100644 --- a/src/raylib.lua +++ b/src/raylib.lua @@ -78,24 +78,26 @@ ffi.cdef [[ int format; } Image; - typedef struct Texture2D { + typedef struct Texture { unsigned int id; int width; int height; int mipmaps; int format; - } Texture2D; - typedef Texture2D Texture; - typedef Texture2D TextureCubemap; + } Texture; + typedef Texture Texture2D; + typedef Texture TextureCubemap; - typedef struct RenderTexture2D { + typedef struct RenderTexture { unsigned int id; - Texture2D texture; - Texture2D depth; - bool depthTexture; - } RenderTexture2D; + Texture texture; + Texture depth; + } RenderTexture; + + typedef RenderTexture RenderTexture2D; + + typedef enum { OPENGL_11 = 1, OPENGL_21, OPENGL_33, OPENGL_ES_20 } GlVersion; - typedef RenderTexture2D RenderTexture; typedef struct NPatchInfo { Rectangle sourceRec; int left; @@ -116,6 +118,7 @@ ffi.cdef [[ typedef struct Font { int baseSize; int charsCount; + int charsPadding; Texture2D texture; Rectangle *recs; CharInfo *chars; @@ -188,9 +191,9 @@ ffi.cdef [[ Matrix transform; int meshCount; - Mesh *meshes; int materialCount; + Mesh *meshes; Material *materials; int *meshMaterial; int boneCount; @@ -200,9 +203,9 @@ ffi.cdef [[ typedef struct ModelAnimation { int boneCount; - BoneInfo *bones; int frameCount; + BoneInfo *bones; Transform **framePoses; } ModelAnimation; @@ -233,26 +236,25 @@ ffi.cdef [[ typedef struct rAudioBuffer rAudioBuffer; typedef struct AudioStream { + rAudioBuffer *buffer; + unsigned int sampleRate; unsigned int sampleSize; unsigned int channels; - - rAudioBuffer *buffer; } AudioStream; typedef struct Sound { - unsigned int sampleCount; AudioStream stream; + unsigned int sampleCount; } Sound; typedef struct Music { + AudioStream stream; + unsigned int sampleCount; + bool looping; + int ctxType; void *ctxData; - - bool looping; - unsigned int sampleCount; - - AudioStream stream; } Music; typedef struct VrDeviceInfo { @@ -269,15 +271,20 @@ ffi.cdef [[ } VrDeviceInfo; typedef enum { - FLAG_RESERVED = 1, - FLAG_FULLSCREEN_MODE = 2, - FLAG_WINDOW_RESIZABLE = 4, - FLAG_WINDOW_UNDECORATED = 8, - FLAG_WINDOW_TRANSPARENT = 16, - FLAG_WINDOW_HIDDEN = 128, - FLAG_WINDOW_ALWAYS_RUN = 256, - FLAG_MSAA_4X_HINT = 32, - FLAG_VSYNC_HINT = 64 + FLAG_VSYNC_HINT = 0x00000040, + FLAG_FULLSCREEN_MODE = 0x00000002, + FLAG_WINDOW_RESIZABLE = 0x00000004, + FLAG_WINDOW_UNDECORATED = 0x00000008, + FLAG_WINDOW_HIDDEN = 0x00000080, + FLAG_WINDOW_MINIMIZED = 0x00000200, + FLAG_WINDOW_MAXIMIZED = 0x00000400, + FLAG_WINDOW_UNFOCUSED = 0x00000800, + FLAG_WINDOW_TOPMOST = 0x00001000, + FLAG_WINDOW_ALWAYS_RUN = 0x00000100, + FLAG_WINDOW_TRANSPARENT = 0x00000010, + FLAG_WINDOW_HIGHDPI = 0x00002000, + FLAG_MSAA_4X_HINT = 0x00000020, + FLAG_INTERLACED_HINT = 0x00010000 } ConfigFlag; typedef enum { @@ -412,6 +419,20 @@ ffi.cdef [[ MOUSE_MIDDLE_BUTTON = 2 } MouseButton; + typedef enum { + MOUSE_CURSOR_DEFAULT = 0, + MOUSE_CURSOR_ARROW = 1, + MOUSE_CURSOR_IBEAM = 2, + MOUSE_CURSOR_CROSSHAIR = 3, + MOUSE_CURSOR_POINTING_HAND = 4, + MOUSE_CURSOR_RESIZE_EW = 5, + MOUSE_CURSOR_RESIZE_NS = 6, + MOUSE_CURSOR_RESIZE_NWSE = 7, + MOUSE_CURSOR_RESIZE_NESW = 8, + MOUSE_CURSOR_RESIZE_ALL = 9, + MOUSE_CURSOR_NOT_ALLOWED = 10 + } MouseCursor; + typedef enum { GAMEPAD_PLAYER1 = 0, GAMEPAD_PLAYER2 = 1, @@ -537,6 +558,13 @@ ffi.cdef [[ FILTER_ANISOTROPIC_16X, } TextureFilterMode; + typedef enum { + WRAP_REPEAT = 0, + WRAP_CLAMP, + WRAP_MIRROR_REPEAT, + WRAP_MIRROR_CLAMP + } TextureWrapMode; + typedef enum { CUBEMAP_AUTO_DETECT = 0, CUBEMAP_LINE_VERTICAL, @@ -546,13 +574,6 @@ ffi.cdef [[ CUBEMAP_PANORAMA } CubemapLayoutType; - typedef enum { - WRAP_REPEAT = 0, - WRAP_CLAMP, - WRAP_MIRROR_REPEAT, - WRAP_MIRROR_CLAMP - } TextureWrapMode; - typedef enum { FONT_DEFAULT = 0, FONT_BITMAP, @@ -610,6 +631,33 @@ ffi.cdef [[ typedef struct float16 { float v[16]; } float16; ]] +-- rlgl cdef +ffi.cdef [[ + typedef enum { + RL_ATTACHMENT_COLOR_CHANNEL0 = 0, + RL_ATTACHMENT_COLOR_CHANNEL1, + RL_ATTACHMENT_COLOR_CHANNEL2, + RL_ATTACHMENT_COLOR_CHANNEL3, + RL_ATTACHMENT_COLOR_CHANNEL4, + RL_ATTACHMENT_COLOR_CHANNEL5, + RL_ATTACHMENT_COLOR_CHANNEL6, + RL_ATTACHMENT_COLOR_CHANNEL7, + RL_ATTACHMENT_DEPTH = 100, + RL_ATTACHMENT_STENCIL = 200, + } FramebufferAttachType; + + typedef enum { + RL_ATTACHMENT_CUBEMAP_POSITIVE_X = 0, + RL_ATTACHMENT_CUBEMAP_NEGATIVE_X, + RL_ATTACHMENT_CUBEMAP_POSITIVE_Y, + RL_ATTACHMENT_CUBEMAP_NEGATIVE_Y, + RL_ATTACHMENT_CUBEMAP_POSITIVE_Z, + RL_ATTACHMENT_CUBEMAP_NEGATIVE_Z, + RL_ATTACHMENT_TEXTURE2D = 100, + RL_ATTACHMENT_RENDERBUFFER = 200, + } FramebufferTexType; +]] + -- Physac cdef ffi.cdef [[ typedef struct PhysicsBodyData *PhysicsBody; diff --git a/src/raylua.c b/src/raylua.c index 72404aa..8d0c2c4 100644 --- a/src/raylua.c +++ b/src/raylua.c @@ -68,8 +68,10 @@ void raylua_boot(lua_State *L, lua_CFunction loadfile, lua_CFunction listfiles, lua_setglobal(L, "raylua"); - if (luaL_dostring(L, raylua_boot_lua)) + if (luaL_dostring(L, raylua_boot_lua)) { fputs(luaL_checkstring(L, -1), stderr); + fputc('\n', stderr); + } } int luaopen_raylua(lua_State *L) diff --git a/src/raylua.lua b/src/raylua.lua index d082c2f..ea30bc8 100644 --- a/src/raylua.lua +++ b/src/raylua.lua @@ -16,7 +16,7 @@ local load = loadstring -raylua.version = "v3.0f" +raylua.version = "v3.5-pre1" function raylua.repl() print("> raylua " .. raylua.version .. " <") @@ -65,16 +65,37 @@ if raylua.loadfile then end print "RAYLUA: Load main.lua from payload." - require "main" + + local f, err = load(raylua.loadfile "main.lua", "main.lua") + if f then + local status, f_err = xpcall(f, debug.traceback) + + if not status then + print(f_err) + end + else + print(err) + end if not raylua.isrepl then - -- Keep launching the repl even with `loadfile` defined. return end + + -- Keep launching the repl even with `loadfile` defined. end if arg and arg[1] then - dofile(arg[1]) + local f, err = loadfile(arg[1]) + if f then + local status, f_err = xpcall(f, debug.traceback) + + if not status then + print(f_err) + end + else + print(err) + end + return end diff --git a/src/raylua_builder.c b/src/raylua_builder.c index dc52e8e..7c46151 100644 --- a/src/raylua_builder.c +++ b/src/raylua_builder.c @@ -150,7 +150,7 @@ static int list_dir(lua_State *L) return 0; struct dirent *entry; - size_t count = 0; + size_t count = 1; lua_newtable(L); diff --git a/src/raylua_builder.lua b/src/raylua_builder.lua index 9709c74..aeb24d3 100644 --- a/src/raylua_builder.lua +++ b/src/raylua_builder.lua @@ -83,7 +83,7 @@ if t == "directory" then local function add_dir(root, dir) for i,file in ipairs(list_dir(path_concat(root, dir))) do - if file ~= ".." then + if file ~= ".." and file ~= "." then local partial_file_path, full_file_path if dir then diff --git a/src/raylua_e.c b/src/raylua_e.c index 376b543..5dad6ba 100644 --- a/src/raylua_e.c +++ b/src/raylua_e.c @@ -88,60 +88,6 @@ int raylua_listfiles(lua_State *L) return 1; } -unsigned char *raylua_loadFileData(const char *path, unsigned int *out_size) -{ - int index = mz_zip_reader_locate_file(&zip_file, path, NULL, 0); - if (index == -1) { - printf("RAYLUA: WARN: File not found in payload : '%s'", path); - return NULL; - } - - mz_zip_archive_file_stat stat; - if (!mz_zip_reader_file_stat(&zip_file, index, &stat)) { - printf("RAYLUA: WARN: Can't get file information of '%s' in payload.", path); - return NULL; - } - - size_t size = stat.m_uncomp_size; - unsigned char *buffer = RL_MALLOC(size); - if (buffer == NULL) { - printf("RAYLUA: WARN: Can't allocate file buffer for '%s'.", path); - return NULL; - } - - mz_zip_reader_extract_to_mem(&zip_file, index, buffer, size, 0); - - *out_size = size; - return buffer; -} - -char *raylua_loadFileText(const char *path) -{ - int index = mz_zip_reader_locate_file(&zip_file, path, NULL, 0); - if (index == -1) { - printf("RAYLUA: WARN: File not found in payload : '%s'", path); - return NULL; - } - - mz_zip_archive_file_stat stat; - if (!mz_zip_reader_file_stat(&zip_file, index, &stat)) { - printf("RAYLUA: WARN: Can't get file information of '%s' in payload.", path); - return NULL; - } - - size_t size = stat.m_uncomp_size; - char *buffer = RL_MALLOC(size + 1); - if (buffer == NULL) { - printf("RAYLUA: WARN: Can't allocate file buffer for '%s'.", path); - return NULL; - } - - buffer[size] = '\0'; - - mz_zip_reader_extract_to_mem(&zip_file, index, buffer, size, 0); - return buffer; -} - static bool raylua_init_payload(FILE *self) { mz_zip_zero_struct(&zip_file); @@ -174,11 +120,6 @@ int main(int argc, const char **argv) lua_setglobal(L, "arg"); - SetFilesystemOverride((FilesystemOverride){ - .loadFileData = &raylua_loadFileData, - .loadFileText = &raylua_loadFileText, - }); - FILE *self = raylua_open_self(argv[0]); if (self == NULL) { diff --git a/tools/api.h b/tools/api.h index cd36fb6..18b0098 100644 --- a/tools/api.h +++ b/tools/api.h @@ -2,18 +2,18 @@ void InitWindow(int width, int height, const char *title) bool WindowShouldClose(void) void CloseWindow(void) bool IsWindowReady(void) +bool IsWindowFullscreen(void) +bool IsWindowHidden(void) bool IsWindowMinimized(void) bool IsWindowMaximized(void) bool IsWindowFocused(void) bool IsWindowResized(void) -bool IsWindowHidden(void) -bool IsWindowFullscreen(void) +bool IsWindowState(unsigned int flag) +void SetWindowState(unsigned int flags) +void ClearWindowState(unsigned int flags) void ToggleFullscreen(void) -void UnhideWindow(void) -void HideWindow(void) -void DecorateWindow(void) -void UndecorateWindow(void) void MaximizeWindow(void) +void MinimizeWindow(void) void RestoreWindow(void) void SetWindowIcon(Image image) void SetWindowTitle(const char *title) @@ -25,6 +25,7 @@ void *GetWindowHandle(void) int GetScreenWidth(void) int GetScreenHeight(void) int GetMonitorCount(void) +Vector2 GetMonitorPosition(int monitor) int GetMonitorWidth(int monitor) int GetMonitorHeight(int monitor) int GetMonitorPhysicalWidth(int monitor) @@ -33,8 +34,8 @@ int GetMonitorRefreshRate(int monitor) Vector2 GetWindowPosition(void) Vector2 GetWindowScaleDPI(void) const char *GetMonitorName(int monitor) -const char *GetClipboardText(void) void SetClipboardText(const char *text) +const char *GetClipboardText(void) void ShowCursor(void) void HideCursor(void) bool IsCursorHidden(void) @@ -63,28 +64,25 @@ void SetTargetFPS(int fps) int GetFPS(void) float GetFrameTime(void) double GetTime(void) -int ColorToInt(Color color) -Vector4 ColorNormalize(Color color) -Color ColorFromNormalized(Vector4 normalized) -Vector3 ColorToHSV(Color color) -Color ColorFromHSV(Vector3 hsv) -Color GetColor(int hexValue) -Color Fade(Color color, float alpha) void SetConfigFlags(unsigned int flags) void SetTraceLogLevel(int logType) void SetTraceLogExit(int logType) void SetTraceLogCallback(TraceLogCallback callback) void TraceLog(int logType, const char *text, ...) +void *MemAlloc(int size) +void MemFree(void *ptr) void TakeScreenshot(const char *fileName) int GetRandomValue(int min, int max) -unsigned char *LoadFileData(const char *fileName, int *bytesRead) -void SaveFileData(const char *fileName, void *data, int bytesToWrite) +uint8_t *LoadFileData(const char *fileName, unsigned int *bytesRead) +void UnloadFileData(unsigned char *data) +bool SaveFileData(const char *fileName, void *data, unsigned int bytesToWrite) char *LoadFileText(const char *fileName) -void SaveFileText(const char *fileName, char *text) +void UnloadFileText(unsigned char *text) +bool SaveFileText(const char *fileName, char *text) bool FileExists(const char *fileName) -bool IsFileExtension(const char *fileName, const char *ext) bool DirectoryExists(const char *dirPath) -const char *GetExtension(const char *fileName) +bool IsFileExtension(const char *fileName, const char *ext) +const char *GetFileExtension(const char *fileName) const char *GetFileName(const char *filePath) const char *GetFileNameWithoutExt(const char *filePath) const char *GetDirectoryPath(const char *filePath) @@ -97,10 +95,10 @@ bool IsFileDropped(void) char **GetDroppedFiles(int *count) void ClearDroppedFiles(void) long GetFileModTime(const char *fileName) -unsigned char *CompressData(unsigned char *data, int dataLength, int *compDataLength) -unsigned char *DecompressData(unsigned char *compData, int compDataLength, int *dataLength) -void SaveStorageValue(int position, int value) -int LoadStorageValue(int position) +uint8_t *CompressData(uint8_t *data, int dataLength, int *compDataLength) +uint8_t *DecompressData(uint8_t *compData, int compDataLength, int *dataLength) +bool SaveStorageValue(unsigned int position, int value) +int LoadStorageValue(unsigned int position) void OpenURL(const char *url) bool IsKeyPressed(int key) bool IsKeyDown(int key) @@ -108,6 +106,7 @@ bool IsKeyReleased(int key) bool IsKeyUp(int key) void SetExitKey(int key) int GetKeyPressed(void) +int GetCharPressed(void) bool IsGamepadAvailable(int gamepad) bool IsGamepadName(int gamepad, const char *name) const char *GetGamepadName(int gamepad) @@ -128,7 +127,9 @@ Vector2 GetMousePosition(void) void SetMousePosition(int x, int y) void SetMouseOffset(int offsetX, int offsetY) void SetMouseScale(float scaleX, float scaleY) -int GetMouseWheelMove(void) +float GetMouseWheelMove(void) +int GetMouseCursor(void) +void SetMouseCursor(int cursor) int GetTouchX(void) int GetTouchY(void) Vector2 GetTouchPosition(int index) @@ -143,17 +144,17 @@ Vector2 GetGesturePinchVector(void) float GetGesturePinchAngle(void) void SetCameraMode(Camera camera, int mode) void UpdateCamera(Camera *camera) -void SetCameraPanControl(int panKey) -void SetCameraAltControl(int altKey) -void SetCameraSmoothZoomControl(int szKey) -void SetCameraMoveControls(int frontKey, int backKey, int rightKey, int leftKey, int upKey, int downKey) +void SetCameraPanControl(int keyPan) +void SetCameraAltControl(int keyAlt) +void SetCameraSmoothZoomControl(int keySmoothZoom) +void SetCameraMoveControls(int keyFront, int keyBack, int keyRight, int keyLeft, int keyUp, int keyDown) void DrawPixel(int posX, int posY, Color color) void DrawPixelV(Vector2 position, Color color) void DrawLine(int startPosX, int startPosY, int endPosX, int endPosY, Color color) void DrawLineV(Vector2 startPos, Vector2 endPos, Color color) void DrawLineEx(Vector2 startPos, Vector2 endPos, float thick, Color color) void DrawLineBezier(Vector2 startPos, Vector2 endPos, float thick, Color color) -void DrawLineStrip(Vector2 *points, int numPoints, Color color) +void DrawLineStrip(Vector2 *points, int pointsCount, Color color) void DrawCircle(int centerX, int centerY, float radius, Color color) void DrawCircleSector(Vector2 center, float radius, int startAngle, int endAngle, int segments, Color color) void DrawCircleSectorLines(Vector2 center, float radius, int startAngle, int endAngle, int segments, Color color) @@ -177,7 +178,7 @@ void DrawRectangleRounded(Rectangle rec, float roundness, int segments, Color co void DrawRectangleRoundedLines(Rectangle rec, float roundness, int segments, int lineThick, Color color) void DrawTriangle(Vector2 v1, Vector2 v2, Vector2 v3, Color color) void DrawTriangleLines(Vector2 v1, Vector2 v2, Vector2 v3, Color color) -void DrawTriangleFan(Vector2 *points, int numPoints, Color color) +void DrawTriangleFan(Vector2 *points, int pointsCount, Color color) void DrawTriangleStrip(Vector2 *points, int pointsCount, Color color) void DrawPoly(Vector2 center, int sides, float radius, float rotation, Color color) void DrawPolyLines(Vector2 center, int sides, float radius, float rotation, Color color) @@ -191,54 +192,34 @@ bool CheckCollisionPointTriangle(Vector2 point, Vector2 p1, Vector2 p2, Vector2 Image LoadImage(const char *fileName) Image LoadImageRaw(const char *fileName, int width, int height, int format, int headerSize) Image LoadImageAnim(const char *fileName, int *frames) -void ExportImage(Image image, const char *fileName) -void ExportImageAsCode(Image image, const char *fileName) -Texture2D LoadTexture(const char *fileName) -Texture2D LoadTextureFromImage(Image image) -TextureCubemap LoadTextureCubemap(Image image, int layoutType) -RenderTexture2D LoadRenderTexture(int width, int height) +Image LoadImageFromMemory(const char *fileType, const uint8_t *fileData, int dataSize) void UnloadImage(Image image) -void UnloadTexture(Texture2D texture) -void UnloadRenderTexture(RenderTexture2D target) -Color *GetImageData(Image image) -Vector4 *GetImageDataNormalized(Image image) -Rectangle GetImageAlphaBorder(Image image, float threshold) -int GetPixelDataSize(int width, int height, int format) -Image GetTextureData(Texture2D texture) -Image GetScreenData(void) -void UpdateTexture(Texture2D texture, const void *pixels) -void UpdateTextureRec(Texture2D texture, Rectangle rec, const void *pixels) +bool ExportImage(Image image, const char *fileName) +bool ExportImageAsCode(Image image, const char *fileName) +Image GenImageColor(int width, int height, Color color) +Image GenImageGradientV(int width, int height, Color top, Color bottom) +Image GenImageGradientH(int width, int height, Color left, Color right) +Image GenImageGradientRadial(int width, int height, float density, Color inner, Color outer) +Image GenImageChecked(int width, int height, int checksX, int checksY, Color col1, Color col2) +Image GenImageWhiteNoise(int width, int height, float factor) +Image GenImagePerlinNoise(int width, int height, int offsetX, int offsetY, float scale) +Image GenImageCellular(int width, int height, int tileSize) Image ImageCopy(Image image) Image ImageFromImage(Image image, Rectangle rec) -void ImageToPOT(Image *image, Color fillColor) -void ImageFormat(Image *image, int newFormat) -void ImageAlphaMask(Image *image, Image alphaMask) -void ImageAlphaClear(Image *image, Color color, float threshold) -void ImageAlphaCrop(Image *image, float threshold) -void ImageAlphaPremultiply(Image *image) -void ImageCrop(Image *image, Rectangle crop) -void ImageResize(Image *image, int newWidth, int newHeight) -void ImageResizeNN(Image *image, int newWidth,int newHeight) -void ImageResizeCanvas(Image *image, int newWidth, int newHeight, int offsetX, int offsetY, Color color) -void ImageMipmaps(Image *image) -void ImageDither(Image *image, int rBpp, int gBpp, int bBpp, int aBpp) -Color *GetImagePalette(Image image, int maxPaletteSize, int *extractCount) Image ImageText(const char *text, int fontSize, Color color) Image ImageTextEx(Font font, const char *text, float fontSize, float spacing, Color tint) -void ImageDraw(Image *dst, Image src, Rectangle srcRec, Rectangle dstRec, Color tint) -void ImageDrawRectangle(Image *dst, int posX, int posY, int width, int height, Color color) -void ImageDrawRectangleV(Image *dst, Vector2 position, Vector2 size, Color color) -void ImageDrawRectangleRec(Image *dst, Rectangle rec, Color color) -void ImageDrawRectangleLines(Image *dst, Rectangle rec, int thick, Color color) -void ImageClearBackground(Image *dst, Color color) -void ImageDrawPixel(Image *dst, int posX, int posY, Color color) -void ImageDrawPixelV(Image *dst, Vector2 position, Color color) -void ImageDrawCircle(Image *dst, int centerX, int centerY, int radius, Color color) -void ImageDrawCircleV(Image *dst, Vector2 center, int radius, Color color) -void ImageDrawLine(Image *dst, int startPosX, int startPosY, int endPosX, int endPosY, Color color) -void ImageDrawLineV(Image *dst, Vector2 start, Vector2 end, Color color) -void ImageDrawText(Image *dst, const char *text, int posX, int posY, int fontSize, Color color) -void ImageDrawTextEx(Image *dst, Font font, const char *text, Vector2 position, float fontSize, float spacing, Color tint) +void ImageFormat(Image *image, int newFormat) +void ImageToPOT(Image *image, Color fill) +void ImageCrop(Image *image, Rectangle crop) +void ImageAlphaCrop(Image *image, float threshold) +void ImageAlphaClear(Image *image, Color color, float threshold) +void ImageAlphaMask(Image *image, Image alphaMask) +void ImageAlphaPremultiply(Image *image) +void ImageResize(Image *image, int newWidth, int newHeight) +void ImageResizeNN(Image *image, int newWidth,int newHeight) +void ImageResizeCanvas(Image *image, int newWidth, int newHeight, int offsetX, int offsetY, Color fill) +void ImageMipmaps(Image *image) +void ImageDither(Image *image, int rBpp, int gBpp, int bBpp, int aBpp) void ImageFlipVertical(Image *image) void ImageFlipHorizontal(Image *image) void ImageRotateCW(Image *image) @@ -249,37 +230,73 @@ void ImageColorGrayscale(Image *image) void ImageColorContrast(Image *image, float contrast) void ImageColorBrightness(Image *image, int brightness) void ImageColorReplace(Image *image, Color color, Color replace) -Image GenImageColor(int width, int height, Color color) -Image GenImageGradientV(int width, int height, Color top, Color bottom) -Image GenImageGradientH(int width, int height, Color left, Color right) -Image GenImageGradientRadial(int width, int height, float density, Color inner, Color outer) -Image GenImageChecked(int width, int height, int checksX, int checksY, Color col1, Color col2) -Image GenImageWhiteNoise(int width, int height, float factor) -Image GenImagePerlinNoise(int width, int height, int offsetX, int offsetY, float scale) -Image GenImageCellular(int width, int height, int tileSize) +Color *LoadImageColors(Image image) +Color *LoadImagePalette(Image image, int maxPaletteSize, int *colorsCount) +void UnloadImageColors(Color *colors) +void UnloadImagePalette(Color *colors) +Rectangle GetImageAlphaBorder(Image image, float threshold) +void ImageClearBackground(Image *dst, Color color) +void ImageDrawPixel(Image *dst, int posX, int posY, Color color) +void ImageDrawPixelV(Image *dst, Vector2 position, Color color) +void ImageDrawLine(Image *dst, int startPosX, int startPosY, int endPosX, int endPosY, Color color) +void ImageDrawLineV(Image *dst, Vector2 start, Vector2 end, Color color) +void ImageDrawCircle(Image *dst, int centerX, int centerY, int radius, Color color) +void ImageDrawCircleV(Image *dst, Vector2 center, int radius, Color color) +void ImageDrawRectangle(Image *dst, int posX, int posY, int width, int height, Color color) +void ImageDrawRectangleV(Image *dst, Vector2 position, Vector2 size, Color color) +void ImageDrawRectangleRec(Image *dst, Rectangle rec, Color color) +void ImageDrawRectangleLines(Image *dst, Rectangle rec, int thick, Color color) +void ImageDraw(Image *dst, Image src, Rectangle srcRec, Rectangle dstRec, Color tint) +void ImageDrawText(Image *dst, const char *text, int posX, int posY, int fontSize, Color color) +void ImageDrawTextEx(Image *dst, Font font, const char *text, Vector2 position, float fontSize, float spacing, Color tint) +Texture2D LoadTexture(const char *fileName) +Texture2D LoadTextureFromImage(Image image) +TextureCubemap LoadTextureCubemap(Image image, int layoutType) +RenderTexture2D LoadRenderTexture(int width, int height) +void UnloadTexture(Texture2D texture) +void UnloadRenderTexture(RenderTexture2D target) +void UpdateTexture(Texture2D texture, const void *pixels) +void UpdateTextureRec(Texture2D texture, Rectangle rec, const void *pixels) +Image GetTextureData(Texture2D texture) +Image GetScreenData(void) void GenTextureMipmaps(Texture2D *texture) void SetTextureFilter(Texture2D texture, int filterMode) void SetTextureWrap(Texture2D texture, int wrapMode) void DrawTexture(Texture2D texture, int posX, int posY, Color tint) void DrawTextureV(Texture2D texture, Vector2 position, Color tint) void DrawTextureEx(Texture2D texture, Vector2 position, float rotation, float scale, Color tint) -void DrawTextureRec(Texture2D texture, Rectangle sourceRec, Vector2 position, Color tint) +void DrawTextureRec(Texture2D texture, Rectangle source, Vector2 position, Color tint) void DrawTextureQuad(Texture2D texture, Vector2 tiling, Vector2 offset, Rectangle quad, Color tint) -void DrawTexturePro(Texture2D texture, Rectangle sourceRec, Rectangle destRec, Vector2 origin, float rotation, Color tint) -void DrawTextureNPatch(Texture2D texture, NPatchInfo nPatchInfo, Rectangle destRec, Vector2 origin, float rotation, Color tint) +void DrawTextureTiled(Texture2D texture, Rectangle source, Rectangle dest, Vector2 origin, float rotation, float scale, Color tint) +void DrawTexturePro(Texture2D texture, Rectangle source, Rectangle dest, Vector2 origin, float rotation, Color tint) +void DrawTextureNPatch(Texture2D texture, NPatchInfo nPatchInfo, Rectangle dest, Vector2 origin, float rotation, Color tint) +Color Fade(Color color, float alpha) +int ColorToInt(Color color) +Vector4 ColorNormalize(Color color) +Color ColorFromNormalized(Vector4 normalized) +Vector3 ColorToHSV(Color color) +Color ColorFromHSV(float hue, float saturation, float value) +Color ColorAlpha(Color color, float alpha) +Color ColorAlphaBlend(Color dst, Color src, Color tint) +Color GetColor(int hexValue) +Color GetPixelColor(void *srcPtr, int format) +void SetPixelColor(void *dstPtr, Color color, int format) +int GetPixelDataSize(int width, int height, int format) Font GetFontDefault(void) Font LoadFont(const char *fileName) Font LoadFontEx(const char *fileName, int fontSize, int *fontChars, int charsCount) Font LoadFontFromImage(Image image, Color key, int firstChar) -CharInfo *LoadFontData(const char *fileName, int fontSize, int *fontChars, int charsCount, int type) +Font LoadFontFromMemory(const char *fileType, const uint8_t *fileData, int dataSize, int fontSize, int *fontChars, int charsCount) +CharInfo *LoadFontData(const uint8_t *fileData, int dataSize, int fontSize, int *fontChars, int charsCount, int type) Image GenImageFontAtlas(const CharInfo *chars, Rectangle **recs, int charsCount, int fontSize, int padding, int packMethod) +void UnloadFontData(CharInfo *chars, int charsCount) void UnloadFont(Font font) void DrawFPS(int posX, int posY) void DrawText(const char *text, int posX, int posY, int fontSize, Color color) void DrawTextEx(Font font, const char *text, Vector2 position, float fontSize, float spacing, Color tint) void DrawTextRec(Font font, const char *text, Rectangle rec, float fontSize, float spacing, bool wordWrap, Color tint) void DrawTextRecEx(Font font, const char *text, Rectangle rec, float fontSize, float spacing, bool wordWrap, Color tint, int selectStart, int selectLength, Color selectTint, Color selectBackTint) -void DrawTextCodepoint(Font font, int codepoint, Vector2 position, float scale, Color tint) +void DrawTextCodepoint(Font font, int codepoint, Vector2 position, float fontSize, Color tint) int MeasureText(const char *text, int fontSize) Vector2 MeasureTextEx(Font font, const char *text, float fontSize, float spacing) int GetGlyphIndex(Font font, int codepoint) @@ -306,6 +323,8 @@ const char *CodepointToUtf8(int codepoint, int *byteLength) void DrawLine3D(Vector3 startPos, Vector3 endPos, Color color) void DrawPoint3D(Vector3 position, Color color) void DrawCircle3D(Vector3 center, float radius, Vector3 rotationAxis, float rotationAngle, Color color) +void DrawTriangle3D(Vector3 v1, Vector3 v2, Vector3 v3, Color color) +void DrawTriangleStrip3D(Vector3 *points, int pointsCount, Color color) void DrawCube(Vector3 position, float width, float height, float length, Color color) void DrawCubeV(Vector3 position, Vector3 size, Color color) void DrawCubeWires(Vector3 position, float width, float height, float length, Color color) @@ -323,8 +342,9 @@ void DrawGizmo(Vector3 position) Model LoadModel(const char *fileName) Model LoadModelFromMesh(Mesh mesh) void UnloadModel(Model model) +void UnloadModelKeepMeshes(Model model) Mesh *LoadMeshes(const char *fileName, int *meshCount) -void ExportMesh(Mesh mesh, const char *fileName) +bool ExportMesh(Mesh mesh, const char *fileName) void UnloadMesh(Mesh mesh) Material *LoadMaterials(const char *fileName, int *materialCount) Material LoadMaterialDefault(void) @@ -355,12 +375,14 @@ void DrawModelWires(Model model, Vector3 position, float scale, Color tint) void DrawModelWiresEx(Model model, Vector3 position, Vector3 rotationAxis, float rotationAngle, Vector3 scale, Color tint) void DrawBoundingBox(BoundingBox box, Color color) void DrawBillboard(Camera camera, Texture2D texture, Vector3 center, float size, Color tint) -void DrawBillboardRec(Camera camera, Texture2D texture, Rectangle sourceRec, Vector3 center, float size, Color tint) -bool CheckCollisionSpheres(Vector3 centerA, float radiusA, Vector3 centerB, float radiusB) +void DrawBillboardRec(Camera camera, Texture2D texture, Rectangle source, Vector3 center, float size, Color tint) +bool CheckCollisionSpheres(Vector3 center1, float radius1, Vector3 center2, float radius2) bool CheckCollisionBoxes(BoundingBox box1, BoundingBox box2) bool CheckCollisionBoxSphere(BoundingBox box, Vector3 center, float radius) +bool CheckCollisionRaySphere(Ray ray, Vector3 center, float radius) bool CheckCollisionRaySphereEx(Ray ray, Vector3 center, float radius, Vector3 *collisionPoint) bool CheckCollisionRayBox(Ray ray, BoundingBox box) +RayHitInfo GetCollisionRayMesh(Ray ray, Mesh mesh, Matrix transform) RayHitInfo GetCollisionRayModel(Ray ray, Model model) RayHitInfo GetCollisionRayTriangle(Ray ray, Vector3 p1, Vector3 p2, Vector3 p3) RayHitInfo GetCollisionRayGround(Ray ray, float groundHeight) @@ -373,6 +395,7 @@ Texture2D GetShapesTexture(void) Rectangle GetShapesTextureRec(void) void SetShapesTexture(Texture2D texture, Rectangle source) int GetShaderLocation(Shader shader, const char *uniformName) +int GetShaderLocationAttrib(Shader shader, const char *attribName) void SetShaderValue(Shader shader, int uniformLoc, const void *value, int uniformType) void SetShaderValueV(Shader shader, int uniformLoc, const void *value, int uniformType, int count) void SetShaderValueMatrix(Shader shader, int uniformLoc, Matrix mat) @@ -381,9 +404,9 @@ void SetMatrixProjection(Matrix proj) void SetMatrixModelview(Matrix view) Matrix GetMatrixModelview(void) Matrix GetMatrixProjection(void) -Texture2D GenTextureCubemap(Shader shader, Texture2D map, int size) -Texture2D GenTextureIrradiance(Shader shader, Texture2D cubemap, int size) -Texture2D GenTexturePrefilter(Shader shader, Texture2D cubemap, int size) +TextureCubemap GenTextureCubemap(Shader shader, Texture2D panorama, int size, int format) +TextureCubemap GenTextureIrradiance(Shader shader, TextureCubemap cubemap, int size) +TextureCubemap GenTexturePrefilter(Shader shader, TextureCubemap cubemap, int size) Texture2D GenTextureBRDF(Shader shader, int size) void BeginShaderMode(Shader shader) void EndShaderMode(void) @@ -402,13 +425,14 @@ void CloseAudioDevice(void) bool IsAudioDeviceReady(void) void SetMasterVolume(float volume) Wave LoadWave(const char *fileName) +Wave LoadWaveFromMemory(const char *fileType, const uint8_t *fileData, int dataSize) Sound LoadSound(const char *fileName) Sound LoadSoundFromWave(Wave wave) void UpdateSound(Sound sound, const void *data, int samplesCount) void UnloadWave(Wave wave) void UnloadSound(Sound sound) -void ExportWave(Wave wave, const char *fileName) -void ExportWaveAsCode(Wave wave, const char *fileName) +bool ExportWave(Wave wave, const char *fileName) +bool ExportWaveAsCode(Wave wave, const char *fileName) void PlaySound(Sound sound) void StopSound(Sound sound) void PauseSound(Sound sound) @@ -422,7 +446,8 @@ void SetSoundPitch(Sound sound, float pitch) void WaveFormat(Wave *wave, int sampleRate, int sampleSize, int channels) Wave WaveCopy(Wave wave) void WaveCrop(Wave *wave, int initSample, int finalSample) -float *GetWaveData(Wave wave) +float *LoadWaveSamples(Wave wave) +void UnloadWaveSamples(float *samples) Music LoadMusicStream(const char *fileName) void UnloadMusicStream(Music music) void PlayMusicStream(Music music) diff --git a/tools/genbind.lua b/tools/genbind.lua index 6dc3176..782f26d 100644 --- a/tools/genbind.lua +++ b/tools/genbind.lua @@ -52,7 +52,8 @@ for _,modname in ipairs(modules) do line = line:gsub("(%W)([%l%d][%w_]*)", function (before, part) for i,keyword in ipairs(keywords) do - if part == keyword then + if part == keyword + or part == "t" then -- uintX_t workaround return before .. part end end diff --git a/tools/raymath.h b/tools/raymath.h index d12db3a..50d9406 100644 --- a/tools/raymath.h +++ b/tools/raymath.h @@ -9,6 +9,7 @@ Vector2 Vector2AddValue(Vector2 v, float add) Vector2 Vector2Subtract(Vector2 v1, Vector2 v2) Vector2 Vector2SubtractValue(Vector2 v, float sub) float Vector2Length(Vector2 v) +float Vector2LengthSqr(Vector2 v) float Vector2DotProduct(Vector2 v1, Vector2 v2) float Vector2Distance(Vector2 v1, Vector2 v2) float Vector2Angle(Vector2 v1, Vector2 v2) @@ -18,6 +19,7 @@ Vector2 Vector2Negate(Vector2 v) Vector2 Vector2Divide(Vector2 v1, Vector2 v2) Vector2 Vector2Normalize(Vector2 v) Vector2 Vector2Lerp(Vector2 v1, Vector2 v2, float amount) +Vector2 Vector2Reflect(Vector2 v, Vector2 normal) Vector2 Vector2Rotate(Vector2 v, float degs) Vector2 Vector2MoveTowards(Vector2 v, Vector2 target, float maxDistance) Vector3 Vector3Zero(void) @@ -31,6 +33,7 @@ Vector3 Vector3Multiply(Vector3 v1, Vector3 v2) Vector3 Vector3CrossProduct(Vector3 v1, Vector3 v2) Vector3 Vector3Perpendicular(Vector3 v) float Vector3Length(const Vector3 v) +float Vector3LengthSqr(const Vector3 v) float Vector3DotProduct(Vector3 v1, Vector3 v2) float Vector3Distance(Vector3 v1, Vector3 v2) Vector3 Vector3Negate(Vector3 v) @@ -53,14 +56,15 @@ Matrix MatrixNormalize(Matrix mat) Matrix MatrixIdentity(void) Matrix MatrixAdd(Matrix left, Matrix right) Matrix MatrixSubtract(Matrix left, Matrix right) +Matrix MatrixMultiply(Matrix left, Matrix right) Matrix MatrixTranslate(float x, float y, float z) Matrix MatrixRotate(Vector3 axis, float angle) -Matrix MatrixRotateXYZ(Vector3 ang) Matrix MatrixRotateX(float angle) Matrix MatrixRotateY(float angle) Matrix MatrixRotateZ(float angle) +Matrix MatrixRotateXYZ(Vector3 ang) +Matrix MatrixRotateZYX(Vector3 ang) Matrix MatrixScale(float x, float y, float z) -Matrix MatrixMultiply(Matrix left, Matrix right) Matrix MatrixFrustum(double left, double right, double bottom, double top, double near, double far) Matrix MatrixPerspective(double fovy, double aspect, double near, double far) Matrix MatrixOrtho(double left, double right, double bottom, double top, double near, double far) diff --git a/tools/rlgl.h b/tools/rlgl.h index 21fb70f..d62842f 100644 --- a/tools/rlgl.h +++ b/tools/rlgl.h @@ -16,16 +16,20 @@ void rlVertex2f(float x, float y) void rlVertex3f(float x, float y, float z) void rlTexCoord2f(float x, float y) void rlNormal3f(float x, float y, float z) -void rlColor4ub(uint8_t r, uint8_t g, uint8_t b, uint8_t a) +void rlColor4ub(unsigned char r, unsigned char g, unsigned char b, unsigned char a) void rlColor3f(float x, float y, float z) void rlColor4f(float x, float y, float z, float w) void rlEnableTexture(unsigned int id) void rlDisableTexture(void) void rlTextureParameters(unsigned int id, int param, int value) -void rlEnableRenderTexture(unsigned int id) -void rlDisableRenderTexture(void) +void rlEnableShader(unsigned int id) +void rlDisableShader(void) +void rlEnableFramebuffer(unsigned int id) +void rlDisableFramebuffer(void) void rlEnableDepthTest(void) void rlDisableDepthTest(void) +void rlEnableDepthMask(void) +void rlDisableDepthMask(void) void rlEnableBackfaceCulling(void) void rlDisableBackfaceCulling(void) void rlEnableScissorTest(void) @@ -33,12 +37,11 @@ void rlDisableScissorTest(void) void rlScissor(int x, int y, int width, int height) void rlEnableWireMode(void) void rlDisableWireMode(void) -void rlDeleteTextures(unsigned int id) -void rlDeleteRenderTextures(RenderTexture2D target) -void rlDeleteShader(unsigned int id) -void rlDeleteVertexArrays(unsigned int id) -void rlDeleteBuffers(unsigned int id) -void rlClearColor(uint8_t r, uint8_t g, uint8_t b, uint8_t a) +void rlSetLineWidth(float width) +float rlGetLineWidth(void) +void rlEnableSmoothLines(void) +void rlDisableSmoothLines(void) +void rlClearColor(unsigned char r, unsigned char g, unsigned char b, unsigned char a) void rlClearScreenBuffers(void) void rlUpdateBuffer(int bufferId, void *data, int dataSize) unsigned int rlLoadAttribBuffer(unsigned int vaoId, int shaderLoc, void *buffer, int size, bool dynamic) @@ -52,7 +55,7 @@ void rlSetDebugMarker(const char *text) void rlSetBlendMode(int glSrcFactor, int glDstFactor, int glEquation) void rlLoadExtensions(void *loader) unsigned int rlLoadTexture(void *data, int width, int height, int format, int mipmapCount) -unsigned int rlLoadTextureDepth(int width, int height, int bits, bool useRenderBuffer) +unsigned int rlLoadTextureDepth(int width, int height, bool useRenderBuffer) unsigned int rlLoadTextureCubemap(void *data, int size, int format) void rlUpdateTexture(unsigned int id, int offsetX, int offsetY, int width, int height, int format, const void *data) void rlGetGlTextureFormats(int format, unsigned int *glInternalFormat, unsigned int *glFormat, unsigned int *glType) @@ -60,11 +63,13 @@ void rlUnloadTexture(unsigned int id) void rlGenerateMipmaps(Texture2D *texture) void *rlReadTexturePixels(Texture2D texture) unsigned char *rlReadScreenPixels(int width, int height) -RenderTexture2D rlLoadRenderTexture(int width, int height, int format, int depthBits, bool useDepthTexture) -void rlRenderTextureAttach(RenderTexture target, unsigned int id, int attachType) -bool rlRenderTextureComplete(RenderTexture target) +unsigned int rlLoadFramebuffer(int width, int height) +void rlFramebufferAttach(unsigned int fboId, unsigned int texId, int attachType) +bool rlFramebufferComplete(unsigned int id) +void rlUnloadFramebuffer(unsigned int id) void rlLoadMesh(Mesh *mesh, bool dynamic) void rlUpdateMesh(Mesh mesh, int buffer, int num) void rlUpdateMeshAt(Mesh mesh, int buffer, int num, int index) +void rlDrawMeshInstanced(Mesh mesh, Material material, Matrix *transforms, int count) void rlDrawMesh(Mesh mesh, Material material, Matrix transform) void rlUnloadMesh(Mesh mesh)