Devadex

C++ Inventory System — No Dependencies

gumroad   €4.00   by fentmachine6000
32d old

C++ Inventory System — No DependenciesA lightweight, plug-and-play inventory system for C++ game projects. No external libraries required — just drop inventory.h into your project and go.Features: Add, remove and stack items by ID Configurable slot limit Save and load to JSON automatically Built-in item registry — just add your own items Works with any C++ project including raylib, SDL, SFML or custom engines Who is this for: Indie devs and students who don't want to waste time writing inventory and save systems from scratch.Tested on C++11 and newer.EXAMPLES -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*---- ## Setup Copy `inventory.h` into your project. Include it. Done. ```cpp #include "inventory.h" ``` --- ## Quick Start ```cpp Inventory inv(20); // 20 slot inventory inv.addItem(1); // add 1x Sword inv.addItem(9, 3); // add 3x Amethyst inv.addItem(5, 2); // add 2x Health Potion // You can set to whatever u want btw inv.save("save.json"); // save to file inv.load("save.json"); // load from file inv.printInventory(); // print to console ``` --- ## API ```cpp inv.addItem(id, quantity) // add item (stacks if exists, returns false if full) inv.removeItem(id, quantity) // remove item (returns false if not enough) inv.hasItem(id, quantity) // check if inventory contains item inv.getQuantity(id) // get quantity of specific item inv.clear() // empty the inventory inv.printInventory() // print all items to console inv.save("file.json") // save to JSON inv.load("file.json") // load from JSON ```

Get it → fentmachine6000.gumroad.com

Found on Devadex — the discovery index for independent software the big search engines bury. More from gumroad.

Report this listing