Archive for the ‘C’ Category

Found an opengl bouncing ball demo

Sunday, September 13th, 2009

OpenGL Bouncing Ball
I complied it with:
gcc ./bounce.c -I/usr/X11R6/include -lglut -lGL -lXext -lX11 -L/usr/X11R6/lib
It was interesting.
Now looking for an SDL version of opengl 3d bouncing ball.

Got physics and gravity working in ball bounce demo.

Sunday, July 26th, 2009

Have you ever wanted to know how they simulate balls bouncing off each other and being pulled down by gravity? Here is some simple code using SDL and C that shows how it works.

Reseaching Sprite Collision Detection

Saturday, July 18th, 2009

http://www.google.com/#hl=en&q=sprite+collision+detection
http://www.gamedev.net/reference/articles/article735.asp
Huge collection of sdl tutorials : http://lazyfoo.net/SDL_tutorials/index.php
I created a very primitive sprite collision scheme built into my multi bouncing ball demo.
Here is the Youtube video: First Sprite Collision Attempt
Here is the code:
collision.c
You compile the code like this:
gcc `sdl-config –cflags –libs`  collision.c
Enjoy.

Adding font display to the graphics.

Saturday, July 18th, 2009

fontdemo.c
I had to install the SDL_ttf dev library to compile this one.
The command line to compile this is:
gcc `sdl-config –cflags –libs` -lSDL_ttf fontdemo.c
Notice the additional
-lSDL_ttf
that was added.
The original example code is here.
The arial ttf library is at that link.  It has to be renamed to all lowercase to work.
I added a check to see [...]

Multiple bouncing balls.

Friday, July 17th, 2009

I revisit the ball bounce program I did earlier today and make the balls objects. The main program now works with a list of balls.

Second SDL Program: Bouncing Ball

Friday, July 17th, 2009

Bouncing Ball Program

The program loads the ball in and bounces it around the screen, as you can see in the screen shot.
I compiled the program with this command:
gcc `sdl-config –cflags –libs`  bouncingball.c
Modified from the tutorial here.

First SDL program.

Friday, July 17th, 2009

Small demo code to make sure that the SDL libraries are installed correctly and that I can compile both C and C++ versions of the code.