Extensions
During the development of the tutorials I found and probably will find
that libKSD has only limited functionality in some areas. It is not
designed to be, for instance, an image processing library. Or a
library for modelling physics.
In games however such functionality is frequently required. Scaling
and rotation of images are very common operations, and so is
collision detection.
When developing my tutorial games and needing such functionality I have
tried to design this functionality in such a way that it is reusable
for other people. Generally all that is needed are the appropriate header
and implementation files, and a using namespace ksd_util directive.
(I have placed my stuff in namespace ksd_util in the hope it will at
some time be part of such a package).
filefinder
This is a very simple class which helps your application find the
resource directory and files therein. It is not dependent on libKSD,
and neither is it in a namespace.
The class is pretty well documented (see the header file) and html
documentation may be generated using doxygen.
You can download filefinder.h and filefinder.cpp from the Download
section.
flipfilter
This is a TImage filter. It flips a given TImage either horizontally
or vertically. It is an example of how easy it is to create a
TImageFilter:)
The files flipfilter.cpp and flipfilter.h can be found in the Download
section.
ScaleImage
Sometimes you want to scale an image. The ScaleImage function provides
a simple way to do this.
The files image_util.cpp and image_util.h can be found in the Download
section.
ImageRotator
Sometimes you want to rotate an image. This is a simple class which
rotates an image. It returns a new and probably larger, rotated image.
This function is not finished and not extensively tested. It does work.
The documenation is not fully correct. At some time I will do this better,
but for now you can consider it a pointer in the right direction.
The files imagerotator.h and imagerotator.cpp can be found in the Download
section.
Collision Detection
The current collision detection class is created to compensate for the
disappearing collision detection logic in the libKSD shapes. It detects
collisions between any combination of the following shapes:
The required file is Collision.h in the Download section.
|