Java-Gaming.org    
Featured games (79)
games approved by the League of Dukes
Games in Showcase (475)
Games in Android Showcase (106)
games submitted by our members
Games in WIP (530)
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 ... 10
1  Game Development / Artificial Intelligence / Re: A* Multiple paths to goal on: 2014-07-01 19:13:09
I took Orangy Tang's solution - I need to improve the heuristic a bit but it will work well. I will probably search for 4-5 paths and choose one at random, only 4-5x slower than always choosing the fastest path, which I can deal with.

Ingame Screenshot:  Smiley
2  Game Development / Artificial Intelligence / Re: A* Multiple paths to goal on: 2014-06-24 14:25:44
Thanks for your comments Smiley

Maybe I am getting confused, but there is only one shortest path for the images you have provided. Do you want instead to have multiple semi-optimal paths?
Yeah exactly.

Hey, interesting problem!

I thought something like this:



A1...B4 are waypoints. First, place waypoints like showing in the picture. Calculate the first path from Start to A1, A2 or A3. From there, calculate a path to B1, B2, B3 or B4, and from there to the End.

You can place waypoints manually or code a simple loop.

Hope this helps.  Smiley
I like this idea - I didn't think of that. Although I'd have to figure out how to place the waypoints on my maps, which are quite more complex than this - I need a solution for any possible map made and this might be difficult.

Here's an idea:

Rather than passable/impassable for your tiles, have a 'cost' associated with moving through them. Impassable are +infinity, and initially all passable tiles start with cost 0. Then:

1. Find the most optimal path considering the costs with regular A*
2. Store that path as a possible path
3. For every tile that the path touches, increase the cost of traversing that tile.
4. Repeat until you have 'enough' paths.

This effectively means that every path after than the first, it's 'harder' to take the same route as an existing path. Note that you don't set the tiles to impassable, as you still want the tiles to be used if there's no other option (like the tile immediately right of your green start square).

Cool. I think I'll try this. Some routes are much "taller" than 1 tile as in my example map so I'll have to make the cost increase for the neighbours around the node as well - but only neighbours that are accessable by the node (can raycast between them without hitting any blocks)
Thanks Smiley




3  Game Development / Artificial Intelligence / A* Multiple paths to goal on: 2014-06-24 02:13:33
Hey,
I have a problem with my pathfinding for bots - they will only choose the shortest path. I however do not want to use Dijkstra's due to the amount of possible paths in the map being too large. (I'm searching from one side of the map to the other).

Here's my example image, start point on the left, goal on the right. Blue are walls / unwalkable.


Right now the bots will take this path only:


I want the bots to choose all "intelligent" routes to the goal, eg. take the shortest path along any possible route.
Here's some examples:













I added some more tiles to show bad paths - There's no point for bots to do this, humans wouldn't.





Can you guys give me any ideas on how I could do this? I need to somehow determine options for routes, then I can make each bot choose one at random when they spawn.

I was thinking of having a list of paths from the bot's position to the goal. Firstly I add the shortest path,
then having a loop, finding paths that have to be "different" from the paths that are currently in the list. I would do this by checking the number of nodes that are the same in the current path to any of the paths already in the list. So at least X nodes have to be different in each path. Once I can't find a path that has X nodes different, I'll stop. But I don't know how I can cut out the "stupid" paths where they go around in circles or something, because some stupid paths can be shorter than the longer routes. Will Dijkstra's be required for this? It needs to be fast enough to calculate for each bot multiple times in their life (eg. if they get knocked off their path then they will have to find a new one)

Thanks,
roland
4  Game Development / Newbie & Debugging Questions / Re: transferFrom returns 0 before end of channel is reached on: 2014-06-12 16:33:33
I got your other one fine, but thanks anyway  Grin
5  Game Development / Newbie & Debugging Questions / Re: transferFrom returns 0 before end of channel is reached on: 2014-06-12 16:32:23
Well first off, wouldn't that loop already cause an infinite loop? You're looping through the code so long as you've received bytes, which could go on forever. Is this actually working? Because it shouldn't!
It can't go on forever because the filesize is fixed Smiley
6  Game Development / Newbie & Debugging Questions / Re: transferFrom returns 0 before end of channel is reached on: 2014-06-12 16:30:16
You should make it like you said, receivedAmount==ExpectedAmount;

You should also make a
1  
long = System.getCurrentTimeMillis()


of when last bytes where received.

Thanks Smiley I'll try that and let you know how it goes.
7  Game Development / Newbie & Debugging Questions / transferFrom returns 0 before end of channel is reached on: 2014-06-12 15:17:35
Hey, I have this code for downloading a file via HTTP and it mostly works fine. However this crashes for a friend of mine with a very poor network connection ("mobile internet", 2-10kb/s download speed) because transferFrom() returns 0 before the full file is downloaded (eg. downloaded 2327 / 3163 bytes). I know the filesize in advance, however I don't want to loop until the received amount = expectedSize because if I modify the file while someone is downloading it they'll get stuck in an infinite loop. Anyone know how I can fix this?

Thanks,
roland

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
try
{
   URL fileURL = new URL(urlOfFileToDownload);
   InputStream stream = fileURL.openStream();
   
   ReadableByteChannel rbc = Channels.newChannel(stream);
   if (!fileExists(saveLocation))
      createEmptyFile(saveLocation);
   FileOutputStream fos = FileManager.GetFileOutputStream(saveLocation);
   int totalNumBytesTransferred = 0;
   int bytesTransferred = 0;
   do
   {
      bytesTransferred = (int)fos.getChannel().transferFrom(rbc, totalNumBytesTransferred, TRANSFER_CHUNK_SIZE); //TRANSFER_CHUNK_SIZE=512*1024
     totalNumBytesTransferred += bytesTransferred;
   } while (bytesTransferred > 0);
   
   fos.close();
   
   //check file
  if (totalNumBytesTransferred != expectedFileSize) //I know expectedFileSize
     throw new UnsupportedOperationException("Failed to fully download file " + urlOfFileToDownload +": wrong filesize (expected " + expectedFileSize +", received "+totalNumBytesTransferred);
   
   success = true;
}
catch(Exception e)
{
   error = e.getMessage();
   e.printStackTrace();
}
8  Games Center / Showcase / Re: Storm2D on: 2014-06-06 15:47:56
After over a year since the last version, Storm2D 0.050 Alpha has been released!  Smiley

Check out a video here: http://youtu.be/2_LQk9y6Ew4

The game has undergone many changes - New art, maps, gamemodes, character classes and weapons. Many networking and general gameplay bugs have been fixed, and a lot of time has been put into making the game as customisable as possible, through modding and scripting. Please have a play through of the game and let me know what you think. (Download link and instructions are in the original post)

Thanks,
roland
9  Game Development / Newbie & Debugging Questions / Re: Read Java VM argument from file on: 2014-05-02 22:12:09
Thanks!  Smiley
10  Game Development / Newbie & Debugging Questions / Read Java VM argument from file on: 2014-05-02 21:52:20
Hey, I'm trying to make the maximum heap size customisable by editing a "memory.txt" file which contains the following:
1  
Xmx128m

I don't want users having to go into my bat/sh scripts in order to change the maximum memory. I'm also using an auto update system, so they can't edit the scripts (they will get overwritten on the next update)

I execute the jar file using a bat or shell script as below.

My Windows bat file version works fine:
1  
2  
set /p HEAPSIZE=<memory.txt
java -%HEAPSIZE% -jar memorytest.jar


However my linux version fails (I run using sh)
1  
2  
HEAPSIZE= cat 'memory.txt'
java -$HEAPSIZE -jar memorytest.jar


This works though:  Huh
1  
2  
HEAPSIZE= "Xmx128m"
java -$HEAPSIZE -jar memorytest.jar


Can anyone help me get this working for linux/mac?
thanks Smiley

11  Java Game APIs & Engines / OpenGL Development / Re: LWJGL Antialiased lines on: 2013-10-05 13:38:34
Thanks for the replies everyone!

I made a Soldat CTF map once, called Crusade. Smiley
Smiley

LWJGL's Display.create() has an overloaded version that takes a PixelFormat. One of the PixelFormat's constructors allows you to turn on anti-aliasing and set how many samples you want.

Here is an example using 4 samples:
1  
2  
// parameters: 0 alpha bits, 8 depth bits, 0 stencil bits, 4 samples
Display.create(new PixelFormat(0, 8, 0, 4));

Is there a way I can check support for this? GLContext etc. Doesn't seem to work until the display is actually created.

@Mac70
Blending doesn't help with geometry like lines.

@roland

when you only want to activate multisampling aka. anti-aliasing for some geometrie like your minimap, you can do it like this.

1. create a multisamples RenderBuffer
2. render to that buffer
3. copy/blit the result to the screen or texture which you want to render

Code should look like this:
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
// creating a multisampled renderbuffer
int samples = 4;//you can query the max supported samples by glGetIntegerv(GL_MAX_SAMPLES, out, 0);

int[] id = new int[1];
glGenRenderbuffers(1, i, 0);
glBindRenderbuffer(GL2ES2.GL_RENDERBUFFER, id[0]);
glRenderbufferStorageMultisample(GL_RENDERBUFFER, samples, GL_RGBA8, width, height);

//blitting the buffer to the screen or a texture
//bind the renderbuffer as colorbuffer to a FBO
 glBindFramebuffer(GL_READ_FRAMEBUFFER, id);//bind this FBO as read buffer
 //now bind the default Framebuffer(0: the screen) or a FBO with the texture
 glBindFramebuffer(GL_DRAW_FRAMEBUFFER, id2);

  //and as a last step copy the content of the multisampled renderbuffer
 glBlitFramebuffer(0, 0, width, height, 0, 0, dstWidth, dstHeight,  GL_COLOR_BUFFER_BIT, GL_LINEAR);


In your case I would do the rendering like this.
Clear the multisampled renderbuffer to some semi transparent black(like in your screenshot)
Render the minimap into it
Copy the renderbuffer into a texture(this step is needed to resolve the multisampling)
render the texture into the top right corner of your screen.

The thing is if you wouldn't need a transparent minimap background, you could directly copy the minimap onto the screen.


ps:
Some googling unearthed this nice trick: http://http.developer.nvidia.com/GPUGems2/gpugems2_chapter22.html
Will creating a multisampled renderbuffer simply achieve the same effect as using full screen antialiasing overriding the default Display.create()? (apart from being faster due to only being applied to the minimap) If so, unfortunately the results aren't too great. I will need to go for a more complicated technique.

Anti-aliased lines is actually pretty challenging in OpenGL.

You could use GL_LINES and line smoothing. Unfortunately, it won't look the same across all platforms. Some will use anti-aliasing, and others will not.

If you want truly consistent smooth lines in OpenGL, you have some options:

1. Use software rendering to draw the lines to a texture. If you are only targeting desktop, you can make use of Java2D to do the rasterization for you. Basically the step is just to render your Graphics to a BufferedImage, and then copy the pixels to a ByteBuffer and upload them to a GL texture.

https://github.com/mattdesl/lwjgl-basics/wiki/LibGDX-&-Java2D

This is really slow, and not something you should be doing every frame.


2. Use multi-sampling like Danny02 said.

3. Use triangles and calculate the anti-aliasing in a shader. This sounds a little daunting, but it just requires a little bit of vector math and a decent grasp of shaders. It also produces really high-quality lines, and gives way to other effects like stippling patterns, outer glows, and smooth color interpolation.

You can also achieve this without a shader, just by using a lookup texture to create a blurry line edge. The problem with this is that the anti-aliasing isn't as accurate and doesn't scale.

Both approaches are discussed here:
http://www.java-gaming.org/topics/circular-health-bar/29791/msg/274139/view.html#msg274139

(There is code at the end of the Swiper tutorial that should give you smooth lines.)

For each point in your line, you simply 'extrude' it along the perpendicular depending on the line thickness. Using triangle strips, you only need 2 vertices for every point in your line. A more complex approach would be to use a miter join, with one technique described here:
https://forum.libcinder.org/topic/smooth-thick-lines-using-geometry-shader#23286000001269127

More advanced still would be to support different types of joins.
http://artgrammer.blogspot.ca/search/label/opengl

4. Another solution which might work for you case is to apply FXAA or another AA technique done in the fragment shader. Since you are rendering your mini-map to a small texture, the impact shouldn't be too significant.
Thanks, I'll have a look  Smiley

12  Java Game APIs & Engines / OpenGL Development / LWJGL Antialiased lines on: 2013-10-04 15:18:53
Hi, I am making a minimap for my game. (See top right corner of below image)



Everything is perfect, except for the jagged outline. I draw lines around the edges of the map, but they aren't smooth.

I've played around with the following settings:
GL11.glEnable(GL11.GL_LINE_SMOOTH);
GL11.glHint(GL11.GL_PERSPECTIVE_CORRECTION_HINT, GL11.GL_NICEST);

and they just make the lines look worse. Searching on google, I came across something called multisampling, I'm not sure if this is what I want though.

Note, this is rendering to a seperate texture. I don't want full-scene antialiasing, just for the lines that make up the background of the minimap.

Can anyone help me?
Thanks,
Roland
13  Games Center / Showcase / Storm2D on: 2013-05-12 07:47:28

Storm2D is a fast-paced and action-packed 2D sidescrolling multiplayer shooter
inspired by Liero and Soldat. Download for free from http://storm2d.net/


<a href="http://www.youtube.com/v/2_LQk9y6Ew4?version=3&amp;hl=en_US&amp;start=" target="_blank">http://www.youtube.com/v/2_LQk9y6Ew4?version=3&amp;hl=en_US&amp;start=</a>



Existing features:
  • Multiplayer online with official US, EU and AUS servers
  • Works on Windows, Linux and Mac
  • Destructible polygon terrain
  • 8 Game modes including Zombies, Capture the flag and Deathmatch  
  • Mod Support
  • Auto-update system

Planned features: (Ordered by priority)
  • Vehicles
  • Conquest and HQ Defence Gamemodes
  • Campaign Mode
  • Ingame Map Editor
  • Missions
  • Minigames

Basic Controls: (You can view and customise all controls from the profiles section in the main menu)
  • WSAD to move (W to jump, S to crouch)
  • Left mouse button: Shoot
  • Right mouse button: Special movement ability (eg. Jet boots)
  • E: Use Belt weapon (eg. Throw Grenade)
  • F: Drop / Throw current weapon
  • Q: Switch between primary and secondary weapons
  • Right Alt+Enter: Switch between windowed and fullscreen

Notes:
  • In order to login and play online you need a KAG account (Storm2D and KAG accounts are shared).
    • Get one for free here: http://kag2d.com/en/register
    • You can play offline without an account, although you will have more fun online playing with other humans rather than bots.
Current Version:
[June 6, 2014] 0.050 Alpha







Old Releases: (Full changelog)
[May 11, 2013] Initial 0.010 Alpha Release


Transhuman Design 2011-2014
14  Game Development / Newbie & Debugging Questions / Re: How to encrypt our code. on: 2013-03-24 08:22:09
Try obfuscation + wrapping it in an EXE or converting it to EXE through tools like Excelsior JET.

You can't "encrypt" bytecode. There has to be something that will decrypt it to run it and that could be also broken. The reason you would want to protect bytecode is because it's easily reverse-engineered. Obfuscation allows for harder reverse-engineering and converting to native makes it even harder.

I do think it's useless though, code is cheap. Art is much more valuable and what people will want and *that* is what you should protect.

Code Isn't cheap Smiley Imagine coding a game for 2 years, releasing it without it being obfuscated. Instantly anyone can decompile the class files into THE EXACT code you made (search jd-gui on google). They now know exactly how your code works, they can modify your game and produce their own version of it, in order to very easily hack/crack the game and distribute it over the internet.

If code was cheap you wouldn't get programming jobs paying you over $60 an hour Wink

I have been working on my game for over a year and a half. I don't even want to guess how many hours of frustration and hard work I put into it, I wouldn't want some random to have access to the code just like that. But that's just me. If you are making an open source game then its fine.

Everyone who values the code they have written and don't want the general public to be able to read it should use proguard. Trying to find out what a large obfuscated program does IMO will be harder than coding it from scratch.
jd-gui is also a useful tool to test if your program has been obfuscated correctly.
15  Game Development / Newbie & Debugging Questions / Re: Java reading file problem only occurs on some PC's on: 2013-03-14 00:30:05
Just from reading the title I got the idea that it might be the PC's partition format.
Ah yeah, sorry the topic title wasn't very clear  XD
But the problem is solved now Smiley
Thanks
16  Game Development / Newbie & Debugging Questions / Re: Java reading file problem only occurs on some PC's on: 2013-03-13 15:21:13
You might also look at Cortex Command. It seems to have some of the same things in it. But I've never played Soldat and am just basing things on the video of the game you posted. >.> I have played KAG though, and they're somewhat similar.
Yeah Cortex command is a great game too Smiley
I played that a lot for a while. I haven't played online with it though, just with some friends on a single PC.
17  Game Development / Newbie & Debugging Questions / Re: Java reading file problem only occurs on some PC's on: 2013-03-13 15:13:35
I think King Arthur's Gold has taken over.

Cas Smiley

KAG is a good game, but completely different to Soldat IMO. Nothing beats a good game of Soldat  Grin
18  Game Development / Newbie & Debugging Questions / Re: Java reading file problem only occurs on some PC's on: 2013-03-13 12:03:29
Game looks ace btw. Soldat's one of my favourite games of all time.

Cas Smiley

Thanks man!  Smiley
Same. I wish I could go back to the old Soldat days! I played that game almost every day for nearly 5 years. This is one of the reasons why I am making a Soldat clone. People have left the game but nothing has replaced it.

There's still a heap of bugs and things I need to do and features to add, but if I can get some good artwork, etc I think this game could be a hit. Just need to keep at it!
19  Game Development / Newbie & Debugging Questions / Re: Java reading file problem only occurs on some PC's on: 2013-03-13 11:58:39
Try to specify the locale of the scanner to match the number format of the read files.

Omg! thanks!  Smiley
That was the problem.
I didn't even know about locales Smiley you learn something new every day.

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
Scanner scan = new Scanner("0.0");
     
System.out.println("Locale: US");
scan.useLocale(Locale.US);
System.out.println("Has next float: " + scan.hasNextFloat());
System.out.println("Has next double: " + scan.hasNextDouble());

System.out.println("Locale: France");
scan.useLocale(Locale.FRANCE); //also GERMAN, ITALIAN, etc.
System.out.println("Has next float: " + scan.hasNextFloat());
System.out.println("Has next double: " + scan.hasNextDouble());


Output:
1  
2  
3  
4  
5  
6  
Locale: US
Has next float: true
Has next double: true
Locale: France
Has next float: false
Has next double: false



Now I just need to remember to never create a Scanner without setting the locale(I made a utility function, but creating Scanners is such a habit  Grin)
20  Game Development / Newbie & Debugging Questions / Java reading file problem only occurs on some PC's on: 2013-03-13 06:03:36
Hey,
For the last year and a half or so I've been working on a Soldat clone, called Storm2D. (http://storm2d.net)
Having released an alpha version of the game, on my latest video (http://www.youtube.com/watch?v=0Eb-4QJHHeQ) two people have posted that the game crashes at a specific point, both using Windows 7 (same as me). Annoyingly, the problem doesn't happen on my computer, nor 3+ other computers I tested the program on, so it is hard to debug. One of the users helpfully posted the crash log (exception stack trace) and it leads me to believe (although I could be wrong, as the location of the crash is not where the actual problem is) that my problem has something to do with the way I am reading files with the Java scanner.

Note: I bundle the jre with my application so it isn't a problem with different versions of java.

when reading through one of my (biped) files needed for the game, at the start of the line I check if the first 'token' in the line is a number. If it is a number, it means I need to read an extra two parameters at the start. I read the line a slightly different way (because the line contains different parameters). For some reason I think the first token is not being recognized as a number on their machines which means that the first two tokens aren't handled and the whole line is read wrongly.

The code I use to check if the token is a number(note: any type of number, float,double, int etc) is below. Does this handle all cases? (apart from long, huge numbers won't occur)

1  
2  
3  
4  
5  
6  
if (scan.hasNextFloat() || scan.hasNextInt())
{
    ... //process the first two tokens
}

//continue to read the rest of the line.


Alternatively I could use the below code and just use scanner.next() rather than using the other methods(hasNextFloat, etc), but I won't know if it works until one of the users that had the problem in the first place try it again.

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
public static boolean isNumeric(String str)  
{  
  try  
  {  
    double d = Double.parseDouble(str);  
  }  
  catch(NumberFormatException nfe)  
  {  
    return false;  
  }  
  return true;  
}


Thanks,
Roland


21  Game Development / Newbie & Debugging Questions / Re: Alt-f4 close with multiple threads on: 2013-02-11 12:21:52
Thanks  Smiley
22  Game Development / Newbie & Debugging Questions / Alt-f4 close with multiple threads on: 2013-02-11 11:00:54
Hi, just confirming, does alt f4 completely destroy the process (and all threads)? or is there some cases where if a thread that is not the main thread is stuck in an infinite loop, the program won't close properly?

Thanks,
roland
23  Java Game APIs & Engines / Java Sound & OpenAL / Re: Slick util OpenAL get song length on: 2012-12-09 11:07:32
Thanks davedes Smiley
A combination of a + b sounds good for me, streaming at normal speed and saving the length to a file when the song finishes.
24  Java Game APIs & Engines / Java Sound & OpenAL / Slick util OpenAL get song length on: 2012-12-09 05:52:38
Hi, I am trying to get the length of a song with OpenAL.
The song streamed rather than fully loaded. I am using .ogg files. A java version of the below code just returns 0.

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
ALfloat GetBufferLength(ALuint buffer)
{
    ALint size, bits, channels, freq;

    alGetBufferi(buffer, AL_SIZE, &size);
    alGetBufferi(buffer, AL_BITS, &bits);
    alGetBufferi(buffer, AL_CHANNELS, &channels);
    alGetBufferi(buffer, AL_FREQUENCY, &freq);
    if(alGetError() != AL_NO_ERROR)
        return -1.0f;

    return (ALfloat)((ALuint)size/channels/(bits/8)) / (ALfloat)freq;
}


I think it's because the song is streaming? Is there any way to fix this?
thanks,
roland
25  Java Game APIs & Engines / Tools Discussion / Re: Proguard include library warnings on: 2012-11-13 10:43:05
Thanks Smiley
I accidentally also added my library jars as program inputs (rather than library inputs). oops xD

roland
26  Java Game APIs & Engines / Tools Discussion / Proguard include library warnings on: 2012-11-11 07:37:10
Hey, I have a problem.
I am trying to use proguard and I include quite a few libraries:
rhino javascript, jbox2d, poly2tri, slf4j, lwjgl, etc.

When i try to obfuscate my jar, I have to add these dependencies.
The problem is, they all have dependencies, which have dependencies, .....
It looks like I have to end up adding over 100 different libraries in, even though they aren't actually needed to run the unobfuscated jar file.

Is there an easier / better way to do this?
thanks,
roland
27  Game Development / Newbie & Debugging Questions / Re: Bundling JRE Windows/Linux/Mac on: 2012-10-24 14:17:13
While we are waiting for someone to give us an answer  Wink

I've only ever done Windows myself but I need to switch to embedded VMs for both Mac and Linux as well. All ears here Smiley

Cas Smiley
So at the moment if you are on linux or mac you need to install java yourself before playing the game? do you have any estimate how much this decreased the likelyness of the average user wanting to try out one of your games?

Also, if not bundling the JRE they need to add java as an environment variable Sad
28  Java Game APIs & Engines / OpenGL Development / Re: Hiding mouse cursor on: 2012-10-24 09:53:04
Thanks davedes! it works perfectly Smiley
29  Game Development / Newbie & Debugging Questions / Bundling JRE Windows/Linux/Mac on: 2012-10-24 08:08:20
Hello,
What is the best way to bundle a JRE with my application? I only have a windows computer at home so it is hard for me to test this. I have no idea even how to get the linux and mac JREs and then extract them onto my computer, so that I can put the jre folder inside my game directory.

Can someone help me out?
Thanks,
roland
30  Java Game APIs & Engines / OpenGL Development / Hiding mouse cursor on: 2012-10-24 03:36:34
Hey, I have a problem.
I might use
1  
Mouse.setGrabbed(true);
which is fine, but in the case where I want to be able to use the mouse outside the window:


1  
2  
Cursor emptyCursor = new Cursor(1, 1, 0, 0, 1, BufferUtils.createIntBuffer(1), null);
Mouse.setNativeCursor(emptyCursor);

taken from http://lwjgl.org/forum/index.php?topic=594.0

This doesn't actually completely hide the cursor. It creates a 1x1 BLACK pixel cursor.
I have tried to create an int buffer that contains a single integer with no alpha (eg new Color(0,0,0,0).getRGB()), this doesn't work.

Anyone have any ideas?

Pages: [1] 2 3 ... 10
 

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

The first screenshot will be displayed as a thumbnail.

ctomni231 (34 views)
2014-07-18 06:55:21

Zero Volt (30 views)
2014-07-17 23:47:54

danieldean (25 views)
2014-07-17 23:41:23

MustardPeter (27 views)
2014-07-16 23:30:00

Cero (42 views)
2014-07-16 00:42:17

Riven (44 views)
2014-07-14 18:02:53

OpenGLShaders (32 views)
2014-07-14 16:23:47

Riven (34 views)
2014-07-14 11:51:35

quew8 (30 views)
2014-07-13 13:57:52

SHC (66 views)
2014-07-12 17:50:04
HotSpot Options
by dleskov
2014-07-08 03:59:08

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:58:24

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:47:22

How do I start Java Game Development?
by ra4king
2014-05-17 11:13:37

HotSpot Options
by Roquen
2014-05-15 09:59:54

HotSpot Options
by Roquen
2014-05-06 15:03:10

Escape Analysis
by Roquen
2014-04-29 22:16:43

Experimental Toys
by Roquen
2014-04-28 13:24:22
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!