小编Abd*_*doe的帖子

Libgdx为什么我的按钮在鼠标点击时没有响应

为什么我的TextButtonlibgdx没有响应点击?

我有一个按钮,这个按钮有一个监听器,但它没有响应.该按钮正在显示,但它不会响应鼠标点击.

public MyStage extends Stage {
     ...
     next.addListener(new InputListener() {
        @Override
        public boolean touchDown(InputEvent event, float x, float y, int pointer, int button)
        {
            Gdx.app.log(ApothecaryGame.LOG, "Pressed: Next button.");
            return true;
        }
        @Override
        public void touchUp(InputEvent event, float x, float y, int pointer, int button) {
            Gdx.app.log( ApothecaryGame.LOG, "Released: Next button.");
            super.touchUp( event, x, y, pointer, button );
            nextPage();
        }
    } );
    this.addActor(next);
}
Run Code Online (Sandbox Code Playgroud)

java button mousepress libgdx

4
推荐指数
1
解决办法
5770
查看次数

带自旋锁的自定义锁

我看不到错误,也许有人可以在这里帮助我。

我有一个使用自旋锁的自定义锁(这是学校用的)

 public class Spinlock : Locker
{
    Boolean locked = false;
    private SpinLock spinLock = new SpinLock();

    public override void LockIt()
    {
        try
        {
            spinLock.Enter(ref locked);
        }
        finally
        {
            if(locked)
                spinLock.Exit();
        }
    }

    public override void UnlockIt()
    {
    }
}

 public abstract class Locker
{
    abstract public void LockIt();
    abstract public void UnlockIt();
}
Run Code Online (Sandbox Code Playgroud)

我得到的例外如下:

System.ArgumentException 未处理

Message=在调用此方法之前,必须将 takeLock 参数设置为 false。

c# locking exception spinlock

2
推荐指数
1
解决办法
1037
查看次数

标签 统计

button ×1

c# ×1

exception ×1

java ×1

libgdx ×1

locking ×1

mousepress ×1

spinlock ×1