Hi, I’m Tyler Mandry, and I’m making a C++ game called (for now)
Adage. I’ve coded the beginnings of a basic widget set for it, and
have a well-structured system of Widgets and (virtual) Windows that
handle the widgets, and finally a WindowManager that handles the
Windows. Windows aren’t really, well, windows (at least not according
to the OS/WM); the whole game is in one actual window and the Windows
are just classes that blit onto there.
I’ve run into a big problem, though: I can’t get any widgets to
display anymore, except for a simple Text widget (front end to
sdl-ttf). The widgets seem to blit onto their parent surface
successfully, which is a Window class. I’ve tested this - when setting
the Widget’s parent surface to the main window surface, it works, and
when creating the Window’s surface using SDL_CreateRGBSurfaceFrom()
with the main surface (which shares the pixel data between surfaces),
it works. When using this technique, however, the color on the widgets
is wrong, UNLESS the Window blits its surface back onto the main
surface. It’s just weird that the blit actually has an effect, and yet
doesn’t seem to be working.
The widgets worked before I started using the Window system (and had
widgets blitting directly to the screen). I made some other changes at
the same time; there’s a small chance that they could have had an
affect. My friends and I have gone over the code for hours, and I’ve
finally concluded that it has to be a problem with my usage of SDL (or
SDL itself, which is unlikely). I’m using SDL 1.2.8.
I need help! I just don’t know what’s wrong. So, if you have any
ideas, please tell me, and if you have any questions please ask. I
hope I wasn’t too confusing. Thank you VERY MUCH in advance!
If you want access to the sources, you can check them out via SVN
(make sure to get rev. 50):
$ svn co -r 50 http://peltkore.net/svn/adage
or view them in WebSVN:
http://peltkore.net/websvn/listing.php?repname=adage&path=%2F&rev=50
If you want, you can also take a look at revisions 51 and 52 for
examples of what happens when we try the (hackish) things I talked
about. 51 displays correctly but the code is all twisted. To build
them (on linux), cd into trunk/src and just do make
and try running
both ./main
and ./preview
(both are pretty much just widget tests
for now).
Thanks again,–
Tyler Mandry