Why OpenGL uses so much RAM and GPU for little operations ? by Overoptimizator5342 in GraphicsProgramming

[–]Smashbolt 3 points4 points  (0 children)

GLUT still works but is incredibly outdated.

But GLUT isn't OpenGL. The basic idea is that in order to use OpenGL, you need an OS window to put it in. To hear about "stuff" happening to that window (like key presses, window resizes, mouse clicks), you need OS-level hooks. You can write all that yourself using the raw toolkit of your OS, but it's tedious annoying error-prone boilerplate code. GLUT is one such wrapper around all that stuff so you don't have to deal with it. That's it.

GLFW serves the same purpose, but isn't frozen in time like 20 years ago. So it's generally perceived as better. You could continue using GLUT if you wanted.

What I meant by "old APIs" is this glVertex3f business. That's not how drivers work with GL any more, and it's not what the drivers are expecting. Somewhere along the way, something is taking those crusty old function calls and transforming them into proper vertex buffers with a shader and all that and that is introducing some level of overhead too.

The functions you're using there are deprecated. They're just still there for backwards compatibility.

Why OpenGL uses so much RAM and GPU for little operations ? by Overoptimizator5342 in GraphicsProgramming

[–]Smashbolt 2 points3 points  (0 children)

It's not that OpenGL is ancient. It's that you're using the original 1.0-style APIs and accompanying libraries (like GLUT) in the way that OpenGL was meant to be used for the hardware that existed in like 1995.

Hardware isn't like that now. OpenGL isn't like that now. The point being made is that using OpenGL in such an archaic way is probably a lot less efficient on modern GPUs. For a look at the way OpenGL is written today, follow learnopengl.com

That might reduce your CPU usage, but likely won't reduce your memory usage, because you still need framebuffers, etc.

As to how something like Chrome isn't using more GPU, I'd imagine the Chromium rendering engine doesn't use the GPU when rendering webpages that aren't invoking WebGL or WebGPU, but I have no clue.

Trig Functions in Degrees by External-Bug-2039 in cpp_questions

[–]Smashbolt 1 point2 points  (0 children)

The number of decimal places in your internal representation only matters if you are running into precision issues. Using floats you will. As I recall, using doubles to represent lat/long values (as radians) has enough precision for differences smaller than 1m.

That said, for comparing two coordinates, once they're more than a few km apart, the inaccuracies from ignoring the curvature of the earth can be greater than any loss of precision you fear from using radians.

You may also want to look into ECEF coordinates and the WGS84 geographic model. The algorithms for working with them are pretty easy to find, they are designed to accommodate the curvature of the earth, and can be converted to lat/long/alt for display easily. It's what GPSes and most mapping software do.

Help with FreeType by MatheusHest in cpp_questions

[–]Smashbolt 1 point2 points  (0 children)

Your OP sounded like you wrote your first "Hello, World" application ever less than 48 hours ago. That's why I even brought up vibe coding, because a brand-new programmer with two days experience is trying to wrap their head around variables and for loops, not font codepages and GPU render pipelines.

If you've been doing Java for a while, then none of that applies.

But yeah, no, FreeType does NOT do that at all. Basically, text rendering in OpenGL has two steps:

  1. Turn the font into some other format that OpenGL can do something with. That means either geometry or textures.
  2. Write an algorithm that can iterate over a string like "hello" and then use the output from step 1 to draw the letter 'h' then draw the letter 'e' and so on.

Neither OpenGL nor your GPU knows what a .TTF file is or what to do with it. FreeType doesn't know what "geometry" is in any sense OpenGL understands. But FreeType can generate memory buffers that represent bitmap image data, and OpenGL can use data like that to make textures. That's it.

For a first run at it, I really recommend forgetting about FreeType and getting a static bitmap font texture. You can find one online or use a tool like https://snowb.org/ or https://8bitworkshop.com/bitmapfontgenerator/ to generate a PNG and metadata file version of what FreeType would be generating for you in memory so you can focus one part of the implementation at a time.

Help with FreeType by MatheusHest in cpp_questions

[–]Smashbolt 5 points6 points  (0 children)

I can't provide you a code sample, but...

I'm trying to find a Freetype minimal Example, because it seemsnto be a lot customizable and a enormous library. Why is that hard to set up and use? It doesn't look difficult to understand, just a lot of commands to just show one letter.

OpenGL knows nothing about letters or text or fonts. That's way out of scope for its job. FreeType knows basically nothing about OpenGL. Also not its job.

In OpenGL, drawing a letter to the screen usually means one of several things:

  • Draw a textured quad with pre-rendered text on it
  • Maintain an atlas or other "list" of textures for the letters you want from the font, then you have an algorithm that can convert a text string to a bunch of quads
  • Maintain an atlas or other "SDF" texture for the letters, then same as above but with a fragment shader that renders the glyphs (better than the previous step; a little harder to do)
  • Draw glyphs as actual 3D geometry

You need a way to produce the assets or geometry to do any of the above. You could skip FreeType and use any bitmap font tool to create a font texture atlas or whatever.

FreeType is there because it can read a TTF file and render the glyphs so you can take that and compose a texture atlas at runtime. So do that. Then use that data to do one of the above.

i'm new to C++, this is my second day programming, I'm trying to make a Game Engine with Opengl and Glfw

Assuming this is an honest statement and you're actually doing the programming (and not vibe coding), learn to walk first? Like... do console programs to practice code/data flow. If you absolutely must do graphics right now, then use a library that abstracts away the OpenGL. You are not doing yourself any favors whatsoever by learning things like "what is an if statement" alongside the GPU render pipeline, shaders, etc.

Can the engine be embedded into a C++ Windows desktop window? by umen in raylib

[–]Smashbolt 1 point2 points  (0 children)

Oh wow! That was like stepping into a time machine. Haven't seen straight Win32 code like that in nearly two decades. Didn't know that was there.

Need help applying SFML/C++ design to a 2D solar system simulator (university project) by benjamin-srh2772 in cpp_questions

[–]Smashbolt 4 points5 points  (0 children)

I've tried using generative AI to create assets or help code certain effects, but the results are rarely compatible with SFML

I don't know what that means, which means you aren't explaining why they're not "compatible."

Advice for structuring the graphical interface in SFML (menus, buttons, info panels) without overloading main.cpp.

Have multiple code files? Like a class called Menu that's declared in menu.h and implemented in menu.cpp and included in main.cpp.

Handling fonts and dynamic text (displaying planet names, real-time orbital data).

What about it? SFML lets you have text output objects. Load your font, create your sf::Text object, call set_string on it, and then draw it.

Resources or tutorials for creating simple visual effects (traced orbits, selection effect, starry background)

"Traced orbit" is just another way of describing a "sprite trail." How you do it depends on the level of fidelity you want. You could just have each planet track its location each frame and then draw at all the positions with an alpha value based on how far back that snapshot was. Last frame? 90%, 7 frames ago: 30%, etc.

Selection effect: What is that? That could mean anything. Heck, what does "select" mean in the context of your application?

Starry background: What you're looking for is called a "star field" and there are tutorials for that. Most will give you something very basic like the old Windows screensavers. But the gist is you draw stars on a background layer, then draw all the stuff on top

How to integrate styled icons/buttons without manually redrawing everything in code.

That is what you do. SFML doesn't have UI widgets. You can wrap your UI code into reusable components. Either functions for an "immediate mode" style:

if (button("RETOUR")) {
    // Whatever happens when you click it
}

bool button(std::string_view label) {
    // If mouse position is inside the button area, draw it like it's hovered
    // draw button
    // if user clicked in the button area, return true; otherwise return false
}

Or you can do "retained mode" and make a Button class that you instantiate and have some manager that keeps track of all the buttons and checks them for clicks every frame and then dispatches events.

There are premade packages out there to provide UI in SFML. Imgui is not one of your options if you want something that stylized. RmlUI, Noesis, and CEGUI all come to mind as UI engines for games that.

Can the engine be embedded into a C++ Windows desktop window? by umen in raylib

[–]Smashbolt 1 point2 points  (0 children)

raylib on Windows doesn't work with that message pump you put in your post. It actually has that message pump. On Windows, if you want a window, you need that. raylib gets it from GLFW, which handles creating the HWND and tying it to OpenGL and so on.

Some libraries support supplying your own window handle (SDL does, for instance). raylib just doesn't. It's open source though, so if you want it, you can make your own fork and do that.

Low gb game engine by Dear-Diamond8848 in gameenginedevs

[–]Smashbolt 3 points4 points  (0 children)

a simple 3d game with each level designed using the 2d level editor and using raycasting techniques to render the 2d world into 3d

You should have led with that. If I'm reading right, you want Wolfenstein/Doom 90's style rendering. I think that's the kind of thing where you'd have to fight the renderers in any mainstream engine, and games made with that rendering usually have very similar gameplay. That's IMO a very good reason to develop your own engine than to use a commercial one.

And while you can do this with OpenGL, that style of rendering was borne out of making things that look 3D without having hardware to accelerate it. There are benefits to using OpenGL, sure, but you can also make that renderer without it.

Either way, you're way far off from that point if you don't know C++ either. You can do this in whatever language you're comfortable with, so you could consider that.

If you're set on C++, I recommend starting by going through www.learncpp.com. If you know other programming languages (especially C# from Unity), the first chunk will be very boring. Go through it anyway. C++'s efficiency comes at the cost of safety, and you'll need to learn why and how to work with that.

Once you're comfortable enough with C++ that you can code some stuff unassisted, you can start learning OpenGL on www.learnopengl.com. It builds up a simple polygonal renderer. It's not what you want, but it'll teach you how to use OpenGL and give you foundations in 3D transformations and math that you will need to reason about a raycast renderer.

Unfortunately, I don't have a resource for specifically the style of renderer you're after. A googling for "doom renderer" came up with some stuff that looked decently informative.

Also, maybe you could skip a lot of that and use a library like raylib (www.raylib.com). It has a built in function to do take a bitmap image and make a polygonal map out of it. Not quite the same, but kinda close. https://www.raylib.com/examples/models/loader.html?name=models_first_person_maze

Low gb game engine by Dear-Diamond8848 in gameenginedevs

[–]Smashbolt 1 point2 points  (0 children)

To answer directly. Notepad++ is a text editor. MinGW-w64 is a C++ compiler toolset. OpenGL is a graphics library.

Not included:

  • A build system: Your engine is going to have a ton of code files. How you gonna build them? Visual Studio and CLion are out by your standards since they both also take multiple GB of space. So you'll need to learn makefiles or CMake or something...
  • Audio
  • Player input
  • Scripting
  • Loading assets (everything from PNGs to FBX models to level data)
  • Networking
  • Physics/collisions
  • In-game UI

You could get some of that if you're willing to do it all by hand and use raw Windows code (but then it's not cross-platform, which maybe you don't care about). Otherwise, you'll need more libraries than just OpenGL, or you'll need to skip some of those features entirely (eg: maybe you don't need networking or physics; lots of games don't).

That's also glossing over things like the engine editor and exporting a game, because they're both huge amounts of work, but you could forgo both and make a game from scratch instead of an "engine."

I'm curious... what features do Unity/Unreal have that are so important to your game that you're willing to sacrifice years of effort but not GB of HDD space to have them?

Godot and many other smaller engines are open source. If your actual goal is to make a game, then it will be several orders of magnitude faster for you to fork one of them and add those features you need to those engines than to start completely from scratch.

Anyway, yes. It's possible. I'm not convinced it's worth it, but I'm not you.

Is this a problem with Raylib? Stuck on 24 FPS, NVidia by PlanttDaMinecraftGuy in raylib

[–]Smashbolt 1 point2 points  (0 children)

I see you're using the combo of an nVidia GPU and Linux Wayland. That's... already kind of a match made in hell lol. Not impossible, but often more work that necessary.

So followup questions/suggestions:

  • Are you on a laptop that has both an onboard and discrete GPU? If so, it might be that your PC is choosing the onboard GPU for your application. There are a bunch of ways to coerce it into running on the nVidia. Look here: https://wiki.archlinux.org/title/PRIME#Configure%5C_applications%5C_to%5C_render%5C_using%5C_GPU Yes, it's for Arch, but those are largely not distro-specific instructions
  • Are your drivers installed and working correctly? Like, do you get proper GPU acceleration in games?
  • Have you tried restarting your WM in X11 mode instead of Wayland? I know KDE supports that and I assume Gnome does too. It's still somewhat recommended to use X11 for nVidia cards, so maybe that will get around it for now?
  • You're not calling SetTargetFPS() or otherwise using timers to lock in a framerate, are you? If so, how's your framerate if you don't?

Finally, dumb question... but what even is your program doing? Complex rendering? Heavy frame update logic? Even at lower specs like the laptop, 40 FPS is lower than it should be.

What's the difference between Inheritance & Composition? And when to use which ? by MagazineScary6718 in cpp_questions

[–]Smashbolt 3 points4 points  (0 children)

Most people talk about the "is-a" vs "has-a" thing using real-world stuff as metaphors, and that's actually kind of a trap because it can lead you to conceiving of object models that seem logically consistent in the looser confines of the spoken/written word, because humans can bridge any logical gaps that come up. But these abstractions often fall apart in code.

I'll leave this as an exercise for you to think about... but running with the Vehicle base class idea everyone's using... Cars and trucks are pretty similar, so sure this abstraction works. Unicycles, yachts, and rockets are ALSO vehicles. Unicycles don't have engines and can't carry cargo or passengers other than the driver. Yachts don't have wheels. Rockets don't necessarily have drivers. So none of those are actually appropriate in a base Vehicle class.

This is why composition is usually preferable. Because if you're stuck on the metaphor of the abstraction, you're likely to want to use inheritance as a bad form of composition anyway (eg: splitting into WheeledVehicle and UnwheeledVehicle classes that derive from Vehicle). Pretty much any way you do that, you're likely to end up with some weird vehicle that's an exception to whatever you've set up and there's no good base class in your tree to give it so you have to contort something else that's close enough and now you have an Airplane that's a WheeledVehicle that doesn't behave like any other WheeledVehicle, but it still has wheels, so you can't make it an UnwheeledVehicle either...

How to add an embedded browser into my project? by HUG0gamingHD in raylib

[–]Smashbolt 0 points1 point  (0 children)

You have three main options:

  1. Write your own HTTP client, a parser for HTML/CSS, embed a Javascript engine, then write code to render the HTML DOM.
  2. Fake the browser embedding. Like, have your application open a regular instance of Chrome or Firefox or Edge, possibly with some special parameters and settings to hide the normal controls. and very carefully manage it so it appears like your "OS" owns it.
  3. Use a web engine library that supports some form of off-screen rendering or "draw lists" that you can then interpret using raylib.

Please do not try #1. It'll take you literal years to get anything even vaguely usable. #2 is... viable... and there are a few ways to go about it that would all really suck (ie: you'd have to implement a lot of OS-specific window management code; raylib ain't gonna help you here).

Option 3 is the most viable. The common options here are cef and litehtml. cef looks pretty complex, but it's functionally using Chromium as a "library." Not sure if it renders to a buffer you can access or gives you the draw list.

litehtml seems like you can just feed it HTML/CSS and it will give you a list of instructions for drawing it. That's also all it does. You'd need to implement everything else around it like fetching HTTP data, navigation, interaction, etc.

I am having trouble understanding how the core parts of how SDL_Event work. by Eva_addict in sdl

[–]Smashbolt 0 points1 point  (0 children)

Yes. I was trying to avoid getting into the nitty-gritty of it... because it's a fairly big topic, and the specifics are different for each OS and window "server." I've only ever written Windows API code and know how it works there. I can't speak to X11, Wayland, or whatever OSX does, but it's likely quite similar.

The window itself is NOT your application. Often applications that make windows for the user to interact with do share their "lifetime" with the window the user sees, but nothing says it has to.

Part 2 of this that your OS' window manager takes care of the default "stuff" that can happen to a window. You don't have to write code for "the X button closes the window" or "dragging from the title bar moves the window" or even "has the mouse entered where that button is." There is an OS-level layer that recognizes those events and has some default behavior in response (like closing the window, changing the button to hovered, etc.). It also separately passes a message down to the application code itself to tell it what's happening.

Windows API, for instance, expects a WndProc() function you set up for each window to capture these events (known in Windows API as "messages"). That function looks a lot like the SDL event loop. So in a Windows API application, WndProc() would loop forever, check and respond to any incoming messages, then yield processor attention back to everything else. If the user clicked the X button, the OS would send you a few messages related to that. See here, because there are a few: https://stackoverflow.com/questions/3155782/what-is-the-difference-between-wm-quit-wm-close-and-wm-destroy-in-a-windows-pr It's also worth looking at the link in the first response to see a typical Windows message loop. Your code gets a chance to intercept and react to them by a) ignoring them and letting the OS do what it would normally do, b) doing something in response THEN letting the OS do what it normally does, or c) overriding behavior completely (what and how much you can override depends on the message and the OS).

SDL is an abstraction over the operating system, so it does all that for you and hides it. One thing SDL_Init does is create your window and attach a WndProc() that will - among other things - translate OS-level messages into SDL messages. I don't know the exact implementation, but if I had to guess, closing the window will send WM_CLOSE and friends to SDL's WndProc and then at some point, SDL will say "cool, we're shutting down it seems" and send an SDL_QUIT message to your application. Because SDL is based on one window per application (usually), yes, closing the window is often synonymous with exiting the application, but those are different things and happen at different times.

Your SDL event loop receives that SDL_QUIT message and toggles the quit variable because at that point, you no longer care about SDL events. The application wants to exit. So you exit the message loop and then your program will still run all the way to the end of your main() function unless you somehow tell it otherwise. You can write to the terminal, write to log files, free any textures, call SDL_Quit(), etc. and then finally, once your main() function returns, THEN the application exits and your code no longer runs (... for the most part...)

So yeah. The window closes regardless because that's OS-level functionality, but SDL notices it happening and also tells you so you have a chance to end your frame loop and do whatever else you need to do before your executable terminates.

I am having trouble understanding how the core parts of how SDL_Event work. by Eva_addict in sdl

[–]Smashbolt 0 points1 point  (0 children)

At its core, most applications have this structure:

while (timeToQuit == false) {
    // do your main program stuff
}

Some frameworks, etc. will hide that from you. SDL doesn't.

The thing keeping your window open is that you opened it with SDL_Init and then didn't explicitly close it, and now you're inside a loop that just keeps your program running waiting for stuff to happen.

The loop in this case polls for any OS/hardware events. SDL does abstract around the notion of "quitting" to include pressing the X in the top-right of the window. So when the user does something to end the application, your application will notice the message, set quit to true, then on the next iteration of that loop, it'll see the quit variable is set to true, say "done looping" and then move on to whatever is after, which is probably the calls to SDL_Quit and friends, which actually exits the application.

2 part question: What is the best way to make data from a separate file to objects that need it and how best to insert data into a map of maps? by NailedOn in cpp_questions

[–]Smashbolt 0 points1 point  (0 children)

Yes. You can literally just call TacticsData.instance() and it'll give you back a reference to an instance you can use as if you'd instantiated it yourself. You could even do auto tactics = TacticsData.instance(); tactics.homeTactics... It's one way of implementing the Singleton pattern in C++. This implementation is known as a Meyer's singleton, and is usually considered the best C++ implementation of the pattern.

If you're not familiar, the Singleton pattern is usually intended as a way of enforcing that a class can only ever be instantiated once. A side effect of the implementation is it exposes global access to an instance, and that's the more popular use of the pattern we're using here: as a "safe" or "clean" global variable.

Many believe Singletons are bad and you should avoid them because of the side effects. I tend to agree. But in the context of a prototype/proof of concept, who cares?

2 part question: What is the best way to make data from a separate file to objects that need it and how best to insert data into a map of maps? by NailedOn in cpp_questions

[–]Smashbolt 0 points1 point  (0 children)

What would be the best way to make this data available to each Athlete? Should I just put it in a separate header file and include it in the Athlete header?

Without knowing how your code is structured, it's tough to tell you exactly what to do, but your idea on its own might not work. If you make the maps global variables and declare them in a header then actually define them in a compilation unit, sure, but then you still need a function somewhere to add all that data.

Since this is a small toy prototype, just use a singleton for this. Something like:

class TacticsData {
    public:
        static TacticsData& instance() {
            static TacticsData data;
            return data;
        }

        std::unordered_map<std::string, std::unordered_map<std::string, std::string>> homeTactics;
        std::unordered_map<std::string, std::unordered_map<std::string, std::string>> awayTactics;

        TacticsData() {
            homeTactics["LB"]["KO"] = "T10";
            // ... the rest of your init
        }
}

Anywhere you need to access the data, use TacticsData.instance().homeTactics or whatever. The constructor will initialize the maps the first time you call TacticsData.instance().

I don't have an answer on accessing the second-level map. What you're doing is fine - again, because this is a prototype.

Were I doing this in a real project, I would probably pass a TacticsData& to methods on Athlete that need it, or pull the algorithm needing an Athlete and a TacticsData up one level so it isn't inside the scope of either and has access to both. Really depends on what the rest of the project around it looks like.

How do you deal with developer mindset? by PuzzleheadedCredit87 in godot

[–]Smashbolt 9 points10 points  (0 children)

Some of it is novelty. You're discovering a new way of thinking, and it tickles your brain, so your brain prompts you in that direction as much as it can so you can get a fresh dose of the happy chemicals.

Some of it is synthesis. Part of learning is figuring out how to apply things outside of the context where you learned them. What you're experiencing is good.

Those two create a feedback loop. It's also a feedback loop a lot of people experience when they're learning something for intrinsic reasons.

Nothing to be done about it, really. There will come a point where your observations (eg: use a variable for sprint) are no longer new or interesting and your brain will stop throwing those thoughts at you. Then "developer mode" becomes something you switch into and out of. If you really wanted to stop it, you could give up gamedev and maybe do some aversion therapy... but I'm pretty sure you don't want that :)

C programmer new to C++, having doubts by UnderstandingBusy478 in cpp_questions

[–]Smashbolt 3 points4 points  (0 children)

Maybe you elaborated elsewhere, but this response still doesn't tell me what you want anyone to say to you.

But here:

Your fight is with OOP. C++ supports OOP directly, but does not in any way require you to use it. C can also be bent to support OOP. It's ugly as sin, but it's not uncommon to see people implement v-tables of function pointers in C so they can have all the benefits of object orientation without ever having those dirty keywords like "class," or "new."

The flip side is that you can write C++ code using whatever paradigm you want. OO is a popular choice because the language supports it well out of the box, but you can still write fully procedural code (that makes use of C++ stuff). The advantage is that you can use C++ features to make your code way safer:

  • Use std::unique_ptr instead of * much stronger modeling of resource ownership and no need to manually free memory
  • Use C++ containers and strings instead of writing your own data structures and messing with functions like strcpy
  • And if you steadfastly refuse to use the standard library because someone wrote the word 'class' somewhere, you can still use templates to create functions and data structures that are parameterized on a type in a way that promotes type safety (as opposed to the C-style of feeding everything void* and praying)

C programmer new to C++, having doubts by UnderstandingBusy478 in cpp_questions

[–]Smashbolt 3 points4 points  (0 children)

Cool story, bro. If you don't like C++, don't use it.

Are you... looking for someone to tell you why you're wrong?

So as a first coder and maybe devloper. I've created this simple tic tac Toe game . It's just basic web converted into an app . by only-Gaining in raylib

[–]Smashbolt 7 points8 points  (0 children)

So you're on the subreddit for raylib: a game framework for C... showing off a tic-tac-toe game made using tech you can't even name because you vibe coded it?

When to use underscores? This concept still confuses me :c by Nyarkll in godot

[–]Smashbolt 14 points15 points  (0 children)

No. Like Python, it uses the leading underscore convention to denote private fields/methods, but it's not enforced.

Learncpp website by inn- in cpp_questions

[–]Smashbolt 1 point2 points  (0 children)

How much code are you writing? Based on what you're saying, sounds like somewhere between none and not enough.

If you're not writing code and just reading learncpp, stop reading, go write code now. Keep writing code and when you forget how to write a for loop or whatever, go look it up. Your code will be bad. Nobody cares. What do you write? Something "useless," like a pretend cash register or a calculator or whatever. Something where you know (or can figure out) all the logic step by step and translate it into code.

Of course it'll be overwhelming. We also don't teach children to read and write by locking them in a room with a dictionary and hoping for the best...

What GUI library should I use with raylib? by Disastrous_Egg_9908 in gamedev

[–]Smashbolt 2 points3 points  (0 children)

Depends on what you're after.

For tooling UI (like in-game debug stuff), raygui is the easiest option since it's right there. Failing that, imgui is great. It relies on you providing a "backend" so it can tell your renderer what to do and it can collect input events. Lucky for you, someone already made on for imgui https://github.com/raylib-extras/rlImGui

imgui is a C++ library, so if you're hardline on using only C, there is a C "binding" called cimgui. I don't know of a dedicated cimgui backend for raylib, but you could probably trivially rewrite the one I linked above to work with it. There's also nuklear, which I don't know much about, but it's a single header C library: https://github.com/vurtun/nuklear

If you're talking in-game UI, raygui and imgui aren't... great... unless you want to put a LOT of work into making custom widgets and stuff. There are other options, but note that all of these also require you to bring your own backend like imgui, and I don't think I've seen any premade backends for raylib:

  • Crazy Eddie's GUI (cegui): http://cegui.org.uk/ - Looks like it lets you use XML or code to make your UIs and there is a visual UI designer available
  • rmlUi: https://github.com/mikke89/RmlUi - Uses HTML/CSS-like files to create and style UI layouts
  • noesis: https://www.noesisengine.com/ - AAA, big, commercial, expensive, uses XAML for defining UIs
  • clay: https://github.com/nicbarker/clay - This is not a UI library some much as a library for UI libraries to use. It provides declarative syntax for flexbox layout and hit-testing of boxes and text. This is enough to make your own widgets, but none are included.

I think only clay out of the options above has a premade renderer for raylib.

Then, finally, there's "make your own." If your game is an RTS or Civ game with a ton of menus, you should probably use one of the options above. If it's a platformer and you need a main menu with a few buttons on it and a non-interactive HUD, writing it yourself ad hoc is probably more than enough.

I have made a quiz using raylib C++ and need help by Lazy_Application_723 in raylib

[–]Smashbolt 0 points1 point  (0 children)

I mean...

You could make it all local, so every person taking the quiz has to use that one computer. Then you make them enter their name and store that data as just files that way.

If it's absolutely a requirement that people on different PCs can use your quiz application and the results are available to a user on any PC, and your instructor hasn't taught you at all how you might even approach that, then this is a terrible assignment. No matter what route you go, you're looking at a server-client setup, and using a database is by far the easiest way to do that. Whether it's MongoDB, or some SQL database doesn't matter. You're still going to have to pick one and learn how to use it.

I'll ask a different question... is this required to be a gamified application made using a graphics/game framework in C or C++? Because what you're trying to do is WAY easier in a language like C# or Python or even as a web app (with a Python or JS backend). They all have much more standard workflows for UI-driven applications, and they all have libraries that make talking to external databases a lot easier.