diff --git a/README.md b/README.md index bd34717..c7ed333 100644 --- a/README.md +++ b/README.md @@ -110,7 +110,7 @@ rl.CloseWindow() ### Compatibility -raylib-lua (raylua) currently uses raylib 3.1-dev API with some 3.0 API compatibility +raylib-lua (raylua) currently uses raylib 3.5 API. (see [compat.lua](https://github.com/TSnake41/raylib-lua/blob/master/src/compat.lua)). physac and rlgl modules are built-in by default. raygui is supported, but is minimally tested, please report any issues you have diff --git a/examples/textures_software_rendering.lua b/examples/textures_software_rendering.lua new file mode 100644 index 0000000..4c9dfbd --- /dev/null +++ b/examples/textures_software_rendering.lua @@ -0,0 +1,42 @@ +local lua_color = rl.new("Color", 3, 3, 128, 255) + +local width, height = 800, 450 + +--rl.SetConfigFlags(rl.FLAG_VSYNC_HINT) +rl.SetTraceLogLevel(rl.LOG_WARNING) +rl.InitWindow(width, height, "raylib [shapes] example - software rendered raylib logo") + +local framebuffer = rl.new "Image" +local fb_data = rl.new("Color[?]", width * height) + +framebuffer.width = width +framebuffer.height = height +framebuffer.format = rl.UNCOMPRESSED_R8G8B8A8 +framebuffer.mipmaps = 1 +framebuffer.data = fb_data + +local fb_texture = rl.LoadTextureFromImage(framebuffer) + +while not rl.WindowShouldClose() do + --rl.ImageClearBackground(framebuffer, rl.RAYWHITE) + for i=0,width*height-1 do + fb_data[i] = rl.RAYWHITE + end + + rl.ImageDrawRectangle(framebuffer, width / 2 - 128, height / 2 - 128, 256, 256, lua_color) + rl.ImageDrawRectangle(framebuffer, width / 2 - 112, height / 2 - 112, 224, 224, rl.RAYWHITE) + rl.ImageDrawText(framebuffer, "raylib", width / 2 - 44, height / 2 + 24, 50, lua_color) + rl.ImageDrawText(framebuffer, "Lua", width / 2 - 44, height / 2 + 65, 50, lua_color) + + rl.ImageDrawText(framebuffer, "this is NOT a texture!", 350, 370, 10, rl.GRAY) + + rl.UpdateTexture(fb_texture, fb_data) + + rl.BeginDrawing() + rl.ClearBackground(rl.RAYWHITE) + rl.DrawTexture(fb_texture, 0, 0, rl.WHITE) + rl.DrawFPS(10, 10) + rl.EndDrawing() +end + +rl.CloseWindow() \ No newline at end of file diff --git a/makefile b/makefile index 6bbc97f..43c7cae 100644 --- a/makefile +++ b/makefile @@ -89,7 +89,7 @@ src/autogen/builder.c: src/raylua_builder.lua clean: rm -rf raylua_s raylua_e libraylua.a src/raylua_e.o src/raylua_s.o \ src/raylua.o src/raylua_self.o src/raylua_builder.o src/autogen/*.c \ - src/lib/miniz.o + src/lib/miniz.o src/res/icon.res $(MAKE) -C luajit clean $(MAKE) -C raylib/src clean rm -f raylib/libraylib.a