Flexible Windows Question

Hi. I’m using Jon Ingold’s flexible windows extension. I’m wondering if there’s any means by which I could display an image to a windowed text buffer just like you can with the main-window, so that a window could display something like this:

John Doe
{Image of John Doe}
Eye Color: Brown
Height: 5’ 10"

I tried using the code from the Inventory Window and Picture example, but it just won’t compile. Here’s the error message:

Inform 6.32 for Win32 (18th November 2010) auto.inf(34749): Error: No such constant as "DrawScaled" Compiled with 1 error and 2876 suppressed warnings

Did you include the I6 code that you’ll find at the very end of the Inventory Window and Picture example? You need to, because that’s where the DrawScaled function (called by the window-drawing rules of the example) is actually defined.

Do you mean this one:

Include (- ! Doing scaling calculations in I6 lets us handle bigger numbers [ GetImageSize curimg index result; result = glk_image_get_info( ResourceIDsOfFigures-->curimg, gg_arguments, gg_arguments+WORDSIZE); return gg_arguments-->index; ]; [ DrawScaled figure g w_total h_total graph_height graph_width w_offset h_offset; graph_height = WindowSize(g, 1); graph_width = gg_arguments-->0; w_total = GetImageSize(figure, 0); h_total = gg_arguments-->1; if (graph_height - h_total < 0) ! if the image won't fit, find the scaling factor { w_total = (graph_height * w_total)/h_total; h_total = graph_height; } if (graph_width - w_total < 0) { h_total = (graph_width * h_total)/w_total; w_total = graph_width; } w_offset = (graph_width - w_total)/2; if (w_offset < 0) w_offset = 0; h_offset = (graph_height - h_total)/2; if (h_offset < 0) h_offset = 0; glk_image_draw_scaled(g.ref_number, ResourceIDsOfFigures-->figure, w_offset, h_offset, w_total, h_total); ]; -) .

then yes.

Did you follow the doc advise to copy paste from “this page”? In that case, try using the paste button instead!

The end result should look like this: [code]Include (-

	! Doing scaling calculations in I6 lets us handle bigger numbers

	[ GetImageSize curimg index result;
		result = glk_image_get_info( ResourceIDsOfFigures-->curimg, gg_arguments,  gg_arguments+WORDSIZE);
		return gg_arguments-->index;
	];

	[ DrawScaled figure g w_total h_total graph_height graph_width w_offset h_offset;
	graph_height = WindowSize(g, 1);
	graph_width = gg_arguments-->0;
	w_total = GetImageSize(figure, 0);
	h_total = gg_arguments-->1;

	if (graph_height - h_total < 0) !	if the image won't fit, find the scaling factor
	{
		w_total = (graph_height * w_total)/h_total;
		h_total = graph_height;

	}

	if (graph_width - w_total < 0)
	{
		h_total = (graph_width * h_total)/w_total;
		w_total = graph_width;
	}

	w_offset = (graph_width - w_total)/2; if (w_offset < 0) w_offset = 0;
	h_offset = (graph_height - h_total)/2; if (h_offset < 0) h_offset = 0;

	glk_image_draw_scaled(g.ref_number, ResourceIDsOfFigures-->figure, w_offset, h_offset, w_total, h_total); 
	];

-) .

[/code]
If it looks like this: Include (- ! Doing scaling calculations in I6 lets us handle bigger numbers [ GetImageSize curimg index result; result = glk_image_get_info( ResourceIDsOfFigures-->curimg, gg_arguments, gg_arguments+WORDSIZE); return gg_arguments-->index; ]; [ DrawScaled figure g w_total h_total graph_height graph_width w_offset h_offset; graph_height = WindowSize(g, 1); graph_width = gg_arguments-->0; w_total = GetImageSize(figure, 0); h_total = gg_arguments-->1; if (graph_height - h_total < 0) ! if the image won't fit, find the scaling factor { w_total = (graph_height * w_total)/h_total; h_total = graph_height; } if (graph_width - w_total < 0) { h_total = (graph_width * h_total)/w_total; w_total = graph_width; } w_offset = (graph_width - w_total)/2; if (w_offset < 0) w_offset = 0; h_offset = (graph_height - h_total)/2; if (h_offset < 0) h_offset = 0; glk_image_draw_scaled(g.ref_number, ResourceIDsOfFigures-->figure, w_offset, h_offset, w_total, h_total); ]; -) . all code goes on the same line. That’s normally not a problem in I6, but in this piece of code there are two comments (beginning with an ‘!’). and in I6 an exclamation mark comments out everything to the right on the same line – i.e., in this case, all of it! You should be able to fix it by deleting the comments – ‘! Doing scaling calculations in I6 lets us handle bigger numbers’ and ‘! if the image won’t fit, find the scaling factor’ – or by putting line breaks after them.

Thanks I’ll try this out immediately.

Well, the game compiled, but no images were being printed to the text buffer. Oh well. I guess I just have to make a graphics window like everyone else.