知道Lua为什么这是错的?
if Pieza == 1 then
if Rotacion == 1 then
Piezas = Cuadrado1
else if Rotacion == 2 then
Piezas = Cuadrado2
else if Rotacion == 3 then --this is Line 273
Piezas = Cuadrado3
else if Rotacion == 4 then
Piezas = Cuadrado4
else
io.write("Me Envio una rotacion que no existe? \n");
end
--this end closes the if inside the first if the one using to compare Rotacion
else if Pieza == 2 then
if Rotacion == 1 …Run Code Online (Sandbox Code Playgroud) 我的按钮工作正常,我是每个按钮的监听器,如下所示:
for(int i = 0; i <= 25; ++i) {
buttons[i] = new Button(Character.toString(letters[i]));
buttons[i].addActionListener(actionListener);
panel1.add(buttons[i]);
}
Run Code Online (Sandbox Code Playgroud)
在这里你可以看到调用者被调用,我想找出我点击的按钮.有没有办法做到这一点?
ActionListener actionListener = new ActionListener() {
public void actionPerformed(ActionEvent actionEvent) {
System.out.println(actionEvent.getSource());
}
};
Run Code Online (Sandbox Code Playgroud)
我需要一些方法来找到数组中的按钮.
我有点坚持这个项目在android我想弄清楚为什么这不工作,但我不知道.这是顺便说一句自定义视图以防万一.
问题是这个事件ACTION_DOWN正在完美地工作,我得到控制台调试"触摸1"和"触摸2"但ACTION_UP,ACTION_CANCEL或默认:不工作我无法弄清楚这样任何帮助将非常感谢谢谢
public void doTouch(MotionEvent event)
{
int action = event.getAction();
float x = event.getX();
float y = event.getY();
switch(action)
{
case MotionEvent.ACTION_DOWN:
if(x < 125 && y < 125){
for(AnimatedSprite a:mSprites)
{
if(a.getID() == 1)
{
a.AdvanceToFrame(0);
touching = true;
System.out.println("Touching 1");
//touch_obj1 = true;
}
}
}
else if(x > getWidth()-125 && y > getHeight()-125)
{
for(AnimatedSprite a:mSprites)
{
if(a.getID() == 2)
{
a.AdvanceToFrame(1);
System.out.println("Touching 2");
touching = true;
//touch_obj2 = true;
}
}
}
else
{
touching …Run Code Online (Sandbox Code Playgroud) 现在c++给了我这个错误:错误C2087'颜色'缺少下标第一次我得到这个,我不知道该怎么做>。<希望any1可以帮助我
struct Color{
float r;
float g;
float b;
};
Color color[][];
Run Code Online (Sandbox Code Playgroud)
我在这里使用它
for(int i=0;i<cubes;i++)
{
color[i][0].r = fRand();color[i][0].g=fRand(.5);color[i][0].b=fRand();
Run Code Online (Sandbox Code Playgroud)
...ETC
大家好,我在这里有一个很大的错误,似乎c ++没有找到glActiveTextureARB(GL_TEXTURE0_ARB); 即时通讯使用代码块,我有glext.h所以每当我右键单击glActiveTextureARB并找到声明它实际上找到它...我有一个64位系统,我已经尝试将glext.h放在GL文件夹中,也在我的项目和即时通讯中得到同样的错误任何想法将有助于tyvm
继承了我的代码,万一你需要它..它是在西班牙语顺便说一句,但它并不重要因为错误我认为它不在代码中
#include "objetos.h"
#include "glext.h"
#include <cassert>
Objetos::Objetos()
{
m_OBJS = NULL;
}
Objetos::Objetos(OBJETO d,int txt)
{
m_OBJS = NULL;
box = 0;
triangle = 0;
circle = 0;
CTargaImage image;
image.Load("TGAs/caja1.tga");
glGenTextures(1, &m_texturaCaja[0]);
glBindTexture(GL_TEXTURE_2D, m_texturaCaja[0]);
gluBuild2DMipmaps(GL_TEXTURE_2D, GL_RGB,
image.GetWidth(), image.GetHeight(),
GL_RGB, GL_UNSIGNED_BYTE, image.GetImage());
image.Release();
image.Load("TGAs/caja2.tga");
glGenTextures(1, &m_texturaCaja[1]);
glBindTexture(GL_TEXTURE_2D, m_texturaCaja[1]);
gluBuild2DMipmaps(GL_TEXTURE_2D, GL_RGB,
image.GetWidth(), image.GetHeight(),
GL_RGB, GL_UNSIGNED_BYTE, image.GetImage());
image.Release();
switch(d)
{
case TRIANGULO:
//borrarlo antes de dibujarlo siempre;
glActiveTextureARB(GL_TEXTURE0_ARB);
glBindTexture(GL_TEXTURE_2D, m_texturaTriangulo[txt]);
glEnable(GL_TEXTURE_2D);
glTexEnvf (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE_EXT);
glTexEnvf (GL_TEXTURE_ENV, GL_COMBINE_RGB_EXT, …Run Code Online (Sandbox Code Playgroud) 我想要做的是,当人们使用我的程序命中输入没有任何东西在那里它不会导致错误这是程序的一部分:
Console.WriteLine("4.-Ya no quiero jugar >.<");
int opc = Convert.ToInt16(Console.ReadLine());
switch (opc)
{
case 1:
Console.WriteLine("omg");
break;
case 2:
Console.WriteLine("wtf");
break;
default:
Console.WriteLine("Cant do that >.>");
Console.ReadKey();
break;
etc.
}Run Code Online (Sandbox Code Playgroud)
事情是使用整数,我试图这样做
string opc1=console.readline();
if (opc =="")
{
console.writeline("nope,try again");
}
else
{ // Brace was omitted in original - Jon
int opc = Convert.ToInt16(Console.ReadLine());
switch (opc)
blah blah.Run Code Online (Sandbox Code Playgroud)
它的不同组合>.<和默认值不起作用
我希望有人可以帮我解决它.<
就像一个优秀的程序员一样,我想我正试图变得懒惰,让程序做出任何东西,但我开始认为这不可能这样做,所以在这里......
我有27个变量a1,a2,a3,a4,a5,a6,a7,a8,a9,b1,b2,b3等,c1,c2,c3等...
我希望用户给我每个的数字,但我不想手动这样做我想用这样的东西做:
for(i=0;i<=0;i++)
{
char a= 'a'+i;
char b= 'b'+i;
char c= 'c'+i;
printf("give me 1st number in square\n");
scanf("%d",a);
printf("give me 2nd number in square\n");
scanf("%d",b);
printf("give me 3rd number in square\n");
scanf("%d",c);
}
Run Code Online (Sandbox Code Playgroud)
知道如何制作这个吗?如果有一种方法我真的很感激你可以告诉我非常感谢XD
是的,如果你无法理解或希望我更好地解释告诉我,我会尽我所能重拍这个.
现在我正试图这样做,所以我有1个角色和3个敌人,如果我的角色死了它应该给游戏结束或者什么但是我不能让它工作(如果敌人死了它的作品我不做我知道为什么).
这是我正在做的事情:
bool Exit = false;
bool CharDead = false;
Heroe Heroe1 = p.ElementAt(0);
Enemigo Enemigo1 = l.ElementAt(0);
Enemigo Enemigo2 = l.ElementAt(1);
Enemigo Enemigo3 = l.ElementAt(2);
a.Agregar(comienza);
List<Items> item = new List<Items>();
do
{
if (Heroe1.HP > 0)
AccionesHeroe1(l, p);
if (Enemigo1.HP > 0)
AccionesEnemigo1(l, p);
if (Enemigo2.HP > 0)
AccionesEnemigo2(l, p);
if (Heroe1.HP > 0)
AccionesHeroe1(l, p);
else
CharDead = true;
if (Enemigo3.HP > 0)
AccionesEnemigo3(l, p);
if (Heroe1.HP <= 0)
{
CharDead = true;
}
if (Enemigo1.HP <= …Run Code Online (Sandbox Code Playgroud) 这就是我在做什么,我从.txt文件获取一些信息当然,当我得到它们时,我将它们作为字符串列表中的字符串... ...(我知道它可能是字符,但在这个例子中是字符串) )所以当我将它们插入另一个列表时,它应该是这样的
list<int> l;
//i is the iterator for the 1st list that already has all the strings
l.push_back(atoi(*i.c_str()));
Run Code Online (Sandbox Code Playgroud)
我不能使用c_str(),因为我试图访问列表的元素,无论如何,我可以做到这一点?
基本上我试图做的只是从一个列表中获取我的字符串并将其更改为整数,同时保持列表格式
任何帮助将非常感谢谢谢