GUI or swing??? help!!!

Started by majitri, October 04, 2009, 12:13:17 PM

Previous topic - Next topic

majitri

   
such a way that shows me a window of my interface would be:




   private void dialogoCorto(String texto){
         try{
            TextureManager tm = TextureManager.getInstance();
            backDrop = new Texture("ventanas"+File.separatorChar+"panel2.gif");   
            window = new Ventana(backDrop, 150, 15);
            aceptar = new Boton(77, 177, 138, 19);
            aceptar.setEtiqueta("Sí");
            aceptar.setListener(this);   
            cancelar = new Boton(298, 177, 138, 19);
            cancelar.setEtiqueta("No");             
            cancelar.setListener(this);   
            stateLabel = new Etiqueta(77, 77);
            stateLabel.setTexto(texto); 
            stateLabel.setTexto();         
            window.add(stateLabel);   
            window.add(aceptar);
            window.add(cancelar);   
         }
             catch(Exception e){}
      }   




How do I apply it like you're explaining?

majitri

   
I use
blit (Texture src, int srcX, srcY int, int destX, desty int, int width, int height, boolean transparent)

Does that slow you can do?

EgonOlsen

That's fine as long as you don't change the texture all the time. Maybe it would be helpful to actually define "slow". Which renderer are you using, how does your GUI looks like (screen shot?) and what's the frame rate?

majitri

  imagenes.enableRenderer (IRenderer.RENDERER_OPENGL, IRenderer.MODE_OPENGL);
  imagenes.disableRenderer (IRenderer.RENDERER_SOFTWARE);

Is that what you mean with the kind of processor?

I do not know how to add a picture to the forum, so I tell my windows GUI is similar to feud_demo project (in fact I have relied on it to make my interface and classes).

with slow I mean it starts to work fine, but when it is displayed multiple windows (to click on a button opens another window, closing the first) begins like to stay caught and spend a few seconds to display the window, but from there begins to take more

paulscode

Quote from: majitri on October 05, 2009, 11:49:19 AM
such a way that shows me a window of my interface would be:

   private void dialogoCorto(String texto){
         try{
            TextureManager tm = TextureManager.getInstance();
            backDrop = new Texture("ventanas"+File.separatorChar+"panel2.gif");   
            window = new Ventana(backDrop, 150, 15);
            aceptar = new Boton(77, 177, 138, 19);
            aceptar.setEtiqueta("Sí");
            aceptar.setListener(this);   
            cancelar = new Boton(298, 177, 138, 19);
            cancelar.setEtiqueta("No");             
            cancelar.setListener(this);   
            stateLabel = new Etiqueta(77, 77);
            stateLabel.setTexto(texto); 
            stateLabel.setTexto();         
            window.add(stateLabel);   
            window.add(aceptar);
            window.add(cancelar);   
         }
             catch(Exception e){}
      }   
How do I apply it like you're explaining?
I can't really get any more specific than I already have, without seeing your code for the Ventana, Boton, and Etiqueta classes.  It should be simple, to be completely honest.  You draw those things at some point, right?  Well instead of drawing them onto the applet/frame, draw them onto the guiImage instead.  And then apply the effect.

Quote from: majitri on October 05, 2009, 11:37:37 AM
You say:

  public void apply (int [] dest, int [] source)
         (
             PixelGrabber pg = new PixelGrabber (guiImage, 0, 0,
                                                 imageWidth,
                                                 imageHeight,
                                                 dest, 0, textureWidth);

but where guiImage and get those parameters?

Umm...
Quote from: paulscode on October 04, 2009, 11:34:52 PM
        guiImage = new BufferedImage( imageWidth, imageHeight,
                                   BufferedImage.TYPE_4BYTE_ABGR );

        //only needed if image dimensions are not powers of 2:
        textureWidth = nextPowerOf2( imageWidth);
        textureHeight = nextPowerOf2( imageHeight );



As the names imply, varriable 'guiImage' is the BufferedImage that you would draw your GUI onto, and varriables 'imageWidth' and 'imageHeight' are the dimensions you want that image to be.

EgonOlsen

Quote from: majitri on October 05, 2009, 09:52:41 PM
  with slow I mean it starts to work fine, but when it is displayed multiple windows (to click on a button opens another window, closing the first) begins like to stay caught and spend a few seconds to display the window, but from there begins to take more
A few SECONDS? ??? Now that IS slow. Do you have a fps counter implemented? Maybe the frame rate is actually fine and just the GUI itself is somehow delayed!?