Java-Gaming.org    
Featured games (81)
games approved by the League of Dukes
Games in Showcase (498)
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   
Pages: [1]
  ignore  |  Print  
  Swing breaks jinput?  (Read 2512 times)
0 Members and 1 Guest are viewing this topic.
Offline gangrel-br

Junior Member




Java and Scala! Thats the game =)


« Posted 2004-05-15 15:00:32 »

My app uses a swing GUI and jinput. But there a strange problem: I've put a JTextField on the screen and, after some few keypresses the whole application crashes Embarrassed. The only different output I get is

1  
DI_BUFFEROVERFLOW


Taking a better look now, the overflow was there even before I put the text field Huh. But it only crashes when I use swing components that receive input Shocked.

Paulo "JCranky" Siqueira
Offline SEZ

Junior Newbie




Java games rock!


« Reply #1 - Posted 2004-05-16 10:56:20 »

mmm I'm not sure if this will help, but I have a Swing user interface and when I press the button with an actionlistener it will not recevie any further input in-game. So I threaded it and it worked fine.

 I wasn't using Jinput though sorry but maybe the same thing?

EDIT: spelling and also to clear up things more... I Threaded the call to start the game.
Offline gangrel-br

Junior Member




Java and Scala! Thats the game =)


« Reply #2 - Posted 2004-05-16 16:22:32 »

Hum... No.  The call to start the game was already threaded. Just to be sure, i made it unthreaded, and the result was the same...

And there is an other really strange thing: the buffer overflow message only appears in a friend's system, not in mine. But the game crashes on both.

Paulo "JCranky" Siqueira
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline endolf

JGO Coder


Medals: 7


Current project release date: sometime in 3003


« Reply #3 - Posted 2004-05-18 07:23:31 »

Hi
 When it crashes you should get a screen full of information, a stack trace, and maybe some native debug, copy and paste the whole lot into here and we *might* be able to help.
 The buffer over flow message happens when there is more information than the buffer can hold, there are 2 options to get round this. 1, if enough people report it I can up the buffer size in the native code. 2) poll more often, this should read the data before the buffer gets full, if you don't poll the buffer fills up till it over flows.

HTH

Endolf

Offline gangrel-br

Junior Member




Java and Scala! Thats the game =)


« Reply #4 - Posted 2004-05-19 02:10:05 »

Hi  Grin

Actually, there isn't any anormal output besides the overflow... but here it is:

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
Scanning jar: dxinput.jar
Examining file : META-INF/
Examining file : META-INF/MANIFEST.MF
Examining file : net/
Examining file : net/java/
Examining file : net/java/games/
Examining file : net/java/games/input/
Examining file : net/java/games/input/DirectInputAxis.class
Examining file : net/java/games/input/DirectInputDevice.class
Examining file : net/java/games/input/DirectInputEnvironmentPlugin.class
Found candidate class: net/java/games/input/DirectInputEnvironmentPlugin.class
Adding class to plugins:net.java.games.input.DirectInputEnvironmentPlugin
Examining file : net/java/games/input/DirectInputKeyboard.class
Examining file : net/java/games/input/DirectInputMouse$BallAxis.class
Examining file : net/java/games/input/DirectInputMouse$BallImpl.class
Examining file : net/java/games/input/DirectInputMouse$ButtonImpl.class
Examining file : net/java/games/input/DirectInputMouse$ButtonsImpl.class
Examining file : net/java/games/input/DirectInputMouse.class
Examining file : net/java/games/input/DirectInputRumbler.class
Creating Psx Gamepad 1 polling = true
DI_BUFFEROVERFLOW


This output comes at the beginning (before crashing), and nothing more appears.

When I said crashes, I meant "freezes". Does it make any difference?

Polling more often doesn't seen to solve this problem... The main thread was sleeping only 20 milliseconds. I changed it to 10 e the results was exactly the same. Anyway, 20 millis is fast enought, isn't it?

To free the buffer what I have to do? Is calling "poll" enough, or I have to call "getPollingData" for every axis?

Thanks  Cool

Paulo "JCranky" Siqueira
Offline endolf

JGO Coder


Medals: 7


Current project release date: sometime in 3003


« Reply #5 - Posted 2004-05-19 06:51:25 »

Hi
 Ok, freezing rather than crashing is a huge difference. In the jinput jar there are some test, can you run net.java.games.input.test.ControllerTextTest or net.java.games.input.test.ControllerReadTest ?

use the same classpath and start directory as you do for your app and those should run. ControllerTextTest will dump a whole heap of stuff to the console, copy and paste the lot in here please Smiley, and ControllerReadTest should open up some windows (one or more per device) and show axis and button values changing as the device is used.

How many time do you get the DI_BUFFEROVERFLOW message, rougly, once, once a second, or more?

Cheers

Endolf

Offline gangrel-br

Junior Member




Java and Scala! Thats the game =)


« Reply #6 - Posted 2004-05-19 14:39:45 »

Hi again  Grin

I knew about the tests  Wink and the ControllerReadTest have always run fine. Here is the output:

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
Scanning jar: dxinput.jar
Examining file : META-INF/
Examining file : META-INF/MANIFEST.MF
Examining file : net/
Examining file : net/java/
Examining file : net/java/games/
Examining file : net/java/games/input/
Examining file : net/java/games/input/DirectInputAxis.class
Examining file : net/java/games/input/DirectInputDevice.class
Examining file : net/java/games/input/DirectInputEnvironmentPlugin.class
Found candidate class: net/java/games/input/DirectInputEnvironmentPlugin.class
Adding class to plugins:net.java.games.input.DirectInputEnvironmentPlugin
Examining file : net/java/games/input/DirectInputKeyboard.class
Examining file : net/java/games/input/DirectInputMouse$BallAxis.class
Examining file : net/java/games/input/DirectInputMouse$BallImpl.class
Examining file : net/java/games/input/DirectInputMouse$ButtonImpl.class
Examining file : net/java/games/input/DirectInputMouse$ButtonsImpl.class
Examining file : net/java/games/input/DirectInputMouse.class
Examining file : net/java/games/input/DirectInputRumbler.class
Creating Psx Gamepad 1 polling = true
Axis count = 2
Axis count = 2
Axis count = 124
Axis count = 23


The DI_BUFFEROVERFLOW occurs only once (a friend reported getting 2 of them).  It comes and does not repeat any more after that.

Thanks for helping  Cheesy

Paulo "JCranky" Siqueira
Offline gangrel-br

Junior Member




Java and Scala! Thats the game =)


« Reply #7 - Posted 2004-05-19 14:44:08 »

About the ControllerTextTest, I couldn't post the output cause it's too big and the forum forbids it. But everything seens fine...

Paulo "JCranky" Siqueira
Offline endolf

JGO Coder


Medals: 7


Current project release date: sometime in 3003


« Reply #8 - Posted 2004-05-20 07:08:21 »

Hi
 The controller read test uses swing, so it can't be that. There must be something in your app thats causeing it. maybe you could put your source on a website somewhere and link to it from here.

As for the DI_BUFFEROVERFLOW, if it's only happening once, I suspect that whats happening is JInput is being initialised and then it happens before the first poll, after that you poll frequently enough not to fill the buffer, but the time between initialisation and the first poll is too long, there is probably very little to worry about with this. Unless you start seeing some strange behaviour, you can probably ignore it for now.

HTH

Endolf

Offline gangrel-br

Junior Member




Java and Scala! Thats the game =)


« Reply #9 - Posted 2004-05-20 14:56:38 »

Hi

 The ControllerReadTest uses swing, but only panels and labels. My game was fine when I was using just that too. But when I put a JTextField there... So I'm still thinking it's a Swing / JInput issue.

 The project I'm working on is an open source turn-based strategy game (artofwar.sf.net). It is hosted on sourceforge, but the code in the CVS is the one with wasn't freezing (and had no JTextField in it). I'll feel bad if I commit a broken version. Wink

 About the DI_BUFFEROVERFLOW, you are probably right (it really makes a lot of sense! Smiley ), and maybe it hasn't anything to do with the problem at all... And I'll surely ignore it for now.

Thanks again Smiley

Paulo "JCranky" Siqueira
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline gangrel-br

Junior Member




Java and Scala! Thats the game =)


« Reply #10 - Posted 2004-05-25 14:48:44 »

Hi

Just thinking... can the AWTEvent queue and/or the use of some event listeners have something to do with this problem? I use jinput for processing keyboard, but I use mouse listeners to help processing the mouse input.

thanks Cool

Paulo "JCranky" Siqueira
Offline gangrel-br

Junior Member




Java and Scala! Thats the game =)


« Reply #11 - Posted 2004-05-26 02:18:11 »

Hi

I found the error, and it really doesn't have anything to do with jinput... Thanks Endolf!  Grin  It was a deadlock in the event dispatch thread X my custom painting code. At least I've learned about the DI_BUFFEROVERFLOW.

thanks again  Smiley

Paulo "JCranky" Siqueira
Offline endolf

JGO Coder


Medals: 7


Current project release date: sometime in 3003


« Reply #12 - Posted 2004-05-28 09:06:44 »

Hi
 Gald it's all working again Smiley

Endolf

Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

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 (20 views)
2014-09-20 17:42:18

BurntPizza (14 views)
2014-09-20 16:30:30

moogie (14 views)
2014-09-20 15:26:15

UprightPath (25 views)
2014-09-20 11:14:06

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

Dwinin (41 views)
2014-09-12 00:08:26

Norakomi (73 views)
2014-09-10 04:57:51

TehJavaDev (96 views)
2014-09-09 21:39:09

Tekkerue (49 views)
2014-09-08 17:24:56

mitcheeb (70 views)
2014-09-07 21:06:29
List of Learning Resources
by Longor1996
2014-08-16 01:40:00

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

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

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

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

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

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

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