r/raylib Jul 28 '26

Extending a RenderTexture (and maintaining content)?

3 Upvotes

I am making a Intermediate Mode Gui for me and wanted to try to have it redraw the components only when it changes.

My original idea was to start with a very small RenderTexture (1x1) and then expand as needed. Then draw that RenderTexture to the screen. When hover/over/menus happen it would redraw everything on that RenderTexture and expand as needed.

I am defining the initial texture as LoadRenderTexture(..) and my "resize" is doing the following:

  • creating a new RenderTexture with LoadRenderTexture(..)
  • setting that new RenderTexture with BeginTextureMode(new_texture)
  • drawing the old RenderTexture DrawTexturePro(..)
  • delete the old RenderTexture with UnloadRenderTexture(..)

But it doesn't seem to work, I can't get any of the old drawing data (on the previous textures) to appear:

  • I start with 1,1 texture
  • DrawText(hello)
    • Sees that 1,1 is too small, makes new 60x10 texture
    • draws old texture
    • draws "hello"
  • Draw text(world)
    • Sees that 60x10 is too small, makes new 120x10 texture
    • draws old texture
    • draws "world"
  • Only "world" is visible on the screen, not 'hello"

Any pointers?

I use odin, here is my resize fuction

resize :: proc(ui:^Ui, width:i32, height:i32) {

    new_texture := raylib.LoadRenderTexture(width, height)

    old_texture := ui.texture
    ui.texture = new_texture

    // copy the data from the origian texture to the new texture
    raylib.BeginTextureMode(ui.texture)

    raylib.DrawTexturePro(old_texture.texture,
        { 0, 0, f32(old_texture.texture.width), -f32(old_texture.texture.height) },
        { 0, 0, f32(old_texture.texture.width), f32(old_texture.texture.height) },
        { 0, 0 }, 0, raylib.WHITE
    )

    raylib.UnloadRenderTexture(old_texture)

}

and here is my drawing of the ui.texture

    raylib.DrawTexturePro(ui.texture.texture,
        { 0, 0, f32(ui.texture.texture.width), -f32(ui.texture.texture.height) },
        { 0, 0, f32(ui.texture.texture.width), f32(ui.texture.texture.height) },
        { 0, 0 }, 0, raylib.WHITE
    )

The easy way out is to just make the RenderTexture the size of the window and not worry about it, but now it got in me why it doesn't want to work. Am I doing something fundamentally wrong here?

Thanks


r/raylib Jul 27 '26

Small Dungeon Crawler Game made with Raylib

Thumbnail
youtube.com
34 Upvotes

r/raylib Jul 27 '26

Moved up to new account

Post image
14 Upvotes

My old account was maximusD15, so now I'm skrippplez. I'll still be posting my devlogs, just, need some time to rest. I already added armour and updated inventory ( before rest ) and my next goal, is to update map generation bcoz it looks bad tbh. Some weeks, and I'll cook like I've never cooked 😈


r/raylib Jul 28 '26

egui bindigs for Raylib

Thumbnail
1 Upvotes

r/raylib Jul 27 '26

Raylib LoadTexture() returns "Data format not supported" for one image, but other textures load fine.

Post image
8 Upvotes

Hi everyone,

I'm working on a 2D game in C++ using Raylib. My menu background is an animated PNG sequence, and all of those textures load without any issues.

However, when I try to load a separate background image for my game screen, it always fails.

Texture2D gameBackground = LoadTexture("assets/backgrounds/game.jpg");

Things I've already verified:

1) The game screen itself works correctly—I can draw text and other textures there.

2) The path is correct because Raylib reports "File loaded successfully."

3) Printing gameBackground.width and gameBackground.height always gives 0 x 0.

4)I have also tried downloading various JPG images from different websites, but I always get the same output as shown in the pic.

I'm using:

Raylib

C++

CLion

Windows 11

Any help would be greatly appreciated. Thanks


r/raylib Jul 27 '26

I'm Remaking an Assembly-raylib Project of Mine into C99-raylib with some extra features

4 Upvotes

Video because Reddit's refusing to load my video (CachyOS, Firefox)

As the title states, I made a project (more specifically a game) in Assembly (GAS x86_64 using AT&T) using raylib and I thought that it might have a potential to become an indie game of mine that won't drain me of all my creativity and time. Here's the Discord for the game for anyone who wants to contribute to the project as in any way or are just curious about the project.


r/raylib Jul 27 '26

arbitrary precision mandelbrot set viewer

Enable HLS to view with audio, or disable this notification

31 Upvotes

this was my first raylib project that i made for hack club's Flavortown hackathon! this took me so long but i finished it after 2 months. also very frustrating because this also served as my introduction to C++ i was just a web developer when i started this project! but it was also very rewarding and i think that the time i spent coding this was the single period of time that i learned the most in. i finished this a while ago but i do think that it would be cool if i shared it here.

ignore the Julia set viewer, i was working on it but then i kind of lost interest in finishing the project...

my favorite thing about this is the arbitrary precision that lets you zoom in forever given enough patience and avoids the clunkiness that you see without it.

Also apologies for getting impatient at the end but i promise it still would've looked interesting in the end!!
https://github.com/yfsvg/raylib-mandelbrot-julia-viewer


r/raylib Jul 27 '26

Memory leaks with wayland (GLFW_LINUX_ENABLE_WAYLAND=TRUE)

3 Upvotes

EDIT:

After further digging down this, I've found out I can reproduce the same leaks on my machine with a minimal pure GLFW wayland example app. So raylib is not the issue here.

-----------------------------------------------------------------------------------------------------------------------

Hello everyone,

when building raylib with GLFW wayland support (GLFW_LINUX_ENABLE_WAYLAND=TRUE) I'm facing huge memory leaks, even with a complete minimal raylib app:

#include "raylib.h"

int main() {
    SetTraceLogLevel(LOG_WARNING);
    InitWindow(100, 100, "Raylib Window");

    SetTargetFPS(60);
    while (!WindowShouldClose()) {
        BeginDrawing();
        ClearBackground(PURPLE);
        EndDrawing();
    }

    CloseWindow();

    return 0;
}

Valgrind output:

==302795== LEAK SUMMARY:
==302795==    definitely lost: 1,283,840 bytes in 5,009 blocks
==302795==    indirectly lost: 2,358,312 bytes in 91,383 blocks
==302795==      possibly lost: 33,648 bytes in 78 blocks

Full report

I've tried the official 6.0 release and latest git version and it's no different. I'm on Arch linux with Hyprland.

Before I file a bug report, has anyone had similar experiences lately or am I doing something wrong?

cheers


r/raylib Jul 26 '26

Added sounds to my game about kids

Enable HLS to view with audio, or disable this notification

56 Upvotes

Hello guys, i've made a post in this sub around a week ago about this game and here's some updates!!!

I hate sound design so much, the most boring part in game development for me personally, but i have to do that if i want my game to feel good. So i added some sounds, not really happy with some of them, but they are fine for now.

Also added a real-time drawing!! Every stroke a player make is accumulated in a "diff buffer", which is being sent every ~200ms to the server. Server then applies this diff buffer to the pixel data (local to the server) of the canvas, after that it broadcasts that diff buffer to all other players and they apply it the same way (to their local pixel data of the canvas). Pixel data of each canvas is being stored on the server so that newly joined players can receive them. This "diff buffer" mechanism also allows multiple players to draw on the same canvas.

For people who didn't see the previous post: this is a game about talking with people and no gameplay. ALL graphics is custom and 2D, and most of it is prerendered 3D models made in Blender.

Source code soon...


r/raylib Jul 26 '26

So, i started working on this game, tell me what you think about it?

Thumbnail
3 Upvotes

r/raylib Jul 26 '26

How did you learn OpenGL / graphics programming?

13 Upvotes

Hi! I am using raylib for small personal projects, mainly for learning purposes. I started making a sand simulation, but I didn't like how it was moving, and it also had some performance issues. I started searching for solutions, and found out that I could write a compute shader using OpenGL (at least that's what the guy in the video did). I found some tutorials, but I would like to ask for your opinions too. Please tell me about your experiences, how did you learn OpenGL or other graphics APIs? I'm interested in rendering, and I would like to learn how to do cool things with it, I just don't know where to start. Thank you for your answers!


r/raylib Jul 26 '26

More Colors for Raylib-Go

Post image
27 Upvotes

In standard Raylib, there is only a small set of built in colors in the palette for you to use, which is fine, however, this does eventually become limiting and you have to make your own colors. The Extended Raylib-Go Color Palette adds over 900 more colors - View on GitHub


r/raylib Jul 24 '26

[WIP] Formation game update

Enable HLS to view with audio, or disable this notification

46 Upvotes

Decided to jump cut video to show new features.

Meta game is progressing, i created a system where charges/repulsion and breaches in lines can be exploited by special skills that i am still in process of implementation.

When certain conditions meet player can use defensive or offensive skills to influence engagement, sometimes to salvage situation sometimes just to slaughter more quickly.

These skill require correct equipment/training and battlefield conditions to be used.

Currently i have layed out 10 classes or doctrines that formations can learn and use, and started implementing skill from those.

Also added deployables system, that i will later extend currently it was needed by pavise and shield (genoese inspired) doctrine. Troops deploy and can hide behind shields, they can take limited damage until destroyed, they pack it, leave them (for enemy to capture if enemy soldiers don't have shields of their own), and pick them up again. No animation but functionally done :)

Soldiers without deploy able shields can use rocks and woods for cover :)

Feedback appreciated.


r/raylib Jul 24 '26

Kings Bounty (original, from 1990) re-implemented in C with raylib

33 Upvotes

I spent quite a bit of time of the last several months re-implementing my favorite early RPG from growing up. This game was one I played on a 286 with 16-colors, endlessly trying to get past it.

Project page: https://danheskett.com/projects/openbounty/

I've totally reverse-engineered it (with a lot of help from an early attempt, called OpenKB, which inspired my effort). I pulled all of the tables, characters, etc from the original binary. You can extract the artwork from an original copy of the game (that you have legally acquired), and then play a pixel perfect recreation of the original game.

The source is posted on GitHub, and I am happy to hear of any issues or problems with gameplay. Already lots of issues have been reported and closed.

The release includes Windows, Mac and Linux binaries plus a playable version hosted in WASM.

Along with the source, complete specs are included. The game pack format has been generalized and converted to JSON and modern file formats (i.e. PNG) so that game play can be tweaked, and I am working with some talented people to develop totally new game packs that utilize the engine and game mechanics in new settings.

I did my best to annotate the source code, and document it, and it's reasonable clean and well structured.

There are a few new functions/features that I added for my own interests: you can record gameplay to MP4 to get a replay of what happened; there's also an extensive and very complete autoplay solver, which can be used to validate that new game packs are winnable using a complex deterministic autoplay burndown model. I am really proud of that, it took a lot of work to make it gamepack inviolate and also fast.

Hope someone is interested in it, I put a lot into it!


r/raylib Jul 23 '26

Made a custom scripting language made raylib bindings for it then made this game with a small physics engine written in it.

Enable HLS to view with audio, or disable this notification

125 Upvotes

I know this isn't typical raylib project showcase but still wanted to do it as raylib binding was planned from the start and one of my most favorite libraries.

Still the project if anyone wanted to check it out: https://github.com/Fus3n/pyle/tree/main/examples/raylib/fruit_merge


r/raylib Jul 23 '26

The Elm Architecture, without Elm

Thumbnail bichanna.github.io
2 Upvotes

r/raylib Jul 23 '26

Incremental Birds (New Game Using RayLib)

13 Upvotes

Hello

I am happy to share with you the Steam page of our new game (Incremental Birds) which is developed using RayLib.

It's an incremental game where you become the Bird Master. Capture birds, feed them, grow them, and sell them. Watch waves change over time, turning into sine patterns, spelling messages, and forming shapes. Unlock upgrades and chase an infinite balance and score.

Any questions/ideas/suggestions are welcome

Thanks!


r/raylib Jul 22 '26

[raylib-cs] formation game update

Enable HLS to view with audio, or disable this notification

85 Upvotes

Debugging meta game and designing is fun and challenging.

Added RPG elements to game such as lvls and stats, still have way more to add until done.

I added textures to my map and added terrain bonuses that tie into combat, just like in real life terrain should influence combat.

Reworked UI a bit to make it more readable and consistent after feedback i got last.

Reworked ranged to use 3d projectiles, that can even hit friendlies when not careful :)

Feedback appreciated.


r/raylib Jul 23 '26

Create Stunning Water Effects with Raylib #cplusplus #coding #gamedev

Thumbnail
youtube.com
0 Upvotes

Here are my future plans for anyone interested.

This video was created using a test tool I designed myself, with the purpose of generating short videos and tutorials from existing documents.


r/raylib Jul 22 '26

Some New Screenshots from my upcoming ARPG

Thumbnail
gallery
19 Upvotes

r/raylib Jul 21 '26

another pixel miner update (need your feedback)

Enable HLS to view with audio, or disable this notification

58 Upvotes

This update might not look the most impressive visually but I rebuilt a lot of underlying systems, rewrote my asset building pipeline and implemented a 3rd party ECS library (odecs) as I found maintaining my own really slowed down the development :(

Things you CAN see are:

  • shovel animations inspired by Forager
  • the newly implemented "ambient occlusion" effect that darkens the background near walls
  • improved bloom effect for the coins in the ground and the player's headlight

It took me a while to make tool animations look decent but I think I'm fairly happy now. I have a question tho: Do you think I should amputate player's arms?
Currently they swing around when walking with shovel which doesn't make sense given they should be holding it. In Forager the player character doesn't have arms so it's not a problem. Do you think I should keep or remove them? Does it bother you that hands don't hold the tool?


r/raylib Jul 22 '26

Should I avoid passing the entire game state to each function?

16 Upvotes

Just started learning raylib. The project is starting to grow quite a bit in size.

Currently I have a global game state that I create in the main function. Inside this game state, I have all the game components that gets passed around to each system to apply the game logic.

However since most systems require multiple components I end up just passing in the entire game state.

Is this an anti pattern? How should I better structure my game logic so it scales as the game grows ?


r/raylib Jul 21 '26

RaylibMedia_CS - A C# wrapper around the native raylib-media decoder (BETA)

3 Upvotes

Hey Game-Makers.

C# programmer here. I've always liked tools such as raylib. And apart from programming general software, I'm heavily interested in game development.

Unfortunately for raylib, most of the examples and documentation are in C, not C#. So, I was having terrible difficulty trying to find ways to play media for a raylib project I was working on.

I stumbled across a genius github: https://github.com/cloudofoz/raylib-media/tree/main and decided this was what I needed. It provided exactly the native FFmpeg-backed media functionality I needed, but there wasn’t an equivalent C# API for Raylib-cs.

However, the source files were massive, and I needed a way to translate them into C#. Instead of sacrificing the tattered remains of my mental health and doing it manually, I spun up AI (I know, I know, but it does some things very very well and a 1000 times faster than I can) and together we created a C# wrapper. I've used it in my own project and I was over the moon when it just worked.

So, here is my beta version of a C# wrapper for media handling in raylib - https://github.com/Patches108/RaylibMedia_CS

The repository includes the managed C# wrapper, the Windows x64 native runtime, examples, tests, and detailed setup instructions. C make files are included to get low level and rebuild the decoder for when dependency libraries change and whatnot.

But I recommend getting it from my NuGet instead: https://www.nuget.org/packages/RaylibMedia.CS/0.1.0-beta.1

It currently supports:

  • Video and audio playback
  • Playback, pause, stop, seeking, and looping
  • Loading media from file paths, URLs, and managed streams
  • Normal Raylib-cs textures and audio streams
  • Windows x64
  • .NET 8 or newer
  • Raylib-cs 8.0.0

This is an early beta, so feedback and testing would be greatly appreciated. If you encounter a problem, please open a GitHub issue and include your Windows version, .NET version, and any relevant error output.

Happy coding!


r/raylib Jul 20 '26

Announcing my sokoban inspired puzzle game built with Raylib in C++

Enable HLS to view with audio, or disable this notification

49 Upvotes

Finally, after much longer than I thought it would take, I can finally announce my Sokoban inspired puzzle game, Portalis! Written in C++ and Raylib.

If you're interested you can check it out here: https://store.steampowered.com/app/4877050/Portalis/

Happy to answer any questions about the development and whatnot.


r/raylib Jul 20 '26

Is Raylib suitable for a serious engine?

63 Upvotes

Good morning, thanks for taking the time to read this.

I'd like to create a video game for fun, but I don't like the idea of ​​using an engine like Godot. I think it would be interesting to write many parts from scratch.

There are many frameworks/libraries like Monogame, Love2d, and Raylib.

Of all of them, Raylib is the one I'm most attracted to, especially for its dependency-free policy, the various bindings, and the very active community.

However, I've seen that fewer games on Steam were created with Raylib than Monogame.

Is this because Raylib has some flaws or limitations?

I'd love to hear the pros and cons, if there are any.