intfiction.org

The Interactive Fiction Community Forum
It is currently Sat May 25, 2013 3:23 pm

All times are UTC - 6 hours [ DST ]




Post new topic Reply to topic  [ 6 posts ] 
Author Message
 Post subject: images...
PostPosted: Sun Jul 03, 2011 1:35 am 
Offline

Joined: Tue Jun 07, 2011 10:06 pm
Posts: 35
*edited title name as I accidently put the wrong extension up ( i previously tried that extension, sorry)

So I have been reading every post on the I7 forums that has the word image in it to try and get a handle on this, but I am just not getting something. Here is the code pertaining to images:

Code:
Include the Basic Screen Effects by Emily Short.
Include the Glulx Entry Points by Emily Short.
Include the Glimmr Canvas-Based Drawing by Erik Temple.

Figure of intro is the file "intro.jpg".
Figure of greetingtalk is the file "greetingTalk.jpg".
Figure of greetingwave is the file "greetingWave.jpg".

The graphics-window is a graphics g-window spawned by the main-window. The position is g-placeabove.  The measurement is 200.  The back-colour is g-dark-grey.

The graphics-canvas is a g-canvas.    The associated canvas of the graphics-window is the graphics-canvas.

The current image is a figure-name that varies.  The current image is Figure of greetingwave.

To depict (f - a figure-name):
     change the current image to f.

Carry out looking:
   depict figure of intro;
   continue the action.
   
When play begins:
     open up the graphics-window;
     depict Figure of greetingwave;
     say, "Welcome..."
     wait for any key;
     clear the screen;
     depict Figure of greetingtalk;
     say, "Blah, blah, blah!"
     wait for any key;
     clear the screen;
     continue the action.

No picture displays at all. I can get a picture to display by putting in:
Code:
The background image is Figure of greetingwave.

But it will not change the image.
So I tried changing:

Code:
To depict (f - a figure-name):
     change the current image to f.

to:
Code:
To depict (f - a figure-name):
     change the background image to f.

(since it seemed to at least understand and carry out the background image...)
That gives me a P31 error and still doesn't change the image.

If anyone could please help me out with this, I would be eternally grateful!

I know I am doing something wrong but I don't know what.


Top
 Profile Send private message  
 
 Post subject: Re: images...
PostPosted: Sun Jul 03, 2011 7:11 am 
Offline
User avatar

Joined: Fri Jun 25, 2010 5:37 am
Posts: 94
Location: Portugal
It doesn't display then on the IDE or on the build? Or both?

I've found sometimes my IDE won't show me the pictures, but if I release the story, the pictures are there.

_________________
This is a block of text that can be added to posts you make. There is a 255 character limit.


Top
 Profile Send private message  
 
 Post subject: Re: images...
PostPosted: Sun Jul 03, 2011 11:35 am 
Offline

Joined: Tue Jun 07, 2011 10:06 pm
Posts: 35
lribeiro wrote:
It doesn't display then on the IDE or on the build? Or both?

I've found sometimes my IDE won't show me the pictures, but if I release the story, the pictures are there.

Well I just tested out your theory, but it doesn't work either way.

Drat, I used Graphical Window Sprites with my last project and got that working fine (in the build also)... I thought handling one image at a time would be a much easier task, but I guess not.

Please, if anyone could help me out, I just don't get what I am doing wrong.


Top
 Profile Send private message  
 
 Post subject: Re: images...
PostPosted: Sun Jul 03, 2011 12:44 pm 
Offline

Joined: Thu Oct 22, 2009 4:31 pm
Posts: 1137
There are a couple of problems here:

1) You don't have any code to actually display the current image--all your "depict" phrase does is change the current image variable to a new figure name.
2) The reason you get the P31 error is that Glimmr Canvas-Based Drawing is designed to use multiple windows, so when you assign a background image to a canvas, you need to do specify which one. In other words, when you write "The background image is Figure of greetingwave," Inform interprets that as "The background image [of nothing] is...", and you get a runtime error. To get this to work, you need to say The background image of the graphics-canvas is Figure of greetingwave. You'll also need to redraw the window using "follow the window-drawing rules for the graphics-window" at an appropriate point in your code.

However, if all you want to do is show a single image, Glimmr Canvas-Based Drawing is really overkill (it's a souped-up version of Graphical Window Sprites). You might want to use Simple Graphical Window instead, which has simple built-in drawing rules. I believe that Jon Ingold has made that extension compatible with Flexible Windows, despite the differences in approach between the two extensions. Of course, if you're going to do other things in other graphics windows, the Glimmr extension might be more appropriate.

--Erik

_________________
Glimmr: Advanced Graphics for I7
blog | download | bug-tracker


Top
 Profile Send private message  
 
 Post subject: Re: images...
PostPosted: Sun Jul 03, 2011 12:55 pm 
Offline

Joined: Tue Jun 07, 2011 10:06 pm
Posts: 35
ektemple wrote:
There are a couple of problems here:

1) You don't have any code to actually display the current image--all your "depict" phrase does is change the current image variable to a new figure name.
2) The reason you get the P31 error is that Glimmr Canvas-Based Drawing is designed to use multiple windows, so when you assign a background image to a canvas, you need to do specify which one. In other words, when you write "The background image is Figure of greetingwave," Inform interprets that as "The background image [of nothing] is...", and you get a runtime error. To get this to work, you need to say The background image of the graphics-canvas is Figure of greetingwave. You'll also need to redraw the window using "follow the window-drawing rules for the graphics-window" at an appropriate point in your code.

However, if all you want to do is show a single image, Glimmr Canvas-Based Drawing is really overkill (it's a souped-up version of Graphical Window Sprites). You might want to use Simple Graphical Window instead, which has simple built-in drawing rules. I believe that Jon Ingold has made that extension compatible with Flexible Windows, despite the differences in approach between the two extensions. Of course, if you're going to do other things in other graphics windows, the Glimmr extension might be more appropriate.

--Erik

Well, I want to use more than one image, just one at a time though. I just want to be able to change the image for certain events.

Thank you so much, Erik! I had tried both of those phrases, just not in combination with eachother. :lol:
The new working code is:
Code:
Include the Basic Screen Effects by Emily Short.
Include the Glulx Entry Points by Emily Short.
Include the Glimmr Canvas-Based Drawing by Erik Temple.

Figure of intro is the file "intro.jpg".
Figure of greetingtalk is the file "greetingTalk.jpg".
Figure of greetingwave is the file "greetingWave.jpg".

The graphics-window is a graphics g-window spawned by the main-window. The position is g-placeabove.  The measurement is 200.  The back-colour is g-dark-grey.

The graphics-canvas is a g-canvas.  The associated canvas of the graphics-window is the graphics-canvas.  The background image of the graphics-canvas is Figure of greetingwave.

To depict (f - a figure-name):
     change the background image of the graphics-canvas to f;
     follow the window-drawing rules for the graphics-window.

Carry out looking:
   depict figure of intro;
   continue the action.
   
When play begins:
     open up the graphics-window;
     depict Figure of greetingwave;
     say "blah, blah, blah...";
     wait for any key;
     clear the screen;
     depict Figure of intro;
     continue the action.

THANK YOU AGAIN!!


Top
 Profile Send private message  
 
 Post subject: Re: images...
PostPosted: Sun Jul 03, 2011 1:48 pm 
Offline

Joined: Thu Oct 22, 2009 4:31 pm
Posts: 1137
anamri wrote:
Well, I want to use more than one image, just one at a time though. I just want to be able to change the image for certain events.


That's what I meant... Anyway, glad you got it working!

_________________
Glimmr: Advanced Graphics for I7
blog | download | bug-tracker


Top
 Profile Send private message  
 
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: No registered users and 2 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