目前,使用Wii遥控器创建虚拟现实头跟踪的工作遇到了一个错误。
类*可以设计,但不是file.Visual Studio中的第一个类,它要求设计人员使用文件中的第一个类。移动类代码,使其成为文件中的第一个类,并再次加载设计器。
我已经将代码拆分到不同的页面中,但是我收到了相同的错误。这是我正在处理的代码:
namespace WiiDesktopVR
{
class Point2D
{
public float x = 0.0f;
public float y = 0.0f;
public void set(float x, float y)
{
this.x = x;
this.y = y;
}
}
public class WiiDesktopVR : Form
{
struct Vertex
{
float x, y, z;
float tu, tv;
public Vertex(float _x, float _y, float _z, float _tu, float _tv)
{
x = _x; y = _y; z = _z;
tu = _tu; tv = _tv;
}
public static readonly VertexFormats FVF_Flags = VertexFormats.Position | VertexFormats.Texture1;
};
Vertex[] targetVertices =
{
new Vertex(-1.0f, 1.0f,.0f, 0.0f,0.0f ),
new Vertex( 1.0f, 1.0f,.0f, 1.0f,0.0f ),
new Vertex(-1.0f,-1.0f,.0f, 0.0f,1.0f ),
new Vertex( 1.0f,-1.0f,.0f, 1.0f,1.0f ),
};
}
}谢谢
发布于 2016-04-13 14:56:03
将Point2D移动到文件的底部。最佳实践表明,每个文件应该只有一个类,所以最好采纳Stuart的建议并将其移到另一个文件中。
namespace WiiDesktopVR
{
public class WiiDesktopVR : Form
{
struct Vertex
{
float x, y, z;
float tu, tv;
public Vertex(float _x, float _y, float _z, float _tu, float _tv)
{
x = _x; y = _y; z = _z;
tu = _tu; tv = _tv;
}
public static readonly VertexFormats FVF_Flags = VertexFormats.Position | VertexFormats.Texture1;
};
Vertex[] targetVertices =
{
new Vertex(-1.0f, 1.0f,.0f, 0.0f,0.0f ),
new Vertex( 1.0f, 1.0f,.0f, 1.0f,0.0f ),
new Vertex(-1.0f,-1.0f,.0f, 0.0f,1.0f ),
new Vertex( 1.0f,-1.0f,.0f, 1.0f,1.0f ),
};
}
class Point2D
{
public float x = 0.0f;
public float y = 0.0f;
public void set(float x, float y)
{
this.x = x;
this.y = y;
}
}
}https://stackoverflow.com/questions/36601887
复制相似问题