Here’s a good article for realistically modeling collisions between spheres. It’s an oldie but a goodie.
Pool Hall lessons
There’s a bit of pseudo code at the bottom, but I’ll post on a C++ implementation of the article.
Continue reading
Tag Archives: C++
Garage Games for OS X – Drag & Drop Fix
I bought Garage Game’s Torque Game Builder for OS X a while back and started to tinker with it. I thought I was going insane when I couldn’t follow the dead simple instructions on dragging and dropping files into the project. After some experimenting, I found out that it works just fine in Windows, so it had to be OS X. I had the source code so I decided to tinker with it. After a bit of fiddling I found a ‘fix’ for it. Garage Games will probably be fixing this soon so hopefully this ‘fix’ will be obsolete.
OS X Get Resource Path from within an APP package
If you’re developing for OSX and need a way to fetch out the complete filename of a resource in your .app package, here’s a bit of code that will help you do it.
Pass in the file name/resource name and it will spit back the complete absolute filename of the resource. This is useful if you’re attempting to load a file with a C library function.
Continue reading
Simple Threading in C++
Ever needed to implement threads in C++? Here’s a quick and dirty way that works both in Windows and Unix/Linux (provided it has POSIX threads, eg. pthreads etc.).
The class has 3 methods. One method start_thread(), is the method that calls the operating system dependent call to create a thread.
Windows:
CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)ThreadStartup, (Application *)this, 0, &threadId);
Which essentially starts up a thread using the ThreadStartup static method and passes in the instance as a parameter.
pthread_create(&tid, NULL, Application::ThreadStartup, (Application *)this);