What is the simplest way to make Image touchable in libgdx?(在 libgdx 中使 Image 可触摸的最简单方法是什么?)
问题描述
这是我的代码:
我正在创建简单的游戏,这就是我创建主菜单的方式.我想让我的 startImage 可触摸(可点击),因为 Image 类没有可用的侦听器.我该怎么做?还是使用 ImageButton 更好?这样我就必须创建图像图集,这对我来说似乎有点复杂..
I'm creating simple game and this is the way I'm creating main menu. I want to make my startImage touchable (clickable) as there is no available listener for Image class. How should I do this? Or is it better to use ImageButton? This way I would have to create image atlas which seems to be a little bit complicated for me now..
我尝试了以下操作:
但是还是不行..
需要调用.解决了.
needs to be called. Solved.
推荐答案
解决方案是调用如下:
这篇关于在 libgdx 中使 Image 可触摸的最简单方法是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!