On Fri, 30 Aug 2002 00:03:37 -0400 Alan Grimes alangrimes@starpower.net wrote:
I think that all I need to do now to get morphic working in my AI window is to start the stepping clock... However the most obvious methods for doing this are still in beta, as I discovered. =\
Here is my init method:
initialize "Try to make an space. | ex ex _ 400@300 super initialize. self image: (Form extent: ex depth: 8). super extent: image extent self isOpaque: true.
"Try to set up morphic" AICanvas _ FormCanvas on: image.
I am fairly certain it works to this point because sending a message to change the fill color to AICanvas changes the color of the rectangle on the screen. -- AFTER I CLICK ON IT!!!
As stated, yes. If you ask a morph to change its color (sending #color:, e.g.), the morph will notify the World (through it chain of owners) that it needs to be redrawn. If, however, you change the color of something else, like AICanvas, (which is an instance variable? a class variable?) then what you are missing is some way for the World to know about the change. So, what you probably want to do is to say
MorphicWorld color: Color magenta.
and let #color: handle both the changing of the color AND the notification to the World that redrawing is needed.
AIWorldState _ WorldState new canvas: AICanvas MorphicWorld _ PasteUpMorph new initForProject: AIWorldState; extent: ex; color: color; startBackgroundProcess.
I don't know what to do after this step or even if I am emotely on the right track at this juncture. I have been comparing the structure of the mini-morphic I am trying to set up to the project structure and have found that they are identical. =\
The only difference I have discovered is that the world morph of the project is getting clock ticks from somewhere by some method while the counters in the mini-morphic are stalled.
Your example isn't quite complete enough to replicate here. How did you actually get MorphicWorld to appear on the screen, e.g.? Do consider that Projects/Worlds are somewhat special things. Unless you really need what they offer, other, simpler, morphs will be easier to use.
Again, this is in persuit of my goal of setting up a visable field for the AI to play with.
BTW: I realized that my Squeak v3 sources is not the curren Squeak V3 sources... A more useful file-name would be appreciated. =\
Wild guess - are you complaining the the source for the system is split between 2 files (.sources and .changes)?
Cheers, Bob
Bob Arning wrote:
I am fairly certain it works to this point because sending a message tochange the fill color to AICanvas changes the color of the rectangle on the screen. -- AFTER I CLICK ON IT!!!
As stated, yes. If you ask a morph to change its color (sending
#color:, e.g.), the morph will notify the World (through it chain of owners) that it needs to be redrawn. If, however, you change the color of something else, like AICanvas, (which is an instance variable? a class variable?)<<<<
Instance varriable.
I just tried force-setting the owner to "AIWorld" (the class I'm develing). (using privateOwner: ) No change in behavior.
then what you are missing is some way for the World to know
about the change. So, what you probably want to do is to say <<<<
MorphicWorld color: Color magenta.
and let #color: handle both the changing of the color AND the notification to the World that redrawing is needed.
Tried it, Duzn't work. Thanks for the idea though.
The only difference I have discovered is that the world morph of the project is getting clock ticks from somewhere by some method while the counters in the mini-morphic are stalled.
Your example isn't quite complete enough to replicate here. How did you actually get MorphicWorld to appear on the screen, e.g.?
I don't think it is displaying on the screen. The entire thing is a subclass of ImageMorph. The method I showed you tried to make the image a canvas and then making the canvas of WorldState a canvas, then finally trying to throw a pasteUpMorph onto the viewplane.
But clearly there is some problem there because color: color. --or-- color: Color magenta does nothing to change the color of the display.
Do consider that Projects/Worlds are somewhat special things. Unless you really need what they offer, other, simpler, morphs will be easier to use.
I am uncertain. I am basically applying a greedy algorithm to the problem. -- one that always takes the cheapest next step.
I need a pixel-mapped view-plane that can be viewed on the sceen and inspected by a set of processing classes to be developed at some point in the future.
The ImageMorph class I am currently using APPEARS TO BE a viable approach so therefore I move on to the next problem.
I require that the AI have a "play-pen" containing some toys that can be explored and manipulated as well as a means for it to communicate with the user through mouse gestures and text messages.
It seems to get the most bang for my buck towards this goal, I want to get morphic functioning within the AI's visual field and then use it to display things such as "ChessMorph" and the AI's highly simplified menus.
Unless I am missing something, this seems to be the correct approach.
So how do I get it working?
On Friday 30 August 2002 12:28 pm, Alan Grimes wrote:
I need a pixel-mapped view-plane that can be viewed on the sceen and inspected by a set of processing classes to be developed at some point in the future.
But you have one already.
It's "Display bits"; you can get Forms from (copies of) parts of it by using Form fromDisplay: rect
Try this, for instance: (Form fromDisplay: (0@0 corner: 300@300)) openAsMorph
If you need to display things on top of it, you can use a SketchMorph or ImageMorph (or subclass that ignores mouse events); just make sure its morphicLayerNumber is high enough to stay on top.
If you need to display things under it, you can use a SketchMorph or ImageMorph (or subclass that ignores mouse events).
squeak-dev@lists.squeakfoundation.org