Reputation: 364
I need to draw lines in a Morph, or at least I think I do. I managed to draw colored lines in a Form, so putting the Form inside a Morph should be fine as well, if that is even possible. How do I go about this?
I'm actually just trying to find a way to be able to draw graphics for a simple game while reacting to keyboard input. Keyboard input seems to be doable using a Morph, but now I'm stuck and I can't seem to find any examples doing anything like I want. Frankly, I find the lack of documentation disturbing.
Upvotes: 2
Views: 775
Reputation: 3141
Please have a look at the book "Squeak by Example" (Black et al.), especially the chapter "Creating and drawing your own morphs". It is available here, for example: https://hal.inria.fr/inria-00441576/file/SBE.pdf
If you have a Form already, you can use ImageMorph to display the Form. Class comment:
ImageMorph is a morph that displays a picture (Form). My extent is determined by the extent of my form.
Use #image: to set my picture.
You can compose Morphs with addMorph:
and friends, if you want to attach your image somewhere.
Upvotes: 3