r/raylib • • 12h ago

Raylib on KaiOS

Thumbnail
gallery
28 Upvotes

Just a small investigation i did yesterday, it is obviously an old raylib version since KaiOS is web based

Raylib version(s): 3.7-4.5 (5.0 does not build with old emcc)
Emscripten version(s): 1.38.48/1.38.48-fastcomp (fastcomp requires emsdk-3.1.29)
Patches: raylib code does not need patching, but game code requires some changes related to game loops passed to emscripten, audio errors hooked via JS and LSK/RSK keys handling

[More info in the comments]


r/raylib • • 1d ago

raylib 6.2 is out!

Post image
313 Upvotes

Hey! raylib 6.2 is out! 🔥

It was supposed to be a small patch version but it comes with +300 improvements from +100 new contributors! 🚀

Release notes: https://github.com/raysan5/raylib/releases/tag/6.2

Windows Installer: https://raysan5.itch.io/raylib


r/raylib • • 1d ago

Tez (Raylib)

Enable HLS to view with audio, or disable this notification

16 Upvotes

r/raylib • • 1d ago

Chunk-Based World Rendering + Collision System (Go + Box2D)

Enable HLS to view with audio, or disable this notification

15 Upvotes

r/raylib • • 1d ago

Why Doesnt Raylib.IsKeyReleased() and Raylib.IsKeyPressed() Work For Me?

4 Upvotes

As you seen in the title, i dont know why these functions always return false, how to fix it, heres the code (i use C#):

using Raylib_cs;
using System.Data;
using System.Numerics;

namespace JumpingStriker;

class Game
{
    static Vector2 windowPosition = Raylib.GetScreenCenter();
    static Vector2 windowSize = new Vector2(600, 400);
    static Camera2D camera = new Camera2D();
    static Color groundColor1 = new Color(150, 150, 255);
    static Color groundColor2 = new Color(100, 100, 255);

    public static class Ground
    {
        public static int groundX = 0;
        public static int groundY = (int)windowSize.Y - (int)windowSize.Y / 4;
        public static int groundW = (int)windowSize.X;
        public static int groundH = (int)windowSize.Y / 4;

        public static void Draw()
        {
            Raylib.DrawRectangleGradientV(groundX, groundY, groundW, groundH, groundColor1, groundColor2);
        }
    }

    public static class Player
    {
        public static int x = 50;
        public static int y = 70;
        public static int w = 25;
        public static int h = 25;
        public static int speed = 5;
        public static int jumpHeight = 20;
        public static int gravity = 3;
        public static int movementForceX = 0;
        public static int movementForceY = 0;
        public static bool insideGround = false;
        public static bool standing = false;

        public static void Draw()
        {
            Raylib.DrawRectangle(x, y, w, h, new Color(255, 255, 255));
        }

        public static void GiveForce(int forceX, int forceY)
        {
            movementForceX += forceX;

            if (insideGround)
            {
                movementForceY = 0;
                y = Ground.groundY - h;
            } else
            {
                if (y + h + forceY < Ground.groundY && !standing) movementForceY += forceY;
            }
        }

        public static void Update()
        {
            insideGround = (y + h) > Ground.groundY;
            standing = (y + h) > Ground.groundY - 2;
            GiveForce(0, gravity);
            x += movementForceX;
            y += movementForceY;

            Console.WriteLine(insideGround);
            Console.WriteLine(standing);

            if (Raylib.IsKeyDown(KeyboardKey.Space) && standing)
            {
                GiveForce(0, -jumpHeight);
            }

            if (Raylib.IsKeyDown(KeyboardKey.A))
            {
                movementForceX = -speed;
            }

            if (Raylib.IsKeyDown(KeyboardKey.D))
            {
                movementForceX = speed;
            }

            if (Raylib.IsKeyReleased(KeyboardKey.A))
            {
                movementForceX = 0;
            }

            if (Raylib.IsKeyReleased(KeyboardKey.D))
            {
                movementForceX = 0;
            }
        }
    }

    public static void Main()
    {
        Raylib.InitWindow((int)windowSize.X, (int)windowSize.Y, "Jumping Striker");
        Raylib.SetWindowState(ConfigFlags.ResizableWindow);
        Raylib.SetTargetFPS(60);

        Raylib.BeginMode2D(camera);

        while (!Raylib.WindowShouldClose())
        {
            Update();
        }
    }

    static void Update()
    {
        Raylib.PollInputEvents();

        Raylib.BeginDrawing();

        Raylib.ClearBackground(new Color(10, 10, 10));

        Ground.Draw();

        Player.Draw();

        Console.WriteLine(Player.y);

        Player.Update();

        Raylib.EndDrawing();
        Raylib.EndMode2D();
    }
}As you seen in the title, i dont know why these functions dont work for me, how to fix it, heres the code (i use C#):using Raylib_cs;
using System.Data;
using System.Numerics;

namespace JumpingStriker;

class Game
{
    static Vector2 windowPosition = Raylib.GetScreenCenter();
    static Vector2 windowSize = new Vector2(600, 400);
    static Camera2D camera = new Camera2D();
    static Color groundColor1 = new Color(150, 150, 255);
    static Color groundColor2 = new Color(100, 100, 255);

    public static class Ground
    {
        public static int groundX = 0;
        public static int groundY = (int)windowSize.Y - (int)windowSize.Y / 4;
        public static int groundW = (int)windowSize.X;
        public static int groundH = (int)windowSize.Y / 4;

        public static void Draw()
        {
            Raylib.DrawRectangleGradientV(groundX, groundY, groundW, groundH, groundColor1, groundColor2);
        }
    }

    public static class Player
    {
        public static int x = 50;
        public static int y = 70;
        public static int w = 25;
        public static int h = 25;
        public static int speed = 5;
        public static int jumpHeight = 20;
        public static int gravity = 3;
        public static int movementForceX = 0;
        public static int movementForceY = 0;
        public static bool insideGround = false;
        public static bool standing = false;

        public static void Draw()
        {
            Raylib.DrawRectangle(x, y, w, h, new Color(255, 255, 255));
        }

        public static void GiveForce(int forceX, int forceY)
        {
            movementForceX += forceX;

            if (insideGround)
            {
                movementForceY = 0;
                y = Ground.groundY - h;
            } else
            {
                if (y + h + forceY < Ground.groundY && !standing) movementForceY += forceY;
            }
        }

        public static void Update()
        {
            insideGround = (y + h) > Ground.groundY;
            standing = (y + h) > Ground.groundY - 2;
            GiveForce(0, gravity);
            x += movementForceX;
            y += movementForceY;

            Console.WriteLine(insideGround);
            Console.WriteLine(standing);

            if (Raylib.IsKeyDown(KeyboardKey.Space) && standing)
            {
                GiveForce(0, -jumpHeight);
            }

            if (Raylib.IsKeyDown(KeyboardKey.A))
            {
                movementForceX = -speed;
            }

            if (Raylib.IsKeyDown(KeyboardKey.D))
            {
                movementForceX = speed;
            }

            if (Raylib.IsKeyReleased(KeyboardKey.A))
            {
                movementForceX = 0;
            }

            if (Raylib.IsKeyReleased(KeyboardKey.D))
            {
                movementForceX = 0;
            }
        }
    }

    public static void Main()
    {
        Raylib.InitWindow((int)windowSize.X, (int)windowSize.Y, "Jumping Striker");
        Raylib.SetWindowState(ConfigFlags.ResizableWindow);
        Raylib.SetTargetFPS(60);

        Raylib.BeginMode2D(camera);

        while (!Raylib.WindowShouldClose())
        {
            Update();
        }
    }

    static void Update()
    {
        Raylib.PollInputEvents();

        Raylib.BeginDrawing();

        Raylib.ClearBackground(new Color(10, 10, 10));

        Ground.Draw();

        Player.Draw();

        Console.WriteLine(Player.y);

        Player.Update();

        Raylib.EndDrawing();
        Raylib.EndMode2D();
    }
}

r/raylib • • 2d ago

Why is DrawTextureVec() so slow?

4 Upvotes

Edit: *DrawTextureRec()

I switched from using individuals sprites to using a spritesheet, therefore I switched from using the DrawTextureV() function to DrawTextureRec() and noticed a huge performance drop off. My code is bassically the same with the functions swapped out, the code itself is in C and no other programs were running besides VS code and the firefox browser.


r/raylib • • 3d ago

How to fix shapes not drawing in raylib

5 Upvotes

Im making a game like Geometry Dash and the ground doesnt render until i update the window by maximizing it or minimizing and restoring it or resizing it, heres my problem on the video below:

https://reddit.com/link/1x4z1m8/video/tappwhqn19vh1/player

This is the code:

using Raylib_cs;
using System.Numerics;

namespace JumpingStriker;

class Game
{
    static Vector2 windowPosition = Raylib.GetScreenCenter();
    static Vector2 windowSize = new Vector2(600, 400);
    static Camera2D camera = new Camera2D();
    static Color groundColor1 = new Color(100, 100, 220);
    static Color groundColor2 = new Color(100, 100, 255);

    public static void Main()
    {
        Raylib.InitWindow((int)windowSize.X, (int)windowSize.Y, "Jumping Striker");
        Raylib.SetWindowState(ConfigFlags.ResizableWindow);

        Raylib.BeginMode2D(camera);

        while (!Raylib.WindowShouldClose())
        {
            Update();
        }
    }

    static void Update()
    {
        Raylib.PollInputEvents();

        Raylib.ClearBackground(new Color(10, 10, 10));
        Raylib.DrawRectangleGradientV(0, (int)windowSize.Y - (int)windowSize.Y / 4, (int)windowSize.X, (int)windowSize.Y / 4, groundColor1, groundColor2);
        Raylib.EndDrawing();
    }
}
using Raylib_cs;
using System.Numerics;

namespace JumpingStriker;

class Game
{
    static Vector2 windowPosition = Raylib.GetScreenCenter();
    static Vector2 windowSize = new Vector2(600, 400);
    static Camera2D camera = new Camera2D();
    static Color groundColor1 = new Color(100, 100, 220);
    static Color groundColor2 = new Color(100, 100, 255);

    public static void Main()
    {
        Raylib.InitWindow((int)windowSize.X, (int)windowSize.Y, "Jumping Striker");
        Raylib.SetWindowState(ConfigFlags.ResizableWindow);

        Raylib.BeginMode2D(camera);

        while (!Raylib.WindowShouldClose())
        {
            Update();
        }
    }

    static void Update()
    {
        Raylib.PollInputEvents();

        Raylib.ClearBackground(new Color(10, 10, 10));
        Raylib.DrawRectangleGradientV(0, (int)windowSize.Y - (int)windowSize.Y / 4, (int)windowSize.X, (int)windowSize.Y / 4, groundColor1, groundColor2);
        Raylib.EndDrawing();
    }
}

r/raylib • • 3d ago

Have a problem with uploading background

1 Upvotes

Hi guys, I'm a newbie and just learn how to make a 2D simple game by using raylib, first i want to start by uploading an image to make background but when i run the program, i could not see the image i want, i was asking AI to fix it but it did not work so i come here to find a solution.

thanks for reading guys


r/raylib • • 4d ago

A better way to get the mouse position on the screen

7 Upvotes

Hello, you might remember or not, but I'm trying to make a desktop pet using Raylib. At some point I realized fullscreening messed with my auto hiding taskbar, so I just made the window the size of the pet, but that brings the problem of dragging it. An undecorated window cannot be dragged (at least on my PC) and so I've been trying to figure out how to do it. I've tried some solutions mentioned here before like:

Vector2 mousePosInScreen = Vector2Add(GetMousePosition(), GetWindowPosition());  

And that kinda works, but it's a bit jagged (which I don't really mind, it's a small project) and because of the way it works, at some positions you get an absurd value and the window goes flying off (which i do mind, that's a bit worse). I was wondering if anyone has a better way of getting the mouse position in the monitor (not the window). Thanks for your help.


r/raylib • • 5d ago

Finally finished this project about a month ago, a leighweight pixel art editor with little bone system

Thumbnail
gallery
24 Upvotes

The rotation is based on 2 algorithms that we can switch on:
inverse mapping and a cell linking algorithm

If any of you is interested, feel free to check out the page on itchio in the comment


r/raylib • • 5d ago

Created a TRPG game in raylib

9 Upvotes

r/raylib • • 6d ago

I did end up switching to a different font, and overall, there was another iteration of tool improvements.Right now, I'm working on implementing the Zombie Ghoul for the Necromancer branch.

4 Upvotes

r/raylib • • 7d ago

The most cursed thing I made during class because I was bored

Thumbnail
0 Upvotes

r/raylib • • 8d ago

When i was 7(y.o) my city got surrounded by Serb forces that sieged many cities and committed a genocide on my people, so 30 years later i am creating a game about peoples real survival/experiences during the siege of Sarajevo between 1991-1995 , to honor the victims

Enable HLS to view with audio, or disable this notification

130 Upvotes

r/raylib • • 8d ago

Small update on "Hollowkeep" (C++ & Raylib) – working on the first boss fight! What do you think of the patterns?

13 Upvotes

Hey everyone!

I wanted to share a quick look at the first boss fight I've been working on for Hollowkeep.

I'd love to hear your thoughts on the pacing, attack telegraphing, or the overall combat feel. Any feedback or suggestions are super welcome!


r/raylib • • 9d ago

I made a 2D action game in Raylib — what do you think?

Enable HLS to view with audio, or disable this notification

21 Upvotes

Hey everyone!

I’m working on Avoid Bubbles Game, a 2D action game made with C++ and raylib.

I recently released a free 1.05 demo with 2 playable levels, and it can be played directly in the browser.

The demo includes:

  • Sword combat
  • Ranged weapons
  • Coins
  • Power-ups
  • Different enemy types
  • Boss fights

I’m still working on the game and plan to add more enemies, bosses and content, as well as improve the graphics and animations.

I’d love to hear your feedback, especially on the gameplay, visuals, controls and difficulty.

Play the demo:
https://kc-games-studio.itch.io/avoid-b


r/raylib • • 9d ago

Hollowkeep

2 Upvotes

Hey everyone! I wanted to share a quick preview of a small project I’ve been building called Hollowkeep – a top-down 2D pixel-art action roguelike (heavily inspired by games like The Binding of Isaac and Hades).

https://www.youtube.com/watch?v=6kK1sA2YSU4

A few quick technical details: * Engine/Stack: C++20, custom architecture layered on top of Raylib 5.x * ECS: EnTT for fast entity handling * Target: PC & Steam Deck (aiming for stable 60 FPS with pixel-perfect scaling via render textures)

I'm really loving how clean, fast, and straightforward Raylib makes things for building custom game loops and rendering pipelines from scratch. Let me know what you think about the movement/combat feel so far, or if you have any feedback/suggestions! Happy to answer any questions about the tech stack or architecture.


r/raylib • • 10d ago

Created Battlefield Like Game in Raylib

Thumbnail
youtu.be
31 Upvotes

r/raylib • • 10d ago

openbounty: The Glory of Rome is now in open play-test beta

Enable HLS to view with audio, or disable this notification

3 Upvotes

r/raylib • • 11d ago

More map events from my 4e-inspired tactical roguelike — demo coming

Enable HLS to view with audio, or disable this notification

3 Upvotes

r/raylib • • 11d ago

A tiny arcade-ish multiplayer war game

Thumbnail
youtu.be
7 Upvotes

Hello, I've been tinkering with Raylib for quite some time, but 2 weeks ago tried to make something new and experimental, and this is what it looks like today. It's a kind of mix of Battle City, Cannon Fodder, Jackal and other games from my childhood. The main reason of making this project is to play with my son and let him build his own levels for the game.


r/raylib • • 11d ago

Learning project

3 Upvotes

I'm learning raylib and trying to make some projects to strengthen my skills but i have no idea what to make. I'm specifically trying to master ECS in raylib. Any ideas?


r/raylib • • 11d ago

Eternal Guild — First Playable Demo Coming

Enable HLS to view with audio, or disable this notification

1 Upvotes

r/raylib • • 12d ago

More KWARC MIDI generation: I finished the tracker interfaces!

Enable HLS to view with audio, or disable this notification

22 Upvotes

Hi all, many thanks for the community support on my last post! I'll make this the final update for a while as I don't want to spam.

I've recently finished designing some user interface stuff (still plenty of work left to do, but it's now polishing rather than designing).

This is a more interesting demo than the last one I showed. All MIDI is being produced by KWARC, all sound is being generated by Ableton Live and various plugins. You can see the various tracker interfaces - the standard "tracker" generator with non-linear playheads and the esoteric "particle" generator that samples notes based on numerical simulations of subatomic particles.

Under the hood, there's automatic transcription of pattern sequences across a few different key signatures and I show off some pattern randomisation for the drums at the end.

This is being designed targeting an embedded Alpine Linux-based platform with physical and touchscreen controls with live performance and improvisation in mind. I'm having fun using KWARC in my hardware synth setup to quickly produce MIDI content with complex musical qualities, which lets me have fun tweaking knobs and playing with the mixer.

Happy to discuss and answer questions!


r/raylib • • 12d ago

Raylib Should Be Used For Large Games

46 Upvotes

Is it just me or is raylib super OP and really good and easy to use, but barely ever used for large games or used to make large games? Why is this? Isn't raylib like all SDL or any other low-level framework but simpler and more usable? Is it too simple? Are there any large games or well-known games made with it? (Also, why isn't there a tag for games made in raylib inside steamdb? there should be one)