Jump to content

Recommended Posts

Posted

Hey guys I am in need of a little help. I am trying to make a toggle key but it toggles twice every key press.

    public void keyDown(EnumSet<TickType> types, KeyBinding kb,
                    boolean tickEnd, boolean isRepeat) 
    {
           if(toggle)
          {
        	  toggle = false;
        	  System.out.println("Toggle On");
          }
          else
          {
        	  toggle = true;
        	  System.out.println("Toggle Off");
          }
    }

This returns

2013-01-09 06:59:48 [iNFO] [sTDOUT] Toggle On

2013-01-09 06:59:48 [iNFO] [sTDOUT] Toggle Off

for every key press.

What am I doing wrong?

Thanks,

Rick

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.