我试图使用spritebatch在XNA中绘制一个矩形形状.我有以下代码:
Texture2D rect = new Texture2D(graphics.GraphicsDevice, 80, 30);
Vector2 coor = new Vector2(10, 20);
spriteBatch.Draw(rect, coor, Color.Chocolate);
Run Code Online (Sandbox Code Playgroud)
但由于某种原因,它没有任何吸引力.知道什么是错的吗?谢谢!
我想知道无论如何在HTML/JSP中定义一个变量.我用google搜索非常努力,但找不到任何资源.基本上在我的html/jsp中我试图将外部值保存到特定于html/jsp的变量中,以便我可以在此后将此变量打印到网页.假设这个外部值是5.我们可以做类似的事情
x = 5?
Ť
我有一个TreeMap,其中RobotKey是一个由字符串字段域和长字段时间戳组成的类.RobotKey实现如下可比:
@Override
public boolean equals(Object obj) {
if (this.domain.equals(((RobotKey) obj).getDomain()))
return true;
return false;
}
Run Code Online (Sandbox Code Playgroud)
树图根据以下compareTo函数排序:
@Override
public int compareTo(RobotKey arg0) {
if (this.lastAccessed < arg0.lastAccessed)
return -1;
else if (this.domain.equals(arg0.getDomain()))
return 0;
else
return 1;
}
Run Code Online (Sandbox Code Playgroud)
所以基本上,地图是通过域名访问的,并根据时间戳进行排序.
我做了treemap.get(RobotKey e),其中e与treemap中的现有条目具有相同的域名,但具有不同的时间戳.这应该返回正确的RobotValue,因为Map操作是用equals完成的.但它反而返回null表示找不到RobotKey.知道为什么会这样吗?我做错了什么,我该如何解决?谢谢!