当前位置: 首页>>代码示例>>Java>>正文


Java Keyboard.isKeyDown方法代码示例

本文整理汇总了Java中org.lwjgl.input.Keyboard.isKeyDown方法的典型用法代码示例。如果您正苦于以下问题:Java Keyboard.isKeyDown方法的具体用法?Java Keyboard.isKeyDown怎么用?Java Keyboard.isKeyDown使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.lwjgl.input.Keyboard的用法示例。


在下文中一共展示了Keyboard.isKeyDown方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onBlockActivated

import org.lwjgl.input.Keyboard; //导入方法依赖的package包/类
@Override
public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) {
    if(!worldIn.isRemote) {
        if(playerIn.inventory.getCurrentItem().getItem() == MItems.WRENCH) {
            TileEntityAccumulator tile = (TileEntityAccumulator) worldIn.getTileEntity(pos);
            EnumFacing face = facing;
            if(Keyboard.isKeyDown(Keyboard.KEY_LCONTROL)){
                face = face.getOpposite();
            }
            AccumulatorInfo info = tile.getInfoForFace(face);
            tile.getInfoForFace(face).setIoInfo(info.getIoInfo().getNext());
            tile.markDirty();
            return true;
        } else
            playerIn.openGui(MAS.INSTANCE, 1, worldIn, pos.getX(), pos.getY(), pos.getZ());
    }
    return true;
}
 
开发者ID:jaredlll08,项目名称:Machines-and-Stuff,代码行数:19,代码来源:BlockAccumulator.java

示例2: movePosition

import org.lwjgl.input.Keyboard; //导入方法依赖的package包/类
private void movePosition(){
	float speed = 0;
	if(Keyboard.isKeyDown(Keyboard.KEY_W)||Keyboard.isKeyDown(Keyboard.KEY_UP)){
		speed = 0.05f;
	}else if(Keyboard.isKeyDown(Keyboard.KEY_S)||Keyboard.isKeyDown(Keyboard.KEY_DOWN)){
		speed = -0.05f;
	}
	center.x += speed * Math.sin(Math.toRadians(yaw));
	center.y += speed * -Math.cos(Math.toRadians(yaw));
	speed = 0;
	if(Keyboard.isKeyDown(Keyboard.KEY_A)||Keyboard.isKeyDown(Keyboard.KEY_LEFT)){
		speed = -0.05f;
	}else if(Keyboard.isKeyDown(Keyboard.KEY_D)||Keyboard.isKeyDown(Keyboard.KEY_RIGHT)){
		speed = 0.05f;
	}
	center.x += speed * Math.sin(Math.toRadians(yaw + 90));
	center.y += speed * -Math.cos(Math.toRadians(yaw + 90));
}
 
开发者ID:TheThinMatrix,项目名称:OcclusionQueries,代码行数:19,代码来源:Camera.java

示例3: shuffleMatrix

import org.lwjgl.input.Keyboard; //导入方法依赖的package包/类
private static void shuffleMatrix(int[][] matrix){
	if(Keyboard.isKeyDown(Keyboard.KEY_X)) {
		for(int x = 0; x < BOARD_WIDTH; x++) {
			for(int y = 0; y < BOARD_HEIGHT; y++) {
				if((int) (Math.random() * 2) > 0.2 && matrix[x][y] == 0) {
					matrix[x][y] = 1;
				}
			}
		}
	}
}
 
开发者ID:marcioz98,项目名称:MRCEngine,代码行数:12,代码来源:GameOfLifeTest.java

示例4: calculateAngleAroundPlayer

import org.lwjgl.input.Keyboard; //导入方法依赖的package包/类
/**
 * Calculate the angle of the camera around the player (when looking down at
 * the camera from above). Basically the yaw. Changes the yaw when the user
 * moves the mouse horizontally with the LMB down.
 */
private void calculateAngleAroundPlayer() {
    if (Mouse.isButtonDown(0) && !Keyboard.isKeyDown(Keyboard.KEY_LCONTROL)) {
        float angleChange = Mouse.getDX() * YAW_SENSITIVITY;
        angleAroundPlayer.increaseTarget(-angleChange);
    }
    angleAroundPlayer.update(1f / 60);
}
 
开发者ID:GryPLOfficial,项目名称:EcoSystem-Official,代码行数:13,代码来源:Camera.java

示例5: drawGuiContainerForegroundLayer

import org.lwjgl.input.Keyboard; //导入方法依赖的package包/类
@Override
protected void drawGuiContainerForegroundLayer(int mx, int my) {
    if(title)
        this.fontRendererObj.drawString(this.name, this.xSize / 2 - this.fontRendererObj.getStringWidth(this.name) / 2, 6, 0xa0a0a0);
    
    GlStateManager.pushAttrib();
    GlStateManager.color(1, 1, 1, 1);
    
    Minecraft.getMinecraft().renderEngine.bindTexture(getTexture());
    GlStateManager.popAttrib();

    if(Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) && getShouldOutline() != null)
        drawOutlines();
}
 
开发者ID:jaredlll08,项目名称:Machines-and-Stuff,代码行数:15,代码来源:GuiBase.java

示例6: onDisable

import org.lwjgl.input.Keyboard; //导入方法依赖的package包/类
@Override
protected void onDisable() {
    if (!Keyboard.isKeyDown(mc.gameSettings.keyBindSneak.getKeyCode())) {
        KeyBinding.setKeyBindState(mc.gameSettings.keyBindSneak.getKeyCode(), false);
        if (this.sneaking) {
            mc.thePlayer.sendQueue.addToSendQueue(new C0BPacketEntityAction(mc.thePlayer, C0BPacketEntityAction.Action.STOP_SNEAKING));
            this.sneaking = false;
        }
    }

    this.sneaking = false;
}
 
开发者ID:SerenityEnterprises,项目名称:SerenityCE,代码行数:13,代码来源:Sneak.java

示例7: input

import org.lwjgl.input.Keyboard; //导入方法依赖的package包/类
private void input() {
	if (Keyboard.isKeyDown(Keyboard.KEY_W)) {
		paddle.setDY(-.5);
	} else if (Keyboard.isKeyDown(Keyboard.KEY_S)) {
		paddle.setDY(.5);
	} else {
		paddle.setDY(0);
	}
}
 
开发者ID:nitrodragon,项目名称:lwjgl_collection,代码行数:10,代码来源:PongGame.java

示例8: addInformation

import org.lwjgl.input.Keyboard; //导入方法依赖的package包/类
@SideOnly(Side.CLIENT)
@Override
public void addInformation(ItemStack itemStack, World player, List<String> list, ITooltipFlag whatIsThis) {
    super.addInformation(itemStack, player, list, whatIsThis);

    if (Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) || Keyboard.isKeyDown(Keyboard.KEY_RSHIFT)) {
        list.add(TextFormatting.WHITE + "This machine cleans air");
        list.add(TextFormatting.WHITE + "using power and coal or charcoal");
        list.add(TextFormatting.WHITE + "Works best in closed area!");
    } else {
        list.add(TextFormatting.WHITE + NeedToBreathe.SHIFT_MESSAGE);
    }
}
 
开发者ID:McJty,项目名称:needtobreath,代码行数:14,代码来源:PurifierBlock.java

示例9: onKeyboardEvent

import org.lwjgl.input.Keyboard; //导入方法依赖的package包/类
@SubscribeEvent
public static void onKeyboardEvent(InputEvent.KeyInputEvent event)
{
    if (ExPetrum.isDevEnvironment)
    {
        if (Keyboard.isKeyDown(Keyboard.KEY_F3) && Keyboard.isKeyDown(Keyboard.KEY_R))
        {
            EntityModelDynamic.reloadAllModels();
        }
    }
}
 
开发者ID:V0idWa1k3r,项目名称:ExPetrum,代码行数:12,代码来源:ExPHandlerClient.java

示例10: prepare

import org.lwjgl.input.Keyboard; //导入方法依赖的package包/类
/**
 * A few general settings. Clears the colour and depth buffer before
 * rendering, turns on backface culling, enables depth testing, turns on
 * antialiasing and allows for wireframe rendering if the "G" key is
 * pressed. The provoking vertex convention is also set here, indicating
 * that the first vertex of each triangle should be the provoking vertex.
 * This is important when using the "flat" type qualifier in the shaders.
 */
private void prepare() {
	GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT);
	GL32.glProvokingVertex(GL32.GL_FIRST_VERTEX_CONVENTION);
	OpenGlUtils.cullBackFaces(true);
	OpenGlUtils.enableDepthTesting(true);
	OpenGlUtils.antialias(true);
	if (Keyboard.isKeyDown(Keyboard.KEY_G)) {
		GL11.glPolygonMode(GL11.GL_FRONT_AND_BACK, GL11.GL_LINE);
	} else {
		GL11.glPolygonMode(GL11.GL_FRONT_AND_BACK, GL11.GL_FILL);
	}
}
 
开发者ID:TheThinMatrix,项目名称:LowPolyTerrain,代码行数:21,代码来源:RenderEngine.java

示例11: isCtrlKeyDown

import org.lwjgl.input.Keyboard; //导入方法依赖的package包/类
/**
 * Returns true if either windows ctrl key is down or if either mac meta key is down
 */
public static boolean isCtrlKeyDown()
{
    return Minecraft.isRunningOnMac ? Keyboard.isKeyDown(219) || Keyboard.isKeyDown(220) : Keyboard.isKeyDown(29) || Keyboard.isKeyDown(157);
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:8,代码来源:GuiScreen.java

示例12: isAltKeyDown

import org.lwjgl.input.Keyboard; //导入方法依赖的package包/类
/**
 * Returns true if either alt key is down
 */
public static boolean isAltKeyDown()
{
    return Keyboard.isKeyDown(56) || Keyboard.isKeyDown(184);
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:8,代码来源:GuiScreen.java

示例13: render

import org.lwjgl.input.Keyboard; //导入方法依赖的package包/类
@Override
public void render()
{
    int bit = DrawingTools.drawStencil(getWidth(), getHeight());
    DrawingTools.drawRectangle(0, 0, getWidth(), getHeight());

    List<Entry> toRemove = new ArrayList<>();
    for (int i = 0; i < cooldowns.length; i++)
        if (cooldowns[i] > 0)
            cooldowns[i] -= (System.currentTimeMillis() - lastms);
    for (Entry entr : entries)
    {
        entr.range -= ((System.currentTimeMillis() - lastms) * 0.1f);

        int x = 32 * entr.line;
        int y = getHeight() - entr.range;
        int w = 32;
        int h = 20;
        if (y > 0)
        {
            if (entr.isCompleted())
                GlStateManager.color(0, 1, 0);
            else
            {
                if (y > getHeight() - (45 + h))
                {
                    cooldowns[entr.line] = 300;
                    boolean compl = Keyboard.isKeyDown(keyMap.get(entr.line));
                    if (compl)
                    {
                        entr.setCompleted(true);
                        rate++;
                        Minecraft.getMinecraft().player.playSound(SoundEvents.BLOCK_NOTE_SNARE, 1, 1);
                    }
                    GlStateManager.color(0, 0, 1);
                }
                else
                    GlStateManager.color(1, 0, 0);
            }
            GlStateManager.enableBlend();
            DrawingTools.drawTexture(TEXTURE_BUTTON, x, y, w, h, 0, 0, w, h);
            GlStateManager.disableBlend();
        }
        if (entr.range <= 0)
        {
            if (!entr.isCompleted())
                minRate();
            toRemove.add(entr);
        }
    }
    entries.removeAll(toRemove);
    GlStateManager.color(0, 0, 1);
    DrawingTools.drawRectangle(0, getHeight() - 45, getWidth(), 1);
    GlStateManager.color(1, 1, 1);
    lastms = System.currentTimeMillis();

    GlStateManager.enableBlend();
    DrawingTools.drawTexture(TEXTURE_DISPLAY, 0, 0, getWidth(), getHeight());
    GlStateManager.disableBlend();

    if (entries.size() == 0 && getDesk().status == GuiTranslationDesk.Status.TRANSLATING)
        done();
    DrawingTools.removeStencil(bit);
}
 
开发者ID:PearXTeam,项目名称:PurificatiMagicae,代码行数:65,代码来源:GuiTranslationDeskPanel.java

示例14: isKeyDown

import org.lwjgl.input.Keyboard; //导入方法依赖的package包/类
private static boolean isKeyDown(KeyBinding key) {
    int i = key.getKeyCode();
    return ((i != 0) && (i < 256)) ? ((i < 0) ? Mouse.isButtonDown(i + 100) : Keyboard.isKeyDown(i)) : false;
}
 
开发者ID:McJty,项目名称:MeeCreeps,代码行数:5,代码来源:GuiWheel.java

示例15: isKeyDown

import org.lwjgl.input.Keyboard; //导入方法依赖的package包/类
public static boolean isKeyDown(IKeybind bind) {
	return Keyboard.isKeyDown(bind.bind.getKeyCode());
}
 
开发者ID:Moudoux,项目名称:EMC,代码行数:4,代码来源:IKeybindWrapper.java


注:本文中的org.lwjgl.input.Keyboard.isKeyDown方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。