[Newbies] Drag and dropped jpg (playing cards) - how to put in the "new morph" menu and create a PlayingCard class?

Edgar J. De Cleene edgardec2001 at yahoo.com.ar
Sun Oct 25 09:36:29 UTC 2009

On 10/25/09 4:29 AM, "Mike Stramba" <mikestramba at gmail.com> wrote:

> I'm runninng squeak 3.10.2 on windows XP.
> If I drag and drop a jpg onto Squeak, it creates a SketchMorph.
> Specficially, I'm adding a playing card image, well 52 of them, and
> I'd like to be able to add a card from the world menu / new morph
> menu.
> I'd also like to create a PlayingCard class, that uses the dropped jpg.
> At the moment I'm doing it the "hard way", after dropping the jpg, I'm
> digging through system dictionary, digging out the world objects, and
> "drilling down" to the dropped object.
> Any tips, info appreciated.
> Mike

I guess you wish do some kind of game.
So , take a look to older Squeaks when you have card games.
Also in my FunSqueak3.10alpha.7 you have the old FreCel still working.

But asking you question, if you have a directory with your .jpg could create
the morphs with this I copy from my old games.
If Spanish comments is difficult, send new mail and I try to help more.


-------------- next part --------------
'From Squeak3.8 of ''5 May 2005'' [latest update: #6665] on 25 October 2009 at 7:35:01 am'!
Dictionary subclass: #MisDibujos
	instanceVariableNames: ''
	classVariableNames: ''
	poolDictionaries: ''
	category: 'Morphic-Puzzle'!
!MisDibujos commentStamp: 'edc 1/19/2006 11:46' prior: 0!
Para guardar en el diccionario por unica vez las fotos que deseamos utilizar

MisDibujos elegirImagen!

"-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- "!

MisDibujos class
	instanceVariableNames: 'current'!

!MisDibujos class methodsFor: 'as yet unclassified' stamp: 'edc 1/19/2006 11:30'!
^current! !

!MisDibujos class methodsFor: 'as yet unclassified' stamp: 'edc 1/19/2006 11:31'!
current: anObject
current := anObject! !

!MisDibujos class methodsFor: 'as yet unclassified' stamp: 'edc 1/24/2006 10:06'!
	"could translate to chooseImage ,Lets the user choose folder with pictures  .
	Hay que hacer MisDibujos elegirImagen"
	| oldFolder newFolder listaArchivos misFotos |
	misFotos := self new.
	oldFolder := FileDirectory default.
	newFolder := FileList2 modalFolderSelector.
	FileDirectory setDefaultDirectory: newFolder pathName.
	listaArchivos := FileDirectory default fileNamesMatching: '*.jpg'.
	misFotos at: #Yellow put: (Form fromFileNamed: 'Yellow.gif').
		to: 5
		do: [:i | 

misFotos at:  i  put:(  RWBinaryOrTextStream with: (StandardFileStream readOnlyFileNamed: (listaArchivos at: i))contents) .

	FileDirectory setDefaultDirectory: oldFolder pathName.
	self current: misFotos
! !

More information about the Beginners mailing list