BareBones Graphics Library is just a small library im making which gives you the bare minimum to make rendering projects
- download or clone the project
- insert it in your project
- add bbgl.cpp and graphic_buffers.cpp to your makefile
-
declare the needed variables
BBGL *bbgl; void update();
-
fill the update and draw functions
void update() { /** This i where you do logic stuff **/ return; }
-
create the BBGLOPTIONS object
BBGLOPTIONS bbglOptions; bbglOptions.windowOptions.maxHeight = 1024; bbglOptions.windowOptions.maxWidth = 1024; bbglOptions.windowOptions.allowResize = true;
-
create the bbgl object
int main() { bbgl = new BBGL(bbglOptions); bbgl->update = update; bbgl->start(); std::cout << "GoodBye World!" << std::endl; return 0; }
-
change pixel data of the window
bbgl->buffs->set_pixel(x, y, RGB(255,255,255));
you can also use safe_set_pixel to prevent crashes but it is a bit slower
bbgl->buffs->safe_set_pixel(x, y, RGB(255,255,255)); //RGB is a macro to turn 4 byte to a uint32_t
Note: Everything after bbgl->start() will only be called after the window is closed. If you need to setup things before the first
update you can do it before calling bbgl->start()
-
scaling
For now BBGL does not scale the buffer when resizing the window.
-
OS
BBGL is completely dependent on the Windows API.
You are welcome to post issues or pull requests in this repository.
It would be greatly appreciated to get a Mac and Linux implementation.