Please, any advice or suggestions would be appreciated.
I thought that as my first "major" Squeak project, I'd translate a game that I had written in Ruby...but the concept seems wrong.
In the original game a tile (gtk: label) with a series of letters would display at the top of the screen, and below it there would be four pictures (xpm, gif, whatever was convenient) on "buttons". Clicking the button that matched the tile would advance to a new scenario with a different label and different pictures. (In this particular game it was music note names and images of the note on either a bass or a treble staff.)
In the original, the images were left on the disk, and only read in as needed (to conserve memory).
In Squeak...well, in the first place I can't figure out how to read a note and place it on a button (which is only then "opened in the world"). Squeak appears to want the images to be read in ahead of time, one by one, and placed by hand, but I suspect that this is my inexperience. Also, when the image is read in, it seems to be assigned an arbitrary ID (reasonable), but what I would want to do is to store them in an ordered collection, and access them by ???? name? index? octave?
If I could read in an image and place it into a button, then I could do a straight translation. But would this be the proper approach? I thought I might find the proper approach by studying the code for the FreeCell game, as in many ways it appears to be a similar problem, but the approach they take appears to be drawing the images on the fly, and the thought of trying to program the drawing of bass and treble signs fills me with such trepidation that I feel this MUST be the wrong approach.
Charles Hixson wrote:
Please, any advice or suggestions would be appreciated.
I thought that as my first "major" Squeak project, I'd translate a game that I had written in Ruby...but the concept seems wrong.
In the original game a tile (gtk: label) with a series of letters would display at the top of the screen, and below it there would be four pictures (xpm, gif, whatever was convenient) on "buttons". Clicking the button that matched the tile would advance to a new scenario with a different label and different pictures. (In this particular game it was music note names and images of the note on either a bass or a treble staff.)
In the original, the images were left on the disk, and only read in as needed (to conserve memory).
Hi, how about SketchMorph fromFile:'note.gif' Karl
In Squeak...well, in the first place I can't figure out how to read a note and place it on a button (which is only then "opened in the world"). Squeak appears to want the images to be read in ahead of time, one by one, and placed by hand, but I suspect that this is my inexperience. Also, when the image is read in, it seems to be assigned an arbitrary ID (reasonable), but what I would want to do is to store them in an ordered collection, and access them by ???? name? index? octave?
If I could read in an image and place it into a button, then I could do a straight translation. But would this be the proper approach? I thought I might find the proper approach by studying the code for the FreeCell game, as in many ways it appears to be a similar problem, but the approach they take appears to be drawing the images on the fly, and the thought of trying to program the drawing of bass and treble signs fills me with such trepidation that I feel this MUST be the wrong approach.
Hi charles
may you want to have a look at the BreakOut I wrote a while back, because teaming Morphic is sometimes not trivial.
Please, any advice or suggestions would be appreciated.
I thought that as my first "major" Squeak project, I'd translate a game that I had written in Ruby...but the concept seems wrong.
In the original game a tile (gtk: label) with a series of letters would display at the top of the screen, and below it there would be four pictures (xpm, gif, whatever was convenient) on "buttons". Clicking the button that matched the tile would advance to a new scenario with a different label and different pictures. (In this particular game it was music note names and images of the note on either a bass or a treble staff.)
In the original, the images were left on the disk, and only read in as needed (to conserve memory).
I would suggest you to load them and save them as class method. Have a look at MenuIcon to get an idea
importIconNamed: aString "self importIconNamed: 'Icons16:appearanceIcon'"
| writer image stream | writer := GIFReadWriter on: (FileStream fileNamed: aString, '.gif'). [ image := writer nextImage] ensure: [writer close]. stream := ReadWriteStream on: (String new). stream nextPutAll: aString ; cr. stream nextPutAll: (self methodStart: aString). image storeOn: stream. stream nextPutAll: self methodEnd. MenuIcons class compile: stream contents classified: 'accessing - icons' notifying: nil. ^ stream contents
In Squeak...well, in the first place I can't figure out how to read a note and place it on a button (which is only then "opened in the world"). Squeak appears to want the images to be read in ahead of time, one by one, and placed by hand, but I suspect that this is my inexperience. Also, when the image is read in, it seems to be assigned an arbitrary ID (reasonable), but what I would want to do is to store them in an ordered collection, and access them by ???? name? index? octave?
If I could read in an image and place it into a button, then I could do a straight translation. But would this be the proper approach? I thought I might find the proper approach by studying the code for the FreeCell game, as in many ways it appears to be a similar problem, but the approach they take appears to be drawing the images on the fly, and the thought of trying to program the drawing of bass and treble signs fills me with such trepidation that I feel this MUST be the wrong approach.
Stef
Charles Hixson puso en su mail :
If I could read in an image and place it into a button, then I could do a straight translation. But would this be the proper approach? I thought I might find the proper approach by studying the code for the FreeCell game, as in many ways it appears to be a similar problem, but the approach they take appears to be drawing the images on the fly, and the thought of trying to program the drawing of bass and treble signs fills me with such trepidation that I feel this MUST be the wrong approach.
Besides Karl and Stephane advice:
f _ Form fromFileNamed: 'YouFile.xxx'. "select the proper path. Graphic files could be .gif, png, .jpg" esteBoton _ IconicButton new. "Create instance of IconicButton "
esteBoton labelGraphic: f. "now the button have your graphic " esteBoton openInWorld.
You could have a Dictionary with names and pictures as: musicDuration := Dictionary new. musicDuration at: #whole put: aIconicButton. musicDuration at: #half put: aIconicButton. musicDuration at: #quarter put: aIconicButton.
Naturally, the instances should match the right picture.
I glad to assist if you need/wish, I on Squeak now.
Edgar
___________________________________________________________ 1GB gratis, Antivirus y Antispam Correo Yahoo!, el mejor correo web del mundo http://correo.yahoo.com.ar
Charles Hixson wrote:
Please, any advice or suggestions would be appreciated.
OK. Based on the suggestions and approaches proposed so far (Thanks, all!) it sounds like a straight-forward translation is the appropriate response. (And thanks again for suggestions as to how to do the uncertain steps in the translation.)
squeak-dev@lists.squeakfoundation.org