javafx jogos dos cabecudinhos 2 na tela

On March 10, 2009, in java, programacao, by athanazio
0

Opa Opa ! grande passo no jogo dos cabeçudinhos ! agora estão os dois na tela, e com movimentos independentes, um pequeno passo para os cabeçudos um grande passo para a vaca vitoria !! huauhahuahu
dois-personagens-na-tela

veja o video

Tagged with:
 

javafx processo de criação de interface

On March 10, 2009, in java, programacao, by athanazio
0

Uma das coisas mais poderosas no JavaFx na minha opiniao eh a possibilidade concreta de dividir esforços da equipe de desenvolvimento e da equipe de design em paralelo.

o resumo eh o seguinte :
a equipe de programação inicia o processo de desenvolvimento com retangulos, ou desenhos conceituais simples que foram criados em SVG e exportados para o JavaFx, enquanto isto a equipe de design pode criar as ilustrações definitivas e quando estiverem prontas serem encaixadas no projeto, permitindo a programação inclusive manipular items das ilustracoes atraves do ID.

vamos mostrar um exemplo passo a passo

o primeiro passo temos a imagem desenhada no inkscape, que vamos assinalar um ID para uma parte da imagem

object-properties

na tela de propriedades adicionamos o nome do corpo do personagem

object-properties2

note que este nome sera usado respeitando maiusculas e minusculas, permitindo que seja manipulado atraves do codigo Javafx pelo desenvolvedor. Agora o próprio designer para testar seu trabalho e deixar pronto para ser usado pela equipe de programação converte seu arquivo SVG para o formato FXZ do JavaFx, e faz isto abrindo o arquivo com o SVG converter que vem no Production Suite.

 open-with-svg-converter

e executa a conversão do arquivo

convertit

Agora o arquivo jah pode ser usado dentro do NetBeans, que oferece uma opção para realizar o preview do arquivo gerado sem sair da ferramenta, veja na tela abaixo

details-of-the-node

Repare que quando clicamos no elemento do corpo do personagem, podemos ver diversas caracteristicas do mesmo, inclusive o ID e o tipo do objeto que eh um Rectangle

Repare que na classa GameScene são definidos objetos do tipo NodeFromFXZ que eh um wrapper para a carga automática de arquivos do tipo FXZ, facilitando o processo de carga para dentro da aplicação.

E um interessante trecho de código que deve ser destacado, é a parte onde transformamos a cor do corpo do personagem de acordo com o jogador, ou seja o jogador1 fica com azul e o 2 com vermelho, veja neste trecho.

        (player1.lookup("JFX:body") as Rectangle).fill = Color.BLUE;

veja o resultado como ficou !!
corpinhos-coloridos

Tagged with:
 

arduino plaquinha da moléstia

On March 8, 2009, in trecos, by athanazio
0

Arre, que plaquinha legal ! deu ateh vontade de comprar uma a fazer umas coisas com controle remoto :)
arduino316

O Silveira Neto, postou com detalhes como usar com Java
http://silveiraneto.net/2009/03/01/arduino-and-java/

e esta eh a pagina do projeto http://www.arduino.cc/

Tagged with:
 

javafx planejando gravidade …

On March 6, 2009, in games, java, programacao, by athanazio
1

Nesta jornada de explorar JavaFx, e na migração do jogo que fizemos no evento do global game jam 2009, estou agora implementando a gravidade para o side scrolling.

Ou seja preciso de um mecanismo para manter os personagens no chão … e que possam dar uns pulinhos, e que não seja soh para cima possam ser pulinhos para os lados, vejam os rascunho que fiz no ônibus.

gravity-manager

A idéia é simples, uma classe para gerenciar a gravidade contendo as lista de plataformas onde será necessário verificar a colisão, para segurar o personagem, uma lista de GNodes que vao ter uma lista de forças que vao incidir sobre e o Node propriamente dito.

cada item que vai representar um Força vai possuir x, y percentual de gravidade que sera aplicado, uma funcao applyGravity(g) e outra para ver se pode remover o objeto da lista, isDisposable()

a logica do update do gravity manager eh :

  • calcular para cada GNode e para cada Força contida o deslocamento x e y do node
  • chamar para cada força o metodo applyGravity()
  • remover cada força que retornar true do isDisposable()

bem este é o plano, vamos ver se funciona :)

Tagged with:
 

javafx esta na área

On December 4, 2008, in java, programacao, by athanazio
0

Opa o esperado JavaFx, esta na área ! é uma iniciativa da Sun de assumir o poder e necessidade do desenvolvimento de interfaces, uma linguagem de script com fortes influências do Java e Javascript.

veja mais em http://javafx.com/

para aqueles que gostam de ler a API, existe uma bem rica que fornece a base para iniciar a implementacao http://java.sun.com/javafx/1/docs/api/master-index.html

minha bola de cristal ve possibilidades otimas para o javafx !! =)

Tagged with:
 

ant file para alterar a data de todos jsp

On October 14, 2008, in java, by athanazio
0

Arre que raiva de usar usar arquivo de include no jsp … quando mudo o header o server nao saca que tem que dar reload nos arquivos, dai tem que ficar abrindo e salvando na mao cada um … dureza !! a menos que alguma atividade cerebral se acometa sobre o seu ser e resolva automatizar isto … bem alguma atividade crebral aconteceu e fiz um ant file para isto, compartilho aqui para meus colegas sofredores … =)

<project name=”i need a hug” default=”touch” basedir=”.”>

   <description>Touch all the JSP files</description>

    

  <target name=”touch” >

 <touch verbose=”yes”>

     <fileset dir=”web”>

      <include name=”**/*.jsp”/>

     </fileset>

 </touch>

  </target>

</project>

Tagged with:
 

sioti eh legal

On April 27, 2008, in games, java, sioti, by athanazio
0

arre !

eu e mais um grupo de loucos esta trabalhando em um projeto de jogo ! imagino que muita gente jah comecou projetos assim, mas espero que possamos nao soh comecar como tambem colocar no ar o projeto !! jah tem umas 3 semanas que comecamos a trabalhar e algumas coisas jah comecaram a criar vida, e jah comecaram a sair do papel !

para ver as novidades do que estamos fazendo visite www.sioti.com em breve a estoria do jogo vai estar lah disponivel bem como outras informacoes legais !

jah temos ateh um cubo andando no cenario !! huahuahuahua que tosqueira puro teste tecnico mesmo, mas se quizer ver esta online … http://www.youtube.com/watch?v=uOrRReoJIKw

e nesta empreitada, meus horarios livres sao para mergulhar no blender, jmonkey engine, pesquisar bichos, plantas, modelos 3d, estorias, roupas, armaduras, coordenar a galera, acordar uns e outros, sorrir junto, chorar junto, caminhar, caminhar, caminhar … vamos caminhando e quem sabe nesta jornada saimos com um jogo interessante para se jogar :)

o mais importante eh fazermos algo que seja divertido de fazer e divertido de jogar !!

e vamos caminhando

Tagged with:
 

working with isometric maps

On February 21, 2008, in games, java, by athanazio
7

Ok, I’m working on my own time to create a game, and exploring technical possibilities on this adventure !

In the beginning I was planning to do the map 2D plain, the coordinates 10,10 would be easy to calculate, was just a matter of multiply the x,y by the width and height of the small tile that would be in the screen.

isometric1.png

But nothing is simple ! My daughters are helping me on the discussions of the game, and also helped to create the map, thanks girls you are the best daughters !! The 8 years old one come with the great idea ! Hey dad, why don’t you make the game like the age of empires or warcraft III maps ? a little bit shifted back … Oh well that began all of this :)

Now I have a new map to work with

isometric2.png

And the nice problem of how to convert from a screen coordinate to the map coordinates ? remember that in this case the screen 0,0 is the top left point of the window.

(more…)

Tagged with:
 

game protocols

On January 21, 2008, in games, java, programacao, by athanazio
0

I’ve been thinking about games protocols… read some stuff about protocol hacking, bots, and many sorts of wierd stuff… But I began to as k myself if the usage of HTTP to send the data would be too slow, cause by using this, we could for example have a backend made in PHP, or Java or wherever language that fits better, and have all the benefits of an mature server solution as Http servers. Things like load balance and security are already tested and solved in the Http world, so why reinvent the wheel by creating custom protocols, and custom server implementations ?

I hope I can do some proof of concept on this, I’m planning to use Pulpcore as UI framework … lets see what happens :)

Tagged with:
 

pretty cool protocol test

On January 9, 2008, in java, by athanazio
0

In this very detailed protocol test, we can see Spring http invoker beating some big guys :)

 http://daniel.gredler.net/2008/01/07/java-remoting-protocol-benchmarks/

Tagged with:
 

organize my mind – mynotes is coming

On January 8, 2008, in java, by athanazio
3

Oh well, I was used to have my scrapbook close to me all the time, take notes with my pentel 0.7 :) , save my todo lists and so on, but … I want to save some trees, and tried some stuff:

- text files, they lack of formatting features :) but are very nice, I can’t add an image, and the information is organized pretty much top to bottom… this is bad, my mind works in a different organization

- mind maps, oh well very nice, but also complicated, and at most what really annoyed me was the fact that the things are AUTO organized, so I can’t do my personal mess, have some piles of stuff that I don’t use (but have to keep it :] ) have for example multitagging system for nodes. Imagine that you are taking notes in a meeting, and some information should be in the action itens, but you also want to see your things, byt tagging things with your name on it…

I thinking on creating an application to do this, not sure if will be done, or when … but the idea is coming, there some basic premisses that I want to follow:

- assume things by default (I hate next next next finish)

- small footprint of memory and processor

- only make infomation in a shareable format when want to (export as xml instead of keep it as xml)

- make client server (even for local) with regular http calls

- made in Java

Beside this, I have some technical plans, use jetty as server + hsqldb to save all the data, please feel free to shoot your suggestions and complaints in this area, let’s if we can do something together … :)

cheers

[edit]

and off course want to use jgraph to create the UI, I hope it can be flexible as need hehehhe

Tagged with:
 

aprendendo Java com o BOPE !

On October 17, 2007, in java, by athanazio
0
Tagged with:
 

cool error output …

On June 22, 2007, in java, by athanazio
0

no words …

cool_error.jpg

Tagged with:
 

windows registry with Java

On June 20, 2007, in java, by athanazio
0

Oh well, I already saw some hacks around but this one was great ! whoever implement this, used the internal methods of Preferences class that uses windows registry, to allow access to any other node in the registry bellow HKEY_CURRENT_USER and HKEY_LOCAL_MACHINE, it´s a pretty cool idea, you can check the original code at http://www.jroller.com/page/lenkite?entry=use_pure_java_to_access

and some changes that I made over the code …





import java.lang.reflect.Method;
import java.util.prefs.Preferences;

/**

 * used to read data from windows registry in the rootkeys :

 * HKEY_CURRENT_USER and HKEY_LOCAL_MACHINE

 

 * see the usage at the main method bellow

 

 */

public class Registry {

  final int KEY_READ = 0×20019;

  private boolean invalidState = true;

  private final Preferences userRoot = Preferences.userRoot();

  private final Class clz = userRoot.getClass();

  private Method mOpenKey = null;

  private Method mCloseKey = null;

  private Method mWinRegQueryValue = null;

  private Method mWinRegEnumValue = null;

  private Method mWinRegQueryInfo = null;

  private static final Class[] parms1 = byte[].class, int.class, int.class };

  private static Registry instance;

  // sample usage

  public static void main(String[] argsthrows Exception {

    System.out.println(Registry.getInstance().readKey(“HKEY_CURRENT_USER/Software/Microsoft/Windows/CurrentVersion/Run/Skype”));

    System.out.println(Registry.getInstance().readKey(“HKEY_LOCAL_MACHINE/SOFTWARE/Adobe/Acrobat Reader/7.0/Language/UI”));

  }

  public static Registry getInstance() throws Exception {

    if (instance == null) {

      instance = new Registry();

    }

    if (instance.invalidState) {

      throw new Exception(“Windows Registry reader invalid state”);

    }

    return instance;

  }

  private Registry() {

    try {

      mOpenKey = clz.getDeclaredMethod(“openKey”, parms1);

      mOpenKey.setAccessible(true);

      Class[] parms2 = int.class };

      mCloseKey = clz.getDeclaredMethod(“closeKey”, parms2);

      mCloseKey.setAccessible(true);

      Class[] parms3 = int.class, byte[].class };

      mWinRegQueryValue = clz.getDeclaredMethod(“WindowsRegQueryValueEx”, parms3);

      mWinRegQueryValue.setAccessible(true);

      Class[] parms4 = int.class, int.class, int.class };

      mWinRegEnumValue = clz.getDeclaredMethod(“WindowsRegEnumValue1″, parms4);

      mWinRegEnumValue.setAccessible(true);

      Class[] parms5 = int.class };

      mWinRegQueryInfo = clz.getDeclaredMethod(“WindowsRegQueryInfoKey1″, parms5);

      mWinRegQueryInfo.setAccessible(true);

      invalidState = false;

    catch (SecurityException e) {

      invalidState = true;

    catch (NoSuchMethodException e) {

      invalidState = true;

    }

  }

  public static final String HKEY_CURRENT_USER = “HKEY_CURRENT_USER”;

  public static final String HKEY_LOCAL_MACHINE = “HKEY_LOCAL_MACHINE”;

  public String readKey(String fullName) {

    String result = null;

    String[] tokens = fullName.split(“/”);

    String rootNode = tokens[0];

    StringBuffer key = new StringBuffer();

    for (int i = 1; i < tokens.length - 1; i++) {

      key.append(tokens[i]);

      key.append(‘\\’);

    }

    if (key.length() 0)

      key.deleteCharAt(key.length() 1);

    String name = tokens[tokens.length - 1];

    if (rootNode.equals(HKEY_CURRENT_USER)) {

      result = readKey(Preferences.userRoot(), key.toString(), name);

    }

    if (rootNode.equals(HKEY_LOCAL_MACHINE)) {

      result = readKey(Preferences.systemRoot(), key.toString(), name);

    }

    return result;

  }

  public String readKey(Preferences preferences, String key, String name) {

    String value = null;

    try {

      Object[] openKeyParameters = toByteArray(key)new Integer(KEY_READ)new Integer(KEY_READ) };

      Integer hSettings = (IntegermOpenKey.invoke(preferences, openKeyParameters);

      Object[] queryParameters = hSettings, toByteArray(name) };

      byte[] b = (byte[]) mWinRegQueryValue.invoke(preferences, queryParameters);

      value = (b != null new String(b).trim() null);

      Object[] objects3 = hSettings };

      mCloseKey.invoke(Preferences.userRoot(), objects3);

    catch (Exception e) {

      System.out.println(“Error getting user’s data from Windows registry:”);

      e.printStackTrace();

    }

    return value;

  }

  private static byte[] toByteArray(String str) {

    byte[] result = new byte[str.length() 1];

    for (int i = 0; i < str.length(); i++) {

      result[i(bytestr.charAt(i);

    }

    result[str.length()] 0;

    return result;

  }

}


Other way to do this would be a call to the command line “reg” [I didn´t klnow this guy ....=) ] that have pretty cool options , and using this any key from the registry would be accessible.

these are the options :

E:>regConsole Registry Tool for Windows - version 3.0Copyright (C) Microsoft Corp. 1981-2001.  All rights reserved

REG Operation [Parameter List]

Operation  [ QUERY   | ADD    | DELETE  | COPY    |

SAVE    | LOAD   | UNLOAD  | RESTORE |

COMPARE | EXPORT | IMPORT ]

Return Code: (Except of REG COMPARE)

0 - Succussful

1 - Failed

For help on a specific operation type:

REG Operation /?

Examples:

REG QUERY /?

REG ADD /?

REG DELETE /?

REG COPY /?

REG SAVE /?

REG RESTORE /?

REG LOAD /?

REG UNLOAD /?

REG COMPARE /?

REG EXPORT /?

REG IMPORT /?
Tagged with: