intfiction.org

The Interactive Fiction Community Forum
It is currently Mon Sep 24, 2018 5:31 am

All times are UTC - 6 hours [ DST ]




Post new topic Reply to topic  [ 6 posts ] 
Author Message
PostPosted: Fri Aug 17, 2018 11:03 am 
Offline

Joined: Wed Aug 13, 2008 11:39 am
Posts: 37
So, using Flexible Windows, I recognize that one can set up a "text buffer" or "graphical" window and that the very first word of "text buffer" is "text." And yet I'm going to plow ahead and ask: can one display figures in a text buffer window? I notice that when you focus on a different window and use "display", the image still shows up in the main window.

I guess what's not clear to me is whether there really is a fundamental difference between the main window and the other windows which explains why one can produce inline images along with text in the main window, or whether that is something that can be worked around with Glulx.


Top
 Profile Send private message  
Reply with quote  
PostPosted: Fri Aug 17, 2018 11:22 am 
Offline

Joined: Sat Jan 23, 2010 4:56 pm
Posts: 5754
It can be worked around. All text buffer windows have the same capabilities.

The low-level (I6) VM_Picture function is written to always send the image to the main window, but it should be easy to write a modified version.


Top
 Profile Send private message  
Reply with quote  
PostPosted: Fri Aug 17, 2018 1:29 pm 
Offline

Joined: Wed Aug 13, 2008 11:39 am
Posts: 37
Thanks. Would I be correct to surmise that this is the bit of I6 code that I'd want to pursue modifying?

Code:
@c
[ VM_Picture resource_ID;
   if (glk_gestalt(gestalt_Graphics, 0)) {
      glk_image_draw(gg_mainwin, resource_ID, imagealign_InlineCenter, 0);
   } else {
      print "[Picture number ", resource_ID, " here.]^";
   }
];


Top
 Profile Send private message  
Reply with quote  
PostPosted: Fri Aug 17, 2018 1:39 pm 
Offline

Joined: Sat Jan 23, 2010 4:56 pm
Posts: 5754
Right. Replace the global "gg_mainwin" with however Flexible Window stores the I6 reference value for your chosen text buffer window. I don't remember offhand how it handles its data structures.


Top
 Profile Send private message  
Reply with quote  
PostPosted: Fri Aug 17, 2018 5:12 pm 
Offline
User avatar

Joined: Wed Oct 14, 2009 4:02 am
Posts: 2525
Code:
glk_image_draw( win.(+ ref number +), resource_ID, imagealign_InlineCenter, 0);


If "win" is a function argument.


Top
 Profile Send private message  
Reply with quote  
PostPosted: Fri Aug 17, 2018 11:56 pm 
Offline

Joined: Wed Aug 13, 2008 11:39 am
Posts: 37
Thanks! I got this to work. For posterity, this was what I had to change (using Flexible Windows)...

Code:
To jf-display (F - figure name) in (win - a g-window):
   (- DisplayFigureAlt({win}, ResourceIDsOfFigures-->{F}, {phrase options}); -).

Include (-
[
DisplayFigureAlt win resource_ID;
   print "^"; VM_PictureAlt(win, resource_ID); print "^";
];
-)

Include (-
[
VM_PictureAlt win resource_ID;
   if (glk_gestalt(gestalt_Graphics, 0)) {
      glk_image_draw( win.(+ ref number +), resource_ID, imagealign_InlineCenter, 0);
   } else {
      print "[Picture number ", resource_ID, " here.]^";
   }
];
-)


Top
 Profile Send private message  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 

All times are UTC - 6 hours [ DST ]


Who is online

Users browsing this forum: ralphmerridew and 9 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group