Java-Gaming.org    
Featured games (91)
games approved by the League of Dukes
Games in Showcase (580)
games submitted by our members
Games in WIP (500)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
   Home   Help   Search   Login   Register   
  Show Posts
Pages: [1]
1  Java Game APIs & Engines / Android / Re: java.lang.OutOfMemoryError: bitmap size exceeds VM budget on: 2010-03-30 07:34:31
Have you tried using SoftReferences for referencing the bitmaps?

This way the GC should clear out references  before you run out of memory.
Combined with a lazy loading mechanism this will give you more memory to work with, at the expense of more IO and decoding ofcourse.  Smiley

http://developer.android.com/reference/java/lang/ref/SoftReference.html
2  Java Game APIs & Engines / Java 2D / Re: Horrendous Performance in a Simple Java2D App on: 2009-04-22 07:44:13
If you're running on linux with intel graphics and don't have 'UseFBDev' set to 'true' in xorg.conf this may help:

-Dsun.java2d.pmoffscreen=false

(add it as an addition argument on the commandline, or as VM argument in your IDE).

Also have a look at this : http://java.sun.com/products/java-media/2D/perf_graphics.html.
3  Game Development / Newbie & Debugging Questions / Re: NotClassDefFoundError on: 2009-01-31 15:12:57
The JAVA_HOME environment variable should only contain a single path like "c:\java". If you want to start Tomcat (an interesting choice of game engine btw Smiley ) you should use the provided startup/shutdown scripts in the  c:\tomcat\bin folder.
4  Game Development / Newbie & Debugging Questions / Re: Why is my JPanel too big? on: 2009-01-29 09:50:24
It depends on what layout manager you're using on the component your adding your panel to.
See this: http://java.sun.com/docs/books/tutorial/uiswing/layout/using.html

The quick fix might actually be to use
setMinimumSize(..)
setMaximumSize(..)
as well. If that does not work you can try to set the layout manager on the container of your panel to null and then use setLocation(..) and setSize(..) to place the component manually. It won't resize with the window through.
See this: [url]http://java.sun.com/docs/books/tutorial/uiswing/layout/none.html[url]
5  Game Development / Newbie & Debugging Questions / Re: JCheckBoxMenuItem question on: 2009-01-24 15:01:55
And don't forget to group them in a ButtonGroup to make them mutually exclusive.
http://java.sun.com/j2se/1.4.2/docs/api/javax/swing/ButtonGroup.html
6  Games Center / 4K Game Competition - 2009 / Fortress4K on: 2009-01-04 14:00:39
A Fort Apocalypse inspired game:

http://www.ctrl-alt-dev.nl/Projects/Fortress4K/resources/Fortress4K/Fortress4K-ws.jnlp

Trapped in a underground fortress, 4 scientists are waiting to be rescued by you, the Armies most skilled helicopter pilot. If all the blockades, laser cannons and misile turrets are not enough, the swift rescue of the scientists is also hindered by the complex layout of the fortress itself, requiring impressive navigational skills. Fortunately you have your SX-4096 helicopter to aid you in your quest.

Rescue the 4 scientists scattered around the fortress.
Use the radar (bottom right) to find them.
The game is over when all your helicopters are lost.

Use W, S, A and D keys move the helicopter.
Use SPACE to fire the onboard cannon.

I hope you like it  Wink
7  Java Game APIs & Engines / Java 2D / Re: Graphics2D transformation on: 2007-03-07 11:34:28
The reason that the label in heightened renders wrong is because all the coordinates are
multiplied by 2 as well :-) So to compensate you need to translate half the height up, then
scale, then render the component internals, scale back and translate back. The last two are
needed if you want to properly render borders and other decorators of the swing component.

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
      protected void paintComponent(Graphics g) {
        Graphics2D g2d= (Graphics2D) g;
        double scaleX= widened? 2 : 1;
        double scaleY = heightened? 2 : 1;
        //
       if (heightened) g2d.translate(0,-getHeight()/2);
        g2d.scale(scaleX, scaleY);
        //
       super.paintComponent(g2d);
        //
       g2d.scale(1/scaleX, 1/scaleY);      
        if (heightened) g2d.translate(0,getHeight()/2);
      }


This is quite a hackish solution on top of a JLabel (but, it works! :-)
Maybe a better solution is do your own custom rendering using a JPanel or JComponent.

Have fun !


Erik

8  Game Development / Newbie & Debugging Questions / Re: Question regarding StringUtils.bytesToHex() on: 2006-11-29 15:17:40
Hi,

Mmm. I cant seem to find the class StringUtils and the method bytesToHex in the JDK docs.

If I look at your code I think you're converting a byte/char array into a hexadecimal string minus
the last 4 bytes/chars. One byte/char would correspond to 2 digits in the resulting string.

So limiting the length to 8 would only work if the original userId would be exactly 8 bytes
-> abcdefgh minus 4 -> abcd -> 61626364
If it would be, lets say 6 bytes the result would be :
-> abcdef minus 4 -> ab -> 6162
Oops :-)

If you would want to limit the length of an array why not use System.arraycopy :
1  
2  
3  
4  
        char[] src="42:life universe everything".toCharArray();
        char[] dst=new char[8];
        System.arraycopy(src,0,dst,0,dst.length);
        myId=new String(dst);


or..

1  
       myId=new String(userId,0,userId.length>8?8:userId.length);


Good luck !


Erik
9  Java Game APIs & Engines / Java 2D / Re: Outlined text and outlineColor and inner fillColor? on: 2006-04-16 11:06:59
To get nicely rendered small outlined text you can also tell the Graphics2D object to
scale all your rendering operations using the scale() method. 

The second thing you can try is to turn on the rendering hint for fractional metrics

1  
2  
3  
4  
    g2D.setRenderingHint( 
          RenderingHints.KEY_FRACTIONALMETRICS,
          RenderingHints.VALUE_FRACTIONALMETRICS_ON
    );


and tell your font render context that you're using these as well :

1  
  FontRenderContext frc = new FontRenderContext(null,true,true);


Ofcourse you must change the thickness of the outline accordingly :

1  
  BasicStroke wideStroke = new BasicStroke(0.5f);  // or something

10  Java Game APIs & Engines / Java 2D / Re: Outlined text and outlineColor and inner fillColor? on: 2006-04-15 16:29:38
Hi Whome,

If you already have the shape, why not use it again with g2D.fill(outline) ? 
Solves the problem :-) Apparently drawString calculates a little different  :-)

1  
2  
3  
4  
5  
6  
7  
8  
      Shape outline = tl.getOutline(textAt);
      g2D.setPaint(gp);
      g2D.fill(outline);
      //
      g2D.setColor(Color.yellow);
      BasicStroke wideStroke = new BasicStroke(2);
      g2D.setStroke(wideStroke);
      g2D.draw(outline);


For your second question, you can create scratch instances of the Graphics object using the create() method,
as you will modify these the original Graphics object will not be changed :-)

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
    Graphics2D sub=(Graphics2D)g2D.create();
    try {
      sayWorld(g2D, 100, 100, true);
    } finally {
      sub.dispose();
    }   
    sub=(Graphics2D)g2D.create();
    try {
      sayWorld(g2D, 100, 160, false);
    } finally {
      sub.dispose();
    }


Have Fun,


Erik
11  Java Game APIs & Engines / Java 2D / Re: bufferedImage Rotation Problem on: 2006-04-03 09:16:59
I ran your code with a transparent background png image of my own but could not  reproduce the
swirls. Maybe its not the code that is at fault here ?

The only thing I see that could corrupt the image is invoking the rotateImage method multiple
times in a row, as it overwrites the source image with the new rotated image which is then
used again as the source image for the next rotation. As an rotated image is never as good
as its original (pixels you know :-) if rotated long enough it will result in something pretty strange Smiley

Good luck,

Erik
12  Java Game APIs & Engines / Java 2D / Re: Custom Look and Feel on: 2006-04-03 08:24:50
I am sorry ENC, there is no such tool that I know of...

.. but please correct me if i'm wrong :-)
 
13  Java Game APIs & Engines / Java 2D / Re: Custom Look and Feel on: 2006-03-26 17:14:42
Hi ENC,

I've good news and bad news for you. You cannot have a custom look and feel on AWT components. Why ? Because they
are actually native platform dependent components with a wrapper around them to make them sort of identical.

You can have a custom look and feel on Swing components (javax.swing.* package).
To do this is not a trivial task but i'll give you some pointers :

http://java.sun.com/products/jfc/tsc/articles/sce/index.html   - an articicle on implementing custom L&F (high-level)
http://www.csie.ntu.edu.tw/~piaip/docs/Swing/Chapter21html/  - a whole chapter on the subject.

If you really don't want to use Swing, there is only one alternative and that is extend the java.awt.Panel class and do all the event
handing and repainting yourself...

Have fun designing !


Erik
14  Java Game APIs & Engines / Java 2D / Re: What does sun.awt.ScreenUpdater do? on: 2006-03-25 12:51:10
Hi  Clemens,

Unfortunately there is no documentation available for these classes (as far as i know :-) its a non-public api.

I just had a look at the decompiled classes of jdk 1.1.5 and my guess is that the purpose of ScreenUpdater
UpdateClient and ScreenUpdaterEntry is a time scheduling queue for calls to the UpdateClient interface.

Typically the UpdateClient interface is implemented by the ComponentPeers (the platform specific instances
of the components) and its purpose is to do a repaint. (native pTriggerRepaint())

So it intended purpose is a repaint mechanism. What is in a name :-) The question now is why did they use this
non public api ? Did they intend to trigger repaints, in that case you should be able to use a plain ordinary
repaint().  However, as it is a generic time scheduler, you could also use it for something different.. and there
is this evil object parameter that you can pass around to do strange things with... . .

Good luck :-)


Erik
15  Games Center / 4K Game Competition - 2006 / Re: And the winner is ... on: 2006-03-13 20:38:35
 Cheesy Noooh. I ended up at #36 with Jyruss4k, which is kinda nice for something i decided 'just to have a go at' Smiley
16  Games Center / 4K Game Competition - 2006 / Re: And the winner is ... on: 2006-03-13 18:43:56
Thanks for organizing this great little compo !

I had lotsa fun (both playing and participating :-)

I'll try hard to do better next year !!

Pages: [1]
 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

xsi3rr4x (50 views)
2014-04-15 18:08:23

BurntPizza (46 views)
2014-04-15 03:46:01

UprightPath (62 views)
2014-04-14 17:39:50

UprightPath (44 views)
2014-04-14 17:35:47

Porlus (61 views)
2014-04-14 15:48:38

tom_mai78101 (84 views)
2014-04-10 04:04:31

BurntPizza (142 views)
2014-04-08 23:06:04

tom_mai78101 (242 views)
2014-04-05 13:34:39

trollwarrior1 (201 views)
2014-04-04 12:06:45

CJLetsGame (208 views)
2014-04-01 02:16:10
List of Learning Resources
by SHC
2014-04-18 03:17:39

List of Learning Resources
by Longarmx
2014-04-08 03:14:44

Good Examples
by matheus23
2014-04-05 13:51:37

Good Examples
by Grunnt
2014-04-03 15:48:46

Good Examples
by Grunnt
2014-04-03 15:48:37

Good Examples
by matheus23
2014-04-01 18:40:51

Good Examples
by matheus23
2014-04-01 18:40:34

Anonymous/Local/Inner class gotchas
by Roquen
2014-03-11 15:22:30
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!