[ main site index, Lord Granitor on Geocities ]
...blah, blah, I've been learning the Simple DirectMedia Layer, which is used in tons of stuff but you can read more about it over there on the libsdl.org website.
The screenshot will have to speak for itself, for now:
And, yes, that block on the third line of the rectangle with the black background is indeed a blinking cursor (take my word for it that it blinks in "teh proggy").
Unfortunately, as with the DOS m1 from years back (1999 or 2000, I think), the update routines are brute force, and horribly inefficient... but considering how powerful windows and my computer now are, even worse. I know what to do (as I did then) but I haven't done it yet because it would take effort and I'm tired.
The good news is that I'm doing all sorts of coolness that I never really did before. My wrath is trickling out upon the world.
[Updated: 17 July, 2006]
I recently started learning SDL, or Simple DirectMedia Layer. It's a programming library thingy which is Chip uses to make cross-platform games for MacOS X, w32, and DreamCast, so it has a proven record of being useful. Anyways, my first program here, "Empty1", is basically just a "hello, world" type thing, but since it is for a game-related library, I added in user input and response.
So, you can download the zip file, extract everything to the same directory, and run the executable. The following screen (or something like it) should appear:
You can now use the arrow keys to move the "greetings card" (the yellow box) around. For example, if you press and hold down the "down arrow" while the application has focus, you'll end up with something like this, after a few seconds:
It appears to be a bit sluggish because the screen is only updated twice a second (that's right, two(2) fps! fast, huh?). There's no technical reason for it to be that slow, I just was following a tutorial and didn't think of the implications until after it was done. The next release of "Empty" will be much more brisk and should also feature an onscreen FPS counter, too, to prove it.
Incidentally, this was based (loosely) on a few tutorials from the Lazy Foo Productions SDL Tutorial series. This is proving to be a very valuable source of information, and may inspire me to do my own tutorials later... which is one of the reasons why I decided to release this first program.
You can download empty1.zip right over here, it's about 183 K zipped, extracts to over a megabyte due to the excessive usage of w32-native BMP files, which are very bloated. I plan to use PNGs for the rest of the graphics, as "Lazy Foo" suggests and does in their tutorials.
More recently (31 July, 2006), I've worked thru more tutorials and read more of the SDL documentation, and now have the frame rate locked... but I took out some interactivity. I'm not going to release this build as all you can really do is look at it, but in the future I'll release something fun based on what I'm learning. Anyhow, here's a screenshot:
As it says, it is quite bland and uninteresting. The stuff on the screen is really just useful to me as I tested different update algorithms, and tried running things in parallel to see how the program would slow down, and so on... I can lock the frame rate at around 40 per second, or run it in "warp mode", and it tracks frames rendered (r:) and dropped (d:), and calculates the percentage.
The "fps" is not recalculated every frame, but approximately twice a second. This follows the principle of taking as many samples as possible before generating a statistic; since this is computer science, it seems reasonable to do things which are scientifically sound.
For another example, my frame rate is locked by a more complicated algorithm than I have so far found in any online tutorial, but it is, in my modest opinion, more scientifically sound. It also recovers better from situations where the application is disrupted, e.g. by being minimized.
However, I would tend to agree that programming - or, metakoding, going beyond mere code-writing to actually make something useful, is an art and more like design and engineering than science. We're not trying to investigate something, like a physical or biological scientist is, we're making our ideas into reality, and the results, appearance, and stability are what matter. Depending on the emphasis, I'd call the result a product, demo/art, or usable/artwork, respectively.
Anyhow, The number of frames between updates (n:) and number of frames rendered in total (a:) are also displayed, because I can reset the r,d values at a keypress, which is helpful if I change rendering modes and want clean stats.
The "mt" is the "militant timer", or the time elapsed since the application was started. I've learned a lot in this short time, and debugged memory leaks, and refactored the code a bit, and also found another source of tutorials: Cone3d, part of gamedev.net. There is a lot more for me to read and learn before I really start on doing games, I'd arrogantly thought that I could jump in and do something in a few hours but it's not that simple, esp. since I tend to go on tangents trying to totally understand something.
...anyways, that's all for now.
Lord Granitor. 12 August, 2006.
[ index, Lord Granitor on Geocities, Chip's C99 Website ]