LibGDX key pressed/held - keyboard

How to distinguish when a key is only pressed or held. Using this code:
Gdx.input.isKeyPressed(Keys.D)
returns true every time the button is held, but how to get only 'one time' press?

Simply use: Gdx.input.isKeyJustPressed(int key)

Related

Where is scripted the Dalaran Well teleport (game object)?

When you try to reach the Dalaran Well in Dalaran, you are teleported to the sewers.
It is using this Game object: Doodad_Dalaran_Well_01 (id = 193904 )
Where is it scripted? How?
I've found nothing in the table smart_scripts, and found nothing in the core about this specific id so I'm curious because this type of teleport is really better than clicking on a game object
This gameobject is a unique case because it works like instance teleports do. If you check the gameobject_template table, you will see that it has several Data columns that have diferent values based on the type of the gameobject.
The gameobject you are refering too is the Well It self but the portal gameobject inside the well gives the player a dummy spell to tell the core that the player has been teleported (spell ID 61652).
For the specific case of the dalaran well, it's type is 30 which means, as the documentation says, GAMEOBJECT_TYPE_AURAGENERATOR. As soon as the player is in range, a dummy aura is cast on him to notify the core that this areatrigger has been activated (You could do stuff when player gets hit by the dummy spell).
The trick here is a bunny, but not the bunny itself since it is there mostly to determine an areatrigger. If you use command .go gobject 61148 you can check him out, he's inside the well.
Areatriggers are a DBC object that are actually present on our database on world.areatrigger. You can check the columns here. When the player enters the Radius box specified on the areatrigger, another thing happens in the core which is world.areatrigger_teleport.
If you run the following query you will be able to check the position where the trigger will teleport the player to.
SELECT * FROM areatrigger_teleport WHERE `Name` LIKE '%Dalaran Well teleporter%';

Why does remapping a key in xkb (e.g. NMLK to Insert) affect other key (e.g. the Super key)?

I changed the behavior of NumLock to perform as Insert with the following line added to my layout file ('br', could be 'us' etc.):
key <NMLK> { [ Insert, Insert, Insert, Insert ] };
However, with this change, the Super key (aka Win key) stopped working.
Other functionalities like the change-brightness keys also stopped working.
This is not the first time I see such kind of interference between unrelated keys.
Is there a reason for it to happen?
Using replace solved the problem:
replace key <NMLK> { [ Insert ] };

How to find out the rarkey value for delete key

How to find out the rarkey value for delete key. If I use rarkey then I can't use any other key is it any alternative method for "on rawkeyDown theKey"
If you capture the rawKey value in a rawKeyDown handler, you must pass the message if you want any of the key presses to be handled by the engine. This is the case with any of the key messages you want to handle (e.g., rawKeyUp, keyDown, keyUp); if you do not pass the message, it's normal functionality will be preempted.
on rawKeyDown pCode
if pCode is 65535 then
# do what you want to do to handle the delete key here
else
pass rawKeyDown
end if
end rawKeyDown

How can I access button group members within a slot?

I have designed my current GUI with QT Designer. The underlying code creates and starts multiple threads. For each thread I have a set up several QPushButtons: Start, Stop, Pause, Resume, and Status. I'd like to group them, but they are not exclusive, so I need to set the enabled attribute from the signaled slot, for each related button, depending on which button has been clicked. I've tried creating a QButtonGroup for each set of buttons. I can get the sender(), but don't see how to get access to the other buttons which belong to the group. Have tried several things, but having no luck.
OK, I think I have what I need on this. The problem was how to I set the enabled states of buttons in a group based on the identity of the sender?
I have a possible x number of threads that can be controlled. The objectNames of the buttons in each QButtonGroup are as follows:
pushButton_start_x
pushButton_stop_x
pushButton_status_x
pushButton_pause_x
pushButton_resume_x
In my Python code I have the following dictionary:
# Each key represents a button type that requires setting the group's
# buttons enabled state
# Each key's values map to these buttons: [start,stop,status,pause,resume]
testManagerButtonEnableStates = {}
testManagerButtonEnableStates["start"] = [False,True,True,True,False]
testManagerButtonEnableStates["stop"] = [True,False,True,False,False]
testManagerButtonEnableStates["pause"] = [False,False,True,False,True]
testManagerButtonEnableStates["resume"] = [False,True,True,True,False]
This routine sets the states based on the objectName of the sender:
# Note that the status button does not require any action here
def setButtonGroupEnabledStates(self):
buttonType = str(self.sender().objectName().toAscii()).split('_')[1]
if buttonType == "status":
return
i = 0
for button in self.sender().group().buttons():
button.setEnabled(self.testManagerButtonEnableStates[buttonType][i])
i+=1
Maybe not the most efficient, but it gets me there...

Sending control key combinations to an element in watir-webdriver

How can you send control key combination to an element when using watir-webdriver?
Currently I am able to send a string to the element with the following code;
$browser.frame(:id,"ws-txt-editor").div(:id,"proxy").send_keys("\b")
or
$browser.frame(:id,"ws-txt-editor").div(:id,"proxy").send_keys(myAttrib[2])
but how do I send arrow keys or things like CTRL-A, CTRL-C or CTRL-V?
I am using watir-webdriver version 0.2.3.
element.send_keys :arrow_down
element.send_keys [:control, "a"], :backspace
etc.

Resources