domenica 26 febbraio 2017

Trasformare un0immagine SVG in PNG

Il programmatore Cappellan ha creato un programma per convertire le immagini SVG (quelle vettoriali) in PNG:

Il programma permette di scrivere il codice SVG e vedere il risultato.
Potete scaricarlo da qui:

Potete vedere degli aggiornamenti da qui: http://forums.livecode.com/viewtopic.php?f=11&t=28384#unread

sabato 25 febbraio 2017

Nuova versione livecode

E' uscito livecode 9 dp5, vediamo le novità:
  • E' possibile leggere i dati delle trasmissioni NCF su Android con la funzioni:
    • mobilesNFCAvailable()
    • mobilesNFCEnabled()
    • mobileEnableNFCDispatch
    • mobileDisableNFCDispatch
    • nfcTagReceived
  •  revVideograbber è disponibile solo so Windows. 
  • Si può usare localhost negli indirizzi dei socket, con la seguente sintassi:
    opensocket from ":8080" to "10.2.1.1:8080"
  • cambiamenti ai messaggii nterni del messeage box
Come al solito le versioni sono tutte scaricabili su: http://downloads.livecode.com/livecode/

martedì 21 febbraio 2017

Apimac

La società italiana Apimac realizza app per Mac e iOS con livecode, potete vedere il sito a questa pagina: http://www.apimac.com
Tra le app prodotto ecco alcune delle più famose:
  • Timer/orologio
  • Criptazione file
  • iNotepad
  • iDatabase
  • cartelle segrete per Mac
  • Compressore file per MAx
  • Clean text
  • slideshow
  • Cripta email
  • Self timer

domenica 19 febbraio 2017

Tree view widget

Il widget tree view permette di creare una vista ad albero, vediamo come funziona.
La proprietà principale è l'arraydata, questa proprietà è un vero array dove ogni chiave rappresenta la voce stessa. Prima di cominciare vi consiglio di settare la proprietà readOnly su true. Ad esempio con questo codice:


   put empty into temp["Lunedì"]["Carlo"]
   put empty into temp["Lunedì"]["Mario"]
   put empty into temp["Martedì"]["Giovanna"]
   put empty into temp["Martedì"]["Laura"]
   set the sortType of widget 1 to "text"
   set the sortOrder of widget 1 to "ascending"
   set the arraydata of widget 1 to temp

otterrete questo:
Non c'è limite al numero di nodi e sotto nodi che potete fare.
Inoltre se una voce non è un nodo per altre voci, potete anche assegnargli un valore. Esempio:
   put "$ 10" into temp["Lunedì"]["Carlo"]
   put "$ 20" into temp["Lunedì"]["Mario"]
   put "ristorante" into temp["Martedì"]["Giovanna"]
   put "parco" into temp["Martedì"]["Laura"]
   set the sortType of widget 1 to "text"
   set the showseparator of widget 1 to true
   set the sortOrder of widget 1 to "ascending"
   set the arraydata of widget 1 to temp


Risultato:

mercoledì 15 febbraio 2017

giovedì 2 febbraio 2017

ControlAtLoc e ControlAtScreenLoc

Oggi vediamo due funzioni che ci dicono cosa c'è in un punto della finestra del nostro programma ControlAtLoc() e ControlAtScreenLoc().
Entrambi vi dicono cosa c'è in una posizione, ad esempio:

if controlAtLoc("10,10") is not empty then
   put the name of controlAtLoc("10,10") into temp
   answer "In posizione 10,10 c'è " & temp
end if

controlla cosa c'è alla posizione 10,10 della finestra corrente e se c'è qualcosa vi avverte.
La funzione ControlAtScreenLoc() è simile ma misura partendo dall'angolo in alto a sinistra dello schermo.
Possiamo sfruttare questa funzione per creare un gioco del puzzle, perchè basta controllare che i pezzi siamo in determinati punti. Se prendiamo ad esempio il baricentro della posizione corretta di un pezzo come punto di controllo, abbiamo un controllo preciso, ma non eccessivamente, giusto per capire se l'untente ha messo in ordine i pezzi.
Ad esempio per fare questo programma:


Basta creare 6 immagini vuote, un gruppo che le contenga, una cornice "qq" attorno al gruppo, un pulsante per caricare una nuova immagine e un pulsante come behavior per tutte e 6 le immagini.
Codice pulsante per caricare:
on mouseUp
   posizionacartella
   lock screen
   resetta
   answer file "scegli immagine"
   put it into temp
   create image
   set the filename of the last image to temp
   set the rect of the last image to the rect of group 1
   put "imm1,imm2,imm3,imm4,imm5,imm6" into lista      
   repeat for each item tItem in lista      
      export snapshot from rect ( the rect of image titem ) of this card to file tItem AS JPEG
      set the filename of image tItem to empty
      set the filename of image tItem to tItem
      set the loc of image titem to (random(383), random(257))
   end repeat   
   set the rect of group 1 to the rect of graphic "qq"
   delete the last image   
   unlock screen
end mouseUp

on resetta
   repeat with i=1 to 6
      set the rect of image i to the inizio of image i
   end repeat
end resetta

on posizionacartella
   set itemDel to "/"
   set the defaultFolder to item 1 to -2 of (the effective fileName of this stack)
end posizionacartella


Codice del behavior per tutte le immagini:

on MouseDown
   grab me   
end MouseDown

On MouseUp
   controlla
end MouseUp

on controlla
   put "imm1,imm2,imm3,imm4,imm5,imm6," into lista   
   if controlatloc("79,73") is not empty then    put the short name of controlatloc("79,73") & comma after posizione
   if controlatloc("199,73") is not empty then put the short name of controlatloc("199,73") & comma after posizione
   if controlatloc("319,73") is not empty then put the short name of controlatloc("319,73") & comma after posizione
   if controlatloc("79,193") is not empty then put the short name of controlatloc("79,193") & comma after posizione
   if controlatloc("199,193") is not empty then put the short name of controlatloc("199,193") & comma after posizione
   if controlatloc("319,193")is not empty then put the short name of controlatloc("319,193") & comma after posizione
   if lista = posizione then
      answer "Vinto"
   end if
end controlla


Fine, non serve altro.