Java-Gaming.org    
Featured games (79)
games approved by the League of Dukes
Games in Showcase (477)
Games in Android Showcase (107)
games submitted by our members
Games in WIP (535)
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  
  Mouse event lost  (Read 3451 times)
0 Members and 1 Guest are viewing this topic.
Offline Bombraider

Senior Newbie





« Posted 2003-05-15 17:28:26 »

Hello, Cheesy
I use a frame full screen, which receive mouse events for the game.
The problem is that the frame is frequently not advised , and I lose many events before they can reach my code.
I work with W2000, with a WACOM mouse. I reduced the computing time to check if System was not overbooked, without success. Cry

Has anybody had the same problem? Does anybody have a clue? Huh

Corinne
Online Abuse

JGO Coder


Medals: 11


falling into the abyss of reality


« Reply #1 - Posted 2003-05-15 19:07:06 »

if you are losing them before they reach your code - how do you even know they exist int eh 1st place  Wink

seriously though, do you lose all events, or is it just mouse events?

i've found when using fullscreen, it is possible for the event dispatch thread to become dorment for no particular reason  Huh

I havn't locked down the actual cause yet though Shocked

Make Elite IV:Dangerous happen! Pledge your backing at KICKSTARTER here! https://dl.dropbox.com/u/54785909/EliteIVsmaller.png
Offline Bombraider

Senior Newbie





« Reply #2 - Posted 2003-05-15 19:17:28 »

After cliking 20, only a range from 4 to 15 could reach my app.
Even if it is for a strategy game, it can make the player ... nervous.

Corinne
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline pepe

Junior Member




Nothing unreal exists


« Reply #3 - Posted 2003-05-16 07:07:16 »

hello.
I seem to have somewhat the same problems.
I have an application  using j3d that sometimes does not receive buttonup or mouseup events. i'll have to take time to investigate, but i'm  thinking that events that occur during GC pauses are lost. (1.4.2 beta) this is new, i think. each time i get s slight pause or a glitch and i depress  the keys at the same time,  i don't get the event.
Of course, it is not very predictible, and as soon as i'm convinced of the cause, i'll try to make a test case, but i doubt i'd be able to create a special program to reveal this. each time...
Please check if the events you don't receive  occur during GC pauses (if you can see them)
By the way, what jdk release do you use?

Home page: http://frederic.barachant.com
------------------------------------------------------
GoSub: java2D gamechmark http://frederic.barachant.com/GoSub/GoSub.jnlp
Offline Bombraider

Senior Newbie





« Reply #4 - Posted 2003-05-16 09:01:34 »

What does GC mean?

I use 1.4.1_02.
I have tried to rise to max the priority of awt_event queue. It didn't make any difference.
I wonder how many tasks are to be crossed between the mouse detection (by polling or IT ?) and the message sending to awt event queue.


Corinne
Offline pepe

Junior Member




Nothing unreal exists


« Reply #5 - Posted 2003-05-16 09:08:55 »

GC is for Garbage Collector. Plus court, non ?  Grin
Are you using 100 % of the cpu, and generating garbage? Do you get GC pauses?

Home page: http://frederic.barachant.com
------------------------------------------------------
GoSub: java2D gamechmark http://frederic.barachant.com/GoSub/GoSub.jnlp
Offline Bombraider

Senior Newbie





« Reply #6 - Posted 2003-05-16 10:28:36 »

As I have tried with just the fullscreen jframe (to remove any other incidence) and dispose of graphics object at the end of paint, garbage should be very small crumbles.

Any way, I have try to disable it by writing -Xnoclassgc into launcher application params in JBuilder. As I am new to this ID, I am not sure to have tested it properly. If I have done it properly, the result is not making any progress. Is there another way to disable GC ?

Corinne
Offline oNyx

JGO Coder


Medals: 1


pixels! :x


« Reply #7 - Posted 2003-05-16 12:07:52 »

You can't disable GC. You can only try to avoid creating too much garbage.

So what's garbage? - you may ask. It's the stuff you don't need anymore.

In C/C++ and a lot of other languages you have to allocate and deallocate memory for yourself. Sounds like fun - but it's a lot of work and usually it produces a lot of errors and so called "memory leaks" (if you forgot to delete/deallocate memory it's marked as "in use" and can't be used till the next reboot).

In Jave deallocation is done automatically by the GC. Unfortunately the whole world is stopped as long as the GC has something to do.

The only thing wich helps a bit is avoiding garbage where it's possible. You can create a "pool" of objects wich you reuse till the end of the program (Yes. Recycling avoids garbage Wink).

The GC kicks in every here and then... if there is a lot to do it will take awhile and if there's nothing to do you won't even notice it.

Well the loosing of events sounds quite seriously... that shouldn't happen ever :-/

弾幕 ☆ @mahonnaiseblog
Offline Backmask

Junior Member




586: The average IQ needed to understand a PC


« Reply #8 - Posted 2003-05-16 12:19:40 »

can u post some sourcecode that has the problem with the lost mouse events so we can verify it to and try to nail down the problem

Offline Bombraider

Senior Newbie





« Reply #9 - Posted 2003-05-16 12:47:48 »

import javax.swing.JFrame;
import java.awt.*;
import java.awt.event.*;

public class FullJFrame
   extends JFrame {

 public static void main(String[] args) {
   FullJFrame MainFrame = new FullJFrame();
 }

 public FullJFrame() {
   GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
   GraphicsDevice gd = ge.getDefaultScreenDevice();
   DisplayMode UsualDisplayMode = gd.getDisplayMode();

   Rectangle GameScreen = new Rectangle(0, 0, UsualDisplayMode.getWidth(),
                                        UsualDisplayMode.getHeight());
   this.setBounds(GameScreen);
   setUndecorated(true);
   if (gd.isFullScreenSupported()) {
     gd.setFullScreenWindow(this);
   }
   setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
   getContentPane().setBackground(Color.BLUE);

   this.setVisible(true);

   this.addMouseListener
       (new MouseAdapter() {
     public void mouseClicked(MouseEvent evt) {
       System.err.println('\n' + Thread.currentThread().getName() + ' ' +
                          String.valueOf(Thread.currentThread().getPriority()));
     }
   });

   this.addKeyListener(new KeyAdapter() {
     public void keyPressed(KeyEvent evt) {
       if (evt.getKeyCode() == KeyEvent.VK_ESCAPE) {
         System.exit(0); //evt.getKeyCode()
       }
     }
   });

 }

}

Corinne
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Backmask

Junior Member




586: The average IQ needed to understand a PC


« Reply #10 - Posted 2003-05-16 12:57:08 »

I got 20 of 20 events...

what JDK version are you using?

Offline Bombraider

Senior Newbie





« Reply #11 - Posted 2003-05-16 13:24:33 »

last official standard edition 1.4.1_02

I feel relieved . If it works better somewhere else, there maybe a solution. Which system are you using?

Corinne
Offline Bombraider

Senior Newbie





« Reply #12 - Posted 2003-05-16 13:42:49 »

I have checked again.
It is effectively 20/20 if I don't move between click, but it is still poor if I make some movements between each click 5-12/20.
How have you tested?

Corinne
Online Abuse

JGO Coder


Medals: 11


falling into the abyss of reality


« Reply #13 - Posted 2003-05-16 16:05:08 »

you are using mouseClicked.

mouseClicked events are only fired when the mouse is clicked and released at the same x,y position.

because you are moving while clicking, you are creating mousedragged events not mouseclciked.

use mousePressed/Released instead.

Make Elite IV:Dangerous happen! Pledge your backing at KICKSTARTER here! https://dl.dropbox.com/u/54785909/EliteIVsmaller.png
Offline Bombraider

Senior Newbie





« Reply #14 - Posted 2003-05-16 16:21:02 »

So goooood! That's it !

You maybe know how to deiconify the program quoted above. It never reappears.

I know that there is a window event (windowDeiconified), I tried to put a paint call in it. But this event never occurs.

Corinne
Online Abuse

JGO Coder


Medals: 11


falling into the abyss of reality


« Reply #15 - Posted 2003-05-16 20:23:47 »

Quote
So goooood! That's it !

You maybe know how to deiconify the program quoted above. It never reappears.

I know that there is a window event (windowDeiconified), I tried to put a paint call in it. But this event never occurs.


you mean alt+tab out (minimizing the window), then restore it?

That works just fine for me.

The fullscreen api is buggy, and its possible you may need to update your gfx drivers.

Make Elite IV:Dangerous happen! Pledge your backing at KICKSTARTER here! https://dl.dropbox.com/u/54785909/EliteIVsmaller.png
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.

Riven (4 views)
2014-07-29 12:53:52

Dwinin (7 views)
2014-07-29 10:59:34

E.R. Fleming (20 views)
2014-07-29 03:07:13

E.R. Fleming (8 views)
2014-07-29 03:06:25

pw (39 views)
2014-07-24 01:59:36

Riven (39 views)
2014-07-23 21:16:32

Riven (26 views)
2014-07-23 21:07:15

Riven (28 views)
2014-07-23 20:56:16

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

Zero Volt (51 views)
2014-07-17 23:47:54
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!