Java-Gaming.org    
Featured games (81)
games approved by the League of Dukes
Games in Showcase (497)
Games in Android Showcase (114)
games submitted by our members
Games in WIP (563)
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] 2 3
1  Game Development / Shared Code / Re: Java Continuations and GreenThreads on: 2013-01-13 09:34:36
I started a HTTP client back in 2008 when I first wrote the lib, it is basically working - but I didn't do much testing on it.
2  Game Development / Shared Code / Re: Java Continuations and GreenThreads on: 2013-01-11 19:06:42
I added another update. Besides fixing methods which return 'long' - this version adds support to call suspendable methods as arguments for constructors (constructors itself are not suspendable).

This now allows constructs like this:
1  
2  
3  
System.out.println(new StringBuilder(someSuspendableMethodWhichReturnString()).append(" Bla").toString());
// Eclipse generates the above code for the following Java statement:
System.out.println(someSuspendableMethodWhichReturnString()+" Bla");
3  Game Development / Shared Code / Re: Java Continuations and GreenThreads on: 2013-01-08 01:47:09
These warnings should now also be fixed (copy & paste bug).

While debugging these a potential issue with the JavaAgent was discovered:
It is possible that multiple threads load classes at the same time, which also means that these thread execute instrumentClass in parallel.
I did not add a synchronization to that method (to prevent potential dead locks with ClassLoader locks) as MethodDatabase might need to load additional classes (eg the base class) - so instead I protected the shared hash maps individually.
This might cause redundant work (if multiple threads analyze the same class) - but each thread should produce the same results or a warning is generated.

So I suggest to use the JavaAgent only while developing - and keep an eye on the console for warning Smiley
4  Game Development / Shared Code / Re: Java Continuations and GreenThreads on: 2013-01-07 22:21:09
I updated the Continuations library - all test cases work now without issues.

The latest sources can be found here.
And a compiled version is available on my website.
5  Java Game APIs & Engines / OpenGL Development / Re: Fontexturer - make .png images from TTF fonts for OpenGL textures on: 2012-03-09 22:39:05
For a more complete font support you can take a look at the BMFont format which also supports kerning.
The TWL Theme Editor has a font generator tool (Tools -> create font) with 3 different rendering methods:
- freetype2: best quality
- AWT drawString
- AWT vector: most effects
6  Java Game APIs & Engines / OpenGL Development / Re: How to display a color picker on: 2012-03-09 22:32:44
TWL has a color picker widget (in addition to many other useful widgets). You can test the color picker in the TWL Demo or in the TWL Theme Editor (both are webstart links). The editor is completely written using TWL.
7  Java Game APIs & Engines / OpenGL Development / Re: 2D - Restricted to appying sprite textures to shapes? on: 2012-02-26 08:35:45
MatthiasM has written some extremely awesome texture loaders spun off from TWL that don't require TWL itself.  It supports BMP, JPG, PNG, and TGA (no GIF that I can see).  It's asynchronous, so you get a callback when the texture is loaded and you can keep on doing your own thing in the meantime (like displaying a loading screen or downloading other resources) without having to manage any threads.

http://hg.l33tlabs.org/TextureLoader/
Well - it supports 3 modes of operations:
- fully managed by using the TextureManager.getTexture() function - this one is asynchronous (eg loads in a background thread)
- synchronous using Texture.loadTexture() function
- using the TextureLoader* classes to get the bytes directly

The asynchronous TextureManager method will render a transparent 2x2 pixel texture when the desired texture has not yet (or could not) been loaded.
Textures which are not used for some time are also unloaded.

And there is no need to manage threads - the only thing you need to do in your main loop when you want to use the TextureManager is:
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
// before main loop
AsyncExecution async = new AsyncExecution();
TextureManager tm = new TextureManager(async);
...
// main loop
while(!Display.isCloseRequested()) {
   ...
   async.executeQueuedJobs();
   tm.nextFrame();
   ...
   Display.update();
}
8  Game Development / Newbie & Debugging Questions / Re: Max and Min of Random on: 2012-02-15 22:23:21
1  
2  
3  
    public float nextFloat() {
        return next(24) / ((float)(1 << 24));
    }

Are you sure 24 distinct random values are enough for you? Lips Sealed
Random.next() is an internal method which takes the number of bits as argument.
9  Game Development / Newbie & Debugging Questions / Re: Problem with Slick 2d Image / Graphics on: 2012-02-12 18:13:18
GLContext.getCapabilities() return null when the current thread has no GL context active.
10  Game Development / Newbie & Debugging Questions / Re: Loading wav, MP3 and MIDI from INSIDE a .jar file on: 2012-02-11 09:50:26
You should not use getClass() for resource loading as this will break when the class is sub classed. Use MidiPlayer.class.getResource() to have a fixed starting point.
Also make sure that the resources are in the same JAR as the class you use as a base reference otherwise you could get issues depending on how the class loaders are setup.
11  Game Development / Newbie & Debugging Questions / Re: RPG inventory on: 2012-02-03 23:02:09
I have a Inventory Demo which shows 4 gems which you can drag around. The source code is available on my site.
12  Game Development / Newbie & Debugging Questions / Re: varargs question on: 2012-01-22 13:56:28
String.format expects an Object[] where each entry corresponds to one argument you want to format.
You could try this:
1  
2  
3  
4  
5  
6  
...
Object[] tmp = new Object[hex.length];
for(int i=0 ; i<hex.length ; i++) {
   tmp[i] = Integer.valueOf(hex[i] & 255);
}
return String.format(format, tmp);
13  Game Development / Newbie & Debugging Questions / Re: ConcurrentModificationException on: 2012-01-21 08:01:22
An easy way to remove (or add) entries while iterating over an array (or ArrayList) without using the for-each loop or Iterator is to use array indices and walk backwards through the array:
1  
2  
3  
4  
5  
6  
for(int i=list.size() ; i-->0 ;) {
   Entry e = list.get(i);
   if(someTest(e)) {
      list.remove(i);
   }
}

This works because any modification of the array/list at or after the current index won't affect the rest of the loop.
14  Game Development / Newbie & Debugging Questions / Re: ConcurrentModificationException on: 2012-01-20 12:47:21
ArrayList.clear() does null out all used slots. Where did you get that false information from?
15  Game Development / Newbie & Debugging Questions / Re: ConcurrentModificationException on: 2012-01-19 22:17:55
Iterator is nearly never thread safe. There are only very few collections (eg java.util.concurrent.*) which are thread safe on their own - everything else needs external locking.
16  Game Development / Newbie & Debugging Questions / Re: How to decide...short, long, int, byte, etc. on: 2011-09-21 06:09:07
Fields take only the required amount of storage - so a short is smaller then an int. Java will always align fields to a multiple of their size - so that you don't get unaligned access. Access to these fields is not slower then other fields.

On the other hand if you put small data types on the stack or as method parameters then it needs additional instructions to enforce the desired overflow behavior.
17  Java Game APIs & Engines / OpenGL Development / Re: Custom tooltips in games on: 2011-09-20 06:44:37
I was considering using TWL for the window system in my game but after I noticed that the jar was like 800kb I reconsidered Sad, the whole game is currently 500kb and seeing as it's an applet it can't take forever to download on slow connections...
Ever heard of pack200 & lzma ? Even with only gzip the file size is below 200KB - with lzma it should be below 150KB 172KB. And LWJGL's AppletLoader directly support pack200 + lzma or gzip.

Edit: fixed size (based on real value of nightly build server) - not sure if I stripped debug symbols or not.
18  Java Game APIs & Engines / OpenGL Development / Re: Custom tooltips in games on: 2011-09-17 23:31:39
Take a look, if http://www.fenggui.org/doku.php suits your needs.
You can easily write a JOGL backend - it's all interface based. I even have a minimalistic Java2D backend Tongue
19  Java Game APIs & Engines / OpenGL Development / Re: Custom tooltips in games on: 2011-09-11 15:02:49
You could just use TWL for your UI - it has full support for tooltips - even including XHTML + CSS rendering including tables and floating elements.
20  Java Game APIs & Engines / Java 2D / Re: Fast Free Commercially Useable PNG Decoder? on: 2011-08-24 18:47:33
I did not write PNGDecoder to be used with BufferedImage - it is intended to be used with OpenGL and it decodes into formats understood by OpenGL. And for that it is probably the fastest decoder (and it is small).

As for the byte order - just look at the Format enum (eg RGBA, BGRA etc).
21  Game Development / Shared Code / Re: Easy readable PNG decoder on: 2011-05-15 12:02:25
Well - I wouldn't call this code readable Smiley

And I would say my PNG decoder is even more feature complete and has documentation Smiley
22  Game Development / Shared Code / Re: Simple "console like" chat on: 2011-03-01 01:32:10
You could also take a look at the TWL Chat Demo and it's source code.
23  Discussions / General Discussions / Re: Vote now in the official JGO logo contest thread with this topic on: 2011-01-04 22:11:05
b++ because the blue fits better with the current theme of the forum
24  Game Development / Shared Code / Re: Cuckoo hashing code[important update**2] on: 2010-12-30 15:26:27
Using an identity hashmap for wrapper classes together with auto boxing is a guarantee for failure. As long as your keys are within the cached range it looks like it will work. But once you use keys outside the cached range (mostly 0..255) you get different objects for the same integer.

So if you use identity hashcode you must use ==. Then you can't use auto boxing.
25  Game Development / Newbie & Debugging Questions / Re: simple interface within an opengl application on: 2010-12-18 18:39:27
If you're using JOGL, never mind TWL, but iirc it integrates with swing/awt nicer than LWJGL, so that would be the direction to look in.
TWL can also be used with JOGL. You just have to write (or port) a Renderer implementation.
TWL's rendering & input subsystem is completely abstracted. The provided renderer for LWJGL is a simple GL11 based renderer. With libgdx you can run TWL also on Android. If you want you could even render it using AWT :DD
26  Games Center / WIP games, tools & toy projects / TWL TextArea Demo on: 2010-06-15 21:29:57
This demo shows some features of TWL's TextArea widget.


(hint: click on the portrait in the demo) (This forum doesn't want to show the screen shots in full size, so just click on them to get the full size version)

These files are used in the demo:
Floating <div> demo HTML file
Table demo HTML file
CSS file for both HTML files
Java code
XML theme file for the demo

Features:
* text alignment
* images
* widgets (uses HTML's <button> element)
* tables (with column spanning)
* floating elements
* unordered lists
* inline styles
* CSS style sheets
27  Game Development / Shared Code / Re: TWL's PNGDecoder now available as standalone JAR on: 2010-05-19 17:48:40
The java.util.zip package is part of core J2SE - so that's always available.

What do you mean with only palettized?!? It supports every non interlaced format except 16 bit per component.
28  Game Development / Shared Code / Re: TWL's PNGDecoder now available as standalone JAR on: 2010-05-19 17:10:47
It uses Inflater from java.util.zip and I did not provide a hook to exchange it with another zlib implementation.

What's that all about custom zlib versions? Are there huge performance gains by using a Java based zlib (which I doubt)? The additional code size is an issue, I want to keep the library small.
29  Game Development / Shared Code / Re: TWL's PNGDecoder now available as standalone JAR on: 2010-05-15 22:27:38
Thanks Riven, it's fixed in the repository Smiley

And the main benefit of this PNGDecoder is the ability to decode into a NIO buffer in OpenGL compatible formats. This avoids unnecessary memory copies. To support NPOT textures it's also possible to specify the stride.
30  Game Development / Shared Code / TWL's PNGDecoder now available as standalone JAR on: 2010-05-15 22:04:12
The PNGDecoder from the TWL - Themable Widget Library is now available as a separate JAR.

JAR: PNGDecoder.jar
Source: PNGDecoder.java

Example usage:
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
InputStream in = new FileInputStream("white_pixel.png");
PNGDecoder decoder = new PNGDecoder(in);

System.out.println("width="+decoder.getWidth());
System.out.println("height="+decoder.getHeight());

ByteBuffer buf = ByteBuffer.allocateDirect(4*decoder.getWidth()*decoder.getHeight());
decoder.decode(buf, decoder.getWidth()*4, Format.RGBA);
buf.flip();

while(buf.hasRemaining()) {
   System.out.printf("%02X\n", buf.get() & 255);
}


Have fun Smiley

EDIT: The PNGDecoder has been moved into the de.matthiasmann.twl.utils package. A class in the old package is still there and forwards all methods to the new PNGDecoder.
Pages: [1] 2 3
 

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

The first screenshot will be displayed as a thumbnail.

BurntPizza (9 views)
2014-09-21 02:42:18

BurntPizza (9 views)
2014-09-21 01:30:30

BurntPizza (12 views)
2014-09-21 00:34:41

moogie (13 views)
2014-09-21 00:26:15

UprightPath (23 views)
2014-09-20 20:14:06

BurntPizza (27 views)
2014-09-19 03:14:18

Dwinin (40 views)
2014-09-12 09:08:26

Norakomi (70 views)
2014-09-10 13:57:51

TehJavaDev (96 views)
2014-09-10 06:39:09

Tekkerue (49 views)
2014-09-09 02:24:56
List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06

List of Learning Resources
by SilverTiger
2014-07-31 11:54:12

HotSpot Options
by dleskov
2014-07-08 01:59:08
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!