The raylib module (https://www.raylib.com/) is still a work in progress.
Here's a list of the implemented APIs:https://github.com/smallbasic/smallbasic.plugins/tree/master/raylib
I've managed to build each of the modules as DLLs now (except glfw).The only snag with the raylib DLL is it depends on some mingw DLLs. This is in spite of attempting all the suggestions I could find online to link statically.
I just took a glance at what Raylib might be, I have one word for it, WOW!
and what Wright brothers these 2 Basics seem to be! The editor with QB64 has me absolutely spoiled with it's formatting,
REM /*******************************************************************************************REM *REM * Physac - Physics demoREM *REM * Copyright (c) 2016-2018 Victor FisacREM *REM ********************************************************************************************/import raylib as rlimport raylibc as cconst screenWidth = 800const screenHeight = 450rl.SetConfigFlags(c.FLAG_MSAA_4X_HINT)rl.InitWindow(screenWidth, screenHeight, "SmallBASIC Physac [raylib] - Physics demo")' Physac logo drawing positionlogoX = screenWidth - rl.MeasureText("Physac", 30) - 10logoY = 15needsReset = false' Initialize physics and default physics bodiesrl.InitPhysics()' Create floor rectangle physics bodyphy_floor = rl.CreatePhysicsBodyRectangle([screenWidth/2, screenHeight], 500, 100, 10)' Create obstacle circle physics bodyphy_circle = rl.CreatePhysicsBodyCircle([screenWidth / 2, screenHeight / 2], 45, 10)' Disable body state to convert it to static (no dynamics, but collisions)rl.enablePhysicsBody(phy_floor, false)rl.enablePhysicsBody(phy_circle, false)rl.SetTargetFPS(60) ' Set our game to run at 60 frames-per-secondwhile (!rl.WindowShouldClose()) rl.RunPhysicsStep() if (needsReset) then phy_floor = rl.CreatePhysicsBodyRectangle([screenWidth/2, screenHeight], 500, 100, 10) phy_circle = rl.CreatePhysicsBodyCircle([screenWidth/2, screenHeight/2], 45, 10) rl.enablePhysicsBody(phy_floor, false) rl.enablePhysicsBody(phy_circle, false) needsReset = false endif ' Reset physics input if (rl.IsKeyPressed(asc("R"))) then rl.ResetPhysics() needsReset = true endif ' Physics body creation inputs if (rl.isMouseButtonPressed(c.MOUSE_LEFT_BUTTON)) then n = rl.CreatePhysicsBodyPolygon(rl.GetMousePosition(), rl.GetRandomValue(20, 80), rl.GetRandomValue(3, 8), 10) elseif (rl.IsMouseButtonPressed(MOUSE_RIGHT_BUTTON)) then n = rl.CreatePhysicsBodyCircle(rl.GetMousePosition(), rl.GetRandomValue(10, 45), 10) endif ' Destroy falling physics bodies bodiesCount = rl.GetPhysicsBodiesCount() for i = bodiesCount - 1 to 0 step -1 body = rl.GetPhysicsBody(i) if (body.position.y > screenHeight*2) then rl.DestroyPhysicsBody(body) endif next i rl.BeginDrawing() rl.ClearBackground(c.BLACK) rl.DrawFPS(screenWidth - 90, screenHeight - 30) ' Draw created physics bodies bodiesCount = rl.GetPhysicsBodiesCount() for i = 0 to bodiesCount - 1 body = rl.GetPhysicsBody(i) if (ismap(body)) then vertexCount = rl.GetPhysicsShapeVerticesCount(i) for j = 0 to vertexCount -1 ' Get physics bodies shape vertices to draw lines ' Note: GetPhysicsShapeVertex() already calculates rotation transformations vertexA = rl.GetPhysicsShapeVertex(body, j) jj = iff(j + 1 < vertexCount, j + 1, 0) ' Get next vertex or first to close the shape vertexB = rl.GetPhysicsShapeVertex(body, jj) rl.DrawLineV(vertexA, vertexB, c.GREEN) ' Draw a line between two vertex positions next j endif next i rl.DrawText("Left mouse button to create a polygon", 10, 10, 10, c.WHITE) rl.DrawText("Right mouse button to create a circle", 10, 25, 10, c.WHITE) rl.DrawText("Press 'R' to reset example", 10, 40, 10, c.WHITE) rl.DrawText("Physac", logoX, logoY, 30, c.WHITE) rl.DrawText("Powered by", logoX + 50, logoY - 7, 10, c.WHITE) rl.EndDrawing()wendrl.ClosePhysics() ' Unitialize physicsrl.CloseWindow() ' Close window and OpenGL context
Here's the SmallBASIC version of physics_demo from the raylib examples.
You can play with raylib examples online here: https://www.raylib.com/examples.html
I've uploaded version 12.20 for Windows (64 bit only).
REM /*******************************************************************************************REM *REM * raylib [textures] example - sprite explosionREM *REM * This example has been created using raylib 2.5 (www.raylib.com)REM * raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)REM *REM * Copyright (c) 2019 Anata and Ramon Santamaria (@raysan5)REM *REM ********************************************************************************************/import raylib as rlimport raylibc as cconst NUM_FRAMES_PER_LINE = 5const NUM_LINES = 5const screenWidth = 800const screenHeight = 450rl.InitWindow(screenWidth, screenHeight, "raylib [textures] example - sprite explosion")rl.InitAudioDevice()' Load explosion soundconst resources = CWD + "raylib/examples/textures/resources/"fxBoom = rl.LoadSound(resources + "boom.wav")' Load explosion textureexplosion = rl.LoadTexture(resources + "explosion.png")' Init variables for animationframeWidth = explosion.width / NUM_FRAMES_PER_LINE ' Sprite one frame rectangle widthframeHeight = explosion.height / NUM_LINES ' Sprite one frame rectangle heightcurrentFrame = 0currentLine = 0frameRec = [0, 0, frameWidth, frameHeight]position = [0.0, 0.0]active = trueframesCounter = 0rl.SetTargetFPS(120)while (!rl.WindowShouldClose()) ' Detect window close button or ESC key ' Check for mouse button pressed and activate explosion (if not active) if (rl.IsMouseButtonPressed(c.MOUSE_LEFT_BUTTON) && !active) then position = rl.GetMousePosition() active = true position.x -= frameWidth/2 position.y -= frameHeight/2 rl.PlaySound(fxBoom) endif ' Compute explosion animation frames if (active) then framesCounter++ if (framesCounter > 2) then currentFrame++ if (currentFrame >= NUM_FRAMES_PER_LINE) then currentFrame = 0 currentLine++ if (currentLine >= NUM_LINES) then currentLine = 0 active = false endif endif framesCounter = 0 endif endif frameRec[0] = frameWidth * currentFrame frameRec[1] = frameHeight * currentLine rl.BeginDrawing() rl.ClearBackground(c.RAYWHITE) ' Draw explosion required frame rectangle if (active) then rl.DrawTextureRec(explosion, frameRec, position, c.WHITE) endif rl.EndDrawing()wendrl.UnloadTexture(explosion) ' Unload texturerl.UnloadSound(fxBoom) ' Unload soundrl.CloseAudioDevice()rl.CloseWindow() ' Close window and OpenGL context
Quote from: chrisws on January 09, 2021, 10:36:54 AMI've uploaded version 12.20 for Windows (64 bit only). Oh, 32-bit Windows is used in my main computer. Will a 32-bit version 12.20 be released in the near future?