Java Code Examples for org.lwjgl.input.Keyboard#enableRepeatEvents()

The following examples show how to use org.lwjgl.input.Keyboard#enableRepeatEvents() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: GuiToolWorkstation.java    From enderutilities with GNU Lesser General Public License v3.0 6 votes vote down vote up
@Override
public void initGui()
{
    super.initGui();

    Keyboard.enableRepeatEvents(true);

    this.nameField = new GuiTextField(0, this.fontRenderer, 34, 100, 134, 12);
    this.nameField.setTextColor(-1);
    this.nameField.setDisabledTextColour(-1);
    this.nameField.setEnableBackgroundDrawing(false);
    this.nameField.setMaxStringLength(50);
    this.nameField.setEnabled(true);
    this.nameField.setText(this.te.getItemName());
    this.nameField.setFocused(false);
    this.nameField.setCursorPositionEnd();

    this.buttonList.clear();
    this.buttonList.add(new GuiButton(1, this.guiLeft + 108, this.guiTop + 113, 60, 20, I18n.format("enderutilities.gui.label.setname")));
}
 
Example 2
Source File: GuiPortalPanel.java    From enderutilities with GNU Lesser General Public License v3.0 6 votes vote down vote up
@Override
public void initGui()
{
    super.initGui();

    Keyboard.enableRepeatEvents(true);

    this.nameField = new GuiTextField(0, this.fontRenderer, 11, 131, 154, 12);
    this.nameField.setTextColor(-1);
    this.nameField.setDisabledTextColour(-1);
    this.nameField.setEnableBackgroundDrawing(false);
    this.nameField.setMaxStringLength(50);
    this.nameField.setEnabled(true);
    this.nameField.setText(this.tepp.getPanelDisplayName());
    this.nameField.setFocused(false);
    this.nameField.setCursorPositionEnd();

    this.createButtons();

}
 
Example 3
Source File: GuiBookCode.java    From Minecoprocessors with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void onGuiClosed() {
  super.onGuiClosed();

  // Write changes back to our data tag.
  saveProgram();

  // Save any changes made and send them to the server.
  final NBTTagCompound nbt = new NBTTagCompound();
  data.writeToNBT(nbt);
  Minecoprocessors.NETWORK.sendToServer(new MessageBookCodeData(nbt));

  Keyboard.enableRepeatEvents(false);
}
 
Example 4
Source File: DisplayContainer.java    From opsu-dance with GNU General Public License v3.0 5 votes vote down vote up
private void postInitGL() throws Exception
{
	GL.initDisplay(width, height);
	GL.enterOrtho(width, height);

	this.glReady = true;
	this.glVersion = glGetString(GL_VERSION);
	this.glVendor = glGetString(GL_VENDOR);

	graphics = new Graphics(width, height);
	graphics.setAntiAlias(false);

	Keyboard.enableRepeatEvents(true);

	Log.info("GL ready");

	GameImage.onResolutionChanged();
	Fonts.init();

	if (volumeControl == null) {
		volumeControl = new VolumeControl();
	}

	destroyImages();
	reinit();
	VolumeControl.createProgram();

	barNotifs.onResolutionChanged(width, height);
	bubNotifs.onResolutionChanged(width, height);
	fpsDisplay.onResolutionChanged(width, height);
	for (ResolutionChangedListener l : this.resolutionChangedListeners) {
		l.onResolutionChanged(width, height);
	}
}
 
Example 5
Source File: GuiNBTEdit.java    From ehacks-pro with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void initGui() {
    Keyboard.enableRepeatEvents(true);
    this.buttonList.clear();
    this.guiTree.initGUI(this.width, this.height, this.height - 35);
    this.nbtString = new GuiTextField(this.mc.fontRenderer, 274, this.height - 27, this.width - 286, 20);
    this.nbtString.setMaxStringLength(32000);
    this.nbtString.setText(Debug.NBTToJson(guiTree.getNBTTree().toNBTTagCompound()));
    this.nbtString.setCursorPositionZero();
    this.buttonList.add(new GuiButton(0, 10, this.height - 27, 60, 20, "Save"));
    this.buttonList.add(new GuiButton(1, 75, this.height - 27, 60, 20, "\u00a7cCancel"));
    this.buttonList.add(new GuiButton(2, 140, this.height - 27, 60, 20, "From JSON"));
    this.buttonList.add(new GuiButton(3, 205, this.height - 27, 60, 20, "To JSON"));
}
 
Example 6
Source File: GuiHelm.java    From archimedes-ships with MIT License 5 votes vote down vote up
@SuppressWarnings("unchecked")
@Override
public void initGui()
{
	super.initGui();
	
	Keyboard.enableRepeatEvents(true);
	
	int btnx = guiLeft - 100;
	int btny = guiTop + 20;
	buttonList.clear();
	
	btnRename = new GuiButton(4, btnx, btny, 100, 20, StatCollector.translateToLocal("gui.shipstatus.rename"));
	buttonList.add(btnRename);
	
	btnAssemble = new GuiButton(1, btnx, btny += 20, 100, 20, StatCollector.translateToLocal("gui.shipstatus.compile"));
	buttonList.add(btnAssemble);
	
	btnUndo = new GuiButton(2, btnx, btny += 20, 100, 20, StatCollector.translateToLocal("gui.shipstatus.undo"));
	btnUndo.enabled = tileEntity.getPrevAssembleResult() != null && tileEntity.getPrevAssembleResult().getCode() != AssembleResult.RESULT_NONE;
	buttonList.add(btnUndo);
	
	btnMount = new GuiButton(3, btnx, btny += 20, 100, 20, StatCollector.translateToLocal("gui.shipstatus.mount"));
	btnMount.enabled = tileEntity.getAssembleResult() != null && tileEntity.getAssembleResult().getCode() == AssembleResult.RESULT_OK;
	buttonList.add(btnMount);
	
	txtShipName = new GuiTextField(fontRendererObj, guiLeft + 8 + xSize / 2, guiTop + 21, 120, 10);
	txtShipName.setMaxStringLength(127);
	txtShipName.setEnableBackgroundDrawing(false);
	txtShipName.setVisible(true);
	txtShipName.setCanLoseFocus(false);
	txtShipName.setTextColor(0xFFFFFF);
	txtShipName.setText(tileEntity.getShipInfo().shipName);
}
 
Example 7
Source File: SkyblockAddonsGui.java    From SkyblockAddons with MIT License 5 votes vote down vote up
/**
 * Save the config when exiting.
 */
@Override
public void onGuiClosed() {
    if (!cancelClose) {
        if (tab == EnumUtils.GuiTab.GENERAL_SETTINGS) {
            main.getRenderListener().setGuiToOpen(EnumUtils.GUIType.MAIN, 1, EnumUtils.GuiTab.MAIN);
        }
        main.getConfigValues().saveConfig();
        Keyboard.enableRepeatEvents(false);
    }
}
 
Example 8
Source File: Game.java    From FEMultiplayer with GNU General Public License v3.0 5 votes vote down vote up
public void init(int width, int height, String name) {
	time = System.nanoTime();
	
	windowWidth = width*scaleX;
	windowHeight = height*scaleY;

	try {
		Display.setDisplayMode(new DisplayMode(windowWidth, windowHeight));
		Display.create();
		Display.setTitle(name);
		Keyboard.create();
		Keyboard.enableRepeatEvents(true);
		Mouse.create();
		glContextExists = true;
	} catch (LWJGLException e) {
		e.printStackTrace();
		System.exit(0);
	}
	
	//init OpenGL
	glEnable(GL_DEPTH_TEST);
	glDepthFunc(GL_LEQUAL);
	glEnable(GL_ALPHA_TEST);
	glAlphaFunc(GL_GREATER, 0.01f);
	glEnable(GL_TEXTURE_2D);
	glShadeModel(GL_SMOOTH);
	glClearDepth(1.0f);
	glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
	glEnable(GL_BLEND);
	glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
	glViewport(0, 0, windowWidth, windowHeight);
	glMatrixMode(GL_PROJECTION);
	glLoadIdentity();
	glOrtho(0, windowWidth/scaleX, windowHeight/scaleY, 0, 1, -1);		//It's basically a camera
	glMatrixMode(GL_MODELVIEW);
	
	keys = new ArrayList<KeyboardEvent>();
	mouseEvents = new ArrayList<MouseEvent>();
}
 
Example 9
Source File: XrayModChooserGui.java    From MinecraftX-RAY with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@Override
public void initGui() {
	super.initGui();
	Keyboard.enableRepeatEvents(true);
	String[] blockListCache = UyjuliansXrayModMain.blockList.toArray(new String[0]);
	Collections.addAll(this.invisibleIdList, blockListCache);
}
 
Example 10
Source File: GuiCyberwareMenu.java    From Cyberware with MIT License 5 votes vote down vote up
@Override
public void onGuiClosed()
{
	Keyboard.enableRepeatEvents(false);
	CyberwareAPI.syncHUDColor();
	//mc.thePlayer.setSprinting(MiscHandler.wasSprinting);
}
 
Example 11
Source File: GuiNBTEdit.java    From ehacks-pro with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void onGuiClosed() {
    Keyboard.enableRepeatEvents(false);
}
 
Example 12
Source File: GuiQuantumComputer.java    From qcraft-mod with Apache License 2.0 4 votes vote down vote up
@Override
public void onGuiClosed()
{
    super.onGuiClosed();
    Keyboard.enableRepeatEvents( false );
}
 
Example 13
Source File: GuiCyberwareMenu.java    From Cyberware with MIT License 4 votes vote down vote up
public GuiCyberwareMenu()
{
	Keyboard.enableRepeatEvents(true);
}
 
Example 14
Source File: GuiAphorismTile.java    From PneumaticCraft with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void initGui(){
    Keyboard.enableRepeatEvents(true);
}
 
Example 15
Source File: Game.java    From FEMultiPlayer-V2 with GNU General Public License v3.0 4 votes vote down vote up
/**
 * Inits the.
 *
 * @param width the width
 * @param height the height
 * @param name the name
 */
public void init(int width, int height, String name) {
	Game.logicalWidth = width;
	Game.logicalHeight = height;
	Game.scale = FEResources.getWindowScale();
	final int windowWidth = Math.round(logicalWidth * scale);
	final int windowHeight = Math.round(logicalHeight * scale);

	try {
		Display.setDisplayMode(new DisplayMode(windowWidth, windowHeight));
		Display.create();
		Display.setTitle(name);
		Keyboard.create();
		Keyboard.enableRepeatEvents(true);
		Mouse.create();
		glContextExists = true;
	} catch (LWJGLException e) {
		e.printStackTrace();
		System.exit(0);
	}
	
	//init OpenGL
	glEnable(GL_DEPTH_TEST);
	glDepthFunc(GL_LEQUAL);
	glEnable(GL_ALPHA_TEST);
	glAlphaFunc(GL_GREATER, 0.01f);
	glEnable(GL_TEXTURE_2D);
	glShadeModel(GL_SMOOTH);
	glClearDepth(1.0f);
	glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
	glEnable(GL_BLEND);
	glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
	glViewport(0, 0, windowWidth, windowHeight);
	glMatrixMode(GL_PROJECTION);
	glLoadIdentity();
	glOrtho(0, width, height, 0, 1, -1);		//It's basically a camera
	glMatrixMode(GL_MODELVIEW);
	
	keys = new ArrayList<KeyboardEvent>();
	mouseEvents = new ArrayList<MouseEvent>();
}
 
Example 16
Source File: GuiAphorismTile.java    From PneumaticCraft with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void onGuiClosed(){
    Keyboard.enableRepeatEvents(false);
}
 
Example 17
Source File: GuiCapture.java    From OpenPeripheral-Addons with MIT License 4 votes vote down vote up
@Override
public void initGui() {
	new GlassesSignalCaptureEvent(guid, true).sendToServer();
	Keyboard.enableRepeatEvents(false);
}
 
Example 18
Source File: GuiSearcher.java    From PneumaticCraft with GNU General Public License v3.0 4 votes vote down vote up
/**
 * Called when the screen is unloaded. Used to disable keyboard repeat events
 */
@Override
public void onGuiClosed(){
    super.onGuiClosed();
    Keyboard.enableRepeatEvents(false);
}
 
Example 19
Source File: Input.java    From slick2d-maven with BSD 3-Clause "New" or "Revised" License 2 votes vote down vote up
/**
 * Enable key repeat for this input context. Uses the system settings for repeat
 * interval configuration.
 */
public void enableKeyRepeat() {
	Keyboard.enableRepeatEvents(true);
}
 
Example 20
Source File: Input.java    From opsu with GNU General Public License v3.0 2 votes vote down vote up
/**
 * Enable key repeat for this input context. Uses the system settings for repeat
 * interval configuration.
 */
public void enableKeyRepeat() {
	Keyboard.enableRepeatEvents(true);
}