[Gtkradiant] working on a plugin, need some advice
Mon, 20 Oct 2003 10:22:02 +0100
This may not help you write the plugin =3D).
I think your problem illustrates a design problem with the LoadImage =
I suggest we decouple the image-loading from the VFS.
We could change the LoadImage API from..
void LoadImage(const char* filename, ... )
RGBAImage* LoadImage(InputStream& inputstream, unsigned int size)
so you can do..
file_t file =3D vfsLoadFile(relative_filename);
if(file.size > 0)
RGBAImage* image =3D LoadImage(file.stream, file.size);
and LoadJPG does...
char* buffer =3D new char[size];
return LoadJPGBuff(buffer, ...);
From: Reed Mideke [mailto:email@example.com]
Sent: 20 October 2003 00:02
Subject: [Gtkradiant] working on a plugin, need some advice
*This message was transferred with a trial version of CommuniGate(tm) =
I'm working on a plugin for this feature:
"loading a background image in the 2D view to use as a layout"
I have the basic functionality working:
Now I'm trying to clean it up and make is user friendly.
Currently, it uses m_pfnLoadImage from radiant to load the
background. This is handy, since it means I don't have to
write any loading code, and users have plenty of format choices.
The downside is, as far as I can tell, this will only load the
file from the under the game directory (main, baseq3 etc) or
a .pk3 file. That means that if I use a standard file dialog,
I would have to munge the path, and users might browse outside
of the the usable directories.
It sure would be nice if there was a way to tell VFS 'it is OK
to try an absolute path first'
Any suggestion on a good way around that ?
Another issue with the plugin is that it renders after
everything else in the 2d window, so it is not really a
proper background image. I get around this by having user
selectable alpha, as well as allowing the use of the
images own alpha channel.
Blending works reasonably well, but it would be faster and more
convenient to have the background image just get rendered at the
very start of the 2d windows stuff. I don't see any way to do
that without either putting it in the radiant core, or adding
another point to hook into.
Thanks in advance for any advice.
Email: rfm(at)collectivecomputing.com or rfm(at)portalofevil.com
Home page: http://www.collectivecomputing.com/rfm
Gtkradiant mailing list