lunedì 29 settembre 2014

Android Unity 3d experimental game : Cubi

I'm playing with Unity 3D and I'm coding a small game called "Cubi".
I published it on Google Play: https://play.google.com/store/apps/details?id=com.bartoleo.cubi
I'm trying also Startapp as a way to monetize it.
Sources available here: https://github.com/bartoleo/cubi
in-game image

mercoledì 4 giugno 2014

giovedì 22 maggio 2014

formatTextInColumns.groovy


just made a small gist to format text with elements separated by char/string to fixed column:
https://gist.github.com/bartoleo/aab5ad2a8164eeae527b

example:
println "example1 without separators"
println formatTextInColumns("""\
aaa|bbbb|ccc
d|e|f|g
h|iiiiiiiiiii
jjjjjjj

end""","|",false)

println "example2 with separators"
println formatTextInColumns("""\
aaa|bbbb|ccc
d|e|f|g
h|iiiiiiiiiii
jjjjjjj

end""","|",true)

output:
example1 without separators
aaa     bbbb        ccc 
d       e           f   g 
h       iiiiiiiiiii 
jjjjjjj 

end     

example2 with separators
aaa    |bbbb       |ccc|
d      |e          |f  |g|
h      |iiiiiiiiiii|
jjjjjjj|
       |

end    |

venerdì 9 maggio 2014

Groovy experiments

Just sharing my groovy experiments on Github:


GFlappyAsciiBird

Flappy Bird ascii clone made in Groovy


GroovyAnsiMatrix

Matrix Falling Chars made in Ansi with Groovy

GRogueLike

Groovy RogueLike (not working ... sorry)

GPoly

Groovy Random Content with easy DSL declaration

GroovyAsciiTwitter

Twitter Ascii Viewer made with Groovy



lunedì 27 gennaio 2014

Idea 12 : How to write a live template with groovyscript inside

With Intellij Idea 12 you can write live templates (interesting post about this feature):

Live templates contain predefined code fragments. You can use them to insert frequently-used or custom code constructs into your source code file quickly, efficiently, and accurately.
(taken from official documentation)

in live template code you can use the groovyScript in expressions of variables to launch embedded groovy script code

with groovy script code you can evaluate templates with much more logic than with the template

to do this you must define a variable in the template text, for example you can use $GROOVY$, and then define the groovy script code using "edit variables"

after clicking it you can see a row for the GROOVY variable
Idea screenshot

you can now define groovy script editing expression field.

for example:

groovyScript("def result=\"from live template! method name ${_1}\"; return result", methodName())

in this sample groovyscript can access methodName using _1

there is a problem ... you must write all you script on a one-line! (I didn't find a way to write multi line code at the moment)

now I'll write a live template called 'logstart' which prints log.info( "<methodname>", "<parameters>")
where parameters will be in the form of <parametername>:${<paramtername>}

groovyScript("def parameters=''; def result='log.info(\"'+_2+'\",\"'; _1.each { parameters+=it+':${'+it+'},'}; result+=parameters[0..-2]+'\")'; return result",methodParameters(),methodName())

now writing logstart and pressing Tab in a method I have a log.info writing all the parameters received

mercoledì 29 maggio 2013

My first post

This is my first post,
I Live in Italy, I live with my family (my wife Roberta, and my 2 sons Alice and Luca)
I like coding and gaming.
I worked years in IT (mostly on Cobol, VB, Oracle, Centura, Java, Groovy, Grails... and a lot more than I can remember)
I like videogames, playing... and coding (I like Lua!!!)
Here you can find some of my projects
https://github.com/bartoleo
https://bitbucket.org/bartoleo