On Tue, Mar 10, 2009 at 03:25:41AM +1300, Ralph Versteegen wrote: > 2009/3/9 James Paige <b...@hamsterrepublic.com>: > > On Mon, Mar 09, 2009 at 01:34:08AM +1300, Ralph Versteegen wrote: > >> 2009/3/8 Ralph Versteegen <teeem...@gmail.com>: > >> > 2009/3/8 <subvers...@hamsterrepublic.com>: > >> >> teeemcee > >> >> 2009-03-07 07:04:11 -0800 (Sat, 07 Mar 2009) > >> >> 1392 > >> >> Complete text rendering rewrite. Adds fonts: > >> >> -A font can be one or two layers. The bottom layer is drawn first for > >> >> the whole string, then the top one. This is to let shadows and effects > >> >> like edgeprint for neighbouring characters overlap. Edgeprint now draws > >> >> a string twice instead of 5 times. > >> >> -Each character can be a variable width > >> >> -Each sprite for each layer for each character can be any size, placed > >> >> in any position relative to the character, and use 256 colours. So you > >> >> can add huge graffiti like tails and things which extend all over the > >> >> place. > >> >> > >> >> There are two fonts currently loaded for each game: the base game font, > >> >> and the game font plus edges. To try out new font features at the > >> >> moment need to use hardcoded fonts, modify setfont. font_loadbmps is > >> >> there for this. > >> >> > >> >> The font code is incomplete, eventually it should have more support for > >> >> palettes and colour manipulation, multiple fonts, and font effects like > >> >> shadows and gradients. > >> >> > >> >> I also changed the way Frame masks act. 0x00 is now transparent and > >> >> 0xff is opaque, instead of the other way around. masks are also now > >> >> optional for transparent blitting using draw_ohr. I believe there are > >> >> only two places where they are actually needed: enemies fading out, and > >> >> scaled blitting (sprite_draw). Everything else could now be changed to > >> >> use half as much memory. However, fonts are the only thing taking > >> >> advantage of this at the moment. > >> >> --- > >> >> U wip/allmodex.bas > >> >> U wip/allmodex.bi > >> >> U wip/common.bas > >> >> U wip/common.bi > >> >> U wip/udts.bi > >> > > >> > Example, a small (2x6 to 6x6 per char) monochrome font I quickly drew, > >> > lowercase letters only: > >> > http://tmc.castleparadox.com/ohr/smallfont.png > >> > To use it, unzip > >> > http://tmc.castleparadox.com/ohr/smallfont.zip > >> > to executable directory and modify setfont. > >> > > >> > >> More fun stuff: > >> http://tmc.castleparadox.com/ohr/sfont1.png > >> http://tmc.castleparadox.com/ohr/bigfont.png > > > > Oh my goodness! I think i underestimated how awesome this could be! > > I need to draw an example of a font that uses layers for another use I > envision: letters which merge together, such as sharing an outline, > example: > http://rlv.zcache.com/hot_pink_black_text_proud_new_aunt_sticker-p217247054994320869qjcl_400.jpg > > > Looks like I have a lot of work to do on making gui elements sized > > according to font sizes. > > But what would you do about very tight menus like the items menu, or > 38 character strings? My thinking was that we might have to require an > at maximum 8x8 font to be provided for use in menus where larger font > wouldn't fit, even if the default is something else. I guess it might > be possible to instead scan problematic strings in the game (eg item > names and descriptions) for excessive length and provide warnings, but > it sounds like a lot of work. > Variable width font really cuts down on string length nicely.
Ah, interesting. Yes, if we required every game to have a "Menu" font with limited dimentions, then that would ease the transition greatly. > > Do we have gunctions yet to get the height of a given string? Or to get > > the height of the font in general? > > > > Not yet. I've only assigned a single height value to a font, instead > of per-character. However, a string will potentially switch between > multiple fonts and contain newlines. We already have xstring for > width! ystring then, I guess :) > Oh yeah, I'll merge (or more likely rewrite) Mike's text controls tag > stuff back in soon (r1025, backed-out over two years ago!) But I think > I'm meant to be working on my Gameathon entry... Well, I can be patient :) By the way, I tried uncommenting the lines you marked in setfont, but I wasn't seeing any difference. Can you give me a little more info on how to test this? --- James Paige _______________________________________________ Ohrrpgce mailing list ohrrpgce@lists.motherhamster.org http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org