(done) dsb_textformat && dsb_bitmap_textout

This forum is for the Lua scriptable clone of DM/CSB called Dungeon Strikes Back by Sophia. Use DSB to build your own highly customised games.

Moderator: Sophia

Forum rules
Please read the Forum rules and policies before posting. You may Image to help finance the hosting costs of this forum.
Post Reply
User avatar
ian_scho
High Lord
Posts: 2807
Joined: Fri Apr 07, 2006 8:30 am
Location: Zaragoza, Spain

(done) dsb_textformat && dsb_bitmap_textout

Post by ian_scho »

Not sure if it's worth Sophia's time on this one...

Code: Select all

	dsb_textformat(chars_per_line, y_offset_per_line, max_lines)
	dsb_bitmap_textout(bitmap, font, string, x, y, alignment, color)
The above assigns a format to our textout, then paints our text onto a bitmap. If we pass alignment as MULTILINE it get's interesting as we can have long sausages of text automatically sliced and diced for us using the chars_per_line value.

Great. But, I'd like the user to read a paragraph, click, read the next paragraph painted on the same canvas. I don't know how far 'down' I am on the canvas, unless I boot up the app a couple of times and change the x value accordingly for each paragraph. The dsb_bitmap_textout returns no height offset value or anything so does anyone have a better suggestion than trial and error or pen&paper math.
User avatar
Sophia
Concise and Honest
Posts: 4307
Joined: Thu Sep 12, 2002 9:50 pm
Location: Nowhere in particular
Contact:

Re: dsb_textformat && dsb_bitmap_textout

Post by Sophia »

It would not be a big problem to make dsb_bitmap_textout return the number of lines printed. Since you know "y_offset_per_line," it then becomes trivial to compute where the next set of lines would go.
User avatar
ian_scho
High Lord
Posts: 2807
Joined: Fri Apr 07, 2006 8:30 am
Location: Zaragoza, Spain

Re: (done) dsb_textformat && dsb_bitmap_textout

Post by ian_scho »

Thanks! I'm in no hurry... Ahh, I've just read the DSB 0.36 thread :)))
Post Reply