Super minimal graphics library

Started by
7 comments, last by Daaark 14 years, 4 months ago
Hi, I am studying game programming in Sweden. I am currently retaking a cource where we have to write implementations of a few design patterns, aswell as a small library that uses some of there patterns. I have desided on working on a very limited ai library that addresses swarming behaviour. To render this on screen i want to use a graphics library. However the ones that i am familiar with requires alot of code for the basic implementation. And i want to keep the example short. Is there a super minimalistic graphics library out there that can be implemented in just a few lines of code. All i realy want to do is print a few circles in a window. I am working in C++ under windows. Thanks in advance for all replies.

Video Game Programmer.
5 years in industry.

Advertisement
You could use SDL. I think you'll have to write a function to draw a circle yourself though (or find one somewhere), but that's not too hard.
For such a program, you don't really need a "graphics library". All you need is a way to render particles in realtime with hardware acceleration. There are many "tutorials" and samples for Direct3D and OpenGL - you only need to grab the code from one of them and modify the particle movement code and you're set. I recommend OpenGL in this instance because installing the DirectX SDK is probably an overkill for this. Good luck.
Problem is that i need to write all the code that i use in the report and i want to write as little code in the report as possible. Don't need hardware acceleration either (can just make fewer swarm entities).

SDL might work, dont remember much from the days that i used it though.

Video Game Programmer.
5 years in industry.

You could try SFML ( http://www.sfml-dev.org ), you can have shapes (and sprites) up and drawn on the screen in less than 30~ lines of code
Thank you superRad you are super rad.
I consider the question answered.

Video Game Programmer.
5 years in industry.

Quote:Original post by Net-Ninja
Problem is that i need to write all the code that i use in the report and i want to write as little code in the report as possible. Don't need hardware acceleration either (can just make fewer swarm entities).

SDL might work, dont remember much from the days that i used it though.
Just use XNA. You can just open up a template new project, and start typing your program directly in the Update and Draw functions.

All you need to do in the draw part is loop through your swarm, and draw each with a call to SpriteBatch.Draw();

Also, you can try the Allegro game library, because it doesn't need anything installed to the system, other than the allegro dll. Just a few calls to get a window to draw in, and then 1 call to load a sprite, and 1 call to draw it. Similar to XNA.

XNA is not C++...

And for some reason SFML keeps crashing and burning with examplecode. Some kind of memory overflow on the inside. gs_report ring any bells?

EDIT:
found it, was supposed to include diffrent libraries in debug mode. Silly me...

[Edited by - Net-Ninja on November 23, 2009 1:41:26 PM]

Video Game Programmer.
5 years in industry.

Quote:Original post by Net-Ninja
XNA is not C++...
Then use Allegro.

You just need

allegro_init();

bitmap *b;
b = load_bitmap("...");

and then call draw sprite (http://www.allegro.cc/manual/api/blitting-and-sprites/draw_sprite) where needed.

This topic is closed to new replies.

Advertisement